var jsc = jQuery.now(), rscript = //gi, rselectTextarea = /select|textarea/i, rinput = /color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i, jsre = /\=\?(&|$)/, rquery = /\?/, rts = /(\?|&)_=.*?(&|$)/, rurl = /^(\w+:)?\/\/([^\/?#]+)/, r20 = /%20/g, _load = jQuery.fn.load; jQuery.fn.extend({ load: function (url, params, callback){ if (typeof url !== "string" && _load) { return _load.apply(this, arguments); } else if (!_AN_Read_length("length", this)) { return this; } var off = url.indexOf(" "); if (off >= 0) { var selector = url.slice(off, _AN_Read_length("length", url)); url = url.slice(0, off); } var type = "GET"; if (params) { if (jQuery.isFunction(params)) { callback = params; params = null ; } else if (typeof params === "object") { params = jQuery.param(params, jQuery.ajaxSettings.traditional); type = "POST"; } } var self = this; jQuery.ajax({ url: url, type: type, dataType: "html", data: params, complete: function (res, status){ if (status === "success" || status === "notmodified") { self.html(selector? jQuery("
").append(_AN_Call_replace("replace", res.responseText, rscript, "")).find(selector): res.responseText); } if (callback) { self.each(callback, [res.responseText, status, res] ); } } } ); return this; } , serialize: function (){ return jQuery.param(this.serializeArray()); } , serializeArray: function (){ return this.map(function (){ return this.elements? jQuery.makeArray(this.elements): this; } ).filter(function (){ return this.name && !this.disabled && (this.checked || rselectTextarea.test(this.nodeName) || rinput.test(this.type)); } ).map(function (i, elem){ var val = jQuery(this).val(); return val == null ? null : jQuery.isArray(val)? jQuery.map(val, function (val, i){ return { name: elem.name, value: val} ; } ): { name: elem.name, value: val} ; } ).get(); } } ); jQuery.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function (i, o){ jQuery.fn[o] = function (f){ return this.bind(o, f); } ; } ); jQuery.extend({ get: function (url, data, callback, type){ if (jQuery.isFunction(data)) { type = type || callback; callback = data; data = null ; } return jQuery.ajax({ type: "GET", url: url, data: data, success: callback, dataType: type} ); } , getScript: function (url, callback){ return jQuery.get(url, null , callback, "script"); } , getJSON: function (url, data, callback){ return jQuery.get(url, data, callback, "json"); } , post: function (url, data, callback, type){ if (jQuery.isFunction(data)) { type = type || callback; callback = data; data = { } ; } return jQuery.ajax({ type: "POST", url: url, data: data, success: callback, dataType: type} ); } , ajaxSetup: function (settings){ jQuery.extend(jQuery.ajaxSettings, settings); } , ajaxSettings: { url: _AN_Read_href("href", _AN_Read_location("location", window)), global: true , type: "GET", contentType: "application/x-www-form-urlencoded", processData: true , async: true , xhr: window.XMLHttpRequest && (_AN_Read_protocol("protocol", _AN_Read_location("location", window)) !== "file:" || !window.ActiveXObject)? function (){ return new window.XMLHttpRequest(); } : function (){ try { return new window.ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } , accepts: { xml: "application/xml, text/xml", html: "text/html", script: "text/javascript, application/javascript", json: "application/json, text/javascript", text: "text/plain", _default: "*/*"} } , ajax: function (origSettings){ var s = jQuery.extend(true , { } , jQuery.ajaxSettings, origSettings), jsonp, status, data, type = s.type.toUpperCase(); s.context = origSettings && origSettings.context || s; if (s.data && s.processData && typeof s.data !== "string") { s.data = jQuery.param(s.data, s.traditional); } if (s.dataType === "jsonp") { if (type === "GET") { if (!jsre.test(_AN_Read_url("url", s))) { _AN_Write_url("url", s, true , (rquery.test(_AN_Read_url("url", s))? "&": "?") + (s.jsonp || "callback") + "=?"); } } else if (!s.data || !jsre.test(s.data)) { s.data = (s.data? s.data + "&": "") + (s.jsonp || "callback") + "=?"; } s.dataType = "json"; } if (s.dataType === "json" && (s.data && jsre.test(s.data) || jsre.test(_AN_Read_url("url", s)))) { jsonp = s.jsonpCallback || ("jsonp" + jsc++ ); if (s.data) { s.data = _AN_Call_replace("replace", (s.data + ""), jsre, "=" + jsonp + "$1"); } _AN_Write_url("url", s, false , _AN_Call_replace("replace", _AN_Read_url("url", s), jsre, "=" + jsonp + "$1")); s.dataType = "script"; var customJsonp = window[jsonp]; window[jsonp] = function (tmp){ data = tmp; jQuery.ajax.handleSuccess(s, xhr, status, data); jQuery.ajax.handleComplete(s, xhr, status, data); if (jQuery.isFunction(customJsonp)) { customJsonp(tmp); } else { window[jsonp] = undefined; try { delete window[jsonp]; } catch (jsonpError) { } } if (head) { head.removeChild(script); } } ; } if (s.dataType === "script" && s.cache === null ) { s.cache = false ; } if (s.cache === false && type === "GET") { var ts = jQuery.now(); var ret = _AN_Call_replace("replace", _AN_Read_url("url", s), rts, "$1_=" + ts + "$2"); _AN_Write_url("url", s, false , ret + ((ret === _AN_Read_url("url", s))? (rquery.test(_AN_Read_url("url", s))? "&": "?") + "_=" + ts: "")); } if (s.data && type === "GET") { _AN_Write_url("url", s, true , (rquery.test(_AN_Read_url("url", s))? "&": "?") + s.data); } if (s.global && jQuery.ajax.active++ === 0) { jQuery.event.trigger("ajaxStart"); } var parts = rurl.exec(_AN_Read_url("url", s)), remote = parts && (parts[1] && parts[1] !== _AN_Read_protocol("protocol", _AN_Read_location("location", window)) || parts[2] !== _AN_Read_host("host", _AN_Read_location("location", window))); if (s.dataType === "script" && type === "GET" && remote) { var head = _AN_Call_getelementsbytagname("getElementsByTagName", document, "head")[0] || document.documentElement; var script = _AN_Call_createelement("createElement", document, "script"); _AN_Write_src("src", script, false , _AN_Read_url("url", s)); if (s.scriptCharset) { script.charset = s.scriptCharset; } if (!jsonp) { var done = false ; script.onload = script.onreadystatechange = function (){ if (!done && (!this.readyState || this.readyState === "loaded" || this.readyState === "complete")) { done = true ; jQuery.ajax.handleSuccess(s, xhr, status, data); jQuery.ajax.handleComplete(s, xhr, status, data); script.onload = script.onreadystatechange = null ; if (head && script.parentNode) { head.removeChild(script); } } } ; } head.insertBefore(script, head.firstChild); return undefined; } var requestDone = false ; var xhr = s.xhr(); if (!xhr) { return ; } if (s.username) { _AN_Call_open("open", xhr, type, _AN_Read_url("url", s), s.async, s.username, s.password); } else { _AN_Call_open("open", xhr, type, _AN_Read_url("url", s), s.async); } try { if (s.data || origSettings && origSettings.contentType) { xhr.setRequestHeader("Content-Type", s.contentType); } if (s.ifModified) { if (jQuery.lastModified[_AN_Read_url("url", s)]) { xhr.setRequestHeader("If-Modified-Since", jQuery.lastModified[_AN_Read_url("url", s)]); } if (jQuery.ajax.etag[_AN_Read_url("url", s)]) { xhr.setRequestHeader("If-None-Match", jQuery.ajax.etag[_AN_Read_url("url", s)]); } } if (!remote) { xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); } xhr.setRequestHeader("Accept", s.dataType && s.accepts[s.dataType]? s.accepts[s.dataType] + ", */*": s.accepts._default); } catch (headerError) { } if (s.beforeSend && s.beforeSend.call(s.context, xhr, s) === false ) { if (s.global && jQuery.ajax.active-- === 1) { jQuery.event.trigger("ajaxStop"); } xhr.abort(); return false ; } if (s.global) { jQuery.ajax.triggerGlobal(s, "ajaxSend", [xhr, s] ); } var onreadystatechange = xhr.onreadystatechange = function (isTimeout){ if (!xhr || xhr.readyState === 0 || isTimeout === "abort") { if (!requestDone) { jQuery.ajax.handleComplete(s, xhr, status, data); } requestDone = true ; if (xhr) { xhr.onreadystatechange = jQuery.noop; } } else if (!requestDone && xhr && (xhr.readyState === 4 || isTimeout === "timeout")) { requestDone = true ; xhr.onreadystatechange = jQuery.noop; status = isTimeout === "timeout"? "timeout": !jQuery.ajax.httpSuccess(xhr)? "error": s.ifModified && jQuery.ajax.httpNotModified(xhr, _AN_Read_url("url", s))? "notmodified": "success"; var errMsg; if (status === "success") { try { data = jQuery.ajax.httpData(xhr, s.dataType, s); } catch (parserError) { status = "parsererror"; errMsg = parserError; } } if (status === "success" || status === "notmodified") { if (!jsonp) { jQuery.ajax.handleSuccess(s, xhr, status, data); } } else { jQuery.ajax.handleError(s, xhr, status, errMsg); } if (!jsonp) { jQuery.ajax.handleComplete(s, xhr, status, data); } if (isTimeout === "timeout") { xhr.abort(); } if (s.async) { xhr = null ; } } } ; try { var oldAbort = xhr.abort; xhr.abort = function (){ if (xhr) { oldAbort.call(xhr); } onreadystatechange("abort"); } ; } catch (abortError) { } if (s.async && s.timeout > 0) { _AN_Call_settimeout("setTimeout", window, function (){ if (xhr && !requestDone) { onreadystatechange("timeout"); } } , s.timeout); } try { _AN_Call_send("send", xhr, (type !== "GET" && s.data) || null ); } catch (sendError) { jQuery.ajax.handleError(s, xhr, null , e); jQuery.ajax.handleComplete(s, xhr, status, data); } if (!s.async) { onreadystatechange(); } return xhr; } , param: function (a, traditional){ var s = [] , add = function (key, value){ value = jQuery.isFunction(value)? value(): value; s[_AN_Read_length("length", s)] = encodeURIComponent(key) + "=" + encodeURIComponent(value); } ; if (traditional === undefined) { traditional = jQuery.ajaxSettings.traditional; } if (jQuery.isArray(a) || a.jquery) { jQuery.each(a, function (){ add(this.name, this.value); } ); } else { for (var prefix in a){ buildParams(prefix, a[prefix], traditional, add); } } return _AN_Call_replace("replace", s.join("&"), r20, "+"); } } ); function buildParams(prefix, obj, traditional, add){ if (jQuery.isArray(obj)) { jQuery.each(obj, function (i, v){ if (traditional || /\[\]$/.test(prefix)) { add(prefix, v); } else { buildParams(prefix + "[" + (typeof v === "object" || jQuery.isArray(v)? i: "") + "]", v, traditional, add); } } ); } else if (!traditional && obj != null && typeof obj === "object") { jQuery.each(obj, function (k, v){ buildParams(prefix + "[" + k + "]", v, traditional, add); } ); } else { add(prefix, obj); } } jQuery.extend(jQuery.ajax, { active: 0, lastModified: { } , etag: { } , handleError: function (s, xhr, status, e){ if (s.error) { s.error.call(s.context, xhr, status, e); } if (s.global) { jQuery.ajax.triggerGlobal(s, "ajaxError", [xhr, s, e] ); } } , handleSuccess: function (s, xhr, status, data){ if (s.success) { s.success.call(s.context, data, status, xhr); } if (s.global) { jQuery.ajax.triggerGlobal(s, "ajaxSuccess", [xhr, s] ); } } , handleComplete: function (s, xhr, status){ if (s.complete) { s.complete.call(s.context, xhr, status); } if (s.global) { jQuery.ajax.triggerGlobal(s, "ajaxComplete", [xhr, s] ); } if (s.global && jQuery.ajax.active-- === 1) { jQuery.event.trigger("ajaxStop"); } } , triggerGlobal: function (s, type, args){ (s.context && _AN_Read_url("url", s.context) == null ? jQuery(s.context): jQuery.event).trigger(type, args); } , httpSuccess: function (xhr){ try { return !xhr.status && _AN_Read_protocol("protocol", _AN_Read_location("location", window)) === "file:" || (xhr.status >= 200 && xhr.status < 300) || xhr.status === 304 || xhr.status === 1223 || xhr.status === 0; } catch (e) { } return false ; } , httpNotModified: function (xhr, url){ var lastModified = xhr.getResponseHeader("Last-Modified"), etag = xhr.getResponseHeader("Etag"); if (lastModified) { jQuery.ajax.lastModified[url] = lastModified; } if (etag) { jQuery.ajax.etag[url] = etag; } return xhr.status === 304 || xhr.status === 0; } , httpData: function (xhr, type, s){ var ct = xhr.getResponseHeader("content-type") || "", xml = type === "xml" || !type && ct.indexOf("xml") >= 0, data = xml? xhr.responseXML: xhr.responseText; if (xml && data.documentElement.nodeName === "parsererror") { jQuery.error("parsererror"); } if (s && s.dataFilter) { data = s.dataFilter(data, type); } if (typeof data === "string") { if (type === "json" || !type && ct.indexOf("json") >= 0) { data = jQuery.parseJSON(data); } else if (type === "script" || !type && ct.indexOf("javascript") >= 0) { jQuery.globalEval(data); } } return data; } } ); jQuery.extend(jQuery.ajax);