| 1 | | /*! jQuery v1.8.3 jquery.com | jquery.org/license */ |
| 2 | | (function(e,t){function _(e){var t=M[e]={};return v.each(e.split(y),function(e,n){t[n]=!0}),t}function H(e,n,r){if(r===t&&e.nodeType===1){var i="data-"+n.replace(P,"-$1").toLowerCase();r=e.getAttribute(i);if(typeof r=="string"){try{r=r==="true"?!0:r==="false"?!1:r==="null"?null:+r+""===r?+r:D.test(r)?v.parseJSON(r):r}catch(s){}v.data(e,n,r)}else r=t}return r}function B(e){var t;for(t in e){if(t==="data"&&v.isEmptyObject(e[t]))continue;if(t!=="toJSON")return!1}return!0}function et(){return!1}function tt(){return!0}function ut(e){return!e||!e.parentNode||e.parentNode.nodeType===11}function at(e,t){do e=e[t];while(e&&e.nodeType!==1);return e}function ft(e,t,n){t=t||0;if(v.isFunction(t))return v.grep(e,function(e,r){var i=!!t.call(e,r,e);return i===n});if(t.nodeType)return v.grep(e,function(e,r){return e===t===n});if(typeof t=="string"){var r=v.grep(e,function(e){return e.nodeType===1});if(it.test(t))return v.filter(t,r,!n);t=v.filter(t,r)}return v.grep(e,function(e,r){return v.inArray(e,t)>=0===n})}function lt(e){var t=ct.split("|"),n=e.createDocumentFragment();if(n.createElement)while(t.length)n.createElement(t.pop());return n}function Lt(e,t){return e.getElementsByTagName(t)[0]||e.appendChild(e.ownerDocument.createElement(t))}function At(e,t){if(t.nodeType!==1||!v.hasData(e))return;var n,r,i,s=v._data(e),o=v._data(t,s),u=s.events;if(u){delete o.handle,o.events={};for(n in u)for(r=0,i=u[n].length;r<i;r++)v.event.add(t,n,u[n][r])}o.data&&(o.data=v.extend({},o.data))}function Ot(e,t){var n;if(t.nodeType!==1)return;t.clearAttributes&&t.clearAttributes(),t.mergeAttributes&&t.mergeAttributes(e),n=t.nodeName.toLowerCase(),n==="object"?(t.parentNode&&(t.outerHTML=e.outerHTML),v.support.html5Clone&&e.innerHTML&&!v.trim(t.innerHTML)&&(t.innerHTML=e.innerHTML)):n==="input"&&Et.test(e.type)?(t.defaultChecked=t.checked=e.checked,t.value!==e.value&&(t.value=e.value)):n==="option"?t.selected=e.defaultSelected:n==="input"||n==="textarea"?t.defaultValue=e.defaultValue:n==="script"&&t.text!==e.text&&(t.text=e.text),t.removeAttribute(v.expando)}function Mt(e){return typeof e.getElementsByTagName!="undefined"?e.getElementsByTagName("*"):typeof e.querySelectorAll!="undefined"?e.querySelectorAll("*"):[]}function _t(e){Et.test(e.type)&&(e.defaultChecked=e.checked)}function Qt(e,t){if(t in e)return t;var n=t.charAt(0).toUpperCase()+t.slice(1),r=t,i=Jt.length;while(i--){t=Jt[i]+n;if(t in e)return t}return r}function Gt(e,t){return e=t||e,v.css(e,"display")==="none"||!v.contains(e.ownerDocument,e)}function Yt(e,t){var n,r,i=[],s=0,o=e.length;for(;s<o;s++){n=e[s];if(!n.style)continue;i[s]=v._data(n,"olddisplay"),t?(!i[s]&&n.style.display==="none"&&(n.style.display=""),n.style.display===""&&Gt(n)&&(i[s]=v._data(n,"olddisplay",nn(n.nodeName)))):(r=Dt(n,"display"),!i[s]&&r!=="none"&&v._data(n,"olddisplay",r))}for(s=0;s<o;s++){n=e[s];if(!n.style)continue;if(!t||n.style.display==="none"||n.style.display==="")n.style.display=t?i[s]||"":"none"}return e}function Zt(e,t,n){var r=Rt.exec(t);return r?Math.max(0,r[1]-(n||0))+(r[2]||"px"):t}function en(e,t,n,r){var i=n===(r?"border":"content")?4:t==="width"?1:0,s=0;for(;i<4;i+=2)n==="margin"&&(s+=v.css(e,n+$t[i],!0)),r?(n==="content"&&(s-=parseFloat(Dt(e,"padding"+$t[i]))||0),n!=="margin"&&(s-=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0)):(s+=parseFloat(Dt(e,"padding"+$t[i]))||0,n!=="padding"&&(s+=parseFloat(Dt(e,"border"+$t[i]+"Width"))||0));return s}function tn(e,t,n){var r=t==="width"?e.offsetWidth:e.offsetHeight,i=!0,s=v.support.boxSizing&&v.css(e,"boxSizing")==="border-box";if(r<=0||r==null){r=Dt(e,t);if(r<0||r==null)r=e.style[t];if(Ut.test(r))return r;i=s&&(v.support.boxSizingReliable||r===e.style[t]),r=parseFloat(r)||0}return r+en(e,t,n||(s?"border":"content"),i)+"px"}function nn(e){if(Wt[e])return Wt[e];var t=v("<"+e+">").appendTo(i.body),n=t.css("display");t.remove();if(n==="none"||n===""){Pt=i.body.appendChild(Pt||v.extend(i.createElement("iframe"),{frameBorder:0,width:0,height:0}));if(!Ht||!Pt.createElement)Ht=(Pt.contentWindow||Pt.contentDocument).document,Ht.write("<!doctype html><html><body>"),Ht.close();t=Ht.body.appendChild(Ht.createElement(e)),n=Dt(t,"display"),i.body.removeChild(Pt)}return Wt[e]=n,n}function fn(e,t,n,r){var i;if(v.isArray(t))v.each(t,function(t,i){n||sn.test(e)?r(e,i):fn(e+"["+(typeof i=="object"?t:"")+"]",i,n,r)});else if(!n&&v.type(t)==="object")for(i in t)fn(e+"["+i+"]",t[i],n,r);else r(e,t)}function Cn(e){return function(t,n){typeof t!="string"&&(n=t,t="*");var r,i,s,o=t.toLowerCase().split(y),u=0,a=o.length;if(v.isFunction(n))for(;u<a;u++)r=o[u],s=/^\+/.test(r),s&&(r=r.substr(1)||"*"),i=e[r]=e[r]||[],i[s?"unshift":"push"](n)}}function kn(e,n,r,i,s,o){s=s||n.dataTypes[0],o=o||{},o[s]=!0;var u,a=e[s],f=0,l=a?a.length:0,c=e===Sn;for(;f<l&&(c||!u);f++)u=a[f](n,r,i),typeof u=="string"&&(!c||o[u]?u=t:(n.dataTypes.unshift(u),u=kn(e,n,r,i,u,o)));return(c||!u)&&!o["*"]&&(u=kn(e,n,r,i,"*",o)),u}function Ln(e,n){var r,i,s=v.ajaxSettings.flatOptions||{};for(r in n)n[r]!==t&&((s[r]?e:i||(i={}))[r]=n[r]);i&&v.extend(!0,e,i)}function An(e,n,r){var i,s,o,u,a=e.contents,f=e.dataTypes,l=e.responseFields;for(s in l)s in r&&(n[l[s]]=r[s]);while(f[0]==="*")f.shift(),i===t&&(i=e.mimeType||n.getResponseHeader("content-type"));if(i)for(s in a)if(a[s]&&a[s].test(i)){f.unshift(s);break}if(f[0]in r)o=f[0];else{for(s in r){if(!f[0]||e.converters[s+" "+f[0]]){o=s;break}u||(u=s)}o=o||u}if(o)return o!==f[0]&&f.unshift(o),r[o]}function On(e,t){var n,r,i,s,o=e.dataTypes.slice(),u=o[0],a={},f=0;e.dataFilter&&(t=e.dataFilter(t,e.dataType));if(o[1])for(n in e.converters)a[n.toLowerCase()]=e.converters[n];for(;i=o[++f];)if(i!=="*"){if(u!=="*"&&u!==i){n=a[u+" "+i]||a["* "+i];if(!n)for(r in a){s=r.split(" ");if(s[1]===i){n=a[u+" "+s[0]]||a["* "+s[0]];if(n){n===!0?n=a[r]:a[r]!==!0&&(i=s[0],o.splice(f--,0,i));break}}}if(n!==!0)if(n&&e["throws"])t=n(t);else try{t=n(t)}catch(l){return{state:"parsererror",error:n?l:"No conversion from "+u+" to "+i}}}u=i}return{state:"success",data:t}}function Fn(){try{return new e.XMLHttpRequest}catch(t){}}function In(){try{return new e.ActiveXObject("Microsoft.XMLHTTP")}catch(t){}}function $n(){return setTimeout(function(){qn=t},0),qn=v.now()}function Jn(e,t){v.each(t,function(t,n){var r=(Vn[t]||[]).concat(Vn["*"]),i=0,s=r.length;for(;i<s;i++)if(r[i].call(e,t,n))return})}function Kn(e,t,n){var r,i=0,s=0,o=Xn.length,u=v.Deferred().always(function(){delete a.elem}),a=function(){var t=qn||$n(),n=Math.max(0,f.startTime+f.duration-t),r=n/f.duration||0,i=1-r,s=0,o=f.tweens.length;for(;s<o;s++)f.tweens[s].run(i);return u.notifyWith(e,[f,i,n]),i<1&&o?n:(u.resolveWith(e,[f]),!1)},f=u.promise({elem:e,props:v.extend({},t),opts:v.extend(!0,{specialEasing:{}},n),originalProperties:t,originalOptions:n,startTime:qn||$n(),duration:n.duration,tweens:[],createTween:function(t,n,r){var i=v.Tween(e,f.opts,t,n,f.opts.specialEasing[t]||f.opts.easing);return f.tweens.push(i),i},stop:function(t){var n=0,r=t?f.tweens.length:0;for(;n<r;n++)f.tweens[n].run(1);return t?u.resolveWith(e,[f,t]):u.rejectWith(e,[f,t]),this}}),l=f.props;Qn(l,f.opts.specialEasing);for(;i<o;i++){r=Xn[i].call(f,e,l,f.opts);if(r)return r}return Jn(f,l),v.isFunction(f.opts.start)&&f.opts.start.call(e,f),v.fx.timer(v.extend(a,{anim:f,queue:f.opts.queue,elem:e})),f.progress(f.opts.progress).done(f.opts.done,f.opts.complete).fail(f.opts.fail).always(f.opts.always)}function Qn(e,t){var n,r,i,s,o;for(n in e){r=v.camelCase(n),i=t[r],s=e[n],v.isArray(s)&&(i=s[1],s=e[n]=s[0]),n!==r&&(e[r]=s,delete e[n]),o=v.cssHooks[r];if(o&&"expand"in o){s=o.expand(s),delete e[r];for(n in s)n in e||(e[n]=s[n],t[n]=i)}else t[r]=i}}function Gn(e,t,n){var r,i,s,o,u,a,f,l,c,h=this,p=e.style,d={},m=[],g=e.nodeType&&Gt(e);n.queue||(l=v._queueHooks(e,"fx"),l.unqueued==null&&(l.unqueued=0,c=l.empty.fire,l.empty.fire=function(){l.unqueued||c()}),l.unqueued++,h.always(function(){h.always(function(){l.unqueued--,v.queue(e,"fx").length||l.empty.fire()})})),e.nodeType===1&&("height"in t||"width"in t)&&(n.overflow=[p.overflow,p.overflowX,p.overflowY],v.css(e,"display")==="inline"&&v.css(e,"float")==="none"&&(!v.support.inlineBlockNeedsLayout||nn(e.nodeName)==="inline"?p.display="inline-block":p.zoom=1)),n.overflow&&(p.overflow="hidden",v.support.shrinkWrapBlocks||h.done(function(){p.overflow=n.overflow[0],p.overflowX=n.overflow[1],p.overflowY=n.overflow[2]}));for(r in t){s=t[r];if(Un.exec(s)){delete t[r],a=a||s==="toggle";if(s===(g?"hide":"show"))continue;m.push(r)}}o=m.length;if(o){u=v._data(e,"fxshow")||v._data(e,"fxshow",{}),"hidden"in u&&(g=u.hidden),a&&(u.hidden=!g),g?v(e).show():h.done(function(){v(e).hide()}),h.done(function(){var t;v.removeData(e,"fxshow",!0);for(t in d)v.style(e,t,d[t])});for(r=0;r<o;r++)i=m[r],f=h.createTween(i,g?u[i]:0),d[i]=u[i]||v.style(e,i),i in u||(u[i]=f.start,g&&(f.end=f.start,f.start=i==="width"||i==="height"?1:0))}}function Yn(e,t,n,r,i){return new Yn.prototype.init(e,t,n,r,i)}function Zn(e,t){var n,r={height:e},i=0;t=t?1:0;for(;i<4;i+=2-t)n=$t[i],r["margin"+n]=r["padding"+n]=e;return t&&(r.opacity=r.width=e),r}function tr(e){return v.isWindow(e)?e:e.nodeType===9?e.defaultView||e.parentWindow:!1}var n,r,i=e.document,s=e.location,o=e.navigator,u=e.jQuery,a=e.$,f=Array.prototype.push,l=Array.prototype.slice,c=Array.prototype.indexOf,h=Object.prototype.toString,p=Object.prototype.hasOwnProperty,d=String.prototype.trim,v=function(e,t){return new v.fn.init(e,t,n)},m=/[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source,g=/\S/,y=/\s+/,b=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,w=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,E=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,S=/^[\],:{}\s]*$/,x=/(?:^|:|,)(?:\s*\[)+/g,T=/\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g,N=/"[^"\\\r\n]*"|true|false|null|-?(?:\d\d*\.|)\d+(?:[eE][\-+]?\d+|)/g,C=/^-ms-/,k=/-([\da-z])/gi,L=function(e,t){return(t+"").toUpperCase()},A=function(){i.addEventListener?(i.removeEventListener("DOMContentLoaded",A,!1),v.ready()):i.readyState==="complete"&&(i.detachEvent("onreadystatechange",A),v.ready())},O={};v.fn=v.prototype={constructor:v,init:function(e,n,r){var s,o,u,a;if(!e)return this;if(e.nodeType)return this.context=this[0]=e,this.length=1,this;if(typeof e=="string"){e.charAt(0)==="<"&&e.charAt(e.length-1)===">"&&e.length>=3?s=[null,e,null]:s=w.exec(e);if(s&&(s[1]||!n)){if(s[1])return n=n instanceof v?n[0]:n,a=n&&n.nodeType?n.ownerDocument||n:i,e=v.parseHTML(s[1],a,!0),E.test(s[1])&&v.isPlainObject(n)&&this.attr.call(e,n,!0),v.merge(this,e);o=i.getElementById(s[2]);if(o&&o.parentNode){if(o.id!==s[2])return r.find(e);this.length=1,this[0]=o}return this.context=i,this.selector=e,this}return!n||n.jquery?(n||r).find(e):this.constructor(n).find(e)}return v.isFunction(e)?r.ready(e):(e.selector!==t&&(this.selector=e.selector,this.context=e.context),v.makeArray(e,this))},selector:"",jquery:"1.8.3",length:0,size:function(){return this.length},toArray:function(){return l.call(this)},get:function(e){return e==null?this.toArray():e<0?this[this.length+e]:this[e]},pushStack:function(e,t,n){var r=v.merge(this.constructor(),e);return r.prevObject=this,r.context=this.context,t==="find"?r.selector=this.selector+(this.selector?" ":"")+n:t&&(r.selector=this.selector+"."+t+"("+n+")"),r},each:function(e,t){return v.each(this,e,t)},ready:function(e){return v.ready.promise().done(e),this},eq:function(e){return e=+e,e===-1?this.slice(e):this.slice(e,e+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(l.apply(this,arguments),"slice",l.call(arguments).join(","))},map:function(e){return this.pushStack(v.map(this,function(t,n){return e.call(t,n,t)}))},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:[].sort,splice:[].splice},v.fn.init.prototype=v.fn,v.extend=v.fn.extend=function(){var e,n,r,i,s,o,u=arguments[0]||{},a=1,f=arguments.length,l=!1;typeof u=="boolean"&&(l=u,u=arguments[1]||{},a=2),typeof u!="object"&&!v.isFunction(u)&&(u={}),f===a&&(u=this,--a);for(;a<f;a++)if((e=arguments[a])!=null)for(n in e){r=u[n],i=e[n];if(u===i)continue;l&&i&&(v.isPlainObject(i)||(s=v.isArray(i)))?(s?(s=!1,o=r&&v.isArray(r)?r:[]):o=r&&v.isPlainObject(r)?r:{},u[n]=v.extend(l,o,i)):i!==t&&(u[n]=i)}return u},v.extend({noConflict:function(t){return e.$===v&&(e.$=a),t&&e.jQuery===v&&(e.jQuery=u),v},isReady:!1,readyWait:1,holdReady:function(e){e?v.readyWait++:v.ready(!0)},ready:function(e){if(e===!0?--v.readyWait:v.isReady)return;if(!i.body)return setTimeout(v.ready,1);v.isReady=!0;if(e!==!0&&--v.readyWait>0)return;r.resolveWith(i,[v]),v.fn.trigger&&v(i).trigger("ready").off("ready")},isFunction:function(e){return v.type(e)==="function"},isArray:Array.isArray||function(e){return v.type(e)==="array"},isWindow:function(e){return e!=null&&e==e.window},isNumeric:function(e){return!isNaN(parseFloat(e))&&isFinite(e)},type:function(e){return e==null?String(e):O[h.call(e)]||"object"},isPlainObject:function(e){if(!e||v.type(e)!=="object"||e.nodeType||v.isWindow(e))return!1;try{if(e.constructor&&!p.call(e,"constructor")&&!p.call(e.constructor.prototype,"isPrototypeOf"))return!1}catch(n){return!1}var r;for(r in e);return r===t||p.call(e,r)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},error:function(e){throw new Error(e)},parseHTML:function(e,t,n){var r;return!e||typeof e!="string"?null:(typeof t=="boolean"&&(n=t,t=0),t=t||i,(r=E.exec(e))?[t.createElement(r[1])]:(r=v.buildFragment([e],t,n?null:[]),v.merge([],(r.cacheable?v.clone(r.fragment):r.fragment).childNodes)))},parseJSON:function(t){if(!t||typeof t!="string")return null;t=v.trim(t);if(e.JSON&&e.JSON.parse)return e.JSON.parse(t);if(S.test(t.replace(T,"@").replace(N,"]").replace(x,"")))return(new Function("return "+t))();v.error("Invalid JSON: "+t)},parseXML:function(n){var r,i;if(!n||typeof n!="string")return null;try{e.DOMParser?(i=new DOMParser,r=i.parseFromString(n,"text/xml")):(r=new ActiveXObject("Microsoft.XMLDOM"),r.async="false",r.loadXML(n))}catch(s){r=t}return(!r||!r.documentElement||r.getElementsByTagName("parsererror").length)&&v.error("Invalid XML: "+n),r},noop:function(){},globalEval:function(t){t&&g.test(t)&&(e.execScript||function(t){e.eval.call(e,t)})(t)},camelCase:function(e){return e.replace(C,"ms-").replace(k,L)},nodeName:function(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()},each:function(e,n,r){var i,s=0,o=e.length,u=o===t||v.isFunction(e);if(r){if(u){for(i in e)if(n.apply(e[i],r)===!1)break}else for(;s<o;)if(n.apply(e[s++],r)===!1)break}else if(u){for(i in e)if(n.call(e[i],i,e[i])===!1)break}else for(;s<o;)if(n.call(e[s],s,e[s++])===!1)break;return e},trim:d&&!d.call("\ufeff\u00a0")?function(e){return e==null?"":d.call(e)}:function(e){return e==null?"":(e+"").replace(b,"")},makeArray:function(e,t){var n,r=t||[];return e!=null&&(n=v.type(e),e.length==null||n==="string"||n==="function"||n==="regexp"||v.isWindow(e)?f.call(r,e):v.merge(r,e)),r},inArray:function(e,t,n){var r;if(t){if(c)return c.call(t,e,n);r=t.length,n=n?n<0?Math.max(0,r+n):n:0;for(;n<r;n++)if(n in t&&t[n]===e)return n}return-1},merge:function(e,n){var r=n.length,i=e.length,s=0;if(typeof r=="number")for(;s<r;s++)e[i++]=n[s];else while(n[s]!==t)e[i++]=n[s++];return e.length=i,e},grep:function(e,t,n){var r,i=[],s=0,o=e.length;n=!!n;for(;s<o;s++)r=!!t(e[s],s),n!==r&&i.push(e[s]);return i},map:function(e,n,r){var i,s,o=[],u=0,a=e.length,f=e instanceof v||a!==t&&typeof a=="number"&&(a>0&&e[0]&&e[a-1]||a===0||v.isArray(e));if(f)for(;u<a;u++)i=n(e[u],u,r),i!=null&&(o[o.length]=i);else for(s in e)i=n(e[s],s,r),i!=null&&(o[o.length]=i);return o.concat.apply([],o)},guid:1,proxy:function(e,n){var r,i,s;return typeof n=="string"&&(r=e[n],n=e,e=r),v.isFunction(e)?(i=l.call(arguments,2),s=function(){return e.apply(n,i.concat(l.call(arguments)))},s.guid=e.guid=e.guid||v.guid++,s):t},access:function(e,n,r,i,s,o,u){var a,f=r==null,l=0,c=e.length;if(r&&typeof r=="object"){for(l in r)v.access(e,n,l,r[l],1,o,i);s=1}else if(i!==t){a=u===t&&v.isFunction(i),f&&(a?(a=n,n=function(e,t,n){return a.call(v(e),n)}):(n.call(e,i),n=null));if(n)for(;l<c;l++)n(e[l],r,a?i.call(e[l],l,n(e[l],r)):i,u);s=1}return s?e:f?n.call(e):c?n(e[0],r):o},now:function(){return(new Date).getTime()}}),v.ready.promise=function(t){if(!r){r=v.Deferred();if(i.readyState==="complete")setTimeout(v.ready,1);else if(i.addEventListener)i.addEventListener("DOMContentLoaded",A,!1),e.addEventListener("load",v.ready,!1);else{i.attachEvent("onreadystatechange",A),e.attachEvent("onload",v.ready);var n=!1;try{n=e.frameElement==null&&i.documentElement}catch(s){}n&&n.doScroll&&function o(){if(!v.isReady){try{n.doScroll("left")}catch(e){return setTimeout(o,50)}v.ready()}}()}}return r.promise(t)},v.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(e,t){O["[object "+t+"]"]=t.toLowerCase()}),n=v(i);var M={};v.Callbacks=function(e){e=typeof e=="string"?M[e]||_(e):v.extend({},e);var n,r,i,s,o,u,a=[],f=!e.once&&[],l=function(t){n=e.memory&&t,r=!0,u=s||0,s=0,o=a.length,i=!0;for(;a&&u<o;u++)if(a[u].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,a&&(f?f.length&&l(f.shift()):n?a=[]:c.disable())},c={add:function(){if(a){var t=a.length;(function r(t){v.each(t,function(t,n){var i=v.type(n);i==="function"?(!e.unique||!c.has(n))&&a.push(n):n&&n.length&&i!=="string"&&r(n)})})(arguments),i?o=a.length:n&&(s=t,l(n))}return this},remove:function(){return a&&v.each(arguments,function(e,t){var n;while((n=v.inArray(t,a,n))>-1)a.splice(n,1),i&&(n<=o&&o--,n<=u&&u--)}),this},has:function(e){return v.inArray(e,a)>-1},empty:function(){return a=[],this},disable:function(){return a=f=n=t,this},disabled:function(){return!a},lock:function(){return f=t,n||c.disable(),this},locked:function(){return!f},fireWith:function(e,t){return t=t||[],t=[e,t.slice?t.slice():t],a&&(!r||f)&&(i?f.push(t):l(t)),this},fire:function(){return c.fireWith(this,arguments),this},fired:function(){return!!r}};return c},v.extend({Deferred:function(e){var t=[["resolve","done",v.Callbacks("once memory"),"resolved"],["reject","fail",v.Callbacks("once memory"),"rejected"],["notify","progress",v.Callbacks("memory")]],n="pending",r={state:function(){return n},always:function(){return i.done(arguments).fail(arguments),this},then:function(){var e=arguments;return v.Deferred(function(n){v.each(t,function(t,r){var s=r[0],o=e[t];i[r[1]](v.isFunction(o)?function(){var e=o.apply(this,arguments);e&&v.isFunction(e.promise)?e.promise().done(n.resolve).fail(n.reject).progress(n.notify):n[s+"With"](this===i?n:this,[e])}:n[s])}),e=null}).promise()},promise:function(e){return e!=null?v.extend(e,r):r}},i={};return r.pipe=r.then,v.each(t,function(e,s){var o=s[2],u=s[3];r[s[1]]=o.add,u&&o.add(function(){n=u},t[e^1][2].disable,t[2][2].lock),i[s[0]]=o.fire,i[s[0]+"With"]=o.fireWith}),r.promise(i),e&&e.call(i,i),i},when:function(e){var t=0,n=l.call(arguments),r=n.length,i=r!==1||e&&v.isFunction(e.promise)?r:0,s=i===1?e:v.Deferred(),o=function(e,t,n){return function(r){t[e]=this,n[e]=arguments.length>1?l.call(arguments):r,n===u?s.notifyWith(t,n):--i||s.resolveWith(t,n)}},u,a,f;if(r>1){u=new Array(r),a=new Array(r),f=new Array(r);for(;t<r;t++)n[t]&&v.isFunction(n[t].promise)?n[t].promise().done(o(t,f,n)).fail(s.reject).progress(o(t,a,u)):--i}return i||s.resolveWith(f,n),s.promise()}}),v.support=function(){var t,n,r,s,o,u,a,f,l,c,h,p=i.createElement("div");p.setAttribute("className","t"),p.innerHTML=" <link/><table></table><a href='/a'>a</a><input type='checkbox'/>",n=p.getElementsByTagName("*"),r=p.getElementsByTagName("a")[0];if(!n||!r||!n.length)return{};s=i.createElement("select"),o=s.appendChild(i.createElement("option")),u=p.getElementsByTagName("input")[0],r.style.cssText="top:1px;float:left;opacity:.5",t={leadingWhitespace:p.firstChild.nodeType===3,tbody:!p.getElementsByTagName("tbody").length,htmlSerialize:!!p.getElementsByTagName("link").length,style:/top/.test(r.getAttribute("style")),hrefNormalized:r.getAttribute("href")==="/a",opacity:/^0.5/.test(r.style.opacity),cssFloat:!!r.style.cssFloat,checkOn:u.value==="on",optSelected:o.selected,getSetAttribute:p.className!=="t",enctype:!!i.createElement("form").enctype,html5Clone:i.createElement("nav").cloneNode(!0).outerHTML!=="<:nav></:nav>",boxModel:i.compatMode==="CSS1Compat",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0,boxSizingReliable:!0,pixelPosition:!1},u.checked=!0,t.noCloneChecked=u.cloneNode(!0).checked,s.disabled=!0,t.optDisabled=!o.disabled;try{delete p.test}catch(d){t.deleteExpando=!1}!p.addEventListener&&p.attachEvent&&p.fireEvent&&(p.attachEvent("onclick",h=function(){t.noCloneEvent=!1}),p.cloneNode(!0).fireEvent("onclick"),p.detachEvent("onclick",h)),u=i.createElement("input"),u.value="t",u.setAttribute("type","radio"),t.radioValue=u.value==="t",u.setAttribute("checked","checked"),u.setAttribute("name","t"),p.appendChild(u),a=i.createDocumentFragment(),a.appendChild(p.lastChild),t.checkClone=a.cloneNode(!0).cloneNode(!0).lastChild.checked,t.appendChecked=u.checked,a.removeChild(u),a.appendChild(p);if(p.attachEvent)for(l in{submit:!0,change:!0,focusin:!0})f="on"+l,c=f in p,c||(p.setAttribute(f,"return;"),c=typeof p[f]=="function"),t[l+"Bubbles"]=c;return v(function(){var n,r,s,o,u="padding:0;margin:0;border:0;display:block;overflow:hidden;",a=i.getElementsByTagName("body")[0];if(!a)return;n=i.createElement("div"),n.style.cssText="visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px",a.insertBefore(n,a.firstChild),r=i.createElement("div"),n.appendChild(r),r.innerHTML="<table><tr><td></td><td>t</td></tr></table>",s=r.getElementsByTagName("td"),s[0].style.cssText="padding:0;margin:0;border:0;display:none",c=s[0].offsetHeight===0,s[0].style.display="",s[1].style.display="none",t.reliableHiddenOffsets=c&&s[0].offsetHeight===0,r.innerHTML="",r.style.cssText="box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;",t.boxSizing=r.offsetWidth===4,t.doesNotIncludeMarginInBodyOffset=a.offsetTop!==1,e.getComputedStyle&&(t.pixelPosition=(e.getComputedStyle(r,null)||{}).top!=="1%",t.boxSizingReliable=(e.getComputedStyle(r,null)||{width:"4px"}).width==="4px",o=i.createElement("div"),o.style.cssText=r.style.cssText=u,o.style.marginRight=o.style.width="0",r.style.width="1px",r.appendChild(o),t.reliableMarginRight=!parseFloat((e.getComputedStyle(o,null)||{}).marginRight)),typeof r.style.zoom!="undefined"&&(r.innerHTML="",r.style.cssText=u+"width:1px;padding:1px;display:inline;zoom:1",t.inlineBlockNeedsLayout=r.offsetWidth===3,r.style.display="block",r.style.overflow="visible",r.innerHTML="<div></div>",r.firstChild.style.width="5px",t.shrinkWrapBlocks=r.offsetWidth!==3,n.style.zoom=1),a.removeChild(n),n=r=s=o=null}),a.removeChild(p),n=r=s=o=u=a=p=null,t}();var D=/(?:\{[\s\S]*\}|\[[\s\S]*\])$/,P=/([A-Z])/g;v.extend({cache:{},deletedIds:[],uuid:0,expando:"jQuery"+(v.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(e){return e=e.nodeType?v.cache[e[v.expando]]:e[v.expando],!!e&&!B(e)},data:function(e,n,r,i){if(!v.acceptData(e))return;var s,o,u=v.expando,a=typeof n=="string",f=e.nodeType,l=f?v.cache:e,c=f?e[u]:e[u]&&u;if((!c||!l[c]||!i&&!l[c].data)&&a&&r===t)return;c||(f?e[u]=c=v.deletedIds.pop()||v.guid++:c=u),l[c]||(l[c]={},f||(l[c].toJSON=v.noop));if(typeof n=="object"||typeof n=="function")i?l[c]=v.extend(l[c],n):l[c].data=v.extend(l[c].data,n);return s=l[c],i||(s.data||(s.data={}),s=s.data),r!==t&&(s[v.camelCase(n)]=r),a?(o=s[n],o==null&&(o=s[v.camelCase(n)])):o=s,o},removeData:function(e,t,n){if(!v.acceptData(e))return;var r,i,s,o=e.nodeType,u=o?v.cache:e,a=o?e[v.expando]:v.expando;if(!u[a])return;if(t){r=n?u[a]:u[a].data;if(r){v.isArray(t)||(t in r?t=[t]:(t=v.camelCase(t),t in r?t=[t]:t=t.split(" ")));for(i=0,s=t.length;i<s;i++)delete r[t[i]];if(!(n?B:v.isEmptyObject)(r))return}}if(!n){delete u[a].data;if(!B(u[a]))return}o?v.cleanData([e],!0):v.support.deleteExpando||u!=u.window?delete u[a]:u[a]=null},_data:function(e,t,n){return v.data(e,t,n,!0)},acceptData:function(e){var t=e.nodeName&&v.noData[e.nodeName.toLowerCase()];return!t||t!==!0&&e.getAttribute("classid")===t}}),v.fn.extend({data:function(e,n){var r,i,s,o,u,a=this[0],f=0,l=null;if(e===t){if(this.length){l=v.data(a);if(a.nodeType===1&&!v._data(a,"parsedAttrs")){s=a.attributes;for(u=s.length;f<u;f++)o=s[f].name,o.indexOf("data-")||(o=v.camelCase(o.substring(5)),H(a,o,l[o]));v._data(a,"parsedAttrs",!0)}}return l}return typeof e=="object"?this.each(function(){v.data(this,e)}):(r=e.split(".",2),r[1]=r[1]?"."+r[1]:"",i=r[1]+"!",v.access(this,function(n){if(n===t)return l=this.triggerHandler("getData"+i,[r[0]]),l===t&&a&&(l=v.data(a,e),l=H(a,e,l)),l===t&&r[1]?this.data(r[0]):l;r[1]=n,this.each(function(){var t=v(this);t.triggerHandler("setData"+i,r),v.data(this,e,n),t.triggerHandler("changeData"+i,r)})},null,n,arguments.length>1,null,!1))},removeData:function(e){return this.each(function(){v.removeData(this,e)})}}),v.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=v._data(e,t),n&&(!r||v.isArray(n)?r=v._data(e,t,v.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=v.queue(e,t),r=n.length,i=n.shift(),s=v._queueHooks(e,t),o=function(){v.dequeue(e,t)};i==="inprogress"&&(i=n.shift(),r--),i&&(t==="fx"&&n.unshift("inprogress"),delete s.stop,i.call(e,o,s)),!r&&s&&s.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return v._data(e,n)||v._data(e,n,{empty:v.Callbacks("once memory").add(function(){v.removeData(e,t+"queue",!0),v.removeData(e,n,!0)})})}}),v.fn.extend({queue:function(e,n){var r=2;return typeof e!="string"&&(n=e,e="fx",r--),arguments.length<r?v.queue(this[0],e):n===t?this:this.each(function(){var t=v.queue(this,e,n);v._queueHooks(this,e),e==="fx"&&t[0]!=="inprogress"&&v.dequeue(this,e)})},dequeue:function(e){return this.each(function(){v.dequeue(this,e)})},delay:function(e,t){return e=v.fx?v.fx.speeds[e]||e:e,t=t||"fx",this.queue(t,function(t,n){var r=setTimeout(t,e);n.stop=function(){clearTimeout(r)}})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,n){var r,i=1,s=v.Deferred(),o=this,u=this.length,a=function(){--i||s.resolveWith(o,[o])};typeof e!="string"&&(n=e,e=t),e=e||"fx";while(u--)r=v._data(o[u],e+"queueHooks"),r&&r.empty&&(i++,r.empty.add(a));return a(),s.promise(n)}});var j,F,I,q=/[\t\r\n]/g,R=/\r/g,U=/^(?:button|input)$/i,z=/^(?:button|input|object|select|textarea)$/i,W=/^a(?:rea|)$/i,X=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,V=v.support.getSetAttribute;v.fn.extend({attr:function(e,t){return v.access(this,v.attr,e,t,arguments.length>1)},removeAttr:function(e){return this.each(function(){v.removeAttr(this,e)})},prop:function(e,t){return v.access(this,v.prop,e,t,arguments.length>1)},removeProp:function(e){return e=v.propFix[e]||e,this.each(function(){try{this[e]=t,delete this[e]}catch(n){}})},addClass:function(e){var t,n,r,i,s,o,u;if(v.isFunction(e))return this.each(function(t){v(this).addClass(e.call(this,t,this.className))});if(e&&typeof e=="string"){t=e.split(y);for(n=0,r=this.length;n<r;n++){i=this[n];if(i.nodeType===1)if(!i.className&&t.length===1)i.className=e;else{s=" "+i.className+" ";for(o=0,u=t.length;o<u;o++)s.indexOf(" "+t[o]+" ")<0&&(s+=t[o]+" ");i.className=v.trim(s)}}}return this},removeClass:function(e){var n,r,i,s,o,u,a;if(v.isFunction(e))return this.each(function(t){v(this).removeClass(e.call(this,t,this.className))});if(e&&typeof e=="string"||e===t){n=(e||"").split(y);for(u=0,a=this.length;u<a;u++){i=this[u];if(i.nodeType===1&&i.className){r=(" "+i.className+" ").replace(q," ");for(s=0,o=n.length;s<o;s++)while(r.indexOf(" "+n[s]+" ")>=0)r=r.replace(" "+n[s]+" "," ");i.className=e?v.trim(r):""}}}return this},toggleClass:function(e,t){var n=typeof e,r=typeof t=="boolean";return v.isFunction(e)?this.each(function(n){v(this).toggleClass(e.call(this,n,this.className,t),t)}):this.each(function(){if(n==="string"){var i,s=0,o=v(this),u=t,a=e.split(y);while(i=a[s++])u=r?u:!o.hasClass(i),o[u?"addClass":"removeClass"](i)}else if(n==="undefined"||n==="boolean")this.className&&v._data(this,"__className__",this.className),this.className=this.className||e===!1?"":v._data(this,"__className__")||""})},hasClass:function(e){var t=" "+e+" ",n=0,r=this.length;for(;n<r;n++)if(this[n].nodeType===1&&(" "+this[n].className+" ").replace(q," ").indexOf(t)>=0)return!0;return!1},val:function(e){var n,r,i,s=this[0];if(!arguments.length){if(s)return n=v.valHooks[s.type]||v.valHooks[s.nodeName.toLowerCase()],n&&"get"in n&&(r=n.get(s,"value"))!==t?r:(r=s.value,typeof r=="string"?r.replace(R,""):r==null?"":r);return}return i=v.isFunction(e),this.each(function(r){var s,o=v(this);if(this.nodeType!==1)return;i?s=e.call(this,r,o.val()):s=e,s==null?s="":typeof s=="number"?s+="":v.isArray(s)&&(s=v.map(s,function(e){return e==null?"":e+""})),n=v.valHooks[this.type]||v.valHooks[this.nodeName.toLowerCase()];if(!n||!("set"in n)||n.set(this,s,"value")===t)this.value=s})}}),v.extend({valHooks:{option:{get:function(e){var t=e.attributes.value;return!t||t.specified?e.value:e.text}},select:{get:function(e){var t,n,r=e.options,i=e.selectedIndex,s=e.type==="select-one"||i<0,o=s?null:[],u=s?i+1:r.length,a=i<0?u:s?i:0;for(;a<u;a++){n=r[a];if((n.selected||a===i)&&(v.support.optDisabled?!n.disabled:n.getAttribute("disabled")===null)&&(!n.parentNode.disabled||!v.nodeName(n.parentNode,"optgroup"))){t=v(n).val();if(s)return t;o.push(t)}}return o},set:function(e,t){var n=v.makeArray(t);return v(e).find("option").each(function(){this.selected=v.inArray(v(this).val(),n)>=0}),n.length||(e.selectedIndex=-1),n}}},attrFn:{},attr:function(e,n,r,i){var s,o,u,a=e.nodeType;if(!e||a===3||a===8||a===2)return;if(i&&v.isFunction(v.fn[n]))return v(e)[n](r);if(typeof e.getAttribute=="undefined")return v.prop(e,n,r);u=a!==1||!v.isXMLDoc(e),u&&(n=n.toLowerCase(),o=v.attrHooks[n]||(X.test(n)?F:j));if(r!==t){if(r===null){v.removeAttr(e,n);return}return o&&"set"in o&&u&&(s=o.set(e,r,n))!==t?s:(e.setAttribute(n,r+""),r)}return o&&"get"in o&&u&&(s=o.get(e,n))!==null?s:(s=e.getAttribute(n),s===null?t:s)},removeAttr:function(e,t){var n,r,i,s,o=0;if(t&&e.nodeType===1){r=t.split(y);for(;o<r.length;o++)i=r[o],i&&(n=v.propFix[i]||i,s=X.test(i),s||v.attr(e,i,""),e.removeAttribute(V?i:n),s&&n in e&&(e[n]=!1))}},attrHooks:{type:{set:function(e,t){if(U.test(e.nodeName)&&e.parentNode)v.error("type property can't be changed");else if(!v.support.radioValue&&t==="radio"&&v.nodeName(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}},value:{get:function(e,t){return j&&v.nodeName(e,"button")?j.get(e,t):t in e?e.value:null},set:function(e,t,n){if(j&&v.nodeName(e,"button"))return j.set(e,t,n);e.value=t}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(e,n,r){var i,s,o,u=e.nodeType;if(!e||u===3||u===8||u===2)return;return o=u!==1||!v.isXMLDoc(e),o&&(n=v.propFix[n]||n,s=v.propHooks[n]),r!==t?s&&"set"in s&&(i=s.set(e,r,n))!==t?i:e[n]=r:s&&"get"in s&&(i=s.get(e,n))!==null?i:e[n]},propHooks:{tabIndex:{get:function(e){var n=e.getAttributeNode("tabindex");return n&&n.specified?parseInt(n.value,10):z.test(e.nodeName)||W.test(e.nodeName)&&e.href?0:t}}}}),F={get:function(e,n){var r,i=v.prop(e,n);return i===!0||typeof i!="boolean"&&(r=e.getAttributeNode(n))&&r.nodeValue!==!1?n.toLowerCase():t},set:function(e,t,n){var r;return t===!1?v.removeAttr(e,n):(r=v.propFix[n]||n,r in e&&(e[r]=!0),e.setAttribute(n,n.toLowerCase())),n}},V||(I={name:!0,id:!0,coords:!0},j=v.valHooks.button={get:function(e,n){var r;return r=e.getAttributeNode(n),r&&(I[n]?r.value!=="":r.specified)?r.value:t},set:function(e,t,n){var r=e.getAttributeNode(n);return r||(r=i.createAttribute(n),e.setAttributeNode(r)),r.value=t+""}},v.each(["width","height"],function(e,t){v.attrHooks[t]=v.extend(v.attrHooks[t],{set:function(e,n){if(n==="")return e.setAttribute(t,"auto"),n}})}),v.attrHooks.contenteditable={get:j.get,set:function(e,t,n){t===""&&(t="false"),j.set(e,t,n)}}),v.support.hrefNormalized||v.each(["href","src","width","height"],function(e,n){v.attrHooks[n]=v.extend(v.attrHooks[n],{get:function(e){var r=e.getAttribute(n,2);return r===null?t:r}})}),v.support.style||(v.attrHooks.style={get:function(e){return e.style.cssText.toLowerCase()||t},set:function(e,t){return e.style.cssText=t+""}}),v.support.optSelected||(v.propHooks.selected=v.extend(v.propHooks.selected,{get:function(e){var t=e.parentNode;return t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex),null}})),v.support.enctype||(v.propFix.enctype="encoding"),v.support.checkOn||v.each(["radio","checkbox"],function(){v.valHooks[this]={get:function(e){return e.getAttribute("value")===null?"on":e.value}}}),v.each(["radio","checkbox"],function(){v.valHooks[this]=v.extend(v.valHooks[this],{set:function(e,t){if(v.isArray(t))return e.checked=v.inArray(v(e).val(),t)>=0}})});var $=/^(?:textarea|input|select)$/i,J=/^([^\.]*|)(?:\.(.+)|)$/,K=/(?:^|\s)hover(\.\S+|)\b/,Q=/^key/,G=/^(?:mouse|contextmenu)|click/,Y=/^(?:focusinfocus|focusoutblur)$/,Z=function(e){return v.event.special.hover?e:e.replace(K,"mouseenter$1 mouseleave$1")};v.event={add:function(e,n,r,i,s){var o,u,a,f,l,c,h,p,d,m,g;if(e.nodeType===3||e.nodeType===8||!n||!r||!(o=v._data(e)))return;r.handler&&(d=r,r=d.handler,s=d.selector),r.guid||(r.guid=v.guid++),a=o.events,a||(o.events=a={}),u=o.handle,u||(o.handle=u=function(e){return typeof v=="undefined"||!!e&&v.event.triggered===e.type?t:v.event.dispatch.apply(u.elem,arguments)},u.elem=e),n=v.trim(Z(n)).split(" ");for(f=0;f<n.length;f++){l=J.exec(n[f])||[],c=l[1],h=(l[2]||"").split(".").sort(),g=v.event.special[c]||{},c=(s?g.delegateType:g.bindType)||c,g=v.event.special[c]||{},p=v.extend({type:c,origType:l[1],data:i,handler:r,guid:r.guid,selector:s,needsContext:s&&v.expr.match.needsContext.test(s),namespace:h.join(".")},d),m=a[c];if(!m){m=a[c]=[],m.delegateCount=0;if(!g.setup||g.setup.call(e,i,h,u)===!1)e.addEventListener?e.addEventListener(c,u,!1):e.attachEvent&&e.attachEvent("on"+c,u)}g.add&&(g.add.call(e,p),p.handler.guid||(p.handler.guid=r.guid)),s?m.splice(m.delegateCount++,0,p):m.push(p),v.event.global[c]=!0}e=null},global:{},remove:function(e,t,n,r,i){var s,o,u,a,f,l,c,h,p,d,m,g=v.hasData(e)&&v._data(e);if(!g||!(h=g.events))return;t=v.trim(Z(t||"")).split(" ");for(s=0;s<t.length;s++){o=J.exec(t[s])||[],u=a=o[1],f=o[2];if(!u){for(u in h)v.event.remove(e,u+t[s],n,r,!0);continue}p=v.event.special[u]||{},u=(r?p.delegateType:p.bindType)||u,d=h[u]||[],l=d.length,f=f?new RegExp("(^|\\.)"+f.split(".").sort().join("\\.(?:.*\\.|)")+"(\\.|$)"):null;for(c=0;c<d.length;c++)m=d[c],(i||a===m.origType)&&(!n||n.guid===m.guid)&&(!f||f.test(m.namespace))&&(!r||r===m.selector||r==="**"&&m.selector)&&(d.splice(c--,1),m.selector&&d.delegateCount--,p.remove&&p.remove.call(e,m));d.length===0&&l!==d.length&&((!p.teardown||p.teardown.call(e,f,g.handle)===!1)&&v.removeEvent(e,u,g.handle),delete h[u])}v.isEmptyObject(h)&&(delete g.handle,v.removeData(e,"events",!0))},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(n,r,s,o){if(!s||s.nodeType!==3&&s.nodeType!==8){var u,a,f,l,c,h,p,d,m,g,y=n.type||n,b=[];if(Y.test(y+v.event.triggered))return;y.indexOf("!")>=0&&(y=y.slice(0,-1),a=!0),y.indexOf(".")>=0&&(b=y.split("."),y=b.shift(),b.sort());if((!s||v.event.customEvent[y])&&!v.event.global[y])return;n=typeof n=="object"?n[v.expando]?n:new v.Event(y,n):new v.Event(y),n.type=y,n.isTrigger=!0,n.exclusive=a,n.namespace=b.join("."),n.namespace_re=n.namespace?new RegExp("(^|\\.)"+b.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,h=y.indexOf(":")<0?"on"+y:"";if(!s){u=v.cache;for(f in u)u[f].events&&u[f].events[y]&&v.event.trigger(n,r,u[f].handle.elem,!0);return}n.result=t,n.target||(n.target=s),r=r!=null?v.makeArray(r):[],r.unshift(n),p=v.event.special[y]||{};if(p.trigger&&p.trigger.apply(s,r)===!1)return;m=[[s,p.bindType||y]];if(!o&&!p.noBubble&&!v.isWindow(s)){g=p.delegateType||y,l=Y.test(g+y)?s:s.parentNode;for(c=s;l;l=l.parentNode)m.push([l,g]),c=l;c===(s.ownerDocument||i)&&m.push([c.defaultView||c.parentWindow||e,g])}for(f=0;f<m.length&&!n.isPropagationStopped();f++)l=m[f][0],n.type=m[f][1],d=(v._data(l,"events")||{})[n.type]&&v._data(l,"handle"),d&&d.apply(l,r),d=h&&l[h],d&&v.acceptData(l)&&d.apply&&d.apply(l,r)===!1&&n.preventDefault();return n.type=y,!o&&!n.isDefaultPrevented()&&(!p._default||p._default.apply(s.ownerDocument,r)===!1)&&(y!=="click"||!v.nodeName(s,"a"))&&v.acceptData(s)&&h&&s[y]&&(y!=="focus"&&y!=="blur"||n.target.offsetWidth!==0)&&!v.isWindow(s)&&(c=s[h],c&&(s[h]=null),v.event.triggered=y,s[y](),v.event.triggered=t,c&&(s[h]=c)),n.result}return},dispatch:function(n){n=v.event.fix(n||e.event);var r,i,s,o,u,a,f,c,h,p,d=(v._data(this,"events")||{})[n.type]||[],m=d.delegateCount,g=l.call(arguments),y=!n.exclusive&&!n.namespace,b=v.event.special[n.type]||{},w=[];g[0]=n,n.delegateTarget=this;if(b.preDispatch&&b.preDispatch.call(this,n)===!1)return;if(m&&(!n.button||n.type!=="click"))for(s=n.target;s!=this;s=s.parentNode||this)if(s.disabled!==!0||n.type!=="click"){u={},f=[];for(r=0;r<m;r++)c=d[r],h=c.selector,u[h]===t&&(u[h]=c.needsContext?v(h,this).index(s)>=0:v.find(h,this,null,[s]).length),u[h]&&f.push(c);f.length&&w.push({elem:s,matches:f})}d.length>m&&w.push({elem:this,matches:d.slice(m)});for(r=0;r<w.length&&!n.isPropagationStopped();r++){a=w[r],n.currentTarget=a.elem;for(i=0;i<a.matches.length&&!n.isImmediatePropagationStopped();i++){c=a.matches[i];if(y||!n.namespace&&!c.namespace||n.namespace_re&&n.namespace_re.test(c.namespace))n.data=c.data,n.handleObj=c,o=((v.event.special[c.origType]||{}).handle||c.handler).apply(a.elem,g),o!==t&&(n.result=o,o===!1&&(n.preventDefault(),n.stopPropagation()))}}return b.postDispatch&&b.postDispatch.call(this,n),n.result},props:"attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(e,t){return e.which==null&&(e.which=t.charCode!=null?t.charCode:t.keyCode),e}},mouseHooks:{props:"button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(e,n){var r,s,o,u=n.button,a=n.fromElement;return e.pageX==null&&n.clientX!=null&&(r=e.target.ownerDocument||i,s=r.documentElement,o=r.body,e.pageX=n.clientX+(s&&s.scrollLeft||o&&o.scrollLeft||0)-(s&&s.clientLeft||o&&o.clientLeft||0),e.pageY=n.clientY+(s&&s.scrollTop||o&&o.scrollTop||0)-(s&&s.clientTop||o&&o.clientTop||0)),!e.relatedTarget&&a&&(e.relatedTarget=a===e.target?n.toElement:a),!e.which&&u!==t&&(e.which=u&1?1:u&2?3:u&4?2:0),e}},fix:function(e){if(e[v.expando])return e;var t,n,r=e,s=v.event.fixHooks[e.type]||{},o=s.props?this.props.concat(s.props):this.props;e=v.Event(r);for(t=o.length;t;)n=o[--t],e[n]=r[n];return e.target||(e.target=r.srcElement||i),e.target.nodeType===3&&(e.target=e.target.parentNode),e.metaKey=!!e.metaKey,s.filter?s.filter(e,r):e},special:{load:{noBubble:!0},focus:{delegateType:"focusin"},blur:{delegateType:"focusout"},beforeunload:{setup:function(e,t,n){v.isWindow(this)&&(this.onbeforeunload=n)},teardown:function(e,t){this.onbeforeunload===t&&(this.onbeforeunload=null)}}},simulate:function(e,t,n,r){var i=v.extend(new v.Event,n,{type:e,isSimulated:!0,originalEvent:{}});r?v.event.trigger(i,null,t):v.event.dispatch.call(t,i),i.isDefaultPrevented()&&n.preventDefault()}},v.event.handle=v.event.dispatch,v.removeEvent=i.removeEventListener?function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n,!1)}:function(e,t,n){var r="on"+t;e.detachEvent&&(typeof e[r]=="undefined"&&(e[r]=null),e.detachEvent(r,n))},v.Event=function(e,t){if(!(this instanceof v.Event))return new v.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||e.returnValue===!1||e.getPreventDefault&&e.getPreventDefault()?tt:et):this.type=e,t&&v.extend(this,t),this.timeStamp=e&&e.timeStamp||v.now(),this[v.expando]=!0},v.Event.prototype={preventDefault:function(){this.isDefaultPrevented=tt;var e=this.originalEvent;if(!e)return;e.preventDefault?e.preventDefault():e.returnValue=!1},stopPropagation:function(){this.isPropagationStopped=tt;var e=this.originalEvent;if(!e)return;e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=tt,this.stopPropagation()},isDefaultPrevented:et,isPropagationStopped:et,isImmediatePropagationStopped:et},v.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(e,t){v.event.special[e]={delegateType:t,bindType:t,handle:function(e){var n,r=this,i=e.relatedTarget,s=e.handleObj,o=s.selector;if(!i||i!==r&&!v.contains(r,i))e.type=s.origType,n=s.handler.apply(this,arguments),e.type=t;return n}}}),v.support.submitBubbles||(v.event.special.submit={setup:function(){if(v.nodeName(this,"form"))return!1;v.event.add(this,"click._submit keypress._submit",function(e){var n=e.target,r=v.nodeName(n,"input")||v.nodeName(n,"button")?n.form:t;r&&!v._data(r,"_submit_attached")&&(v.event.add(r,"submit._submit",function(e){e._submit_bubble=!0}),v._data(r,"_submit_attached",!0))})},postDispatch:function(e){e._submit_bubble&&(delete e._submit_bubble,this.parentNode&&!e.isTrigger&&v.event.simulate("submit",this.parentNode,e,!0))},teardown:function(){if(v.nodeName(this,"form"))return!1;v.event.remove(this,"._submit")}}),v.support.changeBubbles||(v.event.special.change={setup:function(){if($.test(this.nodeName)){if(this.type==="checkbox"||this.type==="radio")v.event.add(this,"propertychange._change",function(e){e.originalEvent.propertyName==="checked"&&(this._just_changed=!0)}),v.event.add(this,"click._change",function(e){this._just_changed&&!e.isTrigger&&(this._just_changed=!1),v.event.simulate("change",this,e,!0)});return!1}v.event.add(this,"beforeactivate._change",function(e){var t=e.target;$.test(t.nodeName)&&!v._data(t,"_change_attached")&&(v.event.add(t,"change._change",function(e){this.parentNode&&!e.isSimulated&&!e.isTrigger&&v.event.simulate("change",this.parentNode,e,!0)}),v._data(t,"_change_attached",!0))})},handle:function(e){var t=e.target;if(this!==t||e.isSimulated||e.isTrigger||t.type!=="radio"&&t.type!=="checkbox")return e.handleObj.handler.apply(this,arguments)},teardown:function(){return v.event.remove(this,"._change"),!$.test(this.nodeName)}}),v.support.focusinBubbles||v.each({focus:"focusin",blur:"focusout"},function(e,t){var n=0,r=function(e){v.event.simulate(t,e.target,v.event.fix(e),!0)};v.event.special[t]={setup:function(){n++===0&&i.addEventListener(e,r,!0)},teardown:function(){--n===0&&i.removeEventListener(e,r,!0)}}}),v.fn.extend({on:function(e,n,r,i,s){var o,u;if(typeof e=="object"){typeof n!="string"&&(r=r||n,n=t);for(u in e)this.on(u,n,r,e[u],s);return this}r==null&&i==null?(i=n,r=n=t):i==null&&(typeof n=="string"?(i=r,r=t):(i=r,r=n,n=t));if(i===!1)i=et;else if(!i)return this;return s===1&&(o=i,i=function(e){return v().off(e),o.apply(this,arguments)},i.guid=o.guid||(o.guid=v.guid++)),this.each(function(){v.event.add(this,e,i,r,n)})},one:function(e,t,n,r){return this.on(e,t,n,r,1)},off:function(e,n,r){var i,s;if(e&&e.preventDefault&&e.handleObj)return i=e.handleObj,v(e.delegateTarget).off(i.namespace?i.origType+"."+i.namespace:i.origType,i.selector,i.handler),this;if(typeof e=="object"){for(s in e)this.off(s,n,e[s]);return this}if(n===!1||typeof n=="function")r=n,n=t;return r===!1&&(r=et),this.each(function(){v.event.remove(this,e,r,n)})},bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},live:function(e,t,n){return v(this.context).on(e,this.selector,t,n),this},die:function(e,t){return v(this.context).off(e,this.selector||"**",t),this},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return arguments.length===1?this.off(e,"**"):this.off(t,e||"**",n)},trigger:function(e,t){return this.each(function(){v.event.trigger(e,t,this)})},triggerHandler:function(e,t){if(this[0])return v.event.trigger(e,t,this[0],!0)},toggle:function(e){var t=arguments,n=e.guid||v.guid++,r=0,i=function(n){var i=(v._data(this,"lastToggle"+e.guid)||0)%r;return v._data(this,"lastToggle"+e.guid,i+1),n.preventDefault(),t[i].apply(this,arguments)||!1};i.guid=n;while(r<t.length)t[r++].guid=n;return this.click(i)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),v.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(e,t){v.fn[t]=function(e,n){return n==null&&(n=e,e=null),arguments.length>0?this.on(t,null,e,n):this.trigger(t)},Q.test(t)&&(v.event.fixHooks[t]=v.event.keyHooks),G.test(t)&&(v.event.fixHooks[t]=v.event.mouseHooks)}),function(e,t){function nt(e,t,n,r){n=n||[],t=t||g;var i,s,a,f,l=t.nodeType;if(!e||typeof e!="string")return n;if(l!==1&&l!==9)return[];a=o(t);if(!a&&!r)if(i=R.exec(e))if(f=i[1]){if(l===9){s=t.getElementById(f);if(!s||!s.parentNode)return n;if(s.id===f)return n.push(s),n}else if(t.ownerDocument&&(s=t.ownerDocument.getElementById(f))&&u(t,s)&&s.id===f)return n.push(s),n}else{if(i[2])return S.apply(n,x.call(t.getElementsByTagName(e),0)),n;if((f=i[3])&&Z&&t.getElementsByClassName)return S.apply(n,x.call(t.getElementsByClassName(f),0)),n}return vt(e.replace(j,"$1"),t,n,r,a)}function rt(e){return function(t){var n=t.nodeName.toLowerCase();return n==="input"&&t.type===e}}function it(e){return function(t){var n=t.nodeName.toLowerCase();return(n==="input"||n==="button")&&t.type===e}}function st(e){return N(function(t){return t=+t,N(function(n,r){var i,s=e([],n.length,t),o=s.length;while(o--)n[i=s[o]]&&(n[i]=!(r[i]=n[i]))})})}function ot(e,t,n){if(e===t)return n;var r=e.nextSibling;while(r){if(r===t)return-1;r=r.nextSibling}return 1}function ut(e,t){var n,r,s,o,u,a,f,l=L[d][e+" "];if(l)return t?0:l.slice(0);u=e,a=[],f=i.preFilter;while(u){if(!n||(r=F.exec(u)))r&&(u=u.slice(r[0].length)||u),a.push(s=[]);n=!1;if(r=I.exec(u))s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=r[0].replace(j," ");for(o in i.filter)(r=J[o].exec(u))&&(!f[o]||(r=f[o](r)))&&(s.push(n=new m(r.shift())),u=u.slice(n.length),n.type=o,n.matches=r);if(!n)break}return t?u.length:u?nt.error(e):L(e,a).slice(0)}function at(e,t,r){var i=t.dir,s=r&&t.dir==="parentNode",o=w++;return t.first?function(t,n,r){while(t=t[i])if(s||t.nodeType===1)return e(t,n,r)}:function(t,r,u){if(!u){var a,f=b+" "+o+" ",l=f+n;while(t=t[i])if(s||t.nodeType===1){if((a=t[d])===l)return t.sizset;if(typeof a=="string"&&a.indexOf(f)===0){if(t.sizset)return t}else{t[d]=l;if(e(t,r,u))return t.sizset=!0,t;t.sizset=!1}}}else while(t=t[i])if(s||t.nodeType===1)if(e(t,r,u))return t}}function ft(e){return e.length>1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function lt(e,t,n,r,i){var s,o=[],u=0,a=e.length,f=t!=null;for(;u<a;u++)if(s=e[u])if(!n||n(s,r,i))o.push(s),f&&t.push(u);return o}function ct(e,t,n,r,i,s){return r&&!r[d]&&(r=ct(r)),i&&!i[d]&&(i=ct(i,s)),N(function(s,o,u,a){var f,l,c,h=[],p=[],d=o.length,v=s||dt(t||"*",u.nodeType?[u]:u,[]),m=e&&(s||!t)?lt(v,h,e,u,a):v,g=n?i||(s?e:d||r)?[]:o:m;n&&n(m,g,u,a);if(r){f=lt(g,p),r(f,[],u,a),l=f.length;while(l--)if(c=f[l])g[p[l]]=!(m[p[l]]=c)}if(s){if(i||e){if(i){f=[],l=g.length;while(l--)(c=g[l])&&f.push(m[l]=c);i(null,g=[],f,a)}l=g.length;while(l--)(c=g[l])&&(f=i?T.call(s,c):h[l])>-1&&(s[f]=!(o[f]=c))}}else g=lt(g===o?g.splice(d,g.length):g),i?i(null,o,g,a):S.apply(o,g)})}function ht(e){var t,n,r,s=e.length,o=i.relative[e[0].type],u=o||i.relative[" "],a=o?1:0,f=at(function(e){return e===t},u,!0),l=at(function(e){return T.call(t,e)>-1},u,!0),h=[function(e,n,r){return!o&&(r||n!==c)||((t=n).nodeType?f(e,n,r):l(e,n,r))}];for(;a<s;a++)if(n=i.relative[e[a].type])h=[at(ft(h),n)];else{n=i.filter[e[a].type].apply(null,e[a].matches);if(n[d]){r=++a;for(;r<s;r++)if(i.relative[e[r].type])break;return ct(a>1&&ft(h),a>1&&e.slice(0,a-1).join("").replace(j,"$1"),n,a<r&&ht(e.slice(a,r)),r<s&&ht(e=e.slice(r)),r<s&&e.join(""))}h.push(n)}return ft(h)}function pt(e,t){var r=t.length>0,s=e.length>0,o=function(u,a,f,l,h){var p,d,v,m=[],y=0,w="0",x=u&&[],T=h!=null,N=c,C=u||s&&i.find.TAG("*",h&&a.parentNode||a),k=b+=N==null?1:Math.E;T&&(c=a!==g&&a,n=o.el);for(;(p=C[w])!=null;w++){if(s&&p){for(d=0;v=e[d];d++)if(v(p,a,f)){l.push(p);break}T&&(b=k,n=++o.el)}r&&((p=!v&&p)&&y--,u&&x.push(p))}y+=w;if(r&&w!==y){for(d=0;v=t[d];d++)v(x,m,a,f);if(u){if(y>0)while(w--)!x[w]&&!m[w]&&(m[w]=E.call(l));m=lt(m)}S.apply(l,m),T&&!u&&m.length>0&&y+t.length>1&&nt.uniqueSort(l)}return T&&(b=k,c=N),x};return o.el=0,r?N(o):o}function dt(e,t,n){var r=0,i=t.length;for(;r<i;r++)nt(e,t[r],n);return n}function vt(e,t,n,r,s){var o,u,f,l,c,h=ut(e),p=h.length;if(!r&&h.length===1){u=h[0]=h[0].slice(0);if(u.length>2&&(f=u[0]).type==="ID"&&t.nodeType===9&&!s&&i.relative[u[1].type]){t=i.find.ID(f.matches[0].replace($,""),t,s)[0];if(!t)return n;e=e.slice(u.shift().length)}for(o=J.POS.test(e)?-1:u.length-1;o>=0;o--){f=u[o];if(i.relative[l=f.type])break;if(c=i.find[l])if(r=c(f.matches[0].replace($,""),z.test(u[0].type)&&t.parentNode||t,s)){u.splice(o,1),e=r.length&&u.join("");if(!e)return S.apply(n,x.call(r,0)),n;break}}}return a(e,h)(r,t,s,n,z.test(e)),n}function mt(){}var n,r,i,s,o,u,a,f,l,c,h=!0,p="undefined",d=("sizcache"+Math.random()).replace(".",""),m=String,g=e.document,y=g.documentElement,b=0,w=0,E=[].pop,S=[].push,x=[].slice,T=[].indexOf||function(e){var t=0,n=this.length;for(;t<n;t++)if(this[t]===e)return t;return-1},N=function(e,t){return e[d]=t==null||t,e},C=function(){var e={},t=[];return N(function(n,r){return t.push(n)>i.cacheLength&&delete e[t.shift()],e[n+" "]=r},e)},k=C(),L=C(),A=C(),O="[\\x20\\t\\r\\n\\f]",M="(?:\\\\.|[-\\w]|[^\\x00-\\xa0])+",_=M.replace("w","w#"),D="([*^$|!~]?=)",P="\\["+O+"*("+M+")"+O+"*(?:"+D+O+"*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|("+_+")|)|)"+O+"*\\]",H=":("+M+")(?:\\((?:(['\"])((?:\\\\.|[^\\\\])*?)\\2|([^()[\\]]*|(?:(?:"+P+")|[^:]|\\\\.)*|.*))\\)|)",B=":(even|odd|eq|gt|lt|nth|first|last)(?:\\("+O+"*((?:-\\d)?\\d*)"+O+"*\\)|)(?=[^-]|$)",j=new RegExp("^"+O+"+|((?:^|[^\\\\])(?:\\\\.)*)"+O+"+$","g"),F=new RegExp("^"+O+"*,"+O+"*"),I=new RegExp("^"+O+"*([\\x20\\t\\r\\n\\f>+~])"+O+"*"),q=new RegExp(H),R=/^(?:#([\w\-]+)|(\w+)|\.([\w\-]+))$/,U=/^:not/,z=/[\x20\t\r\n\f]*[+~]/,W=/:not\($/,X=/h\d/i,V=/input|select|textarea|button/i,$=/\\(?!\\)/g,J={ID:new RegExp("^#("+M+")"),CLASS:new RegExp("^\\.("+M+")"),NAME:new RegExp("^\\[name=['\"]?("+M+")['\"]?\\]"),TAG:new RegExp("^("+M.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+H),POS:new RegExp(B,"i"),CHILD:new RegExp("^:(only|nth|first|last)-child(?:\\("+O+"*(even|odd|(([+-]|)(\\d*)n|)"+O+"*(?:([+-]|)"+O+"*(\\d+)|))"+O+"*\\)|)","i"),needsContext:new RegExp("^"+O+"*[>+~]|"+B,"i")},K=function(e){var t=g.createElement("div");try{return e(t)}catch(n){return!1}finally{t=null}},Q=K(function(e){return e.appendChild(g.createComment("")),!e.getElementsByTagName("*").length}),G=K(function(e){return e.innerHTML="<a href='#'></a>",e.firstChild&&typeof e.firstChild.getAttribute!==p&&e.firstChild.getAttribute("href")==="#"}),Y=K(function(e){e.innerHTML="<select></select>";var t=typeof e.lastChild.getAttribute("multiple");return t!=="boolean"&&t!=="string"}),Z=K(function(e){return e.innerHTML="<div class='hidden e'></div><div class='hidden'></div>",!e.getElementsByClassName||!e.getElementsByClassName("e").length?!1:(e.lastChild.className="e",e.getElementsByClassName("e").length===2)}),et=K(function(e){e.id=d+0,e.innerHTML="<a name='"+d+"'></a><div name='"+d+"'></div>",y.insertBefore(e,y.firstChild);var t=g.getElementsByName&&g.getElementsByName(d).length===2+g.getElementsByName(d+0).length;return r=!g.getElementById(d),y.removeChild(e),t});try{x.call(y.childNodes,0)[0].nodeType}catch(tt){x=function(e){var t,n=[];for(;t=this[e];e++)n.push(t);return n}}nt.matches=function(e,t){return nt(e,null,null,t)},nt.matchesSelector=function(e,t){return nt(t,null,null,[e]).length>0},s=nt.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(i===1||i===9||i===11){if(typeof e.textContent=="string")return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=s(e)}else if(i===3||i===4)return e.nodeValue}else for(;t=e[r];r++)n+=s(t);return n},o=nt.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return t?t.nodeName!=="HTML":!1},u=nt.contains=y.contains?function(e,t){var n=e.nodeType===9?e.documentElement:e,r=t&&t.parentNode;return e===r||!!(r&&r.nodeType===1&&n.contains&&n.contains(r))}:y.compareDocumentPosition?function(e,t){return t&&!!(e.compareDocumentPosition(t)&16)}:function(e,t){while(t=t.parentNode)if(t===e)return!0;return!1},nt.attr=function(e,t){var n,r=o(e);return r||(t=t.toLowerCase()),(n=i.attrHandle[t])?n(e):r||Y?e.getAttribute(t):(n=e.getAttributeNode(t),n?typeof e[t]=="boolean"?e[t]?t:null:n.specified?n.value:null:null)},i=nt.selectors={cacheLength:50,createPseudo:N,match:J,attrHandle:G?{}:{href:function(e){return e.getAttribute("href",2)},type:function(e){return e.getAttribute("type")}},find:{ID:r?function(e,t,n){if(typeof t.getElementById!==p&&!n){var r=t.getElementById(e);return r&&r.parentNode?[r]:[]}}:function(e,n,r){if(typeof n.getElementById!==p&&!r){var i=n.getElementById(e);return i?i.id===e||typeof i.getAttributeNode!==p&&i.getAttributeNode("id").value===e?[i]:t:[]}},TAG:Q?function(e,t){if(typeof t.getElementsByTagName!==p)return t.getElementsByTagName(e)}:function(e,t){var n=t.getElementsByTagName(e);if(e==="*"){var r,i=[],s=0;for(;r=n[s];s++)r.nodeType===1&&i.push(r);return i}return n},NAME:et&&function(e,t){if(typeof t.getElementsByName!==p)return t.getElementsByName(name)},CLASS:Z&&function(e,t,n){if(typeof t.getElementsByClassName!==p&&!n)return t.getElementsByClassName(e)}},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace($,""),e[3]=(e[4]||e[5]||"").replace($,""),e[2]==="~="&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),e[1]==="nth"?(e[2]||nt.error(e[0]),e[3]=+(e[3]?e[4]+(e[5]||1):2*(e[2]==="even"||e[2]==="odd")),e[4]=+(e[6]+e[7]||e[2]==="odd")):e[2]&&nt.error(e[0]),e},PSEUDO:function(e){var t,n;if(J.CHILD.test(e[0]))return null;if(e[3])e[2]=e[3];else if(t=e[4])q.test(t)&&(n=ut(t,!0))&&(n=t.indexOf(")",t.length-n)-t.length)&&(t=t.slice(0,n),e[0]=e[0].slice(0,n)),e[2]=t;return e.slice(0,3)}},filter:{ID:r?function(e){return e=e.replace($,""),function(t){return t.getAttribute("id")===e}}:function(e){return e=e.replace($,""),function(t){var n=typeof t.getAttributeNode!==p&&t.getAttributeNode("id");return n&&n.value===e}},TAG:function(e){return e==="*"?function(){return!0}:(e=e.replace($,"").toLowerCase(),function(t){return t.nodeName&&t.nodeName.toLowerCase()===e})},CLASS:function(e){var t=k[d][e+" "];return t||(t=new RegExp("(^|"+O+")"+e+"("+O+"|$)"))&&k(e,function(e){return t.test(e.className||typeof e.getAttribute!==p&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r,i){var s=nt.attr(r,e);return s==null?t==="!=":t?(s+="",t==="="?s===n:t==="!="?s!==n:t==="^="?n&&s.indexOf(n)===0:t==="*="?n&&s.indexOf(n)>-1:t==="$="?n&&s.substr(s.length-n.length)===n:t==="~="?(" "+s+" ").indexOf(n)>-1:t==="|="?s===n||s.substr(0,n.length+1)===n+"-":!1):!0}},CHILD:function(e,t,n,r){return e==="nth"?function(e){var t,i,s=e.parentNode;if(n===1&&r===0)return!0;if(s){i=0;for(t=s.firstChild;t;t=t.nextSibling)if(t.nodeType===1){i++;if(e===t)break}}return i-=r,i===n||i%n===0&&i/n>=0}:function(t){var n=t;switch(e){case"only":case"first":while(n=n.previousSibling)if(n.nodeType===1)return!1;if(e==="first")return!0;n=t;case"last":while(n=n.nextSibling)if(n.nodeType===1)return!1;return!0}}},PSEUDO:function(e,t){var n,r=i.pseudos[e]||i.setFilters[e.toLowerCase()]||nt.error("unsupported pseudo: "+e);return r[d]?r(t):r.length>1?(n=[e,e,"",t],i.setFilters.hasOwnProperty(e.toLowerCase())?N(function(e,n){var i,s=r(e,t),o=s.length;while(o--)i=T.call(e,s[o]),e[i]=!(n[i]=s[o])}):function(e){return r(e,0,n)}):r}},pseudos:{not:N(function(e){var t=[],n=[],r=a(e.replace(j,"$1"));return r[d]?N(function(e,t,n,i){var s,o=r(e,null,i,[]),u=e.length;while(u--)if(s=o[u])e[u]=!(t[u]=s)}):function(e,i,s){return t[0]=e,r(t,null,s,n),!n.pop()}}),has:N(function(e){return function(t){return nt(e,t).length>0}}),contains:N(function(e){return function(t){return(t.textContent||t.innerText||s(t)).indexOf(e)>-1}}),enabled:function(e){return e.disabled===!1},disabled:function(e){return e.disabled===!0},checked:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&!!e.checked||t==="option"&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,e.selected===!0},parent:function(e){return!i.pseudos.empty(e)},empty:function(e){var t;e=e.firstChild;while(e){if(e.nodeName>"@"||(t=e.nodeType)===3||t===4)return!1;e=e.nextSibling}return!0},header:function(e){return X.test(e.nodeName)},text:function(e){var t,n;return e.nodeName.toLowerCase()==="input"&&(t=e.type)==="text"&&((n=e.getAttribute("type"))==null||n.toLowerCase()===t)},radio:rt("radio"),checkbox:rt("checkbox"),file:rt("file"),password:rt("password"),image:rt("image"),submit:it("submit"),reset:it("reset"),button:function(e){var t=e.nodeName.toLowerCase();return t==="input"&&e.type==="button"||t==="button"},input:function(e){return V.test(e.nodeName)},focus:function(e){var t=e.ownerDocument;return e===t.activeElement&&(!t.hasFocus||t.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},active:function(e){return e===e.ownerDocument.activeElement},first:st(function(){return[0]}),last:st(function(e,t){return[t-1]}),eq:st(function(e,t,n){return[n<0?n+t:n]}),even:st(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:st(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:st(function(e,t,n){for(var r=n<0?n+t:n;--r>=0;)e.push(r);return e}),gt:st(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}},f=y.compareDocumentPosition?function(e,t){return e===t?(l=!0,0):(!e.compareDocumentPosition||!t.compareDocumentPosition?e.compareDocumentPosition:e.compareDocumentPosition(t)&4)?-1:1}:function(e,t){if(e===t)return l=!0,0;if(e.sourceIndex&&t.sourceIndex)return e.sourceIndex-t.sourceIndex;var n,r,i=[],s=[],o=e.parentNode,u=t.parentNode,a=o;if(o===u)return ot(e,t);if(!o)return-1;if(!u)return 1;while(a)i.unshift(a),a=a.parentNode;a=u;while(a)s.unshift(a),a=a.parentNode;n=i.length,r=s.length;for(var f=0;f<n&&f<r;f++)if(i[f]!==s[f])return ot(i[f],s[f]);return f===n?ot(e,s[f],-1):ot(i[f],t,1)},[0,0].sort(f),h=!l,nt.uniqueSort=function(e){var t,n=[],r=1,i=0;l=h,e.sort(f);if(l){for(;t=e[r];r++)t===e[r-1]&&(i=n.push(r));while(i--)e.splice(n[i],1)}return e},nt.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},a=nt.compile=function(e,t){var n,r=[],i=[],s=A[d][e+" "];if(!s){t||(t=ut(e)),n=t.length;while(n--)s=ht(t[n]),s[d]?r.push(s):i.push(s);s=A(e,pt(i,r))}return s},g.querySelectorAll&&function(){var e,t=vt,n=/'|\\/g,r=/\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g,i=[":focus"],s=[":active"],u=y.matchesSelector||y.mozMatchesSelector||y.webkitMatchesSelector||y.oMatchesSelector||y.msMatchesSelector;K(function(e){e.innerHTML="<select><option selected=''></option></select>",e.querySelectorAll("[selected]").length||i.push("\\["+O+"*(?:checked|disabled|ismap|multiple|readonly|selected|value)"),e.querySelectorAll(":checked").length||i.push(":checked")}),K(function(e){e.innerHTML="<p test=''></p>",e.querySelectorAll("[test^='']").length&&i.push("[*^$]="+O+"*(?:\"\"|'')"),e.innerHTML="<input type='hidden'/>",e.querySelectorAll(":enabled").length||i.push(":enabled",":disabled")}),i=new RegExp(i.join("|")),vt=function(e,r,s,o,u){if(!o&&!u&&!i.test(e)){var a,f,l=!0,c=d,h=r,p=r.nodeType===9&&e;if(r.nodeType===1&&r.nodeName.toLowerCase()!=="object"){a=ut(e),(l=r.getAttribute("id"))?c=l.replace(n,"\\$&"):r.setAttribute("id",c),c="[id='"+c+"'] ",f=a.length;while(f--)a[f]=c+a[f].join("");h=z.test(e)&&r.parentNode||r,p=a.join(",")}if(p)try{return S.apply(s,x.call(h.querySelectorAll(p),0)),s}catch(v){}finally{l||r.removeAttribute("id")}}return t(e,r,s,o,u)},u&&(K(function(t){e=u.call(t,"div");try{u.call(t,"[test!='']:sizzle"),s.push("!=",H)}catch(n){}}),s=new RegExp(s.join("|")),nt.matchesSelector=function(t,n){n=n.replace(r,"='$1']");if(!o(t)&&!s.test(n)&&!i.test(n))try{var a=u.call(t,n);if(a||e||t.document&&t.document.nodeType!==11)return a}catch(f){}return nt(n,null,null,[t]).length>0})}(),i.pseudos.nth=i.pseudos.eq,i.filters=mt.prototype=i.pseudos,i.setFilters=new mt,nt.attr=v.attr,v.find=nt,v.expr=nt.selectors,v.expr[":"]=v.expr.pseudos,v.unique=nt.uniqueSort,v.text=nt.getText,v.isXMLDoc=nt.isXML,v.contains=nt.contains}(e);var nt=/Until$/,rt=/^(?:parents|prev(?:Until|All))/,it=/^.[^:#\[\.,]*$/,st=v.expr.match.needsContext,ot={children:!0,contents:!0,next:!0,prev:!0};v.fn.extend({find:function(e){var t,n,r,i,s,o,u=this;if(typeof e!="string")return v(e).filter(function(){for(t=0,n=u.length;t<n;t++)if(v.contains(u[t],this))return!0});o=this.pushStack("","find",e);for(t=0,n=this.length;t<n;t++){r=o.length,v.find(e,this[t],o);if(t>0)for(i=r;i<o.length;i++)for(s=0;s<r;s++)if(o[s]===o[i]){o.splice(i--,1);break}}return o},has:function(e){var t,n=v(e,this),r=n.length;return this.filter(function(){for(t=0;t<r;t++)if(v.contains(this,n[t]))return!0})},not:function(e){return this.pushStack(ft(this,e,!1),"not",e)},filter:function(e){return this.pushStack(ft(this,e,!0),"filter",e)},is:function(e){return!!e&&(typeof e=="string"?st.test(e)?v(e,this.context).index(this[0])>=0:v.filter(e,this).length>0:this.filter(e).length>0)},closest:function(e,t){var n,r=0,i=this.length,s=[],o=st.test(e)||typeof e!="string"?v(e,t||this.context):0;for(;r<i;r++){n=this[r];while(n&&n.ownerDocument&&n!==t&&n.nodeType!==11){if(o?o.index(n)>-1:v.find.matchesSelector(n,e)){s.push(n);break}n=n.parentNode}}return s=s.length>1?v.unique(s):s,this.pushStack(s,"closest",e)},index:function(e){return e?typeof e=="string"?v.inArray(this[0],v(e)):v.inArray(e.jquery?e[0]:e,this):this[0]&&this[0].parentNode?this.prevAll().length:-1},add:function(e,t){var n=typeof e=="string"?v(e,t):v.makeArray(e&&e.nodeType?[e]:e),r=v.merge(this.get(),n);return this.pushStack(ut(n[0])||ut(r[0])?r:v.unique(r))},addBack:function(e){return this.add(e==null?this.prevObject:this.prevObject.filter(e))}}),v.fn.andSelf=v.fn.addBack,v.each({parent:function(e){var t=e.parentNode;return t&&t.nodeType!==11?t:null},parents:function(e){return v.dir(e,"parentNode")},parentsUntil:function(e,t,n){return v.dir(e,"parentNode",n)},next:function(e){return at(e,"nextSibling")},prev:function(e){return at(e,"previousSibling")},nextAll:function(e){return v.dir(e,"nextSibling")},prevAll:function(e){return v.dir(e,"previousSibling")},nextUntil:function(e,t,n){return v.dir(e,"nextSibling",n)},prevUntil:function(e,t,n){return v.dir(e,"previousSibling",n)},siblings:function(e){return v.sibling((e.parentNode||{}).firstChild,e)},children:function(e){return v.sibling(e.firstChild)},contents:function(e){return v.nodeName(e,"iframe")?e.contentDocument||e.contentWindow.document:v.merge([],e.childNodes)}},function(e,t){v.fn[e]=function(n,r){var i=v.map(this,t,n);return nt.test(e)||(r=n),r&&typeof r=="string"&&(i=v.filter(r,i)),i=this.length>1&&!ot[e]?v.unique(i):i,this.length>1&&rt.test(e)&&(i=i.reverse()),this.pushStack(i,e,l.call(arguments).join(","))}}),v.extend({filter:function(e,t,n){return n&&(e=":not("+e+")"),t.length===1?v.find.matchesSelector(t[0],e)?[t[0]]:[]:v.find.matches(e,t)},dir:function(e,n,r){var i=[],s=e[n];while(s&&s.nodeType!==9&&(r===t||s.nodeType!==1||!v(s).is(r)))s.nodeType===1&&i.push(s),s=s[n];return i},sibling:function(e,t){var n=[];for(;e;e=e.nextSibling)e.nodeType===1&&e!==t&&n.push(e);return n}});var ct="abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",ht=/ jQuery\d+="(?:null|\d+)"/g,pt=/^\s+/,dt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,vt=/<([\w:]+)/,mt=/<tbody/i,gt=/<|&#?\w+;/,yt=/<(?:script|style|link)/i,bt=/<(?:script|object|embed|option|style)/i,wt=new RegExp("<(?:"+ct+")[\\s/>]","i"),Et=/^(?:checkbox|radio)$/,St=/checked\s*(?:[^=]|=\s*.checked.)/i,xt=/\/(java|ecma)script/i,Tt=/^\s*<!(?:\[CDATA\[|\-\-)|[\]\-]{2}>\s*$/g,Nt={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]},Ct=lt(i),kt=Ct.appendChild(i.createElement("div"));Nt.optgroup=Nt.option,Nt.tbody=Nt.tfoot=Nt.colgroup=Nt.caption=Nt.thead,Nt.th=Nt.td,v.support.htmlSerialize||(Nt._default=[1,"X<div>","</div>"]),v.fn.extend({text:function(e){return v.access(this,function(e){return e===t?v.text(this):this.empty().append((this[0]&&this[0].ownerDocument||i).createTextNode(e))},null,e,arguments.length)},wrapAll:function(e){if(v.isFunction(e))return this.each(function(t){v(this).wrapAll(e.call(this,t))});if(this[0]){var t=v(e,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstChild&&e.firstChild.nodeType===1)e=e.firstChild;return e}).append(this)}return this},wrapInner:function(e){return v.isFunction(e)?this.each(function(t){v(this).wrapInner(e.call(this,t))}):this.each(function(){var t=v(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=v.isFunction(e);return this.each(function(n){v(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(){return this.parent().each(function(){v.nodeName(this,"body")||v(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.appendChild(e)})},prepend:function(){return this.domManip(arguments,!0,function(e){(this.nodeType===1||this.nodeType===11)&&this.insertBefore(e,this.firstChild)})},before:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(e,this),"before",this.selector)}},after:function(){if(!ut(this[0]))return this.domManip(arguments,!1,function(e){this.parentNode.insertBefore(e,this.nextSibling)});if(arguments.length){var e=v.clean(arguments);return this.pushStack(v.merge(this,e),"after",this.selector)}},remove:function(e,t){var n,r=0;for(;(n=this[r])!=null;r++)if(!e||v.filter(e,[n]).length)!t&&n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),v.cleanData([n])),n.parentNode&&n.parentNode.removeChild(n);return this},empty:function(){var e,t=0;for(;(e=this[t])!=null;t++){e.nodeType===1&&v.cleanData(e.getElementsByTagName("*"));while(e.firstChild)e.removeChild(e.firstChild)}return this},clone:function(e,t){return e=e==null?!1:e,t=t==null?e:t,this.map(function(){return v.clone(this,e,t)})},html:function(e){return v.access(this,function(e){var n=this[0]||{},r=0,i=this.length;if(e===t)return n.nodeType===1?n.innerHTML.replace(ht,""):t;if(typeof e=="string"&&!yt.test(e)&&(v.support.htmlSerialize||!wt.test(e))&&(v.support.leadingWhitespace||!pt.test(e))&&!Nt[(vt.exec(e)||["",""])[1].toLowerCase()]){e=e.replace(dt,"<$1></$2>");try{for(;r<i;r++)n=this[r]||{},n.nodeType===1&&(v.cleanData(n.getElementsByTagName("*")),n.innerHTML=e);n=0}catch(s){}}n&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(e){return ut(this[0])?this.length?this.pushStack(v(v.isFunction(e)?e():e),"replaceWith",e):this:v.isFunction(e)?this.each(function(t){var n=v(this),r=n.html();n.replaceWith(e.call(this,t,r))}):(typeof e!="string"&&(e=v(e).detach()),this.each(function(){var t=this.nextSibling,n=this.parentNode;v(this).remove(),t?v(t).before(e):v(n).append(e)}))},detach:function(e){return this.remove(e,!0)},domManip:function(e,n,r){e=[].concat.apply([],e);var i,s,o,u,a=0,f=e[0],l=[],c=this.length;if(!v.support.checkClone&&c>1&&typeof f=="string"&&St.test(f))return this.each(function(){v(this).domManip(e,n,r)});if(v.isFunction(f))return this.each(function(i){var s=v(this);e[0]=f.call(this,i,n?s.html():t),s.domManip(e,n,r)});if(this[0]){i=v.buildFragment(e,this,l),o=i.fragment,s=o.firstChild,o.childNodes.length===1&&(o=s);if(s){n=n&&v.nodeName(s,"tr");for(u=i.cacheable||c-1;a<c;a++)r.call(n&&v.nodeName(this[a],"table")?Lt(this[a],"tbody"):this[a],a===u?o:v.clone(o,!0,!0))}o=s=null,l.length&&v.each(l,function(e,t){t.src?v.ajax?v.ajax({url:t.src,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0}):v.error("no ajax"):v.globalEval((t.text||t.textContent||t.innerHTML||"").replace(Tt,"")),t.parentNode&&t.parentNode.removeChild(t)})}return this}}),v.buildFragment=function(e,n,r){var s,o,u,a=e[0];return n=n||i,n=!n.nodeType&&n[0]||n,n=n.ownerDocument||n,e.length===1&&typeof a=="string"&&a.length<512&&n===i&&a.charAt(0)==="<"&&!bt.test(a)&&(v.support.checkClone||!St.test(a))&&(v.support.html5Clone||!wt.test(a))&&(o=!0,s=v.fragments[a],u=s!==t),s||(s=n.createDocumentFragment(),v.clean(e,n,s,r),o&&(v.fragments[a]=u&&s)),{fragment:s,cacheable:o}},v.fragments={},v.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,t){v.fn[e]=function(n){var r,i=0,s=[],o=v(n),u=o.length,a=this.length===1&&this[0].parentNode;if((a==null||a&&a.nodeType===11&&a.childNodes.length===1)&&u===1)return o[t](this[0]),this;for(;i<u;i++)r=(i>0?this.clone(!0):this).get(),v(o[i])[t](r),s=s.concat(r);return this.pushStack(s,e,o.selector)}}),v.extend({clone:function(e,t,n){var r,i,s,o;v.support.html5Clone||v.isXMLDoc(e)||!wt.test("<"+e.nodeName+">")?o=e.cloneNode(!0):(kt.innerHTML=e.outerHTML,kt.removeChild(o=kt.firstChild));if((!v.support.noCloneEvent||!v.support.noCloneChecked)&&(e.nodeType===1||e.nodeType===11)&&!v.isXMLDoc(e)){Ot(e,o),r=Mt(e),i=Mt(o);for(s=0;r[s];++s)i[s]&&Ot(r[s],i[s])}if(t){At(e,o);if(n){r=Mt(e),i=Mt(o);for(s=0;r[s];++s)At(r[s],i[s])}}return r=i=null,o},clean:function(e,t,n,r){var s,o,u,a,f,l,c,h,p,d,m,g,y=t===i&&Ct,b=[];if(!t||typeof t.createDocumentFragment=="undefined")t=i;for(s=0;(u=e[s])!=null;s++){typeof u=="number"&&(u+="");if(!u)continue;if(typeof u=="string")if(!gt.test(u))u=t.createTextNode(u);else{y=y||lt(t),c=t.createElement("div"),y.appendChild(c),u=u.replace(dt,"<$1></$2>"),a=(vt.exec(u)||["",""])[1].toLowerCase(),f=Nt[a]||Nt._default,l=f[0],c.innerHTML=f[1]+u+f[2];while(l--)c=c.lastChild;if(!v.support.tbody){h=mt.test(u),p=a==="table"&&!h?c.firstChild&&c.firstChild.childNodes:f[1]==="<table>"&&!h?c.childNodes:[];for(o=p.length-1;o>=0;--o)v.nodeName(p[o],"tbody")&&!p[o].childNodes.length&&p[o].parentNode.removeChild(p[o])}!v.support.leadingWhitespace&&pt.test(u)&&c.insertBefore(t.createTextNode(pt.exec(u)[0]),c.firstChild),u=c.childNodes,c.parentNode.removeChild(c)}u.nodeType?b.push(u):v.merge(b,u)}c&&(u=c=y=null);if(!v.support.appendChecked)for(s=0;(u=b[s])!=null;s++)v.nodeName(u,"input")?_t(u):typeof u.getElementsByTagName!="undefined"&&v.grep(u.getElementsByTagName("input"),_t);if(n){m=function(e){if(!e.type||xt.test(e.type))return r?r.push(e.parentNode?e.parentNode.removeChild(e):e):n.appendChild(e)};for(s=0;(u=b[s])!=null;s++)if(!v.nodeName(u,"script")||!m(u))n.appendChild(u),typeof u.getElementsByTagName!="undefined"&&(g=v.grep(v.merge([],u.getElementsByTagName("script")),m),b.splice.apply(b,[s+1,0].concat(g)),s+=g.length)}return b},cleanData:function(e,t){var n,r,i,s,o=0,u=v.expando,a=v.cache,f=v.support.deleteExpando,l=v.event.special;for(;(i=e[o])!=null;o++)if(t||v.acceptData(i)){r=i[u],n=r&&a[r];if(n){if(n.events)for(s in n.events)l[s]?v.event.remove(i,s):v.removeEvent(i,s,n.handle);a[r]&&(delete a[r],f?delete i[u]:i.removeAttribute?i.removeAttribute(u):i[u]=null,v.deletedIds.push(r))}}}}),function(){var e,t;v.uaMatch=function(e){e=e.toLowerCase();var t=/(chrome)[ \/]([\w.]+)/.exec(e)||/(webkit)[ \/]([\w.]+)/.exec(e)||/(opera)(?:.*version|)[ \/]([\w.]+)/.exec(e)||/(msie) ([\w.]+)/.exec(e)||e.indexOf("compatible")<0&&/(mozilla)(?:.*? rv:([\w.]+)|)/.exec(e)||[];return{browser:t[1]||"",version:t[2]||"0"}},e=v.uaMatch(o.userAgent),t={},e.browser&&(t[e.browser]=!0,t.version=e.version),t.chrome?t.webkit=!0:t.webkit&&(t.safari=!0),v.browser=t,v.sub=function(){function e(t,n){return new e.fn.init(t,n)}v.extend(!0,e,this),e.superclass=this,e.fn=e.prototype=this(),e.fn.constructor=e,e.sub=this.sub,e.fn.init=function(r,i){return i&&i instanceof v&&!(i instanceof e)&&(i=e(i)),v.fn.init.call(this,r,i,t)},e.fn.init.prototype=e.fn;var t=e(i);return e}}();var Dt,Pt,Ht,Bt=/alpha\([^)]*\)/i,jt=/opacity=([^)]*)/,Ft=/^(top|right|bottom|left)$/,It=/^(none|table(?!-c[ea]).+)/,qt=/^margin/,Rt=new RegExp("^("+m+")(.*)$","i"),Ut=new RegExp("^("+m+")(?!px)[a-z%]+$","i"),zt=new RegExp("^([-+])=("+m+")","i"),Wt={BODY:"block"},Xt={position:"absolute",visibility:"hidden",display:"block"},Vt={letterSpacing:0,fontWeight:400},$t=["Top","Right","Bottom","Left"],Jt=["Webkit","O","Moz","ms"],Kt=v.fn.toggle;v.fn.extend({css:function(e,n){return v.access(this,function(e,n,r){return r!==t?v.style(e,n,r):v.css(e,n)},e,n,arguments.length>1)},show:function(){return Yt(this,!0)},hide:function(){return Yt(this)},toggle:function(e,t){var n=typeof e=="boolean";return v.isFunction(e)&&v.isFunction(t)?Kt.apply(this,arguments):this.each(function(){(n?e:Gt(this))?v(this).show():v(this).hide()})}}),v.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Dt(e,"opacity");return n===""?"1":n}}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":v.support.cssFloat?"cssFloat":"styleFloat"},style:function(e,n,r,i){if(!e||e.nodeType===3||e.nodeType===8||!e.style)return;var s,o,u,a=v.camelCase(n),f=e.style;n=v.cssProps[a]||(v.cssProps[a]=Qt(f,a)),u=v.cssHooks[n]||v.cssHooks[a];if(r===t)return u&&"get"in u&&(s=u.get(e,!1,i))!==t?s:f[n];o=typeof r,o==="string"&&(s=zt.exec(r))&&(r=(s[1]+1)*s[2]+parseFloat(v.css(e,n)),o="number");if(r==null||o==="number"&&isNaN(r))return;o==="number"&&!v.cssNumber[a]&&(r+="px");if(!u||!("set"in u)||(r=u.set(e,r,i))!==t)try{f[n]=r}catch(l){}},css:function(e,n,r,i){var s,o,u,a=v.camelCase(n);return n=v.cssProps[a]||(v.cssProps[a]=Qt(e.style,a)),u=v.cssHooks[n]||v.cssHooks[a],u&&"get"in u&&(s=u.get(e,!0,i)),s===t&&(s=Dt(e,n)),s==="normal"&&n in Vt&&(s=Vt[n]),r||i!==t?(o=parseFloat(s),r||v.isNumeric(o)?o||0:s):s},swap:function(e,t,n){var r,i,s={};for(i in t)s[i]=e.style[i],e.style[i]=t[i];r=n.call(e);for(i in t)e.style[i]=s[i];return r}}),e.getComputedStyle?Dt=function(t,n){var r,i,s,o,u=e.getComputedStyle(t,null),a=t.style;return u&&(r=u.getPropertyValue(n)||u[n],r===""&&!v.contains(t.ownerDocument,t)&&(r=v.style(t,n)),Ut.test(r)&&qt.test(n)&&(i=a.width,s=a.minWidth,o=a.maxWidth,a.minWidth=a.maxWidth=a.width=r,r=u.width,a.width=i,a.minWidth=s,a.maxWidth=o)),r}:i.documentElement.currentStyle&&(Dt=function(e,t){var n,r,i=e.currentStyle&&e.currentStyle[t],s=e.style;return i==null&&s&&s[t]&&(i=s[t]),Ut.test(i)&&!Ft.test(t)&&(n=s.left,r=e.runtimeStyle&&e.runtimeStyle.left,r&&(e.runtimeStyle.left=e.currentStyle.left),s.left=t==="fontSize"?"1em":i,i=s.pixelLeft+"px",s.left=n,r&&(e.runtimeStyle.left=r)),i===""?"auto":i}),v.each(["height","width"],function(e,t){v.cssHooks[t]={get:function(e,n,r){if(n)return e.offsetWidth===0&&It.test(Dt(e,"display"))?v.swap(e,Xt,function(){return tn(e,t,r)}):tn(e,t,r)},set:function(e,n,r){return Zt(e,n,r?en(e,t,r,v.support.boxSizing&&v.css(e,"boxSizing")==="border-box"):0)}}}),v.support.opacity||(v.cssHooks.opacity={get:function(e,t){return jt.test((t&&e.currentStyle?e.currentStyle.filter:e.style.filter)||"")?.01*parseFloat(RegExp.$1)+"":t?"1":""},set:function(e,t){var n=e.style,r=e.currentStyle,i=v.isNumeric(t)?"alpha(opacity="+t*100+")":"",s=r&&r.filter||n.filter||"";n.zoom=1;if(t>=1&&v.trim(s.replace(Bt,""))===""&&n.removeAttribute){n.removeAttribute("filter");if(r&&!r.filter)return}n.filter=Bt.test(s)?s.replace(Bt,i):s+" "+i}}),v(function(){v.support.reliableMarginRight||(v.cssHooks.marginRight={get:function(e,t){return v.swap(e,{display:"inline-block"},function(){if(t)return Dt(e,"marginRight")})}}),!v.support.pixelPosition&&v.fn.position&&v.each(["top","left"],function(e,t){v.cssHooks[t]={get:function(e,n){if(n){var r=Dt(e,t);return Ut.test(r)?v(e).position()[t]+"px":r}}}})}),v.expr&&v.expr.filters&&(v.expr.filters.hidden=function(e){return e.offsetWidth===0&&e.offsetHeight===0||!v.support.reliableHiddenOffsets&&(e.style&&e.style.display||Dt(e,"display"))==="none"},v.expr.filters.visible=function(e){return!v.expr.filters.hidden(e)}),v.each({margin:"",padding:"",border:"Width"},function(e,t){v.cssHooks[e+t]={expand:function(n){var r,i=typeof n=="string"?n.split(" "):[n],s={};for(r=0;r<4;r++)s[e+$t[r]+t]=i[r]||i[r-2]||i[0];return s}},qt.test(e)||(v.cssHooks[e+t].set=Zt)});var rn=/%20/g,sn=/\[\]$/,on=/\r?\n/g,un=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,an=/^(?:select|textarea)/i;v.fn.extend({serialize:function(){return v.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?v.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||an.test(this.nodeName)||un.test(this.type))}).map(function(e,t){var n=v(this).val();return n==null?null:v.isArray(n)?v.map(n,function(e,n){return{name:t.name,value:e.replace(on,"\r\n")}}):{name:t.name,value:n.replace(on,"\r\n")}}).get()}}),v.param=function(e,n){var r,i=[],s=function(e,t){t=v.isFunction(t)?t():t==null?"":t,i[i.length]=encodeURIComponent(e)+"="+encodeURIComponent(t)};n===t&&(n=v.ajaxSettings&&v.ajaxSettings.traditional);if(v.isArray(e)||e.jquery&&!v.isPlainObject(e))v.each(e,function(){s(this.name,this.value)});else for(r in e)fn(r,e[r],n,s);return i.join("&").replace(rn,"+")};var ln,cn,hn=/#.*$/,pn=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,dn=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,vn=/^(?:GET|HEAD)$/,mn=/^\/\//,gn=/\?/,yn=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bn=/([?&])_=[^&]*/,wn=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/,En=v.fn.load,Sn={},xn={},Tn=["*/"]+["*"];try{cn=s.href}catch(Nn){cn=i.createElement("a"),cn.href="",cn=cn.href}ln=wn.exec(cn.toLowerCase())||[],v.fn.load=function(e,n,r){if(typeof e!="string"&&En)return En.apply(this,arguments);if(!this.length)return this;var i,s,o,u=this,a=e.indexOf(" ");return a>=0&&(i=e.slice(a,e.length),e=e.slice(0,a)),v.isFunction(n)?(r=n,n=t):n&&typeof n=="object"&&(s="POST"),v.ajax({url:e,type:s,dataType:"html",data:n,complete:function(e,t){r&&u.each(r,o||[e.responseText,t,e])}}).done(function(e){o=arguments,u.html(i?v("<div>").append(e.replace(yn,"")).find(i):e)}),this},v.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(e,t){v.fn[t]=function(e){return this.on(t,e)}}),v.each(["get","post"],function(e,n){v[n]=function(e,r,i,s){return v.isFunction(r)&&(s=s||i,i=r,r=t),v.ajax({type:n,url:e,data:r,success:i,dataType:s})}}),v.extend({getScript:function(e,n){return v.get(e,t,n,"script")},getJSON:function(e,t,n){return v.get(e,t,n,"json")},ajaxSetup:function(e,t){return t?Ln(e,v.ajaxSettings):(t=e,e=v.ajaxSettings),Ln(e,t),e},ajaxSettings:{url:cn,isLocal:dn.test(ln[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":Tn},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":e.String,"text html":!0,"text json":v.parseJSON,"text xml":v.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:Cn(Sn),ajaxTransport:Cn(xn),ajax:function(e,n){function T(e,n,s,a){var l,y,b,w,S,T=n;if(E===2)return;E=2,u&&clearTimeout(u),o=t,i=a||"",x.readyState=e>0?4:0,s&&(w=An(c,x,s));if(e>=200&&e<300||e===304)c.ifModified&&(S=x.getResponseHeader("Last-Modified"),S&&(v.lastModified[r]=S),S=x.getResponseHeader("Etag"),S&&(v.etag[r]=S)),e===304?(T="notmodified",l=!0):(l=On(c,w),T=l.state,y=l.data,b=l.error,l=!b);else{b=T;if(!T||e)T="error",e<0&&(e=0)}x.status=e,x.statusText=(n||T)+"",l?d.resolveWith(h,[y,T,x]):d.rejectWith(h,[x,T,b]),x.statusCode(g),g=t,f&&p.trigger("ajax"+(l?"Success":"Error"),[x,c,l?y:b]),m.fireWith(h,[x,T]),f&&(p.trigger("ajaxComplete",[x,c]),--v.active||v.event.trigger("ajaxStop"))}typeof e=="object"&&(n=e,e=t),n=n||{};var r,i,s,o,u,a,f,l,c=v.ajaxSetup({},n),h=c.context||c,p=h!==c&&(h.nodeType||h instanceof v)?v(h):v.event,d=v.Deferred(),m=v.Callbacks("once memory"),g=c.statusCode||{},b={},w={},E=0,S="canceled",x={readyState:0,setRequestHeader:function(e,t){if(!E){var n=e.toLowerCase();e=w[n]=w[n]||e,b[e]=t}return this},getAllResponseHeaders:function(){return E===2?i:null},getResponseHeader:function(e){var n;if(E===2){if(!s){s={};while(n=pn.exec(i))s[n[1].toLowerCase()]=n[2]}n=s[e.toLowerCase()]}return n===t?null:n},overrideMimeType:function(e){return E||(c.mimeType=e),this},abort:function(e){return e=e||S,o&&o.abort(e),T(0,e),this}};d.promise(x),x.success=x.done,x.error=x.fail,x.complete=m.add,x.statusCode=function(e){if(e){var t;if(E<2)for(t in e)g[t]=[g[t],e[t]];else t=e[x.status],x.always(t)}return this},c.url=((e||c.url)+"").replace(hn,"").replace(mn,ln[1]+"//"),c.dataTypes=v.trim(c.dataType||"*").toLowerCase().split(y),c.crossDomain==null&&(a=wn.exec(c.url.toLowerCase()),c.crossDomain=!(!a||a[1]===ln[1]&&a[2]===ln[2]&&(a[3]||(a[1]==="http:"?80:443))==(ln[3]||(ln[1]==="http:"?80:443)))),c.data&&c.processData&&typeof c.data!="string"&&(c.data=v.param(c.data,c.traditional)),kn(Sn,c,n,x);if(E===2)return x;f=c.global,c.type=c.type.toUpperCase(),c.hasContent=!vn.test(c.type),f&&v.active++===0&&v.event.trigger("ajaxStart");if(!c.hasContent){c.data&&(c.url+=(gn.test(c.url)?"&":"?")+c.data,delete c.data),r=c.url;if(c.cache===!1){var N=v.now(),C=c.url.replace(bn,"$1_="+N);c.url=C+(C===c.url?(gn.test(c.url)?"&":"?")+"_="+N:"")}}(c.data&&c.hasContent&&c.contentType!==!1||n.contentType)&&x.setRequestHeader("Content-Type",c.contentType),c.ifModified&&(r=r||c.url,v.lastModified[r]&&x.setRequestHeader("If-Modified-Since",v.lastModified[r]),v.etag[r]&&x.setRequestHeader("If-None-Match",v.etag[r])),x.setRequestHeader("Accept",c.dataTypes[0]&&c.accepts[c.dataTypes[0]]?c.accepts[c.dataTypes[0]]+(c.dataTypes[0]!=="*"?", "+Tn+"; q=0.01":""):c.accepts["*"]);for(l in c.headers)x.setRequestHeader(l,c.headers[l]);if(!c.beforeSend||c.beforeSend.call(h,x,c)!==!1&&E!==2){S="abort";for(l in{success:1,error:1,complete:1})x[l](c[l]);o=kn(xn,c,n,x);if(!o)T(-1,"No Transport");else{x.readyState=1,f&&p.trigger("ajaxSend",[x,c]),c.async&&c.timeout>0&&(u=setTimeout(function(){x.abort("timeout")},c.timeout));try{E=1,o.send(b,T)}catch(k){if(!(E<2))throw k;T(-1,k)}}return x}return x.abort()},active:0,lastModified:{},etag:{}});var Mn=[],_n=/\?/,Dn=/(=)\?(?=&|$)|\?\?/,Pn=v.now();v.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Mn.pop()||v.expando+"_"+Pn++;return this[e]=!0,e}}),v.ajaxPrefilter("json jsonp",function(n,r,i){var s,o,u,a=n.data,f=n.url,l=n.jsonp!==!1,c=l&&Dn.test(f),h=l&&!c&&typeof a=="string"&&!(n.contentType||"").indexOf("application/x-www-form-urlencoded")&&Dn.test(a);if(n.dataTypes[0]==="jsonp"||c||h)return s=n.jsonpCallback=v.isFunction(n.jsonpCallback)?n.jsonpCallback():n.jsonpCallback,o=e[s],c?n.url=f.replace(Dn,"$1"+s):h?n.data=a.replace(Dn,"$1"+s):l&&(n.url+=(_n.test(f)?"&":"?")+n.jsonp+"="+s),n.converters["script json"]=function(){return u||v.error(s+" was not called"),u[0]},n.dataTypes[0]="json",e[s]=function(){u=arguments},i.always(function(){e[s]=o,n[s]&&(n.jsonpCallback=r.jsonpCallback,Mn.push(s)),u&&v.isFunction(o)&&o(u[0]),u=o=t}),"script"}),v.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(e){return v.globalEval(e),e}}}),v.ajaxPrefilter("script",function(e){e.cache===t&&(e.cache=!1),e.crossDomain&&(e.type="GET",e.global=!1)}),v.ajaxTransport("script",function(e){if(e.crossDomain){var n,r=i.head||i.getElementsByTagName("head")[0]||i.documentElement;return{send:function(s,o){n=i.createElement("script"),n.async="async",e.scriptCharset&&(n.charset=e.scriptCharset),n.src=e.url,n.onload=n.onreadystatechange=function(e,i){if(i||!n.readyState||/loaded|complete/.test(n.readyState))n.onload=n.onreadystatechange=null,r&&n.parentNode&&r.removeChild(n),n=t,i||o(200,"success")},r.insertBefore(n,r.firstChild)},abort:function(){n&&n.onload(0,1)}}}});var Hn,Bn=e.ActiveXObject?function(){for(var e in Hn)Hn[e](0,1)}:!1,jn=0;v.ajaxSettings.xhr=e.ActiveXObject?function(){return!this.isLocal&&Fn()||In()}:Fn,function(e){v.extend(v.support,{ajax:!!e,cors:!!e&&"withCredentials"in e})}(v.ajaxSettings.xhr()),v.support.ajax&&v.ajaxTransport(function(n){if(!n.crossDomain||v.support.cors){var r;return{send:function(i,s){var o,u,a=n.xhr();n.username?a.open(n.type,n.url,n.async,n.username,n.password):a.open(n.type,n.url,n.async);if(n.xhrFields)for(u in n.xhrFields)a[u]=n.xhrFields[u];n.mimeType&&a.overrideMimeType&&a.overrideMimeType(n.mimeType),!n.crossDomain&&!i["X-Requested-With"]&&(i["X-Requested-With"]="XMLHttpRequest");try{for(u in i)a.setRequestHeader(u,i[u])}catch(f){}a.send(n.hasContent&&n.data||null),r=function(e,i){var u,f,l,c,h;try{if(r&&(i||a.readyState===4)){r=t,o&&(a.onreadystatechange=v.noop,Bn&&delete Hn[o]);if(i)a.readyState!==4&&a.abort();else{u=a.status,l=a.getAllResponseHeaders(),c={},h=a.responseXML,h&&h.documentElement&&(c.xml=h);try{c.text=a.responseText}catch(p){}try{f=a.statusText}catch(p){f=""}!u&&n.isLocal&&!n.crossDomain?u=c.text?200:404:u===1223&&(u=204)}}}catch(d){i||s(-1,d)}c&&s(u,f,c,l)},n.async?a.readyState===4?setTimeout(r,0):(o=++jn,Bn&&(Hn||(Hn={},v(e).unload(Bn)),Hn[o]=r),a.onreadystatechange=r):r()},abort:function(){r&&r(0,1)}}}});var qn,Rn,Un=/^(?:toggle|show|hide)$/,zn=new RegExp("^(?:([-+])=|)("+m+")([a-z%]*)$","i"),Wn=/queueHooks$/,Xn=[Gn],Vn={"*":[function(e,t){var n,r,i=this.createTween(e,t),s=zn.exec(t),o=i.cur(),u=+o||0,a=1,f=20;if(s){n=+s[2],r=s[3]||(v.cssNumber[e]?"":"px");if(r!=="px"&&u){u=v.css(i.elem,e,!0)||n||1;do a=a||".5",u/=a,v.style(i.elem,e,u+r);while(a!==(a=i.cur()/o)&&a!==1&&--f)}i.unit=r,i.start=u,i.end=s[1]?u+(s[1]+1)*n:n}return i}]};v.Animation=v.extend(Kn,{tweener:function(e,t){v.isFunction(e)?(t=e,e=["*"]):e=e.split(" ");var n,r=0,i=e.length;for(;r<i;r++)n=e[r],Vn[n]=Vn[n]||[],Vn[n].unshift(t)},prefilter:function(e,t){t?Xn.unshift(e):Xn.push(e)}}),v.Tween=Yn,Yn.prototype={constructor:Yn,init:function(e,t,n,r,i,s){this.elem=e,this.prop=n,this.easing=i||"swing",this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=s||(v.cssNumber[n]?"":"px")},cur:function(){var e=Yn.propHooks[this.prop];return e&&e.get?e.get(this):Yn.propHooks._default.get(this)},run:function(e){var t,n=Yn.propHooks[this.prop];return this.options.duration?this.pos=t=v.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):Yn.propHooks._default.set(this),this}},Yn.prototype.init.prototype=Yn.prototype,Yn.propHooks={_default:{get:function(e){var t;return e.elem[e.prop]==null||!!e.elem.style&&e.elem.style[e.prop]!=null?(t=v.css(e.elem,e.prop,!1,""),!t||t==="auto"?0:t):e.elem[e.prop]},set:function(e){v.fx.step[e.prop]?v.fx.step[e.prop](e):e.elem.style&&(e.elem.style[v.cssProps[e.prop]]!=null||v.cssHooks[e.prop])?v.style(e.elem,e.prop,e.now+e.unit):e.elem[e.prop]=e.now}}},Yn.propHooks.scrollTop=Yn.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},v.each(["toggle","show","hide"],function(e,t){var n=v.fn[t];v.fn[t]=function(r,i,s){return r==null||typeof r=="boolean"||!e&&v.isFunction(r)&&v.isFunction(i)?n.apply(this,arguments):this.animate(Zn(t,!0),r,i,s)}}),v.fn.extend({fadeTo:function(e,t,n,r){return this.filter(Gt).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(e,t,n,r){var i=v.isEmptyObject(e),s=v.speed(t,n,r),o=function(){var t=Kn(this,v.extend({},e),s);i&&t.stop(!0)};return i||s.queue===!1?this.each(o):this.queue(s.queue,o)},stop:function(e,n,r){var i=function(e){var t=e.stop;delete e.stop,t(r)};return typeof e!="string"&&(r=n,n=e,e=t),n&&e!==!1&&this.queue(e||"fx",[]),this.each(function(){var t=!0,n=e!=null&&e+"queueHooks",s=v.timers,o=v._data(this);if(n)o[n]&&o[n].stop&&i(o[n]);else for(n in o)o[n]&&o[n].stop&&Wn.test(n)&&i(o[n]);for(n=s.length;n--;)s[n].elem===this&&(e==null||s[n].queue===e)&&(s[n].anim.stop(r),t=!1,s.splice(n,1));(t||!r)&&v.dequeue(this,e)})}}),v.each({slideDown:Zn("show"),slideUp:Zn("hide"),slideToggle:Zn("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,t){v.fn[e]=function(e,n,r){return this.animate(t,e,n,r)}}),v.speed=function(e,t,n){var r=e&&typeof e=="object"?v.extend({},e):{complete:n||!n&&t||v.isFunction(e)&&e,duration:e,easing:n&&t||t&&!v.isFunction(t)&&t};r.duration=v.fx.off?0:typeof r.duration=="number"?r.duration:r.duration in v.fx.speeds?v.fx.speeds[r.duration]:v.fx.speeds._default;if(r.queue==null||r.queue===!0)r.queue="fx";return r.old=r.complete,r.complete=function(){v.isFunction(r.old)&&r.old.call(this),r.queue&&v.dequeue(this,r.queue)},r},v.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2}},v.timers=[],v.fx=Yn.prototype.init,v.fx.tick=function(){var e,n=v.timers,r=0;qn=v.now();for(;r<n.length;r++)e=n[r],!e()&&n[r]===e&&n.splice(r--,1);n.length||v.fx.stop(),qn=t},v.fx.timer=function(e){e()&&v.timers.push(e)&&!Rn&&(Rn=setInterval(v.fx.tick,v.fx.interval))},v.fx.interval=13,v.fx.stop=function(){clearInterval(Rn),Rn=null},v.fx.speeds={slow:600,fast:200,_default:400},v.fx.step={},v.expr&&v.expr.filters&&(v.expr.filters.animated=function(e){return v.grep(v.timers,function(t){return e===t.elem}).length});var er=/^(?:body|html)$/i;v.fn.offset=function(e){if(arguments.length)return e===t?this:this.each(function(t){v.offset.setOffset(this,e,t)});var n,r,i,s,o,u,a,f={top:0,left:0},l=this[0],c=l&&l.ownerDocument;if(!c)return;return(r=c.body)===l?v.offset.bodyOffset(l):(n=c.documentElement,v.contains(n,l)?(typeof l.getBoundingClientRect!="undefined"&&(f=l.getBoundingClientRect()),i=tr(c),s=n.clientTop||r.clientTop||0,o=n.clientLeft||r.clientLeft||0,u=i.pageYOffset||n.scrollTop,a=i.pageXOffset||n.scrollLeft,{top:f.top+u-s,left:f.left+a-o}):f)},v.offset={bodyOffset:function(e){var t=e.offsetTop,n=e.offsetLeft;return v.support.doesNotIncludeMarginInBodyOffset&&(t+=parseFloat(v.css(e,"marginTop"))||0,n+=parseFloat(v.css(e,"marginLeft"))||0),{top:t,left:n}},setOffset:function(e,t,n){var r=v.css(e,"position");r==="static"&&(e.style.position="relative");var i=v(e),s=i.offset(),o=v.css(e,"top"),u=v.css(e,"left"),a=(r==="absolute"||r==="fixed")&&v.inArray("auto",[o,u])>-1,f={},l={},c,h;a?(l=i.position(),c=l.top,h=l.left):(c=parseFloat(o)||0,h=parseFloat(u)||0),v.isFunction(t)&&(t=t.call(e,n,s)),t.top!=null&&(f.top=t.top-s.top+c),t.left!=null&&(f.left=t.left-s.left+h),"using"in t?t.using.call(e,f):i.css(f)}},v.fn.extend({position:function(){if(!this[0])return;var e=this[0],t=this.offsetParent(),n=this.offset(),r=er.test(t[0].nodeName)?{top:0,left:0}:t.offset();return n.top-=parseFloat(v.css(e,"marginTop"))||0,n.left-=parseFloat(v.css(e,"marginLeft"))||0,r.top+=parseFloat(v.css(t[0],"borderTopWidth"))||0,r.left+=parseFloat(v.css(t[0],"borderLeftWidth"))||0,{top:n.top-r.top,left:n.left-r.left}},offsetParent:function(){return this.map(function(){var e=this.offsetParent||i.body;while(e&&!er.test(e.nodeName)&&v.css(e,"position")==="static")e=e.offsetParent;return e||i.body})}}),v.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(e,n){var r=/Y/.test(n);v.fn[e]=function(i){return v.access(this,function(e,i,s){var o=tr(e);if(s===t)return o?n in o?o[n]:o.document.documentElement[i]:e[i];o?o.scrollTo(r?v(o).scrollLeft():s,r?s:v(o).scrollTop()):e[i]=s},e,i,arguments.length,null)}}),v.each({Height:"height",Width:"width"},function(e,n){v.each({padding:"inner"+e,content:n,"":"outer"+e},function(r,i){v.fn[i]=function(i,s){var o=arguments.length&&(r||typeof i!="boolean"),u=r||(i===!0||s===!0?"margin":"border");return v.access(this,function(n,r,i){var s;return v.isWindow(n)?n.document.documentElement["client"+e]:n.nodeType===9?(s=n.documentElement,Math.max(n.body["scroll"+e],s["scroll"+e],n.body["offset"+e],s["offset"+e],s["client"+e])):i===t?v.css(n,r,i,u):v.style(n,r,i,u)},n,o?i:t,o,null)}})}),e.jQuery=e.$=v,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return v})})(window); |
| | 1 | /*! |
| | 2 | * jQuery JavaScript Library v1.9.0b1 |
| | 3 | * http://jquery.com/ |
| | 4 | * |
| | 5 | * Includes Sizzle.js |
| | 6 | * http://sizzlejs.com/ |
| | 7 | * |
| | 8 | * Copyright 2012 jQuery Foundation and other contributors |
| | 9 | * Released under the MIT license |
| | 10 | * http://jquery.org/license |
| | 11 | * |
| | 12 | * Date: 2012-12-16 |
| | 13 | */ |
| | 14 | (function( window, undefined ) { |
| | 15 | "use strict"; |
| | 16 | var |
| | 17 | // A central reference to the root jQuery(document) |
| | 18 | rootjQuery, |
| | 19 | |
| | 20 | // The deferred used on DOM ready |
| | 21 | readyList, |
| | 22 | |
| | 23 | // Use the correct document accordingly with window argument (sandbox) |
| | 24 | document = window.document, |
| | 25 | location = window.location, |
| | 26 | |
| | 27 | // Map over jQuery in case of overwrite |
| | 28 | _jQuery = window.jQuery, |
| | 29 | |
| | 30 | // Map over the $ in case of overwrite |
| | 31 | _$ = window.$, |
| | 32 | |
| | 33 | // [[Class]] -> type pairs |
| | 34 | class2type = {}, |
| | 35 | |
| | 36 | // List of deleted data cache ids, so we can reuse them |
| | 37 | core_deletedIds = [], |
| | 38 | |
| | 39 | core_version = "1.9.0b1", |
| | 40 | |
| | 41 | // Save a reference to some core methods |
| | 42 | core_concat = core_deletedIds.concat, |
| | 43 | core_push = core_deletedIds.push, |
| | 44 | core_slice = core_deletedIds.slice, |
| | 45 | core_indexOf = core_deletedIds.indexOf, |
| | 46 | core_toString = class2type.toString, |
| | 47 | core_hasOwn = class2type.hasOwnProperty, |
| | 48 | core_trim = core_version.trim, |
| | 49 | |
| | 50 | // Define a local copy of jQuery |
| | 51 | jQuery = function( selector, context ) { |
| | 52 | // The jQuery object is actually just the init constructor 'enhanced' |
| | 53 | return new jQuery.fn.init( selector, context, rootjQuery ); |
| | 54 | }, |
| | 55 | |
| | 56 | // Used for matching numbers |
| | 57 | core_pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source, |
| | 58 | |
| | 59 | // Used for splitting on whitespace |
| | 60 | core_rnotwhite = /\S+/g, |
| | 61 | |
| | 62 | // Make sure we trim BOM and NBSP (here's looking at you, Safari 5.0 and IE) |
| | 63 | rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, |
| | 64 | |
| | 65 | // A simple way to check for HTML strings |
| | 66 | // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) |
| | 67 | // Strict HTML recognition (#11290: must start with <) |
| | 68 | rquickExpr = /^(?:(<[\w\W]+>)[^>]*|#([\w-]*))$/, |
| | 69 | |
| | 70 | // Match a standalone tag |
| | 71 | rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>|)$/, |
| | 72 | |
| | 73 | // JSON RegExp |
| | 74 | rvalidchars = /^[\],:{}\s]*$/, |
| | 75 | rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, |
| | 76 | rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g, |
| | 77 | rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g, |
| | 78 | |
| | 79 | // Matches dashed string for camelizing |
| | 80 | rmsPrefix = /^-ms-/, |
| | 81 | rdashAlpha = /-([\da-z])/gi, |
| | 82 | |
| | 83 | // Used by jQuery.camelCase as callback to replace() |
| | 84 | fcamelCase = function( all, letter ) { |
| | 85 | return letter.toUpperCase(); |
| | 86 | }, |
| | 87 | |
| | 88 | // The ready event handler and self cleanup method |
| | 89 | DOMContentLoaded = function() { |
| | 90 | if ( document.addEventListener ) { |
| | 91 | document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
| | 92 | jQuery.ready(); |
| | 93 | } else if ( document.readyState === "complete" ) { |
| | 94 | // we're here because readyState === "complete" in oldIE |
| | 95 | // which is good enough for us to call the dom ready! |
| | 96 | document.detachEvent( "onreadystatechange", DOMContentLoaded ); |
| | 97 | jQuery.ready(); |
| | 98 | } |
| | 99 | }; |
| | 100 | |
| | 101 | jQuery.fn = jQuery.prototype = { |
| | 102 | // The current version of jQuery being used |
| | 103 | jquery: core_version, |
| | 104 | |
| | 105 | constructor: jQuery, |
| | 106 | init: function( selector, context, rootjQuery ) { |
| | 107 | var match, elem; |
| | 108 | |
| | 109 | // HANDLE: $(""), $(null), $(undefined), $(false) |
| | 110 | if ( !selector ) { |
| | 111 | return this; |
| | 112 | } |
| | 113 | |
| | 114 | // HANDLE: $(DOMElement) |
| | 115 | if ( selector.nodeType ) { |
| | 116 | this.context = this[0] = selector; |
| | 117 | this.length = 1; |
| | 118 | return this; |
| | 119 | } |
| | 120 | |
| | 121 | // Handle HTML strings |
| | 122 | if ( typeof selector === "string" ) { |
| | 123 | if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { |
| | 124 | // Assume that strings that start and end with <> are HTML and skip the regex check |
| | 125 | match = [ null, selector, null ]; |
| | 126 | |
| | 127 | } else { |
| | 128 | match = rquickExpr.exec( selector ); |
| | 129 | } |
| | 130 | |
| | 131 | // Match html or make sure no context is specified for #id |
| | 132 | if ( match && (match[1] || !context) ) { |
| | 133 | |
| | 134 | // HANDLE: $(html) -> $(array) |
| | 135 | if ( match[1] ) { |
| | 136 | context = context instanceof jQuery ? context[0] : context; |
| | 137 | |
| | 138 | // scripts is true for back-compat |
| | 139 | jQuery.merge( this, jQuery.parseHTML( |
| | 140 | match[1], |
| | 141 | context && context.nodeType ? context.ownerDocument || context : document, |
| | 142 | true |
| | 143 | ) ); |
| | 144 | |
| | 145 | // HANDLE: $(html, props) |
| | 146 | if ( rsingleTag.test( match[1] ) && jQuery.isPlainObject( context ) ) { |
| | 147 | for ( match in context ) { |
| | 148 | // Properties of context are called as methods if possible |
| | 149 | if ( jQuery.isFunction( this[ match ] ) ) { |
| | 150 | this[ match ]( context[ match ] ); |
| | 151 | |
| | 152 | // ...and otherwise set as attributes |
| | 153 | } else { |
| | 154 | this.attr( match, context[ match ] ); |
| | 155 | } |
| | 156 | } |
| | 157 | } |
| | 158 | |
| | 159 | return this; |
| | 160 | |
| | 161 | // HANDLE: $(#id) |
| | 162 | } else { |
| | 163 | elem = document.getElementById( match[2] ); |
| | 164 | |
| | 165 | // Check parentNode to catch when Blackberry 4.6 returns |
| | 166 | // nodes that are no longer in the document #6963 |
| | 167 | if ( elem && elem.parentNode ) { |
| | 168 | // Handle the case where IE and Opera return items |
| | 169 | // by name instead of ID |
| | 170 | if ( elem.id !== match[2] ) { |
| | 171 | return rootjQuery.find( selector ); |
| | 172 | } |
| | 173 | |
| | 174 | // Otherwise, we inject the element directly into the jQuery object |
| | 175 | this.length = 1; |
| | 176 | this[0] = elem; |
| | 177 | } |
| | 178 | |
| | 179 | this.context = document; |
| | 180 | this.selector = selector; |
| | 181 | return this; |
| | 182 | } |
| | 183 | |
| | 184 | // HANDLE: $(expr, $(...)) |
| | 185 | } else if ( !context || context.jquery ) { |
| | 186 | return ( context || rootjQuery ).find( selector ); |
| | 187 | |
| | 188 | // HANDLE: $(expr, context) |
| | 189 | // (which is just equivalent to: $(context).find(expr) |
| | 190 | } else { |
| | 191 | return this.constructor( context ).find( selector ); |
| | 192 | } |
| | 193 | |
| | 194 | // HANDLE: $(function) |
| | 195 | // Shortcut for document ready |
| | 196 | } else if ( jQuery.isFunction( selector ) ) { |
| | 197 | return rootjQuery.ready( selector ); |
| | 198 | } |
| | 199 | |
| | 200 | if ( selector.selector !== undefined ) { |
| | 201 | this.selector = selector.selector; |
| | 202 | this.context = selector.context; |
| | 203 | } |
| | 204 | |
| | 205 | return jQuery.makeArray( selector, this ); |
| | 206 | }, |
| | 207 | |
| | 208 | // Start with an empty selector |
| | 209 | selector: "", |
| | 210 | |
| | 211 | // The default length of a jQuery object is 0 |
| | 212 | length: 0, |
| | 213 | |
| | 214 | // The number of elements contained in the matched element set |
| | 215 | size: function() { |
| | 216 | return this.length; |
| | 217 | }, |
| | 218 | |
| | 219 | toArray: function() { |
| | 220 | return core_slice.call( this ); |
| | 221 | }, |
| | 222 | |
| | 223 | // Get the Nth element in the matched element set OR |
| | 224 | // Get the whole matched element set as a clean array |
| | 225 | get: function( num ) { |
| | 226 | return num == null ? |
| | 227 | |
| | 228 | // Return a 'clean' array |
| | 229 | this.toArray() : |
| | 230 | |
| | 231 | // Return just the object |
| | 232 | ( num < 0 ? this[ this.length + num ] : this[ num ] ); |
| | 233 | }, |
| | 234 | |
| | 235 | // Take an array of elements and push it onto the stack |
| | 236 | // (returning the new matched element set) |
| | 237 | pushStack: function( elems ) { |
| | 238 | |
| | 239 | // Build a new jQuery matched element set |
| | 240 | var ret = jQuery.merge( this.constructor(), elems ); |
| | 241 | |
| | 242 | // Add the old object onto the stack (as a reference) |
| | 243 | ret.prevObject = this; |
| | 244 | ret.context = this.context; |
| | 245 | |
| | 246 | // Return the newly-formed element set |
| | 247 | return ret; |
| | 248 | }, |
| | 249 | |
| | 250 | // Execute a callback for every element in the matched set. |
| | 251 | // (You can seed the arguments with an array of args, but this is |
| | 252 | // only used internally.) |
| | 253 | each: function( callback, args ) { |
| | 254 | return jQuery.each( this, callback, args ); |
| | 255 | }, |
| | 256 | |
| | 257 | ready: function( fn ) { |
| | 258 | // Add the callback |
| | 259 | jQuery.ready.promise().done( fn ); |
| | 260 | |
| | 261 | return this; |
| | 262 | }, |
| | 263 | |
| | 264 | slice: function() { |
| | 265 | return this.pushStack( core_slice.apply( this, arguments ) ); |
| | 266 | }, |
| | 267 | |
| | 268 | first: function() { |
| | 269 | return this.eq( 0 ); |
| | 270 | }, |
| | 271 | |
| | 272 | last: function() { |
| | 273 | return this.eq( -1 ); |
| | 274 | }, |
| | 275 | |
| | 276 | eq: function( i ) { |
| | 277 | var len = this.length, |
| | 278 | j = +i + ( i < 0 ? len : 0 ); |
| | 279 | return this.pushStack( j >= 0 && j < len ? [ this[j] ] : [] ); |
| | 280 | }, |
| | 281 | |
| | 282 | map: function( callback ) { |
| | 283 | return this.pushStack( jQuery.map(this, function( elem, i ) { |
| | 284 | return callback.call( elem, i, elem ); |
| | 285 | })); |
| | 286 | }, |
| | 287 | |
| | 288 | end: function() { |
| | 289 | return this.prevObject || this.constructor(null); |
| | 290 | }, |
| | 291 | |
| | 292 | // For internal use only. |
| | 293 | // Behaves like an Array's method, not like a jQuery method. |
| | 294 | push: core_push, |
| | 295 | sort: [].sort, |
| | 296 | splice: [].splice |
| | 297 | }; |
| | 298 | |
| | 299 | // Give the init function the jQuery prototype for later instantiation |
| | 300 | jQuery.fn.init.prototype = jQuery.fn; |
| | 301 | |
| | 302 | jQuery.extend = jQuery.fn.extend = function() { |
| | 303 | var options, name, src, copy, copyIsArray, clone, |
| | 304 | target = arguments[0] || {}, |
| | 305 | i = 1, |
| | 306 | length = arguments.length, |
| | 307 | deep = false; |
| | 308 | |
| | 309 | // Handle a deep copy situation |
| | 310 | if ( typeof target === "boolean" ) { |
| | 311 | deep = target; |
| | 312 | target = arguments[1] || {}; |
| | 313 | // skip the boolean and the target |
| | 314 | i = 2; |
| | 315 | } |
| | 316 | |
| | 317 | // Handle case when target is a string or something (possible in deep copy) |
| | 318 | if ( typeof target !== "object" && !jQuery.isFunction(target) ) { |
| | 319 | target = {}; |
| | 320 | } |
| | 321 | |
| | 322 | // extend jQuery itself if only one argument is passed |
| | 323 | if ( length === i ) { |
| | 324 | target = this; |
| | 325 | --i; |
| | 326 | } |
| | 327 | |
| | 328 | for ( ; i < length; i++ ) { |
| | 329 | // Only deal with non-null/undefined values |
| | 330 | if ( (options = arguments[ i ]) != null ) { |
| | 331 | // Extend the base object |
| | 332 | for ( name in options ) { |
| | 333 | src = target[ name ]; |
| | 334 | copy = options[ name ]; |
| | 335 | |
| | 336 | // Prevent never-ending loop |
| | 337 | if ( target === copy ) { |
| | 338 | continue; |
| | 339 | } |
| | 340 | |
| | 341 | // Recurse if we're merging plain objects or arrays |
| | 342 | if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { |
| | 343 | if ( copyIsArray ) { |
| | 344 | copyIsArray = false; |
| | 345 | clone = src && jQuery.isArray(src) ? src : []; |
| | 346 | |
| | 347 | } else { |
| | 348 | clone = src && jQuery.isPlainObject(src) ? src : {}; |
| | 349 | } |
| | 350 | |
| | 351 | // Never move original objects, clone them |
| | 352 | target[ name ] = jQuery.extend( deep, clone, copy ); |
| | 353 | |
| | 354 | // Don't bring in undefined values |
| | 355 | } else if ( copy !== undefined ) { |
| | 356 | target[ name ] = copy; |
| | 357 | } |
| | 358 | } |
| | 359 | } |
| | 360 | } |
| | 361 | |
| | 362 | // Return the modified object |
| | 363 | return target; |
| | 364 | }; |
| | 365 | |
| | 366 | jQuery.extend({ |
| | 367 | noConflict: function( deep ) { |
| | 368 | if ( window.$ === jQuery ) { |
| | 369 | window.$ = _$; |
| | 370 | } |
| | 371 | |
| | 372 | if ( deep && window.jQuery === jQuery ) { |
| | 373 | window.jQuery = _jQuery; |
| | 374 | } |
| | 375 | |
| | 376 | return jQuery; |
| | 377 | }, |
| | 378 | |
| | 379 | // Is the DOM ready to be used? Set to true once it occurs. |
| | 380 | isReady: false, |
| | 381 | |
| | 382 | // A counter to track how many items to wait for before |
| | 383 | // the ready event fires. See #6781 |
| | 384 | readyWait: 1, |
| | 385 | |
| | 386 | // Hold (or release) the ready event |
| | 387 | holdReady: function( hold ) { |
| | 388 | if ( hold ) { |
| | 389 | jQuery.readyWait++; |
| | 390 | } else { |
| | 391 | jQuery.ready( true ); |
| | 392 | } |
| | 393 | }, |
| | 394 | |
| | 395 | // Handle when the DOM is ready |
| | 396 | ready: function( wait ) { |
| | 397 | |
| | 398 | // Abort if there are pending holds or we're already ready |
| | 399 | if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { |
| | 400 | return; |
| | 401 | } |
| | 402 | |
| | 403 | // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). |
| | 404 | if ( !document.body ) { |
| | 405 | return setTimeout( jQuery.ready ); |
| | 406 | } |
| | 407 | |
| | 408 | // Remember that the DOM is ready |
| | 409 | jQuery.isReady = true; |
| | 410 | |
| | 411 | // If a normal DOM Ready event fired, decrement, and wait if need be |
| | 412 | if ( wait !== true && --jQuery.readyWait > 0 ) { |
| | 413 | return; |
| | 414 | } |
| | 415 | |
| | 416 | // If there are functions bound, to execute |
| | 417 | readyList.resolveWith( document, [ jQuery ] ); |
| | 418 | |
| | 419 | // Trigger any bound ready events |
| | 420 | if ( jQuery.fn.trigger ) { |
| | 421 | jQuery( document ).trigger("ready").off("ready"); |
| | 422 | } |
| | 423 | }, |
| | 424 | |
| | 425 | // See test/unit/core.js for details concerning isFunction. |
| | 426 | // Since version 1.3, DOM methods and functions like alert |
| | 427 | // aren't supported. They return false on IE (#2968). |
| | 428 | isFunction: function( obj ) { |
| | 429 | return jQuery.type(obj) === "function"; |
| | 430 | }, |
| | 431 | |
| | 432 | isArray: Array.isArray || function( obj ) { |
| | 433 | return jQuery.type(obj) === "array"; |
| | 434 | }, |
| | 435 | |
| | 436 | isWindow: function( obj ) { |
| | 437 | return obj != null && obj == obj.window; |
| | 438 | }, |
| | 439 | |
| | 440 | isNumeric: function( obj ) { |
| | 441 | return !isNaN( parseFloat(obj) ) && isFinite( obj ); |
| | 442 | }, |
| | 443 | |
| | 444 | type: function( obj ) { |
| | 445 | return obj == null ? |
| | 446 | String( obj ) : |
| | 447 | class2type[ core_toString.call(obj) ] || "object"; |
| | 448 | }, |
| | 449 | |
| | 450 | isPlainObject: function( obj ) { |
| | 451 | // Must be an Object. |
| | 452 | // Because of IE, we also have to check the presence of the constructor property. |
| | 453 | // Make sure that DOM nodes and window objects don't pass through, as well |
| | 454 | if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { |
| | 455 | return false; |
| | 456 | } |
| | 457 | |
| | 458 | try { |
| | 459 | // Not own constructor property must be Object |
| | 460 | if ( obj.constructor && |
| | 461 | !core_hasOwn.call(obj, "constructor") && |
| | 462 | !core_hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { |
| | 463 | return false; |
| | 464 | } |
| | 465 | } catch ( e ) { |
| | 466 | // IE8,9 Will throw exceptions on certain host objects #9897 |
| | 467 | return false; |
| | 468 | } |
| | 469 | |
| | 470 | // Own properties are enumerated firstly, so to speed up, |
| | 471 | // if last one is own, then all properties are own. |
| | 472 | |
| | 473 | var key; |
| | 474 | for ( key in obj ) {} |
| | 475 | |
| | 476 | return key === undefined || core_hasOwn.call( obj, key ); |
| | 477 | }, |
| | 478 | |
| | 479 | isEmptyObject: function( obj ) { |
| | 480 | var name; |
| | 481 | for ( name in obj ) { |
| | 482 | return false; |
| | 483 | } |
| | 484 | return true; |
| | 485 | }, |
| | 486 | |
| | 487 | error: function( msg ) { |
| | 488 | throw new Error( msg ); |
| | 489 | }, |
| | 490 | |
| | 491 | // data: string of html |
| | 492 | // context (optional): If specified, the fragment will be created in this context, defaults to document |
| | 493 | // keepScripts (optional): If true, will include scripts passed in the html string |
| | 494 | parseHTML: function( data, context, keepScripts ) { |
| | 495 | if ( !data || typeof data !== "string" ) { |
| | 496 | return null; |
| | 497 | } |
| | 498 | if ( typeof context === "boolean" ) { |
| | 499 | keepScripts = context; |
| | 500 | context = false; |
| | 501 | } |
| | 502 | context = context || document; |
| | 503 | |
| | 504 | var parsed = rsingleTag.exec( data ), |
| | 505 | scripts = !keepScripts && []; |
| | 506 | |
| | 507 | // Single tag |
| | 508 | if ( parsed ) { |
| | 509 | return [ context.createElement( parsed[1] ) ]; |
| | 510 | } |
| | 511 | |
| | 512 | parsed = context.createDocumentFragment(); |
| | 513 | jQuery.clean( [ data ], context, parsed, scripts ); |
| | 514 | if ( scripts ) { |
| | 515 | jQuery( scripts ).remove(); |
| | 516 | } |
| | 517 | return jQuery.merge( [], parsed.childNodes ); |
| | 518 | }, |
| | 519 | |
| | 520 | parseJSON: function( data ) { |
| | 521 | // Attempt to parse using the native JSON parser first |
| | 522 | if ( window.JSON && window.JSON.parse ) { |
| | 523 | return window.JSON.parse( data ); |
| | 524 | } |
| | 525 | |
| | 526 | if ( data === null ) { |
| | 527 | return data; |
| | 528 | } |
| | 529 | |
| | 530 | if ( typeof data === "string" ) { |
| | 531 | |
| | 532 | // Make sure leading/trailing whitespace is removed (IE can't handle it) |
| | 533 | data = jQuery.trim( data ); |
| | 534 | |
| | 535 | if ( data ) { |
| | 536 | // Make sure the incoming data is actual JSON |
| | 537 | // Logic borrowed from http://json.org/json2.js |
| | 538 | if ( rvalidchars.test( data.replace( rvalidescape, "@" ) |
| | 539 | .replace( rvalidtokens, "]" ) |
| | 540 | .replace( rvalidbraces, "")) ) { |
| | 541 | |
| | 542 | return ( new Function( "return " + data ) )(); |
| | 543 | } |
| | 544 | } |
| | 545 | } |
| | 546 | |
| | 547 | jQuery.error( "Invalid JSON: " + data ); |
| | 548 | }, |
| | 549 | |
| | 550 | // Cross-browser xml parsing |
| | 551 | parseXML: function( data ) { |
| | 552 | var xml, tmp; |
| | 553 | if ( !data || typeof data !== "string" ) { |
| | 554 | return null; |
| | 555 | } |
| | 556 | try { |
| | 557 | if ( window.DOMParser ) { // Standard |
| | 558 | tmp = new DOMParser(); |
| | 559 | xml = tmp.parseFromString( data , "text/xml" ); |
| | 560 | } else { // IE |
| | 561 | xml = new ActiveXObject( "Microsoft.XMLDOM" ); |
| | 562 | xml.async = "false"; |
| | 563 | xml.loadXML( data ); |
| | 564 | } |
| | 565 | } catch( e ) { |
| | 566 | xml = undefined; |
| | 567 | } |
| | 568 | if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { |
| | 569 | jQuery.error( "Invalid XML: " + data ); |
| | 570 | } |
| | 571 | return xml; |
| | 572 | }, |
| | 573 | |
| | 574 | noop: function() {}, |
| | 575 | |
| | 576 | // Evaluates a script in a global context |
| | 577 | // Workarounds based on findings by Jim Driscoll |
| | 578 | // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context |
| | 579 | globalEval: function( data ) { |
| | 580 | if ( data && jQuery.trim( data ) ) { |
| | 581 | // We use execScript on Internet Explorer |
| | 582 | // We use an anonymous function so that context is window |
| | 583 | // rather than jQuery in Firefox |
| | 584 | ( window.execScript || function( data ) { |
| | 585 | window[ "eval" ].call( window, data ); |
| | 586 | } )( data ); |
| | 587 | } |
| | 588 | }, |
| | 589 | |
| | 590 | // Convert dashed to camelCase; used by the css and data modules |
| | 591 | // Microsoft forgot to hump their vendor prefix (#9572) |
| | 592 | camelCase: function( string ) { |
| | 593 | return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); |
| | 594 | }, |
| | 595 | |
| | 596 | nodeName: function( elem, name ) { |
| | 597 | return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); |
| | 598 | }, |
| | 599 | |
| | 600 | // args is for internal usage only |
| | 601 | each: function( obj, callback, args ) { |
| | 602 | var value, |
| | 603 | i = 0, |
| | 604 | length = obj.length, |
| | 605 | isArray = isArraylike( obj ); |
| | 606 | |
| | 607 | if ( args ) { |
| | 608 | if ( isArray ) { |
| | 609 | for ( ; i < length; i++ ) { |
| | 610 | value = callback.apply( obj[ i ], args ); |
| | 611 | |
| | 612 | if ( value === false ) { |
| | 613 | break; |
| | 614 | } |
| | 615 | } |
| | 616 | } else { |
| | 617 | for ( i in obj ) { |
| | 618 | value = callback.apply( obj[ i ], args ); |
| | 619 | |
| | 620 | if ( value === false ) { |
| | 621 | break; |
| | 622 | } |
| | 623 | } |
| | 624 | } |
| | 625 | |
| | 626 | // A special, fast, case for the most common use of each |
| | 627 | } else { |
| | 628 | if ( isArray ) { |
| | 629 | for ( ; i < length; i++ ) { |
| | 630 | value = callback.call( obj[ i ], i, obj[ i ] ); |
| | 631 | |
| | 632 | if ( value === false ) { |
| | 633 | break; |
| | 634 | } |
| | 635 | } |
| | 636 | } else { |
| | 637 | for ( i in obj ) { |
| | 638 | value = callback.call( obj[ i ], i, obj[ i ] ); |
| | 639 | |
| | 640 | if ( value === false ) { |
| | 641 | break; |
| | 642 | } |
| | 643 | } |
| | 644 | } |
| | 645 | } |
| | 646 | |
| | 647 | return obj; |
| | 648 | }, |
| | 649 | |
| | 650 | // Use native String.trim function wherever possible |
| | 651 | trim: core_trim && !core_trim.call("\uFEFF\xA0") ? |
| | 652 | function( text ) { |
| | 653 | return text == null ? |
| | 654 | "" : |
| | 655 | core_trim.call( text ); |
| | 656 | } : |
| | 657 | |
| | 658 | // Otherwise use our own trimming functionality |
| | 659 | function( text ) { |
| | 660 | return text == null ? |
| | 661 | "" : |
| | 662 | ( text + "" ).replace( rtrim, "" ); |
| | 663 | }, |
| | 664 | |
| | 665 | // results is for internal usage only |
| | 666 | makeArray: function( arr, results ) { |
| | 667 | var ret = results || []; |
| | 668 | |
| | 669 | if ( arr != null ) { |
| | 670 | if ( isArraylike( Object(arr) ) ) { |
| | 671 | jQuery.merge( ret, |
| | 672 | typeof arr === "string" ? |
| | 673 | [ arr ] : arr |
| | 674 | ); |
| | 675 | } else { |
| | 676 | core_push.call( ret, arr ); |
| | 677 | } |
| | 678 | } |
| | 679 | |
| | 680 | return ret; |
| | 681 | }, |
| | 682 | |
| | 683 | inArray: function( elem, arr, i ) { |
| | 684 | var len; |
| | 685 | |
| | 686 | if ( arr ) { |
| | 687 | if ( core_indexOf ) { |
| | 688 | return core_indexOf.call( arr, elem, i ); |
| | 689 | } |
| | 690 | |
| | 691 | len = arr.length; |
| | 692 | i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; |
| | 693 | |
| | 694 | for ( ; i < len; i++ ) { |
| | 695 | // Skip accessing in sparse arrays |
| | 696 | if ( i in arr && arr[ i ] === elem ) { |
| | 697 | return i; |
| | 698 | } |
| | 699 | } |
| | 700 | } |
| | 701 | |
| | 702 | return -1; |
| | 703 | }, |
| | 704 | |
| | 705 | merge: function( first, second ) { |
| | 706 | var l = second.length, |
| | 707 | i = first.length, |
| | 708 | j = 0; |
| | 709 | |
| | 710 | if ( typeof l === "number" ) { |
| | 711 | for ( ; j < l; j++ ) { |
| | 712 | first[ i++ ] = second[ j ]; |
| | 713 | } |
| | 714 | } else { |
| | 715 | while ( second[j] !== undefined ) { |
| | 716 | first[ i++ ] = second[ j++ ]; |
| | 717 | } |
| | 718 | } |
| | 719 | |
| | 720 | first.length = i; |
| | 721 | |
| | 722 | return first; |
| | 723 | }, |
| | 724 | |
| | 725 | grep: function( elems, callback, inv ) { |
| | 726 | var retVal, |
| | 727 | ret = [], |
| | 728 | i = 0, |
| | 729 | length = elems.length; |
| | 730 | inv = !!inv; |
| | 731 | |
| | 732 | // Go through the array, only saving the items |
| | 733 | // that pass the validator function |
| | 734 | for ( ; i < length; i++ ) { |
| | 735 | retVal = !!callback( elems[ i ], i ); |
| | 736 | if ( inv !== retVal ) { |
| | 737 | ret.push( elems[ i ] ); |
| | 738 | } |
| | 739 | } |
| | 740 | |
| | 741 | return ret; |
| | 742 | }, |
| | 743 | |
| | 744 | // arg is for internal usage only |
| | 745 | map: function( elems, callback, arg ) { |
| | 746 | var value, |
| | 747 | i = 0, |
| | 748 | length = elems.length, |
| | 749 | isArray = isArraylike( elems ), |
| | 750 | ret = []; |
| | 751 | |
| | 752 | // Go through the array, translating each of the items to their |
| | 753 | if ( isArray ) { |
| | 754 | for ( ; i < length; i++ ) { |
| | 755 | value = callback( elems[ i ], i, arg ); |
| | 756 | |
| | 757 | if ( value != null ) { |
| | 758 | ret[ ret.length ] = value; |
| | 759 | } |
| | 760 | } |
| | 761 | |
| | 762 | // Go through every key on the object, |
| | 763 | } else { |
| | 764 | for ( i in elems ) { |
| | 765 | value = callback( elems[ i ], i, arg ); |
| | 766 | |
| | 767 | if ( value != null ) { |
| | 768 | ret[ ret.length ] = value; |
| | 769 | } |
| | 770 | } |
| | 771 | } |
| | 772 | |
| | 773 | // Flatten any nested arrays |
| | 774 | return core_concat.apply( [], ret ); |
| | 775 | }, |
| | 776 | |
| | 777 | // A global GUID counter for objects |
| | 778 | guid: 1, |
| | 779 | |
| | 780 | // Bind a function to a context, optionally partially applying any |
| | 781 | // arguments. |
| | 782 | proxy: function( fn, context ) { |
| | 783 | var tmp, args, proxy; |
| | 784 | |
| | 785 | if ( typeof context === "string" ) { |
| | 786 | tmp = fn[ context ]; |
| | 787 | context = fn; |
| | 788 | fn = tmp; |
| | 789 | } |
| | 790 | |
| | 791 | // Quick check to determine if target is callable, in the spec |
| | 792 | // this throws a TypeError, but we will just return undefined. |
| | 793 | if ( !jQuery.isFunction( fn ) ) { |
| | 794 | return undefined; |
| | 795 | } |
| | 796 | |
| | 797 | // Simulated bind |
| | 798 | args = core_slice.call( arguments, 2 ); |
| | 799 | proxy = function() { |
| | 800 | return fn.apply( context || this, args.concat( core_slice.call( arguments ) ) ); |
| | 801 | }; |
| | 802 | |
| | 803 | // Set the guid of unique handler to the same of original handler, so it can be removed |
| | 804 | proxy.guid = fn.guid = fn.guid || jQuery.guid++; |
| | 805 | |
| | 806 | return proxy; |
| | 807 | }, |
| | 808 | |
| | 809 | // Multifunctional method to get and set values of a collection |
| | 810 | // The value/s can optionally be executed if it's a function |
| | 811 | access: function( elems, fn, key, value, chainable, emptyGet, raw ) { |
| | 812 | var i = 0, |
| | 813 | length = elems.length, |
| | 814 | bulk = key == null; |
| | 815 | |
| | 816 | // Sets many values |
| | 817 | if ( jQuery.type( key ) === "object" ) { |
| | 818 | chainable = true; |
| | 819 | for ( i in key ) { |
| | 820 | jQuery.access( elems, fn, i, key[i], true, emptyGet, raw ); |
| | 821 | } |
| | 822 | |
| | 823 | // Sets one value |
| | 824 | } else if ( value !== undefined ) { |
| | 825 | chainable = true; |
| | 826 | |
| | 827 | if ( !jQuery.isFunction( value ) ) { |
| | 828 | raw = true; |
| | 829 | } |
| | 830 | |
| | 831 | if ( bulk ) { |
| | 832 | // Bulk operations run against the entire set |
| | 833 | if ( raw ) { |
| | 834 | fn.call( elems, value ); |
| | 835 | fn = null; |
| | 836 | |
| | 837 | // ...except when executing function values |
| | 838 | } else { |
| | 839 | bulk = fn; |
| | 840 | fn = function( elem, key, value ) { |
| | 841 | return bulk.call( jQuery( elem ), value ); |
| | 842 | }; |
| | 843 | } |
| | 844 | } |
| | 845 | |
| | 846 | if ( fn ) { |
| | 847 | for ( ; i < length; i++ ) { |
| | 848 | fn( elems[i], key, raw ? value : value.call( elems[i], i, fn( elems[i], key ) ) ); |
| | 849 | } |
| | 850 | } |
| | 851 | } |
| | 852 | |
| | 853 | return chainable ? |
| | 854 | elems : |
| | 855 | |
| | 856 | // Gets |
| | 857 | bulk ? |
| | 858 | fn.call( elems ) : |
| | 859 | length ? fn( elems[0], key ) : emptyGet; |
| | 860 | }, |
| | 861 | |
| | 862 | now: function() { |
| | 863 | return ( new Date() ).getTime(); |
| | 864 | } |
| | 865 | }); |
| | 866 | |
| | 867 | jQuery.ready.promise = function( obj ) { |
| | 868 | if ( !readyList ) { |
| | 869 | |
| | 870 | readyList = jQuery.Deferred(); |
| | 871 | |
| | 872 | // Catch cases where $(document).ready() is called after the browser event has already occurred. |
| | 873 | // we once tried to use readyState "interactive" here, but it caused issues like the one |
| | 874 | // discovered by ChrisS here: http://bugs.jquery.com/ticket/12282#comment:15 |
| | 875 | if ( document.readyState === "complete" ) { |
| | 876 | // Handle it asynchronously to allow scripts the opportunity to delay ready |
| | 877 | setTimeout( jQuery.ready ); |
| | 878 | |
| | 879 | // Standards-based browsers support DOMContentLoaded |
| | 880 | } else if ( document.addEventListener ) { |
| | 881 | // Use the handy event callback |
| | 882 | document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); |
| | 883 | |
| | 884 | // A fallback to window.onload, that will always work |
| | 885 | window.addEventListener( "load", jQuery.ready, false ); |
| | 886 | |
| | 887 | // If IE event model is used |
| | 888 | } else { |
| | 889 | // Ensure firing before onload, maybe late but safe also for iframes |
| | 890 | document.attachEvent( "onreadystatechange", DOMContentLoaded ); |
| | 891 | |
| | 892 | // A fallback to window.onload, that will always work |
| | 893 | window.attachEvent( "onload", jQuery.ready ); |
| | 894 | |
| | 895 | // If IE and not a frame |
| | 896 | // continually check to see if the document is ready |
| | 897 | var top = false; |
| | 898 | |
| | 899 | try { |
| | 900 | top = window.frameElement == null && document.documentElement; |
| | 901 | } catch(e) {} |
| | 902 | |
| | 903 | if ( top && top.doScroll ) { |
| | 904 | (function doScrollCheck() { |
| | 905 | if ( !jQuery.isReady ) { |
| | 906 | |
| | 907 | try { |
| | 908 | // Use the trick by Diego Perini |
| | 909 | // http://javascript.nwbox.com/IEContentLoaded/ |
| | 910 | top.doScroll("left"); |
| | 911 | } catch(e) { |
| | 912 | return setTimeout( doScrollCheck, 50 ); |
| | 913 | } |
| | 914 | |
| | 915 | // and execute any waiting functions |
| | 916 | jQuery.ready(); |
| | 917 | } |
| | 918 | })(); |
| | 919 | } |
| | 920 | } |
| | 921 | } |
| | 922 | return readyList.promise( obj ); |
| | 923 | }; |
| | 924 | |
| | 925 | // Populate the class2type map |
| | 926 | jQuery.each("Boolean Number String Function Array Date RegExp Object Error".split(" "), function(i, name) { |
| | 927 | class2type[ "[object " + name + "]" ] = name.toLowerCase(); |
| | 928 | }); |
| | 929 | |
| | 930 | function isArraylike( obj ) { |
| | 931 | var length = obj.length, |
| | 932 | type = jQuery.type( obj ); |
| | 933 | |
| | 934 | if ( jQuery.isWindow( obj ) ) { |
| | 935 | return false; |
| | 936 | } |
| | 937 | |
| | 938 | if ( obj.nodeType === 1 && length ) { |
| | 939 | return true; |
| | 940 | } |
| | 941 | |
| | 942 | return type === "array" || type !== "function" && |
| | 943 | ( length === 0 || |
| | 944 | typeof length === "number" && length > 0 && ( length - 1 ) in obj ); |
| | 945 | } |
| | 946 | |
| | 947 | // All jQuery objects should point back to these |
| | 948 | rootjQuery = jQuery(document); |
| | 949 | // String to Object options format cache |
| | 950 | var optionsCache = {}; |
| | 951 | |
| | 952 | // Convert String-formatted options into Object-formatted ones and store in cache |
| | 953 | function createOptions( options ) { |
| | 954 | var object = optionsCache[ options ] = {}; |
| | 955 | jQuery.each( options.match( core_rnotwhite ) || [], function( _, flag ) { |
| | 956 | object[ flag ] = true; |
| | 957 | }); |
| | 958 | return object; |
| | 959 | } |
| | 960 | |
| | 961 | /* |
| | 962 | * Create a callback list using the following parameters: |
| | 963 | * |
| | 964 | * options: an optional list of space-separated options that will change how |
| | 965 | * the callback list behaves or a more traditional option object |
| | 966 | * |
| | 967 | * By default a callback list will act like an event callback list and can be |
| | 968 | * "fired" multiple times. |
| | 969 | * |
| | 970 | * Possible options: |
| | 971 | * |
| | 972 | * once: will ensure the callback list can only be fired once (like a Deferred) |
| | 973 | * |
| | 974 | * memory: will keep track of previous values and will call any callback added |
| | 975 | * after the list has been fired right away with the latest "memorized" |
| | 976 | * values (like a Deferred) |
| | 977 | * |
| | 978 | * unique: will ensure a callback can only be added once (no duplicate in the list) |
| | 979 | * |
| | 980 | * stopOnFalse: interrupt callings when a callback returns false |
| | 981 | * |
| | 982 | */ |
| | 983 | jQuery.Callbacks = function( options ) { |
| | 984 | |
| | 985 | // Convert options from String-formatted to Object-formatted if needed |
| | 986 | // (we check in cache first) |
| | 987 | options = typeof options === "string" ? |
| | 988 | ( optionsCache[ options ] || createOptions( options ) ) : |
| | 989 | jQuery.extend( {}, options ); |
| | 990 | |
| | 991 | var // Last fire value (for non-forgettable lists) |
| | 992 | memory, |
| | 993 | // Flag to know if list was already fired |
| | 994 | fired, |
| | 995 | // Flag to know if list is currently firing |
| | 996 | firing, |
| | 997 | // First callback to fire (used internally by add and fireWith) |
| | 998 | firingStart, |
| | 999 | // End of the loop when firing |
| | 1000 | firingLength, |
| | 1001 | // Index of currently firing callback (modified by remove if needed) |
| | 1002 | firingIndex, |
| | 1003 | // Actual callback list |
| | 1004 | list = [], |
| | 1005 | // Stack of fire calls for repeatable lists |
| | 1006 | stack = !options.once && [], |
| | 1007 | // Fire callbacks |
| | 1008 | fire = function( data ) { |
| | 1009 | memory = options.memory && data; |
| | 1010 | fired = true; |
| | 1011 | firingIndex = firingStart || 0; |
| | 1012 | firingStart = 0; |
| | 1013 | firingLength = list.length; |
| | 1014 | firing = true; |
| | 1015 | for ( ; list && firingIndex < firingLength; firingIndex++ ) { |
| | 1016 | if ( list[ firingIndex ].apply( data[ 0 ], data[ 1 ] ) === false && options.stopOnFalse ) { |
| | 1017 | memory = false; // To prevent further calls using add |
| | 1018 | break; |
| | 1019 | } |
| | 1020 | } |
| | 1021 | firing = false; |
| | 1022 | if ( list ) { |
| | 1023 | if ( stack ) { |
| | 1024 | if ( stack.length ) { |
| | 1025 | fire( stack.shift() ); |
| | 1026 | } |
| | 1027 | } else if ( memory ) { |
| | 1028 | list = []; |
| | 1029 | } else { |
| | 1030 | self.disable(); |
| | 1031 | } |
| | 1032 | } |
| | 1033 | }, |
| | 1034 | // Actual Callbacks object |
| | 1035 | self = { |
| | 1036 | // Add a callback or a collection of callbacks to the list |
| | 1037 | add: function() { |
| | 1038 | if ( list ) { |
| | 1039 | // First, we save the current length |
| | 1040 | var start = list.length; |
| | 1041 | (function add( args ) { |
| | 1042 | jQuery.each( args, function( _, arg ) { |
| | 1043 | var type = jQuery.type( arg ); |
| | 1044 | if ( type === "function" ) { |
| | 1045 | if ( !options.unique || !self.has( arg ) ) { |
| | 1046 | list.push( arg ); |
| | 1047 | } |
| | 1048 | } else if ( arg && arg.length && type !== "string" ) { |
| | 1049 | // Inspect recursively |
| | 1050 | add( arg ); |
| | 1051 | } |
| | 1052 | }); |
| | 1053 | })( arguments ); |
| | 1054 | // Do we need to add the callbacks to the |
| | 1055 | // current firing batch? |
| | 1056 | if ( firing ) { |
| | 1057 | firingLength = list.length; |
| | 1058 | // With memory, if we're not firing then |
| | 1059 | // we should call right away |
| | 1060 | } else if ( memory ) { |
| | 1061 | firingStart = start; |
| | 1062 | fire( memory ); |
| | 1063 | } |
| | 1064 | } |
| | 1065 | return this; |
| | 1066 | }, |
| | 1067 | // Remove a callback from the list |
| | 1068 | remove: function() { |
| | 1069 | if ( list ) { |
| | 1070 | jQuery.each( arguments, function( _, arg ) { |
| | 1071 | var index; |
| | 1072 | while( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { |
| | 1073 | list.splice( index, 1 ); |
| | 1074 | // Handle firing indexes |
| | 1075 | if ( firing ) { |
| | 1076 | if ( index <= firingLength ) { |
| | 1077 | firingLength--; |
| | 1078 | } |
| | 1079 | if ( index <= firingIndex ) { |
| | 1080 | firingIndex--; |
| | 1081 | } |
| | 1082 | } |
| | 1083 | } |
| | 1084 | }); |
| | 1085 | } |
| | 1086 | return this; |
| | 1087 | }, |
| | 1088 | // Control if a given callback is in the list |
| | 1089 | has: function( fn ) { |
| | 1090 | return jQuery.inArray( fn, list ) > -1; |
| | 1091 | }, |
| | 1092 | // Remove all callbacks from the list |
| | 1093 | empty: function() { |
| | 1094 | list = []; |
| | 1095 | return this; |
| | 1096 | }, |
| | 1097 | // Have the list do nothing anymore |
| | 1098 | disable: function() { |
| | 1099 | list = stack = memory = undefined; |
| | 1100 | return this; |
| | 1101 | }, |
| | 1102 | // Is it disabled? |
| | 1103 | disabled: function() { |
| | 1104 | return !list; |
| | 1105 | }, |
| | 1106 | // Lock the list in its current state |
| | 1107 | lock: function() { |
| | 1108 | stack = undefined; |
| | 1109 | if ( !memory ) { |
| | 1110 | self.disable(); |
| | 1111 | } |
| | 1112 | return this; |
| | 1113 | }, |
| | 1114 | // Is it locked? |
| | 1115 | locked: function() { |
| | 1116 | return !stack; |
| | 1117 | }, |
| | 1118 | // Call all callbacks with the given context and arguments |
| | 1119 | fireWith: function( context, args ) { |
| | 1120 | args = args || []; |
| | 1121 | args = [ context, args.slice ? args.slice() : args ]; |
| | 1122 | if ( list && ( !fired || stack ) ) { |
| | 1123 | if ( firing ) { |
| | 1124 | stack.push( args ); |
| | 1125 | } else { |
| | 1126 | fire( args ); |
| | 1127 | } |
| | 1128 | } |
| | 1129 | return this; |
| | 1130 | }, |
| | 1131 | // Call all the callbacks with the given arguments |
| | 1132 | fire: function() { |
| | 1133 | self.fireWith( this, arguments ); |
| | 1134 | return this; |
| | 1135 | }, |
| | 1136 | // To know if the callbacks have already been called at least once |
| | 1137 | fired: function() { |
| | 1138 | return !!fired; |
| | 1139 | } |
| | 1140 | }; |
| | 1141 | |
| | 1142 | return self; |
| | 1143 | }; |
| | 1144 | jQuery.extend({ |
| | 1145 | |
| | 1146 | Deferred: function( func ) { |
| | 1147 | var tuples = [ |
| | 1148 | // action, add listener, listener list, final state |
| | 1149 | [ "resolve", "done", jQuery.Callbacks("once memory"), "resolved" ], |
| | 1150 | [ "reject", "fail", jQuery.Callbacks("once memory"), "rejected" ], |
| | 1151 | [ "notify", "progress", jQuery.Callbacks("memory") ] |
| | 1152 | ], |
| | 1153 | state = "pending", |
| | 1154 | promise = { |
| | 1155 | state: function() { |
| | 1156 | return state; |
| | 1157 | }, |
| | 1158 | always: function() { |
| | 1159 | deferred.done( arguments ).fail( arguments ); |
| | 1160 | return this; |
| | 1161 | }, |
| | 1162 | then: function( /* fnDone, fnFail, fnProgress */ ) { |
| | 1163 | var fns = arguments; |
| | 1164 | return jQuery.Deferred(function( newDefer ) { |
| | 1165 | jQuery.each( tuples, function( i, tuple ) { |
| | 1166 | var action = tuple[ 0 ], |
| | 1167 | fn = fns[ i ]; |
| | 1168 | // deferred[ done | fail | progress ] for forwarding actions to newDefer |
| | 1169 | deferred[ tuple[1] ]( jQuery.isFunction( fn ) ? |
| | 1170 | function() { |
| | 1171 | var returned = fn.apply( this, arguments ); |
| | 1172 | if ( returned && jQuery.isFunction( returned.promise ) ) { |
| | 1173 | returned.promise() |
| | 1174 | .done( newDefer.resolve ) |
| | 1175 | .fail( newDefer.reject ) |
| | 1176 | .progress( newDefer.notify ); |
| | 1177 | } else { |
| | 1178 | newDefer[ action + "With" ]( this === promise ? newDefer.promise() : this, [ returned ] ); |
| | 1179 | } |
| | 1180 | } : |
| | 1181 | newDefer[ action ] |
| | 1182 | ); |
| | 1183 | }); |
| | 1184 | fns = null; |
| | 1185 | }).promise(); |
| | 1186 | }, |
| | 1187 | // Get a promise for this deferred |
| | 1188 | // If obj is provided, the promise aspect is added to the object |
| | 1189 | promise: function( obj ) { |
| | 1190 | return obj != null ? jQuery.extend( obj, promise ) : promise; |
| | 1191 | } |
| | 1192 | }, |
| | 1193 | deferred = {}; |
| | 1194 | |
| | 1195 | // Keep pipe for back-compat |
| | 1196 | promise.pipe = promise.then; |
| | 1197 | |
| | 1198 | // Add list-specific methods |
| | 1199 | jQuery.each( tuples, function( i, tuple ) { |
| | 1200 | var list = tuple[ 2 ], |
| | 1201 | stateString = tuple[ 3 ]; |
| | 1202 | |
| | 1203 | // promise[ done | fail | progress ] = list.add |
| | 1204 | promise[ tuple[1] ] = list.add; |
| | 1205 | |
| | 1206 | // Handle state |
| | 1207 | if ( stateString ) { |
| | 1208 | list.add(function() { |
| | 1209 | // state = [ resolved | rejected ] |
| | 1210 | state = stateString; |
| | 1211 | |
| | 1212 | // [ reject_list | resolve_list ].disable; progress_list.lock |
| | 1213 | }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); |
| | 1214 | } |
| | 1215 | |
| | 1216 | // deferred[ resolve | reject | notify ] |
| | 1217 | deferred[ tuple[0] ] = function() { |
| | 1218 | deferred[ tuple[0] + "With" ]( promise, arguments ); |
| | 1219 | return this; |
| | 1220 | }; |
| | 1221 | deferred[ tuple[0] + "With" ] = list.fireWith; |
| | 1222 | }); |
| | 1223 | |
| | 1224 | // Make the deferred a promise |
| | 1225 | promise.promise( deferred ); |
| | 1226 | |
| | 1227 | // Call given func if any |
| | 1228 | if ( func ) { |
| | 1229 | func.call( deferred, deferred ); |
| | 1230 | } |
| | 1231 | |
| | 1232 | // All done! |
| | 1233 | return deferred; |
| | 1234 | }, |
| | 1235 | |
| | 1236 | // Deferred helper |
| | 1237 | when: function( subordinate /* , ..., subordinateN */ ) { |
| | 1238 | var i = 0, |
| | 1239 | resolveValues = core_slice.call( arguments ), |
| | 1240 | length = resolveValues.length, |
| | 1241 | |
| | 1242 | // the count of uncompleted subordinates |
| | 1243 | remaining = length !== 1 || ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, |
| | 1244 | |
| | 1245 | // the master Deferred. If resolveValues consist of only a single Deferred, just use that. |
| | 1246 | deferred = remaining === 1 ? subordinate : jQuery.Deferred(), |
| | 1247 | |
| | 1248 | // Update function for both resolve and progress values |
| | 1249 | updateFunc = function( i, contexts, values ) { |
| | 1250 | return function( value ) { |
| | 1251 | contexts[ i ] = this; |
| | 1252 | values[ i ] = arguments.length > 1 ? core_slice.call( arguments ) : value; |
| | 1253 | if( values === progressValues ) { |
| | 1254 | deferred.notifyWith( contexts, values ); |
| | 1255 | } else if ( !( --remaining ) ) { |
| | 1256 | deferred.resolveWith( contexts, values ); |
| | 1257 | } |
| | 1258 | }; |
| | 1259 | }, |
| | 1260 | |
| | 1261 | progressValues, progressContexts, resolveContexts; |
| | 1262 | |
| | 1263 | // add listeners to Deferred subordinates; treat others as resolved |
| | 1264 | if ( length > 1 ) { |
| | 1265 | progressValues = new Array( length ); |
| | 1266 | progressContexts = new Array( length ); |
| | 1267 | resolveContexts = new Array( length ); |
| | 1268 | for ( ; i < length; i++ ) { |
| | 1269 | if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { |
| | 1270 | resolveValues[ i ].promise() |
| | 1271 | .done( updateFunc( i, resolveContexts, resolveValues ) ) |
| | 1272 | .fail( deferred.reject ) |
| | 1273 | .progress( updateFunc( i, progressContexts, progressValues ) ); |
| | 1274 | } else { |
| | 1275 | --remaining; |
| | 1276 | } |
| | 1277 | } |
| | 1278 | } |
| | 1279 | |
| | 1280 | // if we're not waiting on anything, resolve the master |
| | 1281 | if ( !remaining ) { |
| | 1282 | deferred.resolveWith( resolveContexts, resolveValues ); |
| | 1283 | } |
| | 1284 | |
| | 1285 | return deferred.promise(); |
| | 1286 | } |
| | 1287 | }); |
| | 1288 | jQuery.support = (function() { |
| | 1289 | |
| | 1290 | var support, |
| | 1291 | all, |
| | 1292 | a, |
| | 1293 | select, |
| | 1294 | opt, |
| | 1295 | input, |
| | 1296 | fragment, |
| | 1297 | eventName, |
| | 1298 | i, |
| | 1299 | isSupported, |
| | 1300 | clickFn, |
| | 1301 | div = document.createElement("div"); |
| | 1302 | |
| | 1303 | // Setup |
| | 1304 | div.setAttribute( "className", "t" ); |
| | 1305 | div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; |
| | 1306 | |
| | 1307 | // Support tests won't run in some limited or non-browser environments |
| | 1308 | all = div.getElementsByTagName("*"); |
| | 1309 | a = div.getElementsByTagName("a")[ 0 ]; |
| | 1310 | if ( !all || !a || !all.length ) { |
| | 1311 | return {}; |
| | 1312 | } |
| | 1313 | |
| | 1314 | // First batch of tests |
| | 1315 | select = document.createElement("select"); |
| | 1316 | opt = select.appendChild( document.createElement("option") ); |
| | 1317 | input = div.getElementsByTagName("input")[ 0 ]; |
| | 1318 | |
| | 1319 | a.style.cssText = "top:1px;float:left;opacity:.5"; |
| | 1320 | support = { |
| | 1321 | // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) |
| | 1322 | getSetAttribute: div.className !== "t", |
| | 1323 | |
| | 1324 | // IE strips leading whitespace when .innerHTML is used |
| | 1325 | leadingWhitespace: div.firstChild.nodeType === 3, |
| | 1326 | |
| | 1327 | // Make sure that tbody elements aren't automatically inserted |
| | 1328 | // IE will insert them into empty tables |
| | 1329 | tbody: !div.getElementsByTagName("tbody").length, |
| | 1330 | |
| | 1331 | // Make sure that link elements get serialized correctly by innerHTML |
| | 1332 | // This requires a wrapper element in IE |
| | 1333 | htmlSerialize: !!div.getElementsByTagName("link").length, |
| | 1334 | |
| | 1335 | // Get the style information from getAttribute |
| | 1336 | // (IE uses .cssText instead) |
| | 1337 | style: /top/.test( a.getAttribute("style") ), |
| | 1338 | |
| | 1339 | // Make sure that URLs aren't manipulated |
| | 1340 | // (IE normalizes it by default) |
| | 1341 | hrefNormalized: a.getAttribute("href") === "/a", |
| | 1342 | |
| | 1343 | // Make sure that element opacity exists |
| | 1344 | // (IE uses filter instead) |
| | 1345 | // Use a regex to work around a WebKit issue. See #5145 |
| | 1346 | opacity: /^0.5/.test( a.style.opacity ), |
| | 1347 | |
| | 1348 | // Verify style float existence |
| | 1349 | // (IE uses styleFloat instead of cssFloat) |
| | 1350 | cssFloat: !!a.style.cssFloat, |
| | 1351 | |
| | 1352 | // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) |
| | 1353 | checkOn: !!input.value, |
| | 1354 | |
| | 1355 | // Make sure that a selected-by-default option has a working selected property. |
| | 1356 | // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) |
| | 1357 | optSelected: opt.selected, |
| | 1358 | |
| | 1359 | // Tests for enctype support on a form (#6743) |
| | 1360 | enctype: !!document.createElement("form").enctype, |
| | 1361 | |
| | 1362 | // Makes sure cloning an html5 element does not cause problems |
| | 1363 | // Where outerHTML is undefined, this still works |
| | 1364 | html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav></:nav>", |
| | 1365 | |
| | 1366 | // jQuery.support.boxModel DEPRECATED in 1.8 since we don't support Quirks Mode |
| | 1367 | boxModel: document.compatMode === "CSS1Compat", |
| | 1368 | |
| | 1369 | // Will be defined later |
| | 1370 | submitBubbles: true, |
| | 1371 | changeBubbles: true, |
| | 1372 | focusinBubbles: false, |
| | 1373 | deleteExpando: true, |
| | 1374 | noCloneEvent: true, |
| | 1375 | inlineBlockNeedsLayout: false, |
| | 1376 | shrinkWrapBlocks: false, |
| | 1377 | reliableMarginRight: true, |
| | 1378 | boxSizingReliable: true, |
| | 1379 | pixelPosition: false |
| | 1380 | }; |
| | 1381 | |
| | 1382 | // Make sure checked status is properly cloned |
| | 1383 | input.checked = true; |
| | 1384 | support.noCloneChecked = input.cloneNode( true ).checked; |
| | 1385 | |
| | 1386 | // Make sure that the options inside disabled selects aren't marked as disabled |
| | 1387 | // (WebKit marks them as disabled) |
| | 1388 | select.disabled = true; |
| | 1389 | support.optDisabled = !opt.disabled; |
| | 1390 | |
| | 1391 | // Test to see if it's possible to delete an expando from an element |
| | 1392 | // Fails in Internet Explorer |
| | 1393 | try { |
| | 1394 | delete div.test; |
| | 1395 | } catch( e ) { |
| | 1396 | support.deleteExpando = false; |
| | 1397 | } |
| | 1398 | |
| | 1399 | if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { |
| | 1400 | div.attachEvent( "onclick", clickFn = function() { |
| | 1401 | // Cloning a node shouldn't copy over any |
| | 1402 | // bound event handlers (IE does this) |
| | 1403 | support.noCloneEvent = false; |
| | 1404 | }); |
| | 1405 | div.cloneNode( true ).fireEvent("onclick"); |
| | 1406 | div.detachEvent( "onclick", clickFn ); |
| | 1407 | } |
| | 1408 | |
| | 1409 | // Check if we can trust getAttribute("value") |
| | 1410 | input = document.createElement("input"); |
| | 1411 | input.setAttribute( "value", "" ); |
| | 1412 | support.input = input.getAttribute( "value" ) === ""; |
| | 1413 | |
| | 1414 | // Check if an input maintains its value after becoming a radio |
| | 1415 | input.value = "t"; |
| | 1416 | input.setAttribute( "type", "radio" ); |
| | 1417 | support.radioValue = input.value === "t"; |
| | 1418 | |
| | 1419 | // #11217 - WebKit loses check when the name is after the checked attribute |
| | 1420 | input.setAttribute( "checked", "checked" ); |
| | 1421 | input.setAttribute( "name", "t" ); |
| | 1422 | |
| | 1423 | div.appendChild( input ); |
| | 1424 | fragment = document.createDocumentFragment(); |
| | 1425 | fragment.appendChild( div.lastChild ); |
| | 1426 | |
| | 1427 | // WebKit doesn't clone checked state correctly in fragments |
| | 1428 | support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; |
| | 1429 | |
| | 1430 | // Check if a disconnected checkbox will retain its checked |
| | 1431 | // value of true after appended to the DOM (IE6/7) |
| | 1432 | support.appendChecked = input.checked; |
| | 1433 | |
| | 1434 | fragment.removeChild( input ); |
| | 1435 | fragment.appendChild( div ); |
| | 1436 | |
| | 1437 | // Technique from Juriy Zaytsev |
| | 1438 | // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ |
| | 1439 | // We only care about the case where non-standard event systems |
| | 1440 | // are used, namely in IE. Short-circuiting here helps us to |
| | 1441 | // avoid an eval call (in setAttribute) which can cause CSP |
| | 1442 | // to go haywire. See: https://developer.mozilla.org/en/Security/CSP |
| | 1443 | if ( div.attachEvent ) { |
| | 1444 | for ( i in { |
| | 1445 | submit: true, |
| | 1446 | change: true, |
| | 1447 | focusin: true |
| | 1448 | }) { |
| | 1449 | eventName = "on" + i; |
| | 1450 | isSupported = ( eventName in div ); |
| | 1451 | if ( !isSupported ) { |
| | 1452 | div.setAttribute( eventName, "return;" ); |
| | 1453 | isSupported = ( typeof div[ eventName ] === "function" ); |
| | 1454 | } |
| | 1455 | support[ i + "Bubbles" ] = isSupported; |
| | 1456 | } |
| | 1457 | } |
| | 1458 | |
| | 1459 | // Run tests that need a body at doc ready |
| | 1460 | jQuery(function() { |
| | 1461 | var container, div, tds, marginDiv, |
| | 1462 | divReset = "padding:0;margin:0;border:0;display:block;overflow:hidden;box-sizing:content-box;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;", |
| | 1463 | body = document.getElementsByTagName("body")[0]; |
| | 1464 | |
| | 1465 | if ( !body ) { |
| | 1466 | // Return for frameset docs that don't have a body |
| | 1467 | return; |
| | 1468 | } |
| | 1469 | |
| | 1470 | container = document.createElement("div"); |
| | 1471 | container.style.cssText = "visibility:hidden;border:0;width:0;height:0;position:static;top:0;margin-top:1px"; |
| | 1472 | body.insertBefore( container, body.firstChild ); |
| | 1473 | |
| | 1474 | // Construct the test element |
| | 1475 | div = document.createElement("div"); |
| | 1476 | container.appendChild( div ); |
| | 1477 | |
| | 1478 | // Check if table cells still have offsetWidth/Height when they are set |
| | 1479 | // to display:none and there are still other visible table cells in a |
| | 1480 | // table row; if so, offsetWidth/Height are not reliable for use when |
| | 1481 | // determining if an element has been hidden directly using |
| | 1482 | // display:none (it is still safe to use offsets if a parent element is |
| | 1483 | // hidden; don safety goggles and see bug #4512 for more information). |
| | 1484 | // (only IE 8 fails this test) |
| | 1485 | div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; |
| | 1486 | tds = div.getElementsByTagName("td"); |
| | 1487 | tds[ 0 ].style.cssText = "padding:0;margin:0;border:0;display:none"; |
| | 1488 | isSupported = ( tds[ 0 ].offsetHeight === 0 ); |
| | 1489 | |
| | 1490 | tds[ 0 ].style.display = ""; |
| | 1491 | tds[ 1 ].style.display = "none"; |
| | 1492 | |
| | 1493 | // Check if empty table cells still have offsetWidth/Height |
| | 1494 | // (IE <= 8 fail this test) |
| | 1495 | support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); |
| | 1496 | |
| | 1497 | // Check box-sizing and margin behavior |
| | 1498 | div.innerHTML = ""; |
| | 1499 | div.style.cssText = "box-sizing:border-box;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;padding:1px;border:1px;display:block;width:4px;margin-top:1%;position:absolute;top:1%;"; |
| | 1500 | support.boxSizing = ( div.offsetWidth === 4 ); |
| | 1501 | support.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== 1 ); |
| | 1502 | |
| | 1503 | // NOTE: To any future maintainer, we've window.getComputedStyle |
| | 1504 | // because jsdom on node.js will break without it. |
| | 1505 | if ( window.getComputedStyle ) { |
| | 1506 | support.pixelPosition = ( window.getComputedStyle( div, null ) || {} ).top !== "1%"; |
| | 1507 | support.boxSizingReliable = ( window.getComputedStyle( div, null ) || { width: "4px" } ).width === "4px"; |
| | 1508 | |
| | 1509 | // Check if div with explicit width and no margin-right incorrectly |
| | 1510 | // gets computed margin-right based on width of container. For more |
| | 1511 | // info see bug #3333 |
| | 1512 | // Fails in WebKit before Feb 2011 nightlies |
| | 1513 | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
| | 1514 | marginDiv = document.createElement("div"); |
| | 1515 | marginDiv.style.cssText = div.style.cssText = divReset; |
| | 1516 | marginDiv.style.marginRight = marginDiv.style.width = "0"; |
| | 1517 | div.style.width = "1px"; |
| | 1518 | div.appendChild( marginDiv ); |
| | 1519 | support.reliableMarginRight = |
| | 1520 | !parseFloat( ( window.getComputedStyle( marginDiv, null ) || {} ).marginRight ); |
| | 1521 | } |
| | 1522 | |
| | 1523 | if ( typeof div.style.zoom !== "undefined" ) { |
| | 1524 | // Check if natively block-level elements act like inline-block |
| | 1525 | // elements when setting their display to 'inline' and giving |
| | 1526 | // them layout |
| | 1527 | // (IE < 8 does this) |
| | 1528 | div.innerHTML = ""; |
| | 1529 | div.style.cssText = divReset + "width:1px;padding:1px;display:inline;zoom:1"; |
| | 1530 | support.inlineBlockNeedsLayout = ( div.offsetWidth === 3 ); |
| | 1531 | |
| | 1532 | // Check if elements with layout shrink-wrap their children |
| | 1533 | // (IE 6 does this) |
| | 1534 | div.style.display = "block"; |
| | 1535 | div.style.overflow = "visible"; |
| | 1536 | div.innerHTML = "<div></div>"; |
| | 1537 | div.firstChild.style.width = "5px"; |
| | 1538 | support.shrinkWrapBlocks = ( div.offsetWidth !== 3 ); |
| | 1539 | |
| | 1540 | // Prevent IE 6 from affecting layout for positioned elements #11048 |
| | 1541 | // Prevent IE from shrinking the body in IE 7 mode #12869 |
| | 1542 | body.style.zoom = 1; |
| | 1543 | } |
| | 1544 | |
| | 1545 | // Null elements to avoid leaks in IE |
| | 1546 | body.removeChild( container ); |
| | 1547 | container = div = tds = marginDiv = null; |
| | 1548 | }); |
| | 1549 | |
| | 1550 | // Null elements to avoid leaks in IE |
| | 1551 | fragment.removeChild( div ); |
| | 1552 | all = a = select = opt = input = fragment = div = null; |
| | 1553 | |
| | 1554 | return support; |
| | 1555 | })(); |
| | 1556 | var rbrace = /(?:\{[\s\S]*\}|\[[\s\S]*\])$/, |
| | 1557 | rmultiDash = /([A-Z])/g; |
| | 1558 | |
| | 1559 | function internalData( elem, name, data, pvt /* Internal Use Only */ ){ |
| | 1560 | if ( !jQuery.acceptData( elem ) ) { |
| | 1561 | return; |
| | 1562 | } |
| | 1563 | |
| | 1564 | var thisCache, ret, |
| | 1565 | internalKey = jQuery.expando, |
| | 1566 | getByName = typeof name === "string", |
| | 1567 | |
| | 1568 | // We have to handle DOM nodes and JS objects differently because IE6-7 |
| | 1569 | // can't GC object references properly across the DOM-JS boundary |
| | 1570 | isNode = elem.nodeType, |
| | 1571 | |
| | 1572 | // Only DOM nodes need the global jQuery cache; JS object data is |
| | 1573 | // attached directly to the object so GC can occur automatically |
| | 1574 | cache = isNode ? jQuery.cache : elem, |
| | 1575 | |
| | 1576 | // Only defining an ID for JS objects if its cache already exists allows |
| | 1577 | // the code to shortcut on the same path as a DOM node with no cache |
| | 1578 | id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; |
| | 1579 | |
| | 1580 | // Avoid doing any more work than we need to when trying to get data on an |
| | 1581 | // object that has no data at all |
| | 1582 | if ( (!id || !cache[id] || (!pvt && !cache[id].data)) && getByName && data === undefined ) { |
| | 1583 | return; |
| | 1584 | } |
| | 1585 | |
| | 1586 | if ( !id ) { |
| | 1587 | // Only DOM nodes need a new unique ID for each element since their data |
| | 1588 | // ends up in the global cache |
| | 1589 | if ( isNode ) { |
| | 1590 | elem[ internalKey ] = id = core_deletedIds.pop() || jQuery.guid++; |
| | 1591 | } else { |
| | 1592 | id = internalKey; |
| | 1593 | } |
| | 1594 | } |
| | 1595 | |
| | 1596 | if ( !cache[ id ] ) { |
| | 1597 | cache[ id ] = {}; |
| | 1598 | |
| | 1599 | // Avoids exposing jQuery metadata on plain JS objects when the object |
| | 1600 | // is serialized using JSON.stringify |
| | 1601 | if ( !isNode ) { |
| | 1602 | cache[ id ].toJSON = jQuery.noop; |
| | 1603 | } |
| | 1604 | } |
| | 1605 | |
| | 1606 | // An object can be passed to jQuery.data instead of a key/value pair; this gets |
| | 1607 | // shallow copied over onto the existing cache |
| | 1608 | if ( typeof name === "object" || typeof name === "function" ) { |
| | 1609 | if ( pvt ) { |
| | 1610 | cache[ id ] = jQuery.extend( cache[ id ], name ); |
| | 1611 | } else { |
| | 1612 | cache[ id ].data = jQuery.extend( cache[ id ].data, name ); |
| | 1613 | } |
| | 1614 | } |
| | 1615 | |
| | 1616 | thisCache = cache[ id ]; |
| | 1617 | |
| | 1618 | // jQuery data() is stored in a separate object inside the object's internal data |
| | 1619 | // cache in order to avoid key collisions between internal data and user-defined |
| | 1620 | // data. |
| | 1621 | if ( !pvt ) { |
| | 1622 | if ( !thisCache.data ) { |
| | 1623 | thisCache.data = {}; |
| | 1624 | } |
| | 1625 | |
| | 1626 | thisCache = thisCache.data; |
| | 1627 | } |
| | 1628 | |
| | 1629 | if ( data !== undefined ) { |
| | 1630 | thisCache[ jQuery.camelCase( name ) ] = data; |
| | 1631 | } |
| | 1632 | |
| | 1633 | // Check for both converted-to-camel and non-converted data property names |
| | 1634 | // If a data property was specified |
| | 1635 | if ( getByName ) { |
| | 1636 | |
| | 1637 | // First Try to find as-is property data |
| | 1638 | ret = thisCache[ name ]; |
| | 1639 | |
| | 1640 | // Test for null|undefined property data |
| | 1641 | if ( ret == null ) { |
| | 1642 | |
| | 1643 | // Try to find the camelCased property |
| | 1644 | ret = thisCache[ jQuery.camelCase( name ) ]; |
| | 1645 | } |
| | 1646 | } else { |
| | 1647 | ret = thisCache; |
| | 1648 | } |
| | 1649 | |
| | 1650 | return ret; |
| | 1651 | } |
| | 1652 | |
| | 1653 | function internalRemoveData( elem, name, pvt /* For internal use only */ ){ |
| | 1654 | if ( !jQuery.acceptData( elem ) ) { |
| | 1655 | return; |
| | 1656 | } |
| | 1657 | |
| | 1658 | var thisCache, i, l, |
| | 1659 | |
| | 1660 | isNode = elem.nodeType, |
| | 1661 | |
| | 1662 | // See jQuery.data for more information |
| | 1663 | cache = isNode ? jQuery.cache : elem, |
| | 1664 | id = isNode ? elem[ jQuery.expando ] : jQuery.expando; |
| | 1665 | |
| | 1666 | // If there is already no cache entry for this object, there is no |
| | 1667 | // purpose in continuing |
| | 1668 | if ( !cache[ id ] ) { |
| | 1669 | return; |
| | 1670 | } |
| | 1671 | |
| | 1672 | if ( name ) { |
| | 1673 | |
| | 1674 | thisCache = pvt ? cache[ id ] : cache[ id ].data; |
| | 1675 | |
| | 1676 | if ( thisCache ) { |
| | 1677 | |
| | 1678 | // Support array or space separated string names for data keys |
| | 1679 | if ( !jQuery.isArray( name ) ) { |
| | 1680 | |
| | 1681 | // try the string as a key before any manipulation |
| | 1682 | if ( name in thisCache ) { |
| | 1683 | name = [ name ]; |
| | 1684 | } else { |
| | 1685 | |
| | 1686 | // split the camel cased version by spaces unless a key with the spaces exists |
| | 1687 | name = jQuery.camelCase( name ); |
| | 1688 | if ( name in thisCache ) { |
| | 1689 | name = [ name ]; |
| | 1690 | } else { |
| | 1691 | name = name.split(" "); |
| | 1692 | } |
| | 1693 | } |
| | 1694 | } else { |
| | 1695 | // If "name" is an array of keys... |
| | 1696 | // When data is initially created, via ("key", "val") signature, |
| | 1697 | // keys will be converted to camelCase. |
| | 1698 | // Since there is no way to tell _how_ a key was added, remove |
| | 1699 | // both plain key and camelCase key. #12786 |
| | 1700 | // This will only penalize the array argument path. |
| | 1701 | name = name.concat( jQuery.map( name, jQuery.camelCase ) ); |
| | 1702 | } |
| | 1703 | |
| | 1704 | for ( i = 0, l = name.length; i < l; i++ ) { |
| | 1705 | delete thisCache[ name[i] ]; |
| | 1706 | } |
| | 1707 | |
| | 1708 | // If there is no data left in the cache, we want to continue |
| | 1709 | // and let the cache object itself get destroyed |
| | 1710 | if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { |
| | 1711 | return; |
| | 1712 | } |
| | 1713 | } |
| | 1714 | } |
| | 1715 | |
| | 1716 | // See jQuery.data for more information |
| | 1717 | if ( !pvt ) { |
| | 1718 | delete cache[ id ].data; |
| | 1719 | |
| | 1720 | // Don't destroy the parent cache unless the internal data object |
| | 1721 | // had been the only thing left in it |
| | 1722 | if ( !isEmptyDataObject( cache[ id ] ) ) { |
| | 1723 | return; |
| | 1724 | } |
| | 1725 | } |
| | 1726 | |
| | 1727 | // Destroy the cache |
| | 1728 | if ( isNode ) { |
| | 1729 | jQuery.cleanData( [ elem ], true ); |
| | 1730 | |
| | 1731 | // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) |
| | 1732 | } else if ( jQuery.support.deleteExpando || cache != cache.window ) { |
| | 1733 | delete cache[ id ]; |
| | 1734 | |
| | 1735 | // When all else fails, null |
| | 1736 | } else { |
| | 1737 | cache[ id ] = null; |
| | 1738 | } |
| | 1739 | } |
| | 1740 | |
| | 1741 | jQuery.extend({ |
| | 1742 | cache: {}, |
| | 1743 | |
| | 1744 | // Unique for each copy of jQuery on the page |
| | 1745 | // Non-digits removed to match rinlinejQuery |
| | 1746 | expando: "jQuery" + ( core_version + Math.random() ).replace( /\D/g, "" ), |
| | 1747 | |
| | 1748 | // The following elements throw uncatchable exceptions if you |
| | 1749 | // attempt to add expando properties to them. |
| | 1750 | noData: { |
| | 1751 | "embed": true, |
| | 1752 | // Ban all objects except for Flash (which handle expandos) |
| | 1753 | "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", |
| | 1754 | "applet": true |
| | 1755 | }, |
| | 1756 | |
| | 1757 | hasData: function( elem ) { |
| | 1758 | elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; |
| | 1759 | return !!elem && !isEmptyDataObject( elem ); |
| | 1760 | }, |
| | 1761 | |
| | 1762 | data: function( elem, name, data ) { |
| | 1763 | return internalData( elem, name, data, false ); |
| | 1764 | }, |
| | 1765 | |
| | 1766 | removeData: function( elem, name ) { |
| | 1767 | return internalRemoveData( elem, name, false ); |
| | 1768 | }, |
| | 1769 | |
| | 1770 | // For internal use only. |
| | 1771 | _data: function( elem, name, data ) { |
| | 1772 | return internalData( elem, name, data, true ); |
| | 1773 | }, |
| | 1774 | |
| | 1775 | _removeData: function( elem, name ) { |
| | 1776 | return internalRemoveData( elem, name, true ); |
| | 1777 | }, |
| | 1778 | |
| | 1779 | // A method for determining if a DOM node can handle the data expando |
| | 1780 | acceptData: function( elem ) { |
| | 1781 | var noData = elem.nodeName && jQuery.noData[ elem.nodeName.toLowerCase() ]; |
| | 1782 | |
| | 1783 | // nodes accept data unless otherwise specified; rejection can be conditional |
| | 1784 | return !noData || noData !== true && elem.getAttribute("classid") === noData; |
| | 1785 | } |
| | 1786 | }); |
| | 1787 | |
| | 1788 | jQuery.fn.extend({ |
| | 1789 | data: function( key, value ) { |
| | 1790 | var attrs, name, |
| | 1791 | elem = this[0], |
| | 1792 | i = 0, |
| | 1793 | data = null; |
| | 1794 | |
| | 1795 | // Gets all values |
| | 1796 | if ( key === undefined ) { |
| | 1797 | if ( this.length ) { |
| | 1798 | data = jQuery.data( elem ); |
| | 1799 | |
| | 1800 | if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { |
| | 1801 | attrs = elem.attributes; |
| | 1802 | for ( ; i < attrs.length; i++ ) { |
| | 1803 | name = attrs[i].name; |
| | 1804 | |
| | 1805 | if ( !name.indexOf( "data-" ) ) { |
| | 1806 | name = jQuery.camelCase( name.substring(5) ); |
| | 1807 | |
| | 1808 | dataAttr( elem, name, data[ name ] ); |
| | 1809 | } |
| | 1810 | } |
| | 1811 | jQuery._data( elem, "parsedAttrs", true ); |
| | 1812 | } |
| | 1813 | } |
| | 1814 | |
| | 1815 | return data; |
| | 1816 | } |
| | 1817 | |
| | 1818 | // Sets multiple values |
| | 1819 | if ( typeof key === "object" ) { |
| | 1820 | return this.each(function() { |
| | 1821 | jQuery.data( this, key ); |
| | 1822 | }); |
| | 1823 | } |
| | 1824 | |
| | 1825 | return jQuery.access( this, function( value ) { |
| | 1826 | |
| | 1827 | if ( value === undefined ) { |
| | 1828 | // Try to fetch any internally stored data first |
| | 1829 | return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null; |
| | 1830 | } |
| | 1831 | |
| | 1832 | this.each(function() { |
| | 1833 | jQuery.data( this, key, value ); |
| | 1834 | }); |
| | 1835 | }, null, value, arguments.length > 1, null, true ); |
| | 1836 | }, |
| | 1837 | |
| | 1838 | removeData: function( key ) { |
| | 1839 | return this.each(function() { |
| | 1840 | jQuery.removeData( this, key ); |
| | 1841 | }); |
| | 1842 | } |
| | 1843 | }); |
| | 1844 | |
| | 1845 | function dataAttr( elem, key, data ) { |
| | 1846 | // If nothing was found internally, try to fetch any |
| | 1847 | // data from the HTML5 data-* attribute |
| | 1848 | if ( data === undefined && elem.nodeType === 1 ) { |
| | 1849 | |
| | 1850 | var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); |
| | 1851 | |
| | 1852 | data = elem.getAttribute( name ); |
| | 1853 | |
| | 1854 | if ( typeof data === "string" ) { |
| | 1855 | try { |
| | 1856 | data = data === "true" ? true : |
| | 1857 | data === "false" ? false : |
| | 1858 | data === "null" ? null : |
| | 1859 | // Only convert to a number if it doesn't change the string |
| | 1860 | +data + "" === data ? +data : |
| | 1861 | rbrace.test( data ) ? jQuery.parseJSON( data ) : |
| | 1862 | data; |
| | 1863 | } catch( e ) {} |
| | 1864 | |
| | 1865 | // Make sure we set the data so it isn't changed later |
| | 1866 | jQuery.data( elem, key, data ); |
| | 1867 | |
| | 1868 | } else { |
| | 1869 | data = undefined; |
| | 1870 | } |
| | 1871 | } |
| | 1872 | |
| | 1873 | return data; |
| | 1874 | } |
| | 1875 | |
| | 1876 | // checks a cache object for emptiness |
| | 1877 | function isEmptyDataObject( obj ) { |
| | 1878 | var name; |
| | 1879 | for ( name in obj ) { |
| | 1880 | |
| | 1881 | // if the public data object is empty, the private is still empty |
| | 1882 | if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { |
| | 1883 | continue; |
| | 1884 | } |
| | 1885 | if ( name !== "toJSON" ) { |
| | 1886 | return false; |
| | 1887 | } |
| | 1888 | } |
| | 1889 | |
| | 1890 | return true; |
| | 1891 | } |
| | 1892 | jQuery.extend({ |
| | 1893 | queue: function( elem, type, data ) { |
| | 1894 | var queue; |
| | 1895 | |
| | 1896 | if ( elem ) { |
| | 1897 | type = ( type || "fx" ) + "queue"; |
| | 1898 | queue = jQuery._data( elem, type ); |
| | 1899 | |
| | 1900 | // Speed up dequeue by getting out quickly if this is just a lookup |
| | 1901 | if ( data ) { |
| | 1902 | if ( !queue || jQuery.isArray(data) ) { |
| | 1903 | queue = jQuery._data( elem, type, jQuery.makeArray(data) ); |
| | 1904 | } else { |
| | 1905 | queue.push( data ); |
| | 1906 | } |
| | 1907 | } |
| | 1908 | return queue || []; |
| | 1909 | } |
| | 1910 | }, |
| | 1911 | |
| | 1912 | dequeue: function( elem, type ) { |
| | 1913 | type = type || "fx"; |
| | 1914 | |
| | 1915 | var queue = jQuery.queue( elem, type ), |
| | 1916 | startLength = queue.length, |
| | 1917 | fn = queue.shift(), |
| | 1918 | hooks = jQuery._queueHooks( elem, type ), |
| | 1919 | next = function() { |
| | 1920 | jQuery.dequeue( elem, type ); |
| | 1921 | }; |
| | 1922 | |
| | 1923 | // If the fx queue is dequeued, always remove the progress sentinel |
| | 1924 | if ( fn === "inprogress" ) { |
| | 1925 | fn = queue.shift(); |
| | 1926 | startLength--; |
| | 1927 | } |
| | 1928 | |
| | 1929 | if ( fn ) { |
| | 1930 | |
| | 1931 | // Add a progress sentinel to prevent the fx queue from being |
| | 1932 | // automatically dequeued |
| | 1933 | if ( type === "fx" ) { |
| | 1934 | queue.unshift( "inprogress" ); |
| | 1935 | } |
| | 1936 | |
| | 1937 | // clear up the last queue stop function |
| | 1938 | delete hooks.stop; |
| | 1939 | fn.call( elem, next, hooks ); |
| | 1940 | } |
| | 1941 | |
| | 1942 | if ( !startLength && hooks ) { |
| | 1943 | hooks.empty.fire(); |
| | 1944 | } |
| | 1945 | }, |
| | 1946 | |
| | 1947 | // not intended for public consumption - generates a queueHooks object, or returns the current one |
| | 1948 | _queueHooks: function( elem, type ) { |
| | 1949 | var key = type + "queueHooks"; |
| | 1950 | return jQuery._data( elem, key ) || jQuery._data( elem, key, { |
| | 1951 | empty: jQuery.Callbacks("once memory").add(function() { |
| | 1952 | jQuery._removeData( elem, type + "queue" ); |
| | 1953 | jQuery._removeData( elem, key ); |
| | 1954 | }) |
| | 1955 | }); |
| | 1956 | } |
| | 1957 | }); |
| | 1958 | |
| | 1959 | jQuery.fn.extend({ |
| | 1960 | queue: function( type, data ) { |
| | 1961 | var setter = 2; |
| | 1962 | |
| | 1963 | if ( typeof type !== "string" ) { |
| | 1964 | data = type; |
| | 1965 | type = "fx"; |
| | 1966 | setter--; |
| | 1967 | } |
| | 1968 | |
| | 1969 | if ( arguments.length < setter ) { |
| | 1970 | return jQuery.queue( this[0], type ); |
| | 1971 | } |
| | 1972 | |
| | 1973 | return data === undefined ? |
| | 1974 | this : |
| | 1975 | this.each(function() { |
| | 1976 | var queue = jQuery.queue( this, type, data ); |
| | 1977 | |
| | 1978 | // ensure a hooks for this queue |
| | 1979 | jQuery._queueHooks( this, type ); |
| | 1980 | |
| | 1981 | if ( type === "fx" && queue[0] !== "inprogress" ) { |
| | 1982 | jQuery.dequeue( this, type ); |
| | 1983 | } |
| | 1984 | }); |
| | 1985 | }, |
| | 1986 | dequeue: function( type ) { |
| | 1987 | return this.each(function() { |
| | 1988 | jQuery.dequeue( this, type ); |
| | 1989 | }); |
| | 1990 | }, |
| | 1991 | // Based off of the plugin by Clint Helfers, with permission. |
| | 1992 | // http://blindsignals.com/index.php/2009/07/jquery-delay/ |
| | 1993 | delay: function( time, type ) { |
| | 1994 | time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; |
| | 1995 | type = type || "fx"; |
| | 1996 | |
| | 1997 | return this.queue( type, function( next, hooks ) { |
| | 1998 | var timeout = setTimeout( next, time ); |
| | 1999 | hooks.stop = function() { |
| | 2000 | clearTimeout( timeout ); |
| | 2001 | }; |
| | 2002 | }); |
| | 2003 | }, |
| | 2004 | clearQueue: function( type ) { |
| | 2005 | return this.queue( type || "fx", [] ); |
| | 2006 | }, |
| | 2007 | // Get a promise resolved when queues of a certain type |
| | 2008 | // are emptied (fx is the type by default) |
| | 2009 | promise: function( type, obj ) { |
| | 2010 | var tmp, |
| | 2011 | count = 1, |
| | 2012 | defer = jQuery.Deferred(), |
| | 2013 | elements = this, |
| | 2014 | i = this.length, |
| | 2015 | resolve = function() { |
| | 2016 | if ( !( --count ) ) { |
| | 2017 | defer.resolveWith( elements, [ elements ] ); |
| | 2018 | } |
| | 2019 | }; |
| | 2020 | |
| | 2021 | if ( typeof type !== "string" ) { |
| | 2022 | obj = type; |
| | 2023 | type = undefined; |
| | 2024 | } |
| | 2025 | type = type || "fx"; |
| | 2026 | |
| | 2027 | while( i-- ) { |
| | 2028 | tmp = jQuery._data( elements[ i ], type + "queueHooks" ); |
| | 2029 | if ( tmp && tmp.empty ) { |
| | 2030 | count++; |
| | 2031 | tmp.empty.add( resolve ); |
| | 2032 | } |
| | 2033 | } |
| | 2034 | resolve(); |
| | 2035 | return defer.promise( obj ); |
| | 2036 | } |
| | 2037 | }); |
| | 2038 | var nodeHook, boolHook, |
| | 2039 | rclass = /[\t\r\n]/g, |
| | 2040 | rreturn = /\r/g, |
| | 2041 | rfocusable = /^(?:input|select|textarea|button|object)$/i, |
| | 2042 | rclickable = /^(?:a|area)$/i, |
| | 2043 | rboolean = /^(?:checked|selected|autofocus|autoplay|async|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped)$/i, |
| | 2044 | ruseDefault = /^(?:checked|selected)$/i, |
| | 2045 | getSetAttribute = jQuery.support.getSetAttribute, |
| | 2046 | getSetInput = jQuery.support.input; |
| | 2047 | |
| | 2048 | jQuery.fn.extend({ |
| | 2049 | attr: function( name, value ) { |
| | 2050 | return jQuery.access( this, jQuery.attr, name, value, arguments.length > 1 ); |
| | 2051 | }, |
| | 2052 | |
| | 2053 | removeAttr: function( name ) { |
| | 2054 | return this.each(function() { |
| | 2055 | jQuery.removeAttr( this, name ); |
| | 2056 | }); |
| | 2057 | }, |
| | 2058 | |
| | 2059 | prop: function( name, value ) { |
| | 2060 | return jQuery.access( this, jQuery.prop, name, value, arguments.length > 1 ); |
| | 2061 | }, |
| | 2062 | |
| | 2063 | removeProp: function( name ) { |
| | 2064 | name = jQuery.propFix[ name ] || name; |
| | 2065 | return this.each(function() { |
| | 2066 | // try/catch handles cases where IE balks (such as removing a property on window) |
| | 2067 | try { |
| | 2068 | this[ name ] = undefined; |
| | 2069 | delete this[ name ]; |
| | 2070 | } catch( e ) {} |
| | 2071 | }); |
| | 2072 | }, |
| | 2073 | |
| | 2074 | addClass: function( value ) { |
| | 2075 | var classes, elem, cur, clazz, j, |
| | 2076 | i = 0, |
| | 2077 | len = this.length, |
| | 2078 | proceed = typeof value === "string" && value; |
| | 2079 | |
| | 2080 | if ( jQuery.isFunction( value ) ) { |
| | 2081 | return this.each(function( j ) { |
| | 2082 | jQuery( this ).addClass( value.call( this, j, this.className ) ); |
| | 2083 | }); |
| | 2084 | } |
| | 2085 | |
| | 2086 | if ( proceed ) { |
| | 2087 | // The disjunction here is for better compressibility (see removeClass) |
| | 2088 | classes = ( value || "" ).match( core_rnotwhite ) || []; |
| | 2089 | |
| | 2090 | for ( ; i < len; i++ ) { |
| | 2091 | elem = this[ i ]; |
| | 2092 | cur = elem.nodeType === 1 && ( elem.className ? |
| | 2093 | ( " " + elem.className + " " ).replace( rclass, " " ) : |
| | 2094 | " " |
| | 2095 | ); |
| | 2096 | |
| | 2097 | if ( cur ) { |
| | 2098 | j = 0; |
| | 2099 | while ( (clazz = classes[j++]) ) { |
| | 2100 | if ( cur.indexOf( " " + clazz + " " ) < 0 ) { |
| | 2101 | cur += clazz + " "; |
| | 2102 | } |
| | 2103 | } |
| | 2104 | elem.className = jQuery.trim( cur ); |
| | 2105 | |
| | 2106 | } |
| | 2107 | } |
| | 2108 | } |
| | 2109 | |
| | 2110 | return this; |
| | 2111 | }, |
| | 2112 | |
| | 2113 | removeClass: function( value ) { |
| | 2114 | var classes, elem, cur, clazz, j, |
| | 2115 | i = 0, |
| | 2116 | len = this.length, |
| | 2117 | proceed = arguments.length === 0 || typeof value === "string" && value; |
| | 2118 | |
| | 2119 | if ( jQuery.isFunction( value ) ) { |
| | 2120 | return this.each(function( j ) { |
| | 2121 | jQuery( this ).removeClass( value.call( this, j, this.className ) ); |
| | 2122 | }); |
| | 2123 | } |
| | 2124 | if ( proceed ) { |
| | 2125 | classes = ( value || "" ).match( core_rnotwhite ) || []; |
| | 2126 | |
| | 2127 | for ( ; i < len; i++ ) { |
| | 2128 | elem = this[ i ]; |
| | 2129 | // This expression is here for better compressibility (see addClass) |
| | 2130 | cur = elem.nodeType === 1 && ( elem.className ? |
| | 2131 | ( " " + elem.className + " " ).replace( rclass, " " ) : |
| | 2132 | "" |
| | 2133 | ); |
| | 2134 | |
| | 2135 | if ( cur ) { |
| | 2136 | j = 0; |
| | 2137 | while ( (clazz = classes[j++]) ) { |
| | 2138 | // Remove *all* instances |
| | 2139 | while ( cur.indexOf( " " + clazz + " " ) >= 0 ) { |
| | 2140 | cur = cur.replace( " " + clazz + " ", " " ); |
| | 2141 | } |
| | 2142 | } |
| | 2143 | elem.className = value ? jQuery.trim( cur ) : ""; |
| | 2144 | } |
| | 2145 | } |
| | 2146 | } |
| | 2147 | |
| | 2148 | return this; |
| | 2149 | }, |
| | 2150 | |
| | 2151 | toggleClass: function( value, stateVal ) { |
| | 2152 | var type = typeof value, |
| | 2153 | isBool = typeof stateVal === "boolean"; |
| | 2154 | |
| | 2155 | if ( jQuery.isFunction( value ) ) { |
| | 2156 | return this.each(function( i ) { |
| | 2157 | jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); |
| | 2158 | }); |
| | 2159 | } |
| | 2160 | |
| | 2161 | return this.each(function() { |
| | 2162 | if ( type === "string" ) { |
| | 2163 | // toggle individual class names |
| | 2164 | var className, |
| | 2165 | i = 0, |
| | 2166 | self = jQuery( this ), |
| | 2167 | state = stateVal, |
| | 2168 | classNames = value.match( core_rnotwhite ) || []; |
| | 2169 | |
| | 2170 | while ( (className = classNames[ i++ ]) ) { |
| | 2171 | // check each className given, space separated list |
| | 2172 | state = isBool ? state : !self.hasClass( className ); |
| | 2173 | self[ state ? "addClass" : "removeClass" ]( className ); |
| | 2174 | } |
| | 2175 | |
| | 2176 | // Toggle whole class name |
| | 2177 | } else if ( type === "undefined" || type === "boolean" ) { |
| | 2178 | if ( this.className ) { |
| | 2179 | // store className if set |
| | 2180 | jQuery._data( this, "__className__", this.className ); |
| | 2181 | } |
| | 2182 | |
| | 2183 | // If the element has a class name or if we're passed "false", |
| | 2184 | // then remove the whole classname (if there was one, the above saved it). |
| | 2185 | // Otherwise bring back whatever was previously saved (if anything), |
| | 2186 | // falling back to the empty string if nothing was stored. |
| | 2187 | this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; |
| | 2188 | } |
| | 2189 | }); |
| | 2190 | }, |
| | 2191 | |
| | 2192 | hasClass: function( selector ) { |
| | 2193 | var className = " " + selector + " ", |
| | 2194 | i = 0, |
| | 2195 | l = this.length; |
| | 2196 | for ( ; i < l; i++ ) { |
| | 2197 | if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) { |
| | 2198 | return true; |
| | 2199 | } |
| | 2200 | } |
| | 2201 | |
| | 2202 | return false; |
| | 2203 | }, |
| | 2204 | |
| | 2205 | val: function( value ) { |
| | 2206 | var hooks, ret, isFunction, |
| | 2207 | elem = this[0]; |
| | 2208 | |
| | 2209 | if ( !arguments.length ) { |
| | 2210 | if ( elem ) { |
| | 2211 | hooks = jQuery.valHooks[ elem.type ] || jQuery.valHooks[ elem.nodeName.toLowerCase() ]; |
| | 2212 | |
| | 2213 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { |
| | 2214 | return ret; |
| | 2215 | } |
| | 2216 | |
| | 2217 | ret = elem.value; |
| | 2218 | |
| | 2219 | return typeof ret === "string" ? |
| | 2220 | // handle most common string cases |
| | 2221 | ret.replace(rreturn, "") : |
| | 2222 | // handle cases where value is null/undef or number |
| | 2223 | ret == null ? "" : ret; |
| | 2224 | } |
| | 2225 | |
| | 2226 | return; |
| | 2227 | } |
| | 2228 | |
| | 2229 | isFunction = jQuery.isFunction( value ); |
| | 2230 | |
| | 2231 | return this.each(function( i ) { |
| | 2232 | var val, |
| | 2233 | self = jQuery(this); |
| | 2234 | |
| | 2235 | if ( this.nodeType !== 1 ) { |
| | 2236 | return; |
| | 2237 | } |
| | 2238 | |
| | 2239 | if ( isFunction ) { |
| | 2240 | val = value.call( this, i, self.val() ); |
| | 2241 | } else { |
| | 2242 | val = value; |
| | 2243 | } |
| | 2244 | |
| | 2245 | // Treat null/undefined as ""; convert numbers to string |
| | 2246 | if ( val == null ) { |
| | 2247 | val = ""; |
| | 2248 | } else if ( typeof val === "number" ) { |
| | 2249 | val += ""; |
| | 2250 | } else if ( jQuery.isArray( val ) ) { |
| | 2251 | val = jQuery.map(val, function ( value ) { |
| | 2252 | return value == null ? "" : value + ""; |
| | 2253 | }); |
| | 2254 | } |
| | 2255 | |
| | 2256 | hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; |
| | 2257 | |
| | 2258 | // If set returns undefined, fall back to normal setting |
| | 2259 | if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { |
| | 2260 | this.value = val; |
| | 2261 | } |
| | 2262 | }); |
| | 2263 | } |
| | 2264 | }); |
| | 2265 | |
| | 2266 | jQuery.extend({ |
| | 2267 | valHooks: { |
| | 2268 | option: { |
| | 2269 | get: function( elem ) { |
| | 2270 | // attributes.value is undefined in Blackberry 4.7 but |
| | 2271 | // uses .value. See #6932 |
| | 2272 | var val = elem.attributes.value; |
| | 2273 | return !val || val.specified ? elem.value : elem.text; |
| | 2274 | } |
| | 2275 | }, |
| | 2276 | select: { |
| | 2277 | get: function( elem ) { |
| | 2278 | var value, option, |
| | 2279 | options = elem.options, |
| | 2280 | index = elem.selectedIndex, |
| | 2281 | one = elem.type === "select-one" || index < 0, |
| | 2282 | values = one ? null : [], |
| | 2283 | max = one ? index + 1 : options.length, |
| | 2284 | i = index < 0 ? |
| | 2285 | max : |
| | 2286 | one ? index : 0; |
| | 2287 | |
| | 2288 | // Loop through all the selected options |
| | 2289 | for ( ; i < max; i++ ) { |
| | 2290 | option = options[ i ]; |
| | 2291 | |
| | 2292 | // oldIE doesn't update selected after form reset (#2551) |
| | 2293 | if ( ( option.selected || i === index ) && |
| | 2294 | // Don't return options that are disabled or in a disabled optgroup |
| | 2295 | ( jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null ) && |
| | 2296 | ( !option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { |
| | 2297 | |
| | 2298 | // Get the specific value for the option |
| | 2299 | value = jQuery( option ).val(); |
| | 2300 | |
| | 2301 | // We don't need an array for one selects |
| | 2302 | if ( one ) { |
| | 2303 | return value; |
| | 2304 | } |
| | 2305 | |
| | 2306 | // Multi-Selects return an array |
| | 2307 | values.push( value ); |
| | 2308 | } |
| | 2309 | } |
| | 2310 | |
| | 2311 | return values; |
| | 2312 | }, |
| | 2313 | |
| | 2314 | set: function( elem, value ) { |
| | 2315 | var values = jQuery.makeArray( value ); |
| | 2316 | |
| | 2317 | jQuery(elem).find("option").each(function() { |
| | 2318 | this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; |
| | 2319 | }); |
| | 2320 | |
| | 2321 | if ( !values.length ) { |
| | 2322 | elem.selectedIndex = -1; |
| | 2323 | } |
| | 2324 | return values; |
| | 2325 | } |
| | 2326 | } |
| | 2327 | }, |
| | 2328 | |
| | 2329 | attr: function( elem, name, value ) { |
| | 2330 | var ret, hooks, notxml, |
| | 2331 | nType = elem.nodeType; |
| | 2332 | |
| | 2333 | // don't get/set attributes on text, comment and attribute nodes |
| | 2334 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
| | 2335 | return; |
| | 2336 | } |
| | 2337 | |
| | 2338 | // Fallback to prop when attributes are not supported |
| | 2339 | if ( typeof elem.getAttribute === "undefined" ) { |
| | 2340 | return jQuery.prop( elem, name, value ); |
| | 2341 | } |
| | 2342 | |
| | 2343 | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
| | 2344 | |
| | 2345 | // All attributes are lowercase |
| | 2346 | // Grab necessary hook if one is defined |
| | 2347 | if ( notxml ) { |
| | 2348 | name = name.toLowerCase(); |
| | 2349 | hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); |
| | 2350 | } |
| | 2351 | |
| | 2352 | if ( value !== undefined ) { |
| | 2353 | |
| | 2354 | if ( value === null ) { |
| | 2355 | jQuery.removeAttr( elem, name ); |
| | 2356 | |
| | 2357 | } else if ( hooks && notxml && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
| | 2358 | return ret; |
| | 2359 | |
| | 2360 | } else { |
| | 2361 | elem.setAttribute( name, value + "" ); |
| | 2362 | return value; |
| | 2363 | } |
| | 2364 | |
| | 2365 | } else if ( hooks && notxml && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { |
| | 2366 | return ret; |
| | 2367 | |
| | 2368 | } else { |
| | 2369 | |
| | 2370 | ret = elem.getAttribute( name ); |
| | 2371 | |
| | 2372 | // Non-existent attributes return null, we normalize to undefined |
| | 2373 | return ret == null ? |
| | 2374 | undefined : |
| | 2375 | ret; |
| | 2376 | } |
| | 2377 | }, |
| | 2378 | |
| | 2379 | removeAttr: function( elem, value ) { |
| | 2380 | var name, propName, |
| | 2381 | i = 0, |
| | 2382 | attrNames = value && value.match( core_rnotwhite ); |
| | 2383 | |
| | 2384 | if ( attrNames && elem.nodeType === 1 ) { |
| | 2385 | while ( (name = attrNames[i++]) ) { |
| | 2386 | propName = jQuery.propFix[ name ] || name; |
| | 2387 | |
| | 2388 | // Boolean attributes get special treatment (#10870) |
| | 2389 | if ( rboolean.test( name ) ) { |
| | 2390 | // Set corresponding property to false for boolean attributes |
| | 2391 | // Also clear defaultChecked/defaultSelected (if appropriate) for IE<8 |
| | 2392 | if ( !getSetAttribute && ruseDefault.test( name ) ) { |
| | 2393 | elem[ jQuery.camelCase( "default-" + name ) ] = |
| | 2394 | elem[ propName ] = false; |
| | 2395 | } else { |
| | 2396 | elem[ propName ] = false; |
| | 2397 | } |
| | 2398 | |
| | 2399 | // See #9699 for explanation of this approach (setting first, then removal) |
| | 2400 | } else { |
| | 2401 | jQuery.attr( elem, name, "" ); |
| | 2402 | } |
| | 2403 | |
| | 2404 | elem.removeAttribute( getSetAttribute ? name : propName ); |
| | 2405 | } |
| | 2406 | } |
| | 2407 | }, |
| | 2408 | |
| | 2409 | attrHooks: { |
| | 2410 | type: { |
| | 2411 | set: function( elem, value ) { |
| | 2412 | if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { |
| | 2413 | // Setting the type on a radio button after the value resets the value in IE6-9 |
| | 2414 | // Reset value to default in case type is set after value during creation |
| | 2415 | var val = elem.value; |
| | 2416 | elem.setAttribute( "type", value ); |
| | 2417 | if ( val ) { |
| | 2418 | elem.value = val; |
| | 2419 | } |
| | 2420 | return value; |
| | 2421 | } |
| | 2422 | } |
| | 2423 | } |
| | 2424 | }, |
| | 2425 | |
| | 2426 | propFix: { |
| | 2427 | tabindex: "tabIndex", |
| | 2428 | readonly: "readOnly", |
| | 2429 | "for": "htmlFor", |
| | 2430 | "class": "className", |
| | 2431 | maxlength: "maxLength", |
| | 2432 | cellspacing: "cellSpacing", |
| | 2433 | cellpadding: "cellPadding", |
| | 2434 | rowspan: "rowSpan", |
| | 2435 | colspan: "colSpan", |
| | 2436 | usemap: "useMap", |
| | 2437 | frameborder: "frameBorder", |
| | 2438 | contenteditable: "contentEditable" |
| | 2439 | }, |
| | 2440 | |
| | 2441 | prop: function( elem, name, value ) { |
| | 2442 | var ret, hooks, notxml, |
| | 2443 | nType = elem.nodeType; |
| | 2444 | |
| | 2445 | // don't get/set properties on text, comment and attribute nodes |
| | 2446 | if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { |
| | 2447 | return; |
| | 2448 | } |
| | 2449 | |
| | 2450 | notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); |
| | 2451 | |
| | 2452 | if ( notxml ) { |
| | 2453 | // Fix name and attach hooks |
| | 2454 | name = jQuery.propFix[ name ] || name; |
| | 2455 | hooks = jQuery.propHooks[ name ]; |
| | 2456 | } |
| | 2457 | |
| | 2458 | if ( value !== undefined ) { |
| | 2459 | if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { |
| | 2460 | return ret; |
| | 2461 | |
| | 2462 | } else { |
| | 2463 | return ( elem[ name ] = value ); |
| | 2464 | } |
| | 2465 | |
| | 2466 | } else { |
| | 2467 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { |
| | 2468 | return ret; |
| | 2469 | |
| | 2470 | } else { |
| | 2471 | return elem[ name ]; |
| | 2472 | } |
| | 2473 | } |
| | 2474 | }, |
| | 2475 | |
| | 2476 | propHooks: { |
| | 2477 | tabIndex: { |
| | 2478 | get: function( elem ) { |
| | 2479 | // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set |
| | 2480 | // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ |
| | 2481 | var attributeNode = elem.getAttributeNode("tabindex"); |
| | 2482 | |
| | 2483 | return attributeNode && attributeNode.specified ? |
| | 2484 | parseInt( attributeNode.value, 10 ) : |
| | 2485 | rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? |
| | 2486 | 0 : |
| | 2487 | undefined; |
| | 2488 | } |
| | 2489 | } |
| | 2490 | } |
| | 2491 | }); |
| | 2492 | |
| | 2493 | // Hook for boolean attributes |
| | 2494 | boolHook = { |
| | 2495 | get: function( elem, name ) { |
| | 2496 | var |
| | 2497 | // Use .prop to determine if this attribute is understood as boolean |
| | 2498 | prop = jQuery.prop( elem, name ), |
| | 2499 | |
| | 2500 | // Fetch it accordingly |
| | 2501 | attr = typeof prop === "boolean" && elem.getAttribute( name ), |
| | 2502 | detail = typeof prop === "boolean" ? |
| | 2503 | |
| | 2504 | getSetInput && getSetAttribute ? |
| | 2505 | attr != null : |
| | 2506 | // oldIE fabricates an empty string for missing boolean attributes |
| | 2507 | // and conflates checked/selected into attroperties |
| | 2508 | ruseDefault.test( name ) ? |
| | 2509 | elem[ jQuery.camelCase( "default-" + name ) ] : |
| | 2510 | !!attr : |
| | 2511 | |
| | 2512 | // fetch an attribute node for properties not recognized as boolean |
| | 2513 | elem.getAttributeNode( name ); |
| | 2514 | |
| | 2515 | return detail && detail.value !== false ? |
| | 2516 | name.toLowerCase() : |
| | 2517 | undefined; |
| | 2518 | }, |
| | 2519 | set: function( elem, value, name ) { |
| | 2520 | if ( value === false ) { |
| | 2521 | // Remove boolean attributes when set to false |
| | 2522 | jQuery.removeAttr( elem, name ); |
| | 2523 | } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { |
| | 2524 | // IE<8 needs the *property* name |
| | 2525 | elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); |
| | 2526 | |
| | 2527 | // Use defaultChecked and defaultSelected for oldIE |
| | 2528 | } else { |
| | 2529 | elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; |
| | 2530 | } |
| | 2531 | |
| | 2532 | return name; |
| | 2533 | } |
| | 2534 | }; |
| | 2535 | |
| | 2536 | // fix oldIE value attroperty |
| | 2537 | if ( !getSetInput || !getSetAttribute ) { |
| | 2538 | jQuery.attrHooks.value = { |
| | 2539 | get: function( elem, name ) { |
| | 2540 | var ret = elem.getAttributeNode( name ); |
| | 2541 | return jQuery.nodeName( elem, "input" ) ? |
| | 2542 | |
| | 2543 | // Ignore the value *property* by using defaultValue |
| | 2544 | elem.defaultValue : |
| | 2545 | |
| | 2546 | ret && ret.specified ? ret.value : undefined; |
| | 2547 | }, |
| | 2548 | set: function( elem, value, name ) { |
| | 2549 | if ( jQuery.nodeName( elem, "input" ) ) { |
| | 2550 | // Does not return so that setAttribute is also used |
| | 2551 | elem.defaultValue = value; |
| | 2552 | } else { |
| | 2553 | // Use nodeHook if defined (#1954); otherwise setAttribute is fine |
| | 2554 | return nodeHook && nodeHook.set( elem, value, name ); |
| | 2555 | } |
| | 2556 | } |
| | 2557 | }; |
| | 2558 | } |
| | 2559 | |
| | 2560 | // IE6/7 do not support getting/setting some attributes with get/setAttribute |
| | 2561 | if ( !getSetAttribute ) { |
| | 2562 | |
| | 2563 | // Use this for any attribute in IE6/7 |
| | 2564 | // This fixes almost every IE6/7 issue |
| | 2565 | nodeHook = jQuery.valHooks.button = { |
| | 2566 | get: function( elem, name ) { |
| | 2567 | var ret = elem.getAttributeNode( name ); |
| | 2568 | return ret && ( name === "id" || name === "name" || name === "coords" ? ret.value !== "" : ret.specified ) ? |
| | 2569 | ret.value : |
| | 2570 | undefined; |
| | 2571 | }, |
| | 2572 | set: function( elem, value, name ) { |
| | 2573 | // Set the existing or create a new attribute node |
| | 2574 | var ret = elem.getAttributeNode( name ); |
| | 2575 | if ( !ret ) { |
| | 2576 | elem.setAttributeNode( |
| | 2577 | (ret = elem.ownerDocument.createAttribute( name )) |
| | 2578 | ); |
| | 2579 | } |
| | 2580 | |
| | 2581 | ret.value = value += ""; |
| | 2582 | |
| | 2583 | // Break association with cloned elements by also using setAttribute (#9646) |
| | 2584 | return name === "value" || value === elem.getAttribute( name ) ? |
| | 2585 | value : |
| | 2586 | undefined; |
| | 2587 | } |
| | 2588 | }; |
| | 2589 | |
| | 2590 | // Set contenteditable to false on removals(#10429) |
| | 2591 | // Setting to empty string throws an error as an invalid value |
| | 2592 | jQuery.attrHooks.contenteditable = { |
| | 2593 | get: nodeHook.get, |
| | 2594 | set: function( elem, value, name ) { |
| | 2595 | nodeHook.set( elem, value === "" ? false : value, name ); |
| | 2596 | } |
| | 2597 | }; |
| | 2598 | |
| | 2599 | // Set width and height to auto instead of 0 on empty string( Bug #8150 ) |
| | 2600 | // This is for removals |
| | 2601 | jQuery.each([ "width", "height" ], function( i, name ) { |
| | 2602 | jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { |
| | 2603 | set: function( elem, value ) { |
| | 2604 | if ( value === "" ) { |
| | 2605 | elem.setAttribute( name, "auto" ); |
| | 2606 | return value; |
| | 2607 | } |
| | 2608 | } |
| | 2609 | }); |
| | 2610 | }); |
| | 2611 | } |
| | 2612 | |
| | 2613 | |
| | 2614 | // Some attributes require a special call on IE |
| | 2615 | // http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx |
| | 2616 | if ( !jQuery.support.hrefNormalized ) { |
| | 2617 | jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { |
| | 2618 | jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { |
| | 2619 | get: function( elem ) { |
| | 2620 | var ret = elem.getAttribute( name, 2 ); |
| | 2621 | return ret == null ? undefined : ret; |
| | 2622 | } |
| | 2623 | }); |
| | 2624 | }); |
| | 2625 | |
| | 2626 | // href/src property should get the full normalized URL (#10299/#12915) |
| | 2627 | jQuery.each([ "href", "src" ], function( i, name ) { |
| | 2628 | jQuery.propHooks[ name ] = { |
| | 2629 | get: function( elem ) { |
| | 2630 | return elem.getAttribute( name, 4 ); |
| | 2631 | } |
| | 2632 | }; |
| | 2633 | }); |
| | 2634 | } |
| | 2635 | |
| | 2636 | if ( !jQuery.support.style ) { |
| | 2637 | jQuery.attrHooks.style = { |
| | 2638 | get: function( elem ) { |
| | 2639 | // Return undefined in the case of empty string |
| | 2640 | // Normalize to lowercase since IE uppercases css property names |
| | 2641 | return elem.style.cssText.toLowerCase() || undefined; |
| | 2642 | }, |
| | 2643 | set: function( elem, value ) { |
| | 2644 | return ( elem.style.cssText = value + "" ); |
| | 2645 | } |
| | 2646 | }; |
| | 2647 | } |
| | 2648 | |
| | 2649 | // Safari mis-reports the default selected property of an option |
| | 2650 | // Accessing the parent's selectedIndex property fixes it |
| | 2651 | if ( !jQuery.support.optSelected ) { |
| | 2652 | jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { |
| | 2653 | get: function( elem ) { |
| | 2654 | var parent = elem.parentNode; |
| | 2655 | |
| | 2656 | if ( parent ) { |
| | 2657 | parent.selectedIndex; |
| | 2658 | |
| | 2659 | // Make sure that it also works with optgroups, see #5701 |
| | 2660 | if ( parent.parentNode ) { |
| | 2661 | parent.parentNode.selectedIndex; |
| | 2662 | } |
| | 2663 | } |
| | 2664 | return null; |
| | 2665 | } |
| | 2666 | }); |
| | 2667 | } |
| | 2668 | |
| | 2669 | // IE6/7 call enctype encoding |
| | 2670 | if ( !jQuery.support.enctype ) { |
| | 2671 | jQuery.propFix.enctype = "encoding"; |
| | 2672 | } |
| | 2673 | |
| | 2674 | // Radios and checkboxes getter/setter |
| | 2675 | if ( !jQuery.support.checkOn ) { |
| | 2676 | jQuery.each([ "radio", "checkbox" ], function() { |
| | 2677 | jQuery.valHooks[ this ] = { |
| | 2678 | get: function( elem ) { |
| | 2679 | // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified |
| | 2680 | return elem.getAttribute("value") === null ? "on" : elem.value; |
| | 2681 | } |
| | 2682 | }; |
| | 2683 | }); |
| | 2684 | } |
| | 2685 | jQuery.each([ "radio", "checkbox" ], function() { |
| | 2686 | jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { |
| | 2687 | set: function( elem, value ) { |
| | 2688 | if ( jQuery.isArray( value ) ) { |
| | 2689 | return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); |
| | 2690 | } |
| | 2691 | } |
| | 2692 | }); |
| | 2693 | }); |
| | 2694 | var rformElems = /^(?:input|select|textarea)$/i, |
| | 2695 | rkeyEvent = /^key/, |
| | 2696 | rmouseEvent = /^(?:mouse|contextmenu)|click/, |
| | 2697 | rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, |
| | 2698 | rtypenamespace = /^([^.]*)(?:\.(.+)|)$/; |
| | 2699 | |
| | 2700 | /* |
| | 2701 | * Helper functions for managing events -- not part of the public interface. |
| | 2702 | * Props to Dean Edwards' addEvent library for many of the ideas. |
| | 2703 | */ |
| | 2704 | jQuery.event = { |
| | 2705 | |
| | 2706 | add: function( elem, types, handler, data, selector ) { |
| | 2707 | var elemData, eventHandle, events, |
| | 2708 | tns, type, namespaces, handleObj, |
| | 2709 | handleObjIn, handlers, special, |
| | 2710 | t = 0; |
| | 2711 | |
| | 2712 | // Don't attach events to noData or text/comment nodes (allow plain objects tho) |
| | 2713 | if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { |
| | 2714 | return; |
| | 2715 | } |
| | 2716 | |
| | 2717 | // Caller can pass in an object of custom data in lieu of the handler |
| | 2718 | if ( handler.handler ) { |
| | 2719 | handleObjIn = handler; |
| | 2720 | handler = handleObjIn.handler; |
| | 2721 | selector = handleObjIn.selector; |
| | 2722 | } |
| | 2723 | |
| | 2724 | // Make sure that the handler has a unique ID, used to find/remove it later |
| | 2725 | if ( !handler.guid ) { |
| | 2726 | handler.guid = jQuery.guid++; |
| | 2727 | } |
| | 2728 | |
| | 2729 | // Init the element's event structure and main handler, if this is the first |
| | 2730 | events = elemData.events; |
| | 2731 | if ( !events ) { |
| | 2732 | elemData.events = events = {}; |
| | 2733 | } |
| | 2734 | eventHandle = elemData.handle; |
| | 2735 | if ( !eventHandle ) { |
| | 2736 | elemData.handle = eventHandle = function( e ) { |
| | 2737 | // Discard the second event of a jQuery.event.trigger() and |
| | 2738 | // when an event is called after a page has unloaded |
| | 2739 | return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? |
| | 2740 | jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : |
| | 2741 | undefined; |
| | 2742 | }; |
| | 2743 | // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events |
| | 2744 | eventHandle.elem = elem; |
| | 2745 | } |
| | 2746 | |
| | 2747 | // Handle multiple events separated by a space |
| | 2748 | // jQuery(...).bind("mouseover mouseout", fn); |
| | 2749 | types = ( types || "" ).match( core_rnotwhite ) || [""]; |
| | 2750 | for ( ; t < types.length; t++ ) { |
| | 2751 | |
| | 2752 | tns = rtypenamespace.exec( types[t] ) || []; |
| | 2753 | type = tns[1]; |
| | 2754 | namespaces = ( tns[2] || "" ).split( "." ).sort(); |
| | 2755 | |
| | 2756 | // If event changes its type, use the special event handlers for the changed type |
| | 2757 | special = jQuery.event.special[ type ] || {}; |
| | 2758 | |
| | 2759 | // If selector defined, determine special event api type, otherwise given type |
| | 2760 | type = ( selector ? special.delegateType : special.bindType ) || type; |
| | 2761 | |
| | 2762 | // Update special based on newly reset type |
| | 2763 | special = jQuery.event.special[ type ] || {}; |
| | 2764 | |
| | 2765 | // handleObj is passed to all event handlers |
| | 2766 | handleObj = jQuery.extend({ |
| | 2767 | type: type, |
| | 2768 | origType: tns[1], |
| | 2769 | data: data, |
| | 2770 | handler: handler, |
| | 2771 | guid: handler.guid, |
| | 2772 | selector: selector, |
| | 2773 | needsContext: selector && jQuery.expr.match.needsContext.test( selector ), |
| | 2774 | namespace: namespaces.join(".") |
| | 2775 | }, handleObjIn ); |
| | 2776 | |
| | 2777 | // Init the event handler queue if we're the first |
| | 2778 | handlers = events[ type ]; |
| | 2779 | if ( !handlers ) { |
| | 2780 | handlers = events[ type ] = []; |
| | 2781 | handlers.delegateCount = 0; |
| | 2782 | |
| | 2783 | // Only use addEventListener/attachEvent if the special events handler returns false |
| | 2784 | if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { |
| | 2785 | // Bind the global event handler to the element |
| | 2786 | if ( elem.addEventListener ) { |
| | 2787 | elem.addEventListener( type, eventHandle, false ); |
| | 2788 | |
| | 2789 | } else if ( elem.attachEvent ) { |
| | 2790 | elem.attachEvent( "on" + type, eventHandle ); |
| | 2791 | } |
| | 2792 | } |
| | 2793 | } |
| | 2794 | |
| | 2795 | if ( special.add ) { |
| | 2796 | special.add.call( elem, handleObj ); |
| | 2797 | |
| | 2798 | if ( !handleObj.handler.guid ) { |
| | 2799 | handleObj.handler.guid = handler.guid; |
| | 2800 | } |
| | 2801 | } |
| | 2802 | |
| | 2803 | // Add to the element's handler list, delegates in front |
| | 2804 | if ( selector ) { |
| | 2805 | handlers.splice( handlers.delegateCount++, 0, handleObj ); |
| | 2806 | } else { |
| | 2807 | handlers.push( handleObj ); |
| | 2808 | } |
| | 2809 | |
| | 2810 | // Keep track of which events have ever been used, for event optimization |
| | 2811 | jQuery.event.global[ type ] = true; |
| | 2812 | } |
| | 2813 | |
| | 2814 | // Nullify elem to prevent memory leaks in IE |
| | 2815 | elem = null; |
| | 2816 | }, |
| | 2817 | |
| | 2818 | global: {}, |
| | 2819 | |
| | 2820 | // Detach an event or set of events from an element |
| | 2821 | remove: function( elem, types, handler, selector, mappedTypes ) { |
| | 2822 | |
| | 2823 | var tns, type, origType, namespaces, origCount, |
| | 2824 | j, events, special, eventType, handleObj, |
| | 2825 | t = 0, |
| | 2826 | elemData = jQuery.hasData( elem ) && jQuery._data( elem ); |
| | 2827 | |
| | 2828 | if ( !elemData || !(events = elemData.events) ) { |
| | 2829 | return; |
| | 2830 | } |
| | 2831 | |
| | 2832 | // Once for each type.namespace in types; type may be omitted |
| | 2833 | types = ( types || "" ).match( core_rnotwhite ) || [""]; |
| | 2834 | for ( ; t < types.length; t++ ) { |
| | 2835 | tns = rtypenamespace.exec( types[t] ) || []; |
| | 2836 | type = origType = tns[1]; |
| | 2837 | namespaces = tns[2]; |
| | 2838 | |
| | 2839 | // Unbind all events (on this namespace, if provided) for the element |
| | 2840 | if ( !type ) { |
| | 2841 | for ( type in events ) { |
| | 2842 | jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); |
| | 2843 | } |
| | 2844 | continue; |
| | 2845 | } |
| | 2846 | |
| | 2847 | special = jQuery.event.special[ type ] || {}; |
| | 2848 | type = ( selector? special.delegateType : special.bindType ) || type; |
| | 2849 | eventType = events[ type ] || []; |
| | 2850 | origCount = eventType.length; |
| | 2851 | namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.|)") + "(\\.|$)") : null; |
| | 2852 | |
| | 2853 | // Remove matching events |
| | 2854 | for ( j = 0; j < eventType.length; j++ ) { |
| | 2855 | handleObj = eventType[ j ]; |
| | 2856 | |
| | 2857 | if ( ( mappedTypes || origType === handleObj.origType ) && |
| | 2858 | ( !handler || handler.guid === handleObj.guid ) && |
| | 2859 | ( !namespaces || namespaces.test( handleObj.namespace ) ) && |
| | 2860 | ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { |
| | 2861 | eventType.splice( j--, 1 ); |
| | 2862 | |
| | 2863 | if ( handleObj.selector ) { |
| | 2864 | eventType.delegateCount--; |
| | 2865 | } |
| | 2866 | if ( special.remove ) { |
| | 2867 | special.remove.call( elem, handleObj ); |
| | 2868 | } |
| | 2869 | } |
| | 2870 | } |
| | 2871 | |
| | 2872 | // Remove generic event handler if we removed something and no more handlers exist |
| | 2873 | // (avoids potential for endless recursion during removal of special event handlers) |
| | 2874 | if ( eventType.length === 0 && origCount !== eventType.length ) { |
| | 2875 | if ( !special.teardown || special.teardown.call( elem, namespaces, elemData.handle ) === false ) { |
| | 2876 | jQuery.removeEvent( elem, type, elemData.handle ); |
| | 2877 | } |
| | 2878 | |
| | 2879 | delete events[ type ]; |
| | 2880 | } |
| | 2881 | } |
| | 2882 | |
| | 2883 | // Remove the expando if it's no longer used |
| | 2884 | if ( jQuery.isEmptyObject( events ) ) { |
| | 2885 | delete elemData.handle; |
| | 2886 | |
| | 2887 | // removeData also checks for emptiness and clears the expando if empty |
| | 2888 | // so use it instead of delete |
| | 2889 | jQuery._removeData( elem, "events" ); |
| | 2890 | } |
| | 2891 | }, |
| | 2892 | |
| | 2893 | trigger: function( event, data, elem, onlyHandlers ) { |
| | 2894 | |
| | 2895 | var i, cur, old, ontype, special, handle, eventPath, bubbleType, |
| | 2896 | type = event.type || event, |
| | 2897 | namespaces = event.namespace ? event.namespace.split(".") : []; |
| | 2898 | |
| | 2899 | elem = elem || document; |
| | 2900 | |
| | 2901 | // Don't do events on text and comment nodes |
| | 2902 | if ( elem.nodeType === 3 || elem.nodeType === 8 ) { |
| | 2903 | return; |
| | 2904 | } |
| | 2905 | |
| | 2906 | // focus/blur morphs to focusin/out; ensure we're not firing them right now |
| | 2907 | if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { |
| | 2908 | return; |
| | 2909 | } |
| | 2910 | |
| | 2911 | if ( type.indexOf(".") >= 0 ) { |
| | 2912 | // Namespaced trigger; create a regexp to match event type in handle() |
| | 2913 | namespaces = type.split("."); |
| | 2914 | type = namespaces.shift(); |
| | 2915 | namespaces.sort(); |
| | 2916 | } |
| | 2917 | |
| | 2918 | // Caller can pass in an Event, Object, or just an event type string |
| | 2919 | event = typeof event === "object" ? |
| | 2920 | // jQuery.Event object |
| | 2921 | event[ jQuery.expando ] ? event : |
| | 2922 | // Object literal |
| | 2923 | new jQuery.Event( type, event ) : |
| | 2924 | // Just the event type (string) |
| | 2925 | new jQuery.Event( type ); |
| | 2926 | |
| | 2927 | event.type = type; |
| | 2928 | event.isTrigger = true; |
| | 2929 | event.namespace = namespaces.join("."); |
| | 2930 | event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null; |
| | 2931 | ontype = type.indexOf(":") < 0 ? "on" + type : ""; |
| | 2932 | |
| | 2933 | // Clean up the event in case it is being reused |
| | 2934 | event.result = undefined; |
| | 2935 | if ( !event.target ) { |
| | 2936 | event.target = elem; |
| | 2937 | } |
| | 2938 | |
| | 2939 | // Clone any incoming data and prepend the event, creating the handler arg list |
| | 2940 | data = data != null ? jQuery.makeArray( data ) : []; |
| | 2941 | data.unshift( event ); |
| | 2942 | |
| | 2943 | // Allow special events to draw outside the lines |
| | 2944 | special = jQuery.event.special[ type ] || {}; |
| | 2945 | if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { |
| | 2946 | return; |
| | 2947 | } |
| | 2948 | |
| | 2949 | // Determine event propagation path in advance, per W3C events spec (#9951) |
| | 2950 | // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) |
| | 2951 | eventPath = [[ elem, special.bindType || type ]]; |
| | 2952 | if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { |
| | 2953 | |
| | 2954 | bubbleType = special.delegateType || type; |
| | 2955 | cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; |
| | 2956 | for ( old = elem; cur; cur = cur.parentNode ) { |
| | 2957 | eventPath.push([ cur, bubbleType ]); |
| | 2958 | old = cur; |
| | 2959 | } |
| | 2960 | |
| | 2961 | // Only add window if we got to document (e.g., not plain obj or detached DOM) |
| | 2962 | if ( old === (elem.ownerDocument || document) ) { |
| | 2963 | eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); |
| | 2964 | } |
| | 2965 | } |
| | 2966 | |
| | 2967 | // Fire handlers on the event path |
| | 2968 | for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { |
| | 2969 | |
| | 2970 | cur = eventPath[i][0]; |
| | 2971 | event.type = eventPath[i][1]; |
| | 2972 | |
| | 2973 | handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); |
| | 2974 | if ( handle ) { |
| | 2975 | handle.apply( cur, data ); |
| | 2976 | } |
| | 2977 | // Note that this is a bare JS function and not a jQuery handler |
| | 2978 | handle = ontype && cur[ ontype ]; |
| | 2979 | if ( handle && jQuery.acceptData( cur ) && handle.apply && handle.apply( cur, data ) === false ) { |
| | 2980 | event.preventDefault(); |
| | 2981 | } |
| | 2982 | } |
| | 2983 | event.type = type; |
| | 2984 | |
| | 2985 | // If nobody prevented the default action, do it now |
| | 2986 | if ( !onlyHandlers && !event.isDefaultPrevented() ) { |
| | 2987 | |
| | 2988 | if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && |
| | 2989 | !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { |
| | 2990 | |
| | 2991 | // Call a native DOM method on the target with the same name name as the event. |
| | 2992 | // Can't use an .isFunction() check here because IE6/7 fails that test. |
| | 2993 | // Don't do default actions on window, that's where global variables be (#6170) |
| | 2994 | if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { |
| | 2995 | |
| | 2996 | // Don't re-trigger an onFOO event when we call its FOO() method |
| | 2997 | old = elem[ ontype ]; |
| | 2998 | |
| | 2999 | if ( old ) { |
| | 3000 | elem[ ontype ] = null; |
| | 3001 | } |
| | 3002 | |
| | 3003 | // Prevent re-triggering of the same event, since we already bubbled it above |
| | 3004 | jQuery.event.triggered = type; |
| | 3005 | try { |
| | 3006 | elem[ type ](); |
| | 3007 | } catch ( e ) { |
| | 3008 | // IE<9 dies on focus/blur to hidden element (#1486,#12518) |
| | 3009 | // only reproducible on winXP IE8 native, not IE9 in IE8 mode |
| | 3010 | } |
| | 3011 | jQuery.event.triggered = undefined; |
| | 3012 | |
| | 3013 | if ( old ) { |
| | 3014 | elem[ ontype ] = old; |
| | 3015 | } |
| | 3016 | } |
| | 3017 | } |
| | 3018 | } |
| | 3019 | |
| | 3020 | return event.result; |
| | 3021 | }, |
| | 3022 | |
| | 3023 | dispatch: function( event ) { |
| | 3024 | |
| | 3025 | // Make a writable jQuery.Event from the native event object |
| | 3026 | event = jQuery.event.fix( event ); |
| | 3027 | |
| | 3028 | var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, |
| | 3029 | handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), |
| | 3030 | delegateCount = handlers.delegateCount, |
| | 3031 | args = core_slice.call( arguments ), |
| | 3032 | special = jQuery.event.special[ event.type ] || {}, |
| | 3033 | handlerQueue = []; |
| | 3034 | |
| | 3035 | // Use the fix-ed jQuery.Event rather than the (read-only) native event |
| | 3036 | args[0] = event; |
| | 3037 | event.delegateTarget = this; |
| | 3038 | |
| | 3039 | // Call the preDispatch hook for the mapped type, and let it bail if desired |
| | 3040 | if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { |
| | 3041 | return; |
| | 3042 | } |
| | 3043 | |
| | 3044 | // Determine handlers that should run if there are delegated events |
| | 3045 | // Avoid non-left-click bubbling in Firefox (#3861) |
| | 3046 | if ( delegateCount && !(event.button && event.type === "click") ) { |
| | 3047 | |
| | 3048 | for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { |
| | 3049 | |
| | 3050 | // Don't process clicks (ONLY) on disabled elements (#6911, #8165, #11382, #11764) |
| | 3051 | if ( cur.disabled !== true || event.type !== "click" ) { |
| | 3052 | selMatch = {}; |
| | 3053 | matches = []; |
| | 3054 | for ( i = 0; i < delegateCount; i++ ) { |
| | 3055 | handleObj = handlers[ i ]; |
| | 3056 | sel = handleObj.selector; |
| | 3057 | |
| | 3058 | if ( selMatch[ sel ] === undefined ) { |
| | 3059 | selMatch[ sel ] = handleObj.needsContext ? |
| | 3060 | jQuery( sel, this ).index( cur ) >= 0 : |
| | 3061 | jQuery.find( sel, this, null, [ cur ] ).length; |
| | 3062 | } |
| | 3063 | if ( selMatch[ sel ] ) { |
| | 3064 | matches.push( handleObj ); |
| | 3065 | } |
| | 3066 | } |
| | 3067 | if ( matches.length ) { |
| | 3068 | handlerQueue.push({ elem: cur, matches: matches }); |
| | 3069 | } |
| | 3070 | } |
| | 3071 | } |
| | 3072 | } |
| | 3073 | |
| | 3074 | // Add the remaining (directly-bound) handlers |
| | 3075 | if ( handlers.length > delegateCount ) { |
| | 3076 | handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); |
| | 3077 | } |
| | 3078 | |
| | 3079 | // Run delegates first; they may want to stop propagation beneath us |
| | 3080 | for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { |
| | 3081 | matched = handlerQueue[ i ]; |
| | 3082 | event.currentTarget = matched.elem; |
| | 3083 | |
| | 3084 | for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { |
| | 3085 | handleObj = matched.matches[ j ]; |
| | 3086 | |
| | 3087 | // Triggered event must either 1) have no namespace, or |
| | 3088 | // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). |
| | 3089 | if ( !event.namespace || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { |
| | 3090 | |
| | 3091 | event.data = handleObj.data; |
| | 3092 | event.handleObj = handleObj; |
| | 3093 | |
| | 3094 | ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) |
| | 3095 | .apply( matched.elem, args ); |
| | 3096 | |
| | 3097 | if ( ret !== undefined ) { |
| | 3098 | event.result = ret; |
| | 3099 | if ( ret === false ) { |
| | 3100 | event.preventDefault(); |
| | 3101 | event.stopPropagation(); |
| | 3102 | } |
| | 3103 | } |
| | 3104 | } |
| | 3105 | } |
| | 3106 | } |
| | 3107 | |
| | 3108 | // Call the postDispatch hook for the mapped type |
| | 3109 | if ( special.postDispatch ) { |
| | 3110 | special.postDispatch.call( this, event ); |
| | 3111 | } |
| | 3112 | |
| | 3113 | return event.result; |
| | 3114 | }, |
| | 3115 | |
| | 3116 | // Includes some event props shared by KeyEvent and MouseEvent |
| | 3117 | props: "altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), |
| | 3118 | |
| | 3119 | fixHooks: {}, |
| | 3120 | |
| | 3121 | keyHooks: { |
| | 3122 | props: "char charCode key keyCode".split(" "), |
| | 3123 | filter: function( event, original ) { |
| | 3124 | |
| | 3125 | // Add which for key events |
| | 3126 | if ( event.which == null ) { |
| | 3127 | event.which = original.charCode != null ? original.charCode : original.keyCode; |
| | 3128 | } |
| | 3129 | |
| | 3130 | return event; |
| | 3131 | } |
| | 3132 | }, |
| | 3133 | |
| | 3134 | mouseHooks: { |
| | 3135 | props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), |
| | 3136 | filter: function( event, original ) { |
| | 3137 | var eventDoc, doc, body, |
| | 3138 | button = original.button, |
| | 3139 | fromElement = original.fromElement; |
| | 3140 | |
| | 3141 | // Calculate pageX/Y if missing and clientX/Y available |
| | 3142 | if ( event.pageX == null && original.clientX != null ) { |
| | 3143 | eventDoc = event.target.ownerDocument || document; |
| | 3144 | doc = eventDoc.documentElement; |
| | 3145 | body = eventDoc.body; |
| | 3146 | |
| | 3147 | event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); |
| | 3148 | event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); |
| | 3149 | } |
| | 3150 | |
| | 3151 | // Add relatedTarget, if necessary |
| | 3152 | if ( !event.relatedTarget && fromElement ) { |
| | 3153 | event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; |
| | 3154 | } |
| | 3155 | |
| | 3156 | // Add which for click: 1 === left; 2 === middle; 3 === right |
| | 3157 | // Note: button is not normalized, so don't use it |
| | 3158 | if ( !event.which && button !== undefined ) { |
| | 3159 | event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); |
| | 3160 | } |
| | 3161 | |
| | 3162 | return event; |
| | 3163 | } |
| | 3164 | }, |
| | 3165 | |
| | 3166 | fix: function( event ) { |
| | 3167 | if ( event[ jQuery.expando ] ) { |
| | 3168 | return event; |
| | 3169 | } |
| | 3170 | |
| | 3171 | // Create a writable copy of the event object and normalize some properties |
| | 3172 | var i, prop, |
| | 3173 | originalEvent = event, |
| | 3174 | fixHook = jQuery.event.fixHooks[ event.type ] || {}, |
| | 3175 | copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; |
| | 3176 | |
| | 3177 | event = jQuery.Event( originalEvent ); |
| | 3178 | |
| | 3179 | for ( i = copy.length; i; ) { |
| | 3180 | prop = copy[ --i ]; |
| | 3181 | event[ prop ] = originalEvent[ prop ]; |
| | 3182 | } |
| | 3183 | |
| | 3184 | // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) |
| | 3185 | if ( !event.target ) { |
| | 3186 | event.target = originalEvent.srcElement || document; |
| | 3187 | } |
| | 3188 | |
| | 3189 | // Target should not be a text node (#504, Safari) |
| | 3190 | if ( event.target.nodeType === 3 ) { |
| | 3191 | event.target = event.target.parentNode; |
| | 3192 | } |
| | 3193 | |
| | 3194 | // For mouse/key events, metaKey==false if it's undefined (#3368, #11328; IE6/7/8) |
| | 3195 | event.metaKey = !!event.metaKey; |
| | 3196 | |
| | 3197 | return fixHook.filter? fixHook.filter( event, originalEvent ) : event; |
| | 3198 | }, |
| | 3199 | |
| | 3200 | special: { |
| | 3201 | load: { |
| | 3202 | // Prevent triggered image.load events from bubbling to window.load |
| | 3203 | noBubble: true |
| | 3204 | }, |
| | 3205 | click: { |
| | 3206 | // For checkbox, fire native event so checked state will be right |
| | 3207 | trigger: function() { |
| | 3208 | if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { |
| | 3209 | this.click(); |
| | 3210 | return false; |
| | 3211 | } |
| | 3212 | } |
| | 3213 | }, |
| | 3214 | focus: { |
| | 3215 | // Fire native event if possible so blur/focus sequence is correct |
| | 3216 | trigger: function() { |
| | 3217 | if ( this !== document.activeElement && this.focus ) { |
| | 3218 | try { |
| | 3219 | this.focus(); |
| | 3220 | return false; |
| | 3221 | } catch ( e ) { |
| | 3222 | // IE<9 dies on focus to hidden element (#1486,#12518) |
| | 3223 | // If this happens, let .trigger() run the handlers |
| | 3224 | } |
| | 3225 | } |
| | 3226 | }, |
| | 3227 | delegateType: "focusin" |
| | 3228 | }, |
| | 3229 | blur: { |
| | 3230 | trigger: function() { |
| | 3231 | if ( this === document.activeElement && this.blur ) { |
| | 3232 | this.blur(); |
| | 3233 | return false; |
| | 3234 | } |
| | 3235 | }, |
| | 3236 | delegateType: "focusout" |
| | 3237 | }, |
| | 3238 | |
| | 3239 | beforeunload: { |
| | 3240 | postDispatch: function( event ) { |
| | 3241 | |
| | 3242 | // Even when returnValue equals to undefined Firefox will still show alert |
| | 3243 | if ( event.result !== undefined ) { |
| | 3244 | event.originalEvent.returnValue = event.result; |
| | 3245 | } |
| | 3246 | } |
| | 3247 | } |
| | 3248 | }, |
| | 3249 | |
| | 3250 | simulate: function( type, elem, event, bubble ) { |
| | 3251 | // Piggyback on a donor event to simulate a different one. |
| | 3252 | // Fake originalEvent to avoid donor's stopPropagation, but if the |
| | 3253 | // simulated event prevents default then we do the same on the donor. |
| | 3254 | var e = jQuery.extend( |
| | 3255 | new jQuery.Event(), |
| | 3256 | event, |
| | 3257 | { type: type, |
| | 3258 | isSimulated: true, |
| | 3259 | originalEvent: {} |
| | 3260 | } |
| | 3261 | ); |
| | 3262 | if ( bubble ) { |
| | 3263 | jQuery.event.trigger( e, null, elem ); |
| | 3264 | } else { |
| | 3265 | jQuery.event.dispatch.call( elem, e ); |
| | 3266 | } |
| | 3267 | if ( e.isDefaultPrevented() ) { |
| | 3268 | event.preventDefault(); |
| | 3269 | } |
| | 3270 | } |
| | 3271 | }; |
| | 3272 | |
| | 3273 | // Some plugins are using, but it's undocumented/deprecated and will be removed. |
| | 3274 | // The 1.7 special event interface should provide all the hooks needed now. |
| | 3275 | jQuery.event.handle = jQuery.event.dispatch; |
| | 3276 | |
| | 3277 | jQuery.removeEvent = document.removeEventListener ? |
| | 3278 | function( elem, type, handle ) { |
| | 3279 | if ( elem.removeEventListener ) { |
| | 3280 | elem.removeEventListener( type, handle, false ); |
| | 3281 | } |
| | 3282 | } : |
| | 3283 | function( elem, type, handle ) { |
| | 3284 | var name = "on" + type; |
| | 3285 | |
| | 3286 | if ( elem.detachEvent ) { |
| | 3287 | |
| | 3288 | // #8545, #7054, preventing memory leaks for custom events in IE6-8 |
| | 3289 | // detachEvent needed property on element, by name of that event, to properly expose it to GC |
| | 3290 | if ( typeof elem[ name ] === "undefined" ) { |
| | 3291 | elem[ name ] = null; |
| | 3292 | } |
| | 3293 | |
| | 3294 | elem.detachEvent( name, handle ); |
| | 3295 | } |
| | 3296 | }; |
| | 3297 | |
| | 3298 | jQuery.Event = function( src, props ) { |
| | 3299 | // Allow instantiation without the 'new' keyword |
| | 3300 | if ( !(this instanceof jQuery.Event) ) { |
| | 3301 | return new jQuery.Event( src, props ); |
| | 3302 | } |
| | 3303 | |
| | 3304 | // Event object |
| | 3305 | if ( src && src.type ) { |
| | 3306 | this.originalEvent = src; |
| | 3307 | this.type = src.type; |
| | 3308 | |
| | 3309 | // Events bubbling up the document may have been marked as prevented |
| | 3310 | // by a handler lower down the tree; reflect the correct value. |
| | 3311 | this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || |
| | 3312 | src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; |
| | 3313 | |
| | 3314 | // Event type |
| | 3315 | } else { |
| | 3316 | this.type = src; |
| | 3317 | } |
| | 3318 | |
| | 3319 | // Put explicitly provided properties onto the event object |
| | 3320 | if ( props ) { |
| | 3321 | jQuery.extend( this, props ); |
| | 3322 | } |
| | 3323 | |
| | 3324 | // Create a timestamp if incoming event doesn't have one |
| | 3325 | this.timeStamp = src && src.timeStamp || jQuery.now(); |
| | 3326 | |
| | 3327 | // Mark it as fixed |
| | 3328 | this[ jQuery.expando ] = true; |
| | 3329 | }; |
| | 3330 | |
| | 3331 | function returnFalse() { |
| | 3332 | return false; |
| | 3333 | } |
| | 3334 | function returnTrue() { |
| | 3335 | return true; |
| | 3336 | } |
| | 3337 | |
| | 3338 | // jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding |
| | 3339 | // http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html |
| | 3340 | jQuery.Event.prototype = { |
| | 3341 | preventDefault: function() { |
| | 3342 | this.isDefaultPrevented = returnTrue; |
| | 3343 | |
| | 3344 | var e = this.originalEvent; |
| | 3345 | if ( !e ) { |
| | 3346 | return; |
| | 3347 | } |
| | 3348 | |
| | 3349 | // if preventDefault exists run it on the original event |
| | 3350 | if ( e.preventDefault ) { |
| | 3351 | e.preventDefault(); |
| | 3352 | |
| | 3353 | // otherwise set the returnValue property of the original event to false (IE) |
| | 3354 | } else { |
| | 3355 | e.returnValue = false; |
| | 3356 | } |
| | 3357 | }, |
| | 3358 | stopPropagation: function() { |
| | 3359 | this.isPropagationStopped = returnTrue; |
| | 3360 | |
| | 3361 | var e = this.originalEvent; |
| | 3362 | if ( !e ) { |
| | 3363 | return; |
| | 3364 | } |
| | 3365 | // if stopPropagation exists run it on the original event |
| | 3366 | if ( e.stopPropagation ) { |
| | 3367 | e.stopPropagation(); |
| | 3368 | } |
| | 3369 | // otherwise set the cancelBubble property of the original event to true (IE) |
| | 3370 | e.cancelBubble = true; |
| | 3371 | }, |
| | 3372 | stopImmediatePropagation: function() { |
| | 3373 | this.isImmediatePropagationStopped = returnTrue; |
| | 3374 | this.stopPropagation(); |
| | 3375 | }, |
| | 3376 | isDefaultPrevented: returnFalse, |
| | 3377 | isPropagationStopped: returnFalse, |
| | 3378 | isImmediatePropagationStopped: returnFalse |
| | 3379 | }; |
| | 3380 | |
| | 3381 | // Create mouseenter/leave events using mouseover/out and event-time checks |
| | 3382 | jQuery.each({ |
| | 3383 | mouseenter: "mouseover", |
| | 3384 | mouseleave: "mouseout" |
| | 3385 | }, function( orig, fix ) { |
| | 3386 | jQuery.event.special[ orig ] = { |
| | 3387 | delegateType: fix, |
| | 3388 | bindType: fix, |
| | 3389 | |
| | 3390 | handle: function( event ) { |
| | 3391 | var ret, |
| | 3392 | target = this, |
| | 3393 | related = event.relatedTarget, |
| | 3394 | handleObj = event.handleObj; |
| | 3395 | |
| | 3396 | // For mousenter/leave call the handler if related is outside the target. |
| | 3397 | // NB: No relatedTarget if the mouse left/entered the browser window |
| | 3398 | if ( !related || (related !== target && !jQuery.contains( target, related )) ) { |
| | 3399 | event.type = handleObj.origType; |
| | 3400 | ret = handleObj.handler.apply( this, arguments ); |
| | 3401 | event.type = fix; |
| | 3402 | } |
| | 3403 | return ret; |
| | 3404 | } |
| | 3405 | }; |
| | 3406 | }); |
| | 3407 | |
| | 3408 | // IE submit delegation |
| | 3409 | if ( !jQuery.support.submitBubbles ) { |
| | 3410 | |
| | 3411 | jQuery.event.special.submit = { |
| | 3412 | setup: function() { |
| | 3413 | // Only need this for delegated form submit events |
| | 3414 | if ( jQuery.nodeName( this, "form" ) ) { |
| | 3415 | return false; |
| | 3416 | } |
| | 3417 | |
| | 3418 | // Lazy-add a submit handler when a descendant form may potentially be submitted |
| | 3419 | jQuery.event.add( this, "click._submit keypress._submit", function( e ) { |
| | 3420 | // Node name check avoids a VML-related crash in IE (#9807) |
| | 3421 | var elem = e.target, |
| | 3422 | form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; |
| | 3423 | if ( form && !jQuery._data( form, "_submit_attached" ) ) { |
| | 3424 | jQuery.event.add( form, "submit._submit", function( event ) { |
| | 3425 | event._submit_bubble = true; |
| | 3426 | }); |
| | 3427 | jQuery._data( form, "_submit_attached", true ); |
| | 3428 | } |
| | 3429 | }); |
| | 3430 | // return undefined since we don't need an event listener |
| | 3431 | }, |
| | 3432 | |
| | 3433 | postDispatch: function( event ) { |
| | 3434 | // If form was submitted by the user, bubble the event up the tree |
| | 3435 | if ( event._submit_bubble ) { |
| | 3436 | delete event._submit_bubble; |
| | 3437 | if ( this.parentNode && !event.isTrigger ) { |
| | 3438 | jQuery.event.simulate( "submit", this.parentNode, event, true ); |
| | 3439 | } |
| | 3440 | } |
| | 3441 | }, |
| | 3442 | |
| | 3443 | teardown: function() { |
| | 3444 | // Only need this for delegated form submit events |
| | 3445 | if ( jQuery.nodeName( this, "form" ) ) { |
| | 3446 | return false; |
| | 3447 | } |
| | 3448 | |
| | 3449 | // Remove delegated handlers; cleanData eventually reaps submit handlers attached above |
| | 3450 | jQuery.event.remove( this, "._submit" ); |
| | 3451 | } |
| | 3452 | }; |
| | 3453 | } |
| | 3454 | |
| | 3455 | // IE change delegation and checkbox/radio fix |
| | 3456 | if ( !jQuery.support.changeBubbles ) { |
| | 3457 | |
| | 3458 | jQuery.event.special.change = { |
| | 3459 | |
| | 3460 | setup: function() { |
| | 3461 | |
| | 3462 | if ( rformElems.test( this.nodeName ) ) { |
| | 3463 | // IE doesn't fire change on a check/radio until blur; trigger it on click |
| | 3464 | // after a propertychange. Eat the blur-change in special.change.handle. |
| | 3465 | // This still fires onchange a second time for check/radio after blur. |
| | 3466 | if ( this.type === "checkbox" || this.type === "radio" ) { |
| | 3467 | jQuery.event.add( this, "propertychange._change", function( event ) { |
| | 3468 | if ( event.originalEvent.propertyName === "checked" ) { |
| | 3469 | this._just_changed = true; |
| | 3470 | } |
| | 3471 | }); |
| | 3472 | jQuery.event.add( this, "click._change", function( event ) { |
| | 3473 | if ( this._just_changed && !event.isTrigger ) { |
| | 3474 | this._just_changed = false; |
| | 3475 | } |
| | 3476 | // Allow triggered, simulated change events (#11500) |
| | 3477 | jQuery.event.simulate( "change", this, event, true ); |
| | 3478 | }); |
| | 3479 | } |
| | 3480 | return false; |
| | 3481 | } |
| | 3482 | // Delegated event; lazy-add a change handler on descendant inputs |
| | 3483 | jQuery.event.add( this, "beforeactivate._change", function( e ) { |
| | 3484 | var elem = e.target; |
| | 3485 | |
| | 3486 | if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "_change_attached" ) ) { |
| | 3487 | jQuery.event.add( elem, "change._change", function( event ) { |
| | 3488 | if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { |
| | 3489 | jQuery.event.simulate( "change", this.parentNode, event, true ); |
| | 3490 | } |
| | 3491 | }); |
| | 3492 | jQuery._data( elem, "_change_attached", true ); |
| | 3493 | } |
| | 3494 | }); |
| | 3495 | }, |
| | 3496 | |
| | 3497 | handle: function( event ) { |
| | 3498 | var elem = event.target; |
| | 3499 | |
| | 3500 | // Swallow native change events from checkbox/radio, we already triggered them above |
| | 3501 | if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { |
| | 3502 | return event.handleObj.handler.apply( this, arguments ); |
| | 3503 | } |
| | 3504 | }, |
| | 3505 | |
| | 3506 | teardown: function() { |
| | 3507 | jQuery.event.remove( this, "._change" ); |
| | 3508 | |
| | 3509 | return !rformElems.test( this.nodeName ); |
| | 3510 | } |
| | 3511 | }; |
| | 3512 | } |
| | 3513 | |
| | 3514 | // Create "bubbling" focus and blur events |
| | 3515 | if ( !jQuery.support.focusinBubbles ) { |
| | 3516 | jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { |
| | 3517 | |
| | 3518 | // Attach a single capturing handler while someone wants focusin/focusout |
| | 3519 | var attaches = 0, |
| | 3520 | handler = function( event ) { |
| | 3521 | jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); |
| | 3522 | }; |
| | 3523 | |
| | 3524 | jQuery.event.special[ fix ] = { |
| | 3525 | setup: function() { |
| | 3526 | if ( attaches++ === 0 ) { |
| | 3527 | document.addEventListener( orig, handler, true ); |
| | 3528 | } |
| | 3529 | }, |
| | 3530 | teardown: function() { |
| | 3531 | if ( --attaches === 0 ) { |
| | 3532 | document.removeEventListener( orig, handler, true ); |
| | 3533 | } |
| | 3534 | } |
| | 3535 | }; |
| | 3536 | }); |
| | 3537 | } |
| | 3538 | |
| | 3539 | jQuery.fn.extend({ |
| | 3540 | |
| | 3541 | on: function( types, selector, data, fn, /*INTERNAL*/ one ) { |
| | 3542 | var origFn, type; |
| | 3543 | |
| | 3544 | // Types can be a map of types/handlers |
| | 3545 | if ( typeof types === "object" ) { |
| | 3546 | // ( types-Object, selector, data ) |
| | 3547 | if ( typeof selector !== "string" ) { // && selector != null |
| | 3548 | // ( types-Object, data ) |
| | 3549 | data = data || selector; |
| | 3550 | selector = undefined; |
| | 3551 | } |
| | 3552 | for ( type in types ) { |
| | 3553 | this.on( type, selector, data, types[ type ], one ); |
| | 3554 | } |
| | 3555 | return this; |
| | 3556 | } |
| | 3557 | |
| | 3558 | if ( data == null && fn == null ) { |
| | 3559 | // ( types, fn ) |
| | 3560 | fn = selector; |
| | 3561 | data = selector = undefined; |
| | 3562 | } else if ( fn == null ) { |
| | 3563 | if ( typeof selector === "string" ) { |
| | 3564 | // ( types, selector, fn ) |
| | 3565 | fn = data; |
| | 3566 | data = undefined; |
| | 3567 | } else { |
| | 3568 | // ( types, data, fn ) |
| | 3569 | fn = data; |
| | 3570 | data = selector; |
| | 3571 | selector = undefined; |
| | 3572 | } |
| | 3573 | } |
| | 3574 | if ( fn === false ) { |
| | 3575 | fn = returnFalse; |
| | 3576 | } else if ( !fn ) { |
| | 3577 | return this; |
| | 3578 | } |
| | 3579 | |
| | 3580 | if ( one === 1 ) { |
| | 3581 | origFn = fn; |
| | 3582 | fn = function( event ) { |
| | 3583 | // Can use an empty set, since event contains the info |
| | 3584 | jQuery().off( event ); |
| | 3585 | return origFn.apply( this, arguments ); |
| | 3586 | }; |
| | 3587 | // Use same guid so caller can remove using origFn |
| | 3588 | fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); |
| | 3589 | } |
| | 3590 | return this.each( function() { |
| | 3591 | jQuery.event.add( this, types, fn, data, selector ); |
| | 3592 | }); |
| | 3593 | }, |
| | 3594 | one: function( types, selector, data, fn ) { |
| | 3595 | return this.on( types, selector, data, fn, 1 ); |
| | 3596 | }, |
| | 3597 | off: function( types, selector, fn ) { |
| | 3598 | var handleObj, type; |
| | 3599 | if ( types && types.preventDefault && types.handleObj ) { |
| | 3600 | // ( event ) dispatched jQuery.Event |
| | 3601 | handleObj = types.handleObj; |
| | 3602 | jQuery( types.delegateTarget ).off( |
| | 3603 | handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType, |
| | 3604 | handleObj.selector, |
| | 3605 | handleObj.handler |
| | 3606 | ); |
| | 3607 | return this; |
| | 3608 | } |
| | 3609 | if ( typeof types === "object" ) { |
| | 3610 | // ( types-object [, selector] ) |
| | 3611 | for ( type in types ) { |
| | 3612 | this.off( type, selector, types[ type ] ); |
| | 3613 | } |
| | 3614 | return this; |
| | 3615 | } |
| | 3616 | if ( selector === false || typeof selector === "function" ) { |
| | 3617 | // ( types [, fn] ) |
| | 3618 | fn = selector; |
| | 3619 | selector = undefined; |
| | 3620 | } |
| | 3621 | if ( fn === false ) { |
| | 3622 | fn = returnFalse; |
| | 3623 | } |
| | 3624 | return this.each(function() { |
| | 3625 | jQuery.event.remove( this, types, fn, selector ); |
| | 3626 | }); |
| | 3627 | }, |
| | 3628 | |
| | 3629 | bind: function( types, data, fn ) { |
| | 3630 | return this.on( types, null, data, fn ); |
| | 3631 | }, |
| | 3632 | unbind: function( types, fn ) { |
| | 3633 | return this.off( types, null, fn ); |
| | 3634 | }, |
| | 3635 | |
| | 3636 | live: function( types, data, fn ) { |
| | 3637 | jQuery( this.context ).on( types, this.selector, data, fn ); |
| | 3638 | return this; |
| | 3639 | }, |
| | 3640 | die: function( types, fn ) { |
| | 3641 | jQuery( this.context ).off( types, this.selector || "**", fn ); |
| | 3642 | return this; |
| | 3643 | }, |
| | 3644 | |
| | 3645 | delegate: function( selector, types, data, fn ) { |
| | 3646 | return this.on( types, selector, data, fn ); |
| | 3647 | }, |
| | 3648 | undelegate: function( selector, types, fn ) { |
| | 3649 | // ( namespace ) or ( selector, types [, fn] ) |
| | 3650 | return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn ); |
| | 3651 | }, |
| | 3652 | |
| | 3653 | trigger: function( type, data ) { |
| | 3654 | return this.each(function() { |
| | 3655 | jQuery.event.trigger( type, data, this ); |
| | 3656 | }); |
| | 3657 | }, |
| | 3658 | triggerHandler: function( type, data ) { |
| | 3659 | if ( this[0] ) { |
| | 3660 | return jQuery.event.trigger( type, data, this[0], true ); |
| | 3661 | } |
| | 3662 | }, |
| | 3663 | |
| | 3664 | hover: function( fnOver, fnOut ) { |
| | 3665 | return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); |
| | 3666 | } |
| | 3667 | }); |
| | 3668 | |
| | 3669 | jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + |
| | 3670 | "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + |
| | 3671 | "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { |
| | 3672 | |
| | 3673 | // Handle event binding |
| | 3674 | jQuery.fn[ name ] = function( data, fn ) { |
| | 3675 | return arguments.length > 0 ? |
| | 3676 | this.on( name, null, data, fn ) : |
| | 3677 | this.trigger( name ); |
| | 3678 | }; |
| | 3679 | |
| | 3680 | if ( rkeyEvent.test( name ) ) { |
| | 3681 | jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; |
| | 3682 | } |
| | 3683 | |
| | 3684 | if ( rmouseEvent.test( name ) ) { |
| | 3685 | jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; |
| | 3686 | } |
| | 3687 | }); |
| | 3688 | /*! |
| | 3689 | * Sizzle CSS Selector Engine |
| | 3690 | * Copyright 2012 jQuery Foundation and other contributors |
| | 3691 | * Released under the MIT license |
| | 3692 | * http://sizzlejs.com/ |
| | 3693 | */ |
| | 3694 | (function( window, undefined ) { |
| | 3695 | |
| | 3696 | var i, |
| | 3697 | cachedruns, |
| | 3698 | Expr, |
| | 3699 | getText, |
| | 3700 | isXML, |
| | 3701 | compile, |
| | 3702 | hasDuplicate, |
| | 3703 | outermostContext, |
| | 3704 | |
| | 3705 | // Local document vars |
| | 3706 | setDocument, |
| | 3707 | document, |
| | 3708 | docElem, |
| | 3709 | documentIsXML, |
| | 3710 | rbuggyQSA, |
| | 3711 | rbuggyMatches, |
| | 3712 | matches, |
| | 3713 | contains, |
| | 3714 | sortOrder, |
| | 3715 | |
| | 3716 | expando = "sizzle" + -(new Date()), |
| | 3717 | |
| | 3718 | strundefined = typeof undefined, |
| | 3719 | |
| | 3720 | // Used in sorting |
| | 3721 | MAX_NEGATIVE = 1 << 31, |
| | 3722 | preferredDoc = window.document, |
| | 3723 | |
| | 3724 | Token = String, |
| | 3725 | dirruns = 0, |
| | 3726 | done = 0, |
| | 3727 | support = {}, |
| | 3728 | |
| | 3729 | // Array methods |
| | 3730 | arr = [], |
| | 3731 | pop = arr.pop, |
| | 3732 | push = arr.push, |
| | 3733 | slice = arr.slice, |
| | 3734 | // Use a stripped-down indexOf if we can't use a native one |
| | 3735 | indexOf = arr.indexOf || function( elem ) { |
| | 3736 | var i = 0, |
| | 3737 | len = this.length; |
| | 3738 | for ( ; i < len; i++ ) { |
| | 3739 | if ( this[i] === elem ) { |
| | 3740 | return i; |
| | 3741 | } |
| | 3742 | } |
| | 3743 | return -1; |
| | 3744 | }, |
| | 3745 | |
| | 3746 | // Augment a function for special use by Sizzle |
| | 3747 | markFunction = function( fn, value ) { |
| | 3748 | fn[ expando ] = value == null || value; |
| | 3749 | return fn; |
| | 3750 | }, |
| | 3751 | |
| | 3752 | createCache = function() { |
| | 3753 | var cache = {}, |
| | 3754 | keys = []; |
| | 3755 | |
| | 3756 | return markFunction(function( key, value ) { |
| | 3757 | // Only keep the most recent entries |
| | 3758 | if ( keys.push( key ) > Expr.cacheLength ) { |
| | 3759 | delete cache[ keys.shift() ]; |
| | 3760 | } |
| | 3761 | |
| | 3762 | // Retrieve with (key + " ") to avoid collision with native Object.prototype properties (see Issue #157) |
| | 3763 | return (cache[ key + " " ] = value); |
| | 3764 | }, cache ); |
| | 3765 | }, |
| | 3766 | |
| | 3767 | classCache = createCache(), |
| | 3768 | tokenCache = createCache(), |
| | 3769 | compilerCache = createCache(), |
| | 3770 | |
| | 3771 | // Regex |
| | 3772 | |
| | 3773 | // Whitespace characters http://www.w3.org/TR/css3-selectors/#whitespace |
| | 3774 | whitespace = "[\\x20\\t\\r\\n\\f]", |
| | 3775 | // http://www.w3.org/TR/css3-syntax/#characters |
| | 3776 | characterEncoding = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", |
| | 3777 | |
| | 3778 | // Loosely modeled on CSS identifier characters |
| | 3779 | // An unquoted value should be a CSS identifier (http://www.w3.org/TR/css3-selectors/#attribute-selectors) |
| | 3780 | // Proper syntax: http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier |
| | 3781 | identifier = characterEncoding.replace( "w", "w#" ), |
| | 3782 | |
| | 3783 | // Acceptable operators http://www.w3.org/TR/selectors/#attribute-selectors |
| | 3784 | operators = "([*^$|!~]?=)", |
| | 3785 | attributes = "\\[" + whitespace + "*(" + characterEncoding + ")" + whitespace + |
| | 3786 | "*(?:" + operators + whitespace + "*(?:(['\"])((?:\\\\.|[^\\\\])*?)\\3|(" + identifier + ")|)|)" + whitespace + "*\\]", |
| | 3787 | |
| | 3788 | // Prefer arguments quoted, |
| | 3789 | // then not containing pseudos/brackets, |
| | 3790 | // then attribute selectors/non-parenthetical expressions, |
| | 3791 | // then anything else |
| | 3792 | // These preferences are here to reduce the number of selectors |
| | 3793 | // needing tokenize in the PSEUDO preFilter |
| | 3794 | pseudos = ":(" + characterEncoding + ")(?:\\(((['\"])((?:\\\\.|[^\\\\])*?)\\3|((?:\\\\.|[^\\\\()[\\]]|" + attributes.replace( 3, 8 ) + ")*)|.*)\\)|)", |
| | 3795 | |
| | 3796 | // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter |
| | 3797 | rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), |
| | 3798 | |
| | 3799 | rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), |
| | 3800 | rcombinators = new RegExp( "^" + whitespace + "*([\\x20\\t\\r\\n\\f>+~])" + whitespace + "*" ), |
| | 3801 | rpseudo = new RegExp( pseudos ), |
| | 3802 | |
| | 3803 | // Easily-parseable/retrievable ID or TAG or CLASS selectors |
| | 3804 | rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, |
| | 3805 | |
| | 3806 | rsibling = /[\x20\t\r\n\f]*[+~]/, |
| | 3807 | |
| | 3808 | rheader = /h\d/i, |
| | 3809 | rinputs = /input|select|textarea|button/i, |
| | 3810 | |
| | 3811 | rnative = /\{\s*\[native code\]\s*\}/, |
| | 3812 | |
| | 3813 | rbackslash = /\\(?!\\)/g, |
| | 3814 | |
| | 3815 | rescape = /'|\\/g, |
| | 3816 | rattributeQuotes = /\=[\x20\t\r\n\f]*([^'"\]]*)[\x20\t\r\n\f]*\]/g, |
| | 3817 | |
| | 3818 | matchExpr = { |
| | 3819 | "ID": new RegExp( "^#(" + characterEncoding + ")" ), |
| | 3820 | "CLASS": new RegExp( "^\\.(" + characterEncoding + ")" ), |
| | 3821 | "NAME": new RegExp( "^\\[name=['\"]?(" + characterEncoding + ")['\"]?\\]" ), |
| | 3822 | "TAG": new RegExp( "^(" + characterEncoding.replace( "w", "w*" ) + ")" ), |
| | 3823 | "ATTR": new RegExp( "^" + attributes ), |
| | 3824 | "PSEUDO": new RegExp( "^" + pseudos ), |
| | 3825 | "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + |
| | 3826 | "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + |
| | 3827 | "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), |
| | 3828 | // For use in libraries implementing .is() |
| | 3829 | // We use this for POS matching in `select` |
| | 3830 | "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + |
| | 3831 | whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) |
| | 3832 | }, |
| | 3833 | |
| | 3834 | /** |
| | 3835 | * For feature detection |
| | 3836 | * @param {Function} fn The function to test for native support |
| | 3837 | */ |
| | 3838 | isNative = function( fn ) { |
| | 3839 | return rnative.test( fn + "" ); |
| | 3840 | }, |
| | 3841 | |
| | 3842 | /** |
| | 3843 | * Support testing using an element |
| | 3844 | * @param {Function} fn Passed the created div and expects a boolean result |
| | 3845 | */ |
| | 3846 | assert = function( fn ) { |
| | 3847 | var div = document.createElement("div"); |
| | 3848 | |
| | 3849 | try { |
| | 3850 | return fn( div ); |
| | 3851 | } catch (e) { |
| | 3852 | return false; |
| | 3853 | } finally { |
| | 3854 | // release memory in IE |
| | 3855 | div = null; |
| | 3856 | } |
| | 3857 | }; |
| | 3858 | |
| | 3859 | // Use a stripped-down slice if we can't use a native one |
| | 3860 | try { |
| | 3861 | slice.call( docElem.childNodes, 0 )[0].nodeType; |
| | 3862 | } catch ( e ) { |
| | 3863 | slice = function( i ) { |
| | 3864 | var elem, |
| | 3865 | results = []; |
| | 3866 | for ( ; (elem = this[i]); i++ ) { |
| | 3867 | results.push( elem ); |
| | 3868 | } |
| | 3869 | return results; |
| | 3870 | }; |
| | 3871 | } |
| | 3872 | |
| | 3873 | function Sizzle( selector, context, results, seed ) { |
| | 3874 | var match, elem, m, nodeType, |
| | 3875 | // QSA vars |
| | 3876 | i, groups, old, nid, newContext, newSelector; |
| | 3877 | |
| | 3878 | if ( context && (( context.ownerDocument || context ) !== document) ) { |
| | 3879 | setDocument( context ); |
| | 3880 | } |
| | 3881 | |
| | 3882 | context = context || document; |
| | 3883 | results = results || []; |
| | 3884 | |
| | 3885 | if ( !selector || typeof selector !== "string" ) { |
| | 3886 | return results; |
| | 3887 | } |
| | 3888 | |
| | 3889 | if ( (nodeType = context.nodeType) !== 1 && nodeType !== 9 ) { |
| | 3890 | return []; |
| | 3891 | } |
| | 3892 | |
| | 3893 | if ( !documentIsXML && !seed ) { |
| | 3894 | |
| | 3895 | // Shortcuts |
| | 3896 | if ( (match = rquickExpr.exec( selector )) ) { |
| | 3897 | // Speed-up: Sizzle("#ID") |
| | 3898 | if ( (m = match[1]) ) { |
| | 3899 | if ( nodeType === 9 ) { |
| | 3900 | elem = context.getElementById( m ); |
| | 3901 | // Check parentNode to catch when Blackberry 4.6 returns |
| | 3902 | // nodes that are no longer in the document #6963 |
| | 3903 | if ( elem && elem.parentNode ) { |
| | 3904 | // Handle the case where IE, Opera, and Webkit return items |
| | 3905 | // by name instead of ID |
| | 3906 | if ( elem.id === m ) { |
| | 3907 | results.push( elem ); |
| | 3908 | return results; |
| | 3909 | } |
| | 3910 | } else { |
| | 3911 | return results; |
| | 3912 | } |
| | 3913 | } else { |
| | 3914 | // Context is not a document |
| | 3915 | if ( context.ownerDocument && (elem = context.ownerDocument.getElementById( m )) && |
| | 3916 | contains( context, elem ) && elem.id === m ) { |
| | 3917 | results.push( elem ); |
| | 3918 | return results; |
| | 3919 | } |
| | 3920 | } |
| | 3921 | |
| | 3922 | // Speed-up: Sizzle("TAG") |
| | 3923 | } else if ( match[2] ) { |
| | 3924 | push.apply( results, slice.call(context.getElementsByTagName( selector ), 0) ); |
| | 3925 | return results; |
| | 3926 | |
| | 3927 | // Speed-up: Sizzle(".CLASS") |
| | 3928 | } else if ( (m = match[3]) && support.getByClassName && context.getElementsByClassName ) { |
| | 3929 | push.apply( results, slice.call(context.getElementsByClassName( m ), 0) ); |
| | 3930 | return results; |
| | 3931 | } |
| | 3932 | } |
| | 3933 | |
| | 3934 | // QSA path |
| | 3935 | if ( support.qsa && !rbuggyQSA.test(selector) ) { |
| | 3936 | old = true; |
| | 3937 | nid = expando; |
| | 3938 | newContext = context; |
| | 3939 | newSelector = nodeType === 9 && selector; |
| | 3940 | |
| | 3941 | // qSA works strangely on Element-rooted queries |
| | 3942 | // We can work around this by specifying an extra ID on the root |
| | 3943 | // and working up from there (Thanks to Andrew Dupont for the technique) |
| | 3944 | // IE 8 doesn't work on object elements |
| | 3945 | if ( nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { |
| | 3946 | groups = tokenize( selector ); |
| | 3947 | |
| | 3948 | if ( (old = context.getAttribute("id")) ) { |
| | 3949 | nid = old.replace( rescape, "\\$&" ); |
| | 3950 | } else { |
| | 3951 | context.setAttribute( "id", nid ); |
| | 3952 | } |
| | 3953 | nid = "[id='" + nid + "'] "; |
| | 3954 | |
| | 3955 | i = groups.length; |
| | 3956 | while ( i-- ) { |
| | 3957 | groups[i] = nid + groups[i].join(""); |
| | 3958 | } |
| | 3959 | newContext = rsibling.test( selector ) && context.parentNode || context; |
| | 3960 | newSelector = groups.join(","); |
| | 3961 | } |
| | 3962 | |
| | 3963 | if ( newSelector ) { |
| | 3964 | try { |
| | 3965 | push.apply( results, slice.call( newContext.querySelectorAll( |
| | 3966 | newSelector |
| | 3967 | ), 0 ) ); |
| | 3968 | return results; |
| | 3969 | } catch(qsaError) { |
| | 3970 | } finally { |
| | 3971 | if ( !old ) { |
| | 3972 | context.removeAttribute("id"); |
| | 3973 | } |
| | 3974 | } |
| | 3975 | } |
| | 3976 | } |
| | 3977 | } |
| | 3978 | |
| | 3979 | // All others |
| | 3980 | return select( selector.replace( rtrim, "$1" ), context, results, seed ); |
| | 3981 | } |
| | 3982 | |
| | 3983 | /** |
| | 3984 | * Detect xml |
| | 3985 | * @param {Element|Object} elem An element or a document |
| | 3986 | */ |
| | 3987 | isXML = Sizzle.isXML = function( elem ) { |
| | 3988 | // documentElement is verified for cases where it doesn't yet exist |
| | 3989 | // (such as loading iframes in IE - #4833) |
| | 3990 | var documentElement = elem && (elem.ownerDocument || elem).documentElement; |
| | 3991 | return documentElement ? documentElement.nodeName !== "HTML" : false; |
| | 3992 | }; |
| | 3993 | |
| | 3994 | /** |
| | 3995 | * Sets document-related variables once based on the current document |
| | 3996 | * @param {Element|Object} [doc] An element or document object to use to set the document |
| | 3997 | * @returns {Object} Returns the current document |
| | 3998 | */ |
| | 3999 | setDocument = Sizzle.setDocument = function( doc ) { |
| | 4000 | doc = doc && doc.ownerDocument || doc || window.document; |
| | 4001 | |
| | 4002 | // If no document and documentElement is available, return |
| | 4003 | if ( !doc || doc.nodeType !== 9 || !doc.documentElement || document === doc ) { |
| | 4004 | return document; |
| | 4005 | } |
| | 4006 | |
| | 4007 | // Set our document |
| | 4008 | document = doc; |
| | 4009 | docElem = doc.documentElement; |
| | 4010 | |
| | 4011 | // Support tests |
| | 4012 | documentIsXML = isXML( doc ); |
| | 4013 | |
| | 4014 | // Check if getElementsByTagName("*") returns only elements |
| | 4015 | support.tagNameNoComments = assert(function( div ) { |
| | 4016 | div.appendChild( doc.createComment("") ); |
| | 4017 | return !div.getElementsByTagName("*").length; |
| | 4018 | }); |
| | 4019 | |
| | 4020 | // Check if attributes should be retrieved by attribute nodes |
| | 4021 | support.attributes = assert(function( div ) { |
| | 4022 | div.innerHTML = "<select></select>"; |
| | 4023 | var type = typeof div.lastChild.getAttribute("multiple"); |
| | 4024 | // IE8 returns a string for some attributes even when not present |
| | 4025 | return type !== "boolean" && type !== "string"; |
| | 4026 | }); |
| | 4027 | |
| | 4028 | // Check if getElementsByClassName can be trusted |
| | 4029 | support.getByClassName = assert(function( div ) { |
| | 4030 | // Opera can't find a second classname (in 9.6) |
| | 4031 | div.innerHTML = "<div class='hidden e'></div><div class='hidden'></div>"; |
| | 4032 | if ( !div.getElementsByClassName || !div.getElementsByClassName("e").length ) { |
| | 4033 | return false; |
| | 4034 | } |
| | 4035 | |
| | 4036 | // Safari 3.2 caches class attributes and doesn't catch changes |
| | 4037 | div.lastChild.className = "e"; |
| | 4038 | return div.getElementsByClassName("e").length === 2; |
| | 4039 | }); |
| | 4040 | |
| | 4041 | // Check if getElementById returns elements by name |
| | 4042 | // Check if getElementsByName privileges form controls or returns elements by ID |
| | 4043 | support.getByName = assert(function( div ) { |
| | 4044 | // Inject content |
| | 4045 | div.id = expando + 0; |
| | 4046 | div.innerHTML = "<a name='" + expando + "'></a><div name='" + expando + "'></div>"; |
| | 4047 | docElem.insertBefore( div, docElem.firstChild ); |
| | 4048 | |
| | 4049 | // Test |
| | 4050 | var pass = doc.getElementsByName && |
| | 4051 | // buggy browsers will return fewer than the correct 2 |
| | 4052 | doc.getElementsByName( expando ).length === 2 + |
| | 4053 | // buggy browsers will return more than the correct 0 |
| | 4054 | doc.getElementsByName( expando + 0 ).length; |
| | 4055 | support.getIdNotName = !doc.getElementById( expando ); |
| | 4056 | |
| | 4057 | // Cleanup |
| | 4058 | docElem.removeChild( div ); |
| | 4059 | |
| | 4060 | return pass; |
| | 4061 | }); |
| | 4062 | |
| | 4063 | // IE6/7 return modified attributes |
| | 4064 | Expr.attrHandle = assert(function( div ) { |
| | 4065 | div.innerHTML = "<a href='#'></a>"; |
| | 4066 | return div.firstChild && typeof div.firstChild.getAttribute !== strundefined && |
| | 4067 | div.firstChild.getAttribute("href") === "#"; |
| | 4068 | }) ? |
| | 4069 | {} : |
| | 4070 | { |
| | 4071 | "href": function( elem ) { |
| | 4072 | return elem.getAttribute( "href", 2 ); |
| | 4073 | }, |
| | 4074 | "type": function( elem ) { |
| | 4075 | return elem.getAttribute("type"); |
| | 4076 | } |
| | 4077 | }; |
| | 4078 | |
| | 4079 | // ID find and filter |
| | 4080 | if ( support.getIdNotName ) { |
| | 4081 | Expr.find["ID"] = function( id, context ) { |
| | 4082 | if ( typeof context.getElementById !== strundefined && !documentIsXML ) { |
| | 4083 | var m = context.getElementById( id ); |
| | 4084 | // Check parentNode to catch when Blackberry 4.6 returns |
| | 4085 | // nodes that are no longer in the document #6963 |
| | 4086 | return m && m.parentNode ? [m] : []; |
| | 4087 | } |
| | 4088 | }; |
| | 4089 | Expr.filter["ID"] = function( id ) { |
| | 4090 | var attrId = id.replace( rbackslash, "" ); |
| | 4091 | return function( elem ) { |
| | 4092 | return elem.getAttribute("id") === attrId; |
| | 4093 | }; |
| | 4094 | }; |
| | 4095 | } else { |
| | 4096 | Expr.find["ID"] = function( id, context ) { |
| | 4097 | if ( typeof context.getElementById !== strundefined && !documentIsXML ) { |
| | 4098 | var m = context.getElementById( id ); |
| | 4099 | |
| | 4100 | return m ? |
| | 4101 | m.id === id || typeof m.getAttributeNode !== strundefined && m.getAttributeNode("id").value === id ? |
| | 4102 | [m] : |
| | 4103 | undefined : |
| | 4104 | []; |
| | 4105 | } |
| | 4106 | }; |
| | 4107 | Expr.filter["ID"] = function( id ) { |
| | 4108 | var attrId = id.replace( rbackslash, "" ); |
| | 4109 | return function( elem ) { |
| | 4110 | var node = typeof elem.getAttributeNode !== strundefined && elem.getAttributeNode("id"); |
| | 4111 | return node && node.value === attrId; |
| | 4112 | }; |
| | 4113 | }; |
| | 4114 | } |
| | 4115 | |
| | 4116 | // Tag |
| | 4117 | Expr.find["TAG"] = support.tagNameNoComments ? |
| | 4118 | function( tag, context ) { |
| | 4119 | if ( typeof context.getElementsByTagName !== strundefined ) { |
| | 4120 | return context.getElementsByTagName( tag ); |
| | 4121 | } |
| | 4122 | } : |
| | 4123 | function( tag, context ) { |
| | 4124 | var elem, |
| | 4125 | tmp = [], |
| | 4126 | i = 0, |
| | 4127 | results = context.getElementsByTagName( tag ); |
| | 4128 | |
| | 4129 | // Filter out possible comments |
| | 4130 | if ( tag === "*" ) { |
| | 4131 | for ( ; (elem = results[i]); i++ ) { |
| | 4132 | if ( elem.nodeType === 1 ) { |
| | 4133 | tmp.push( elem ); |
| | 4134 | } |
| | 4135 | } |
| | 4136 | |
| | 4137 | return tmp; |
| | 4138 | } |
| | 4139 | return results; |
| | 4140 | }; |
| | 4141 | |
| | 4142 | // Name |
| | 4143 | Expr.find["NAME"] = support.getByName && function( tag, context ) { |
| | 4144 | if ( typeof context.getElementsByName !== strundefined ) { |
| | 4145 | return context.getElementsByName( name ); |
| | 4146 | } |
| | 4147 | }; |
| | 4148 | |
| | 4149 | // Class |
| | 4150 | Expr.find["CLASS"] = support.getByClassName && function( className, context ) { |
| | 4151 | if ( typeof context.getElementsByClassName !== strundefined && !documentIsXML ) { |
| | 4152 | return context.getElementsByClassName( className ); |
| | 4153 | } |
| | 4154 | }; |
| | 4155 | |
| | 4156 | // QSA and matchesSelector support |
| | 4157 | |
| | 4158 | // matchesSelector(:active) reports false when true (IE9/Opera 11.5) |
| | 4159 | rbuggyMatches = []; |
| | 4160 | |
| | 4161 | // qSa(:focus) reports false when true (Chrome 21), |
| | 4162 | // no need to also add to buggyMatches since matches checks buggyQSA |
| | 4163 | // A support test would require too much code (would include document ready) |
| | 4164 | rbuggyQSA = [ ":focus" ]; |
| | 4165 | |
| | 4166 | if ( (support.qsa = isNative(doc.querySelectorAll)) ) { |
| | 4167 | // Build QSA regex |
| | 4168 | // Regex strategy adopted from Diego Perini |
| | 4169 | assert(function( div ) { |
| | 4170 | // Select is set to empty string on purpose |
| | 4171 | // This is to test IE's treatment of not explictly |
| | 4172 | // setting a boolean content attribute, |
| | 4173 | // since its presence should be enough |
| | 4174 | // http://bugs.jquery.com/ticket/12359 |
| | 4175 | div.innerHTML = "<select><option selected=''></option></select>"; |
| | 4176 | |
| | 4177 | // IE8 - Some boolean attributes are not treated correctly |
| | 4178 | if ( !div.querySelectorAll("[selected]").length ) { |
| | 4179 | rbuggyQSA.push( "\\[" + whitespace + "*(?:checked|disabled|ismap|multiple|readonly|selected|value)" ); |
| | 4180 | } |
| | 4181 | |
| | 4182 | // Webkit/Opera - :checked should return selected option elements |
| | 4183 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
| | 4184 | // IE8 throws error here and will not see later tests |
| | 4185 | if ( !div.querySelectorAll(":checked").length ) { |
| | 4186 | rbuggyQSA.push(":checked"); |
| | 4187 | } |
| | 4188 | }); |
| | 4189 | |
| | 4190 | assert(function( div ) { |
| | 4191 | |
| | 4192 | // Opera 10-12/IE9 - ^= $= *= and empty values |
| | 4193 | // Should not select anything |
| | 4194 | div.innerHTML = "<p test=''></p>"; |
| | 4195 | if ( div.querySelectorAll("[test^='']").length ) { |
| | 4196 | rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:\"\"|'')" ); |
| | 4197 | } |
| | 4198 | |
| | 4199 | // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) |
| | 4200 | // IE8 throws error here and will not see later tests |
| | 4201 | div.innerHTML = "<input type='hidden'/>"; |
| | 4202 | if ( !div.querySelectorAll(":enabled").length ) { |
| | 4203 | rbuggyQSA.push( ":enabled", ":disabled" ); |
| | 4204 | } |
| | 4205 | |
| | 4206 | // Opera 10-11 does not throw on post-comma invalid pseudos |
| | 4207 | div.querySelectorAll("*,:x"); |
| | 4208 | rbuggyQSA.push(",.*:"); |
| | 4209 | }); |
| | 4210 | } |
| | 4211 | |
| | 4212 | if ( (support.matchesSelector = isNative( (matches = docElem.matchesSelector || |
| | 4213 | docElem.mozMatchesSelector || |
| | 4214 | docElem.webkitMatchesSelector || |
| | 4215 | docElem.oMatchesSelector || |
| | 4216 | docElem.msMatchesSelector) )) ) { |
| | 4217 | |
| | 4218 | assert(function( div ) { |
| | 4219 | // Check to see if it's possible to do matchesSelector |
| | 4220 | // on a disconnected node (IE 9) |
| | 4221 | support.disconnectedMatch = matches.call( div, "div" ); |
| | 4222 | |
| | 4223 | // This should fail with an exception |
| | 4224 | // Gecko does not error, returns false instead |
| | 4225 | matches.call( div, "[test!='']:x" ); |
| | 4226 | rbuggyMatches.push( "!=", pseudos ); |
| | 4227 | }); |
| | 4228 | } |
| | 4229 | |
| | 4230 | rbuggyQSA = new RegExp( rbuggyQSA.join("|") ); |
| | 4231 | rbuggyMatches = new RegExp( rbuggyMatches.join("|") ); |
| | 4232 | |
| | 4233 | // Element contains another |
| | 4234 | // Purposefully does not implement inclusive descendent |
| | 4235 | // As in, an element does not contain itself |
| | 4236 | contains = isNative(docElem.contains) || docElem.compareDocumentPosition ? |
| | 4237 | function( a, b ) { |
| | 4238 | var adown = a.nodeType === 9 ? a.documentElement : a, |
| | 4239 | bup = b && b.parentNode; |
| | 4240 | return a === bup || !!( bup && bup.nodeType === 1 && ( |
| | 4241 | adown.contains ? |
| | 4242 | adown.contains( bup ) : |
| | 4243 | a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 |
| | 4244 | )); |
| | 4245 | } : |
| | 4246 | function( a, b ) { |
| | 4247 | if ( b ) { |
| | 4248 | while ( (b = b.parentNode) ) { |
| | 4249 | if ( b === a ) { |
| | 4250 | return true; |
| | 4251 | } |
| | 4252 | } |
| | 4253 | } |
| | 4254 | return false; |
| | 4255 | }; |
| | 4256 | |
| | 4257 | // Document order sorting |
| | 4258 | sortOrder = docElem.compareDocumentPosition ? |
| | 4259 | function( a, b ) { |
| | 4260 | var compare; |
| | 4261 | |
| | 4262 | if ( a === b ) { |
| | 4263 | hasDuplicate = true; |
| | 4264 | return 0; |
| | 4265 | } |
| | 4266 | |
| | 4267 | if ( (compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b )) ) { |
| | 4268 | if ( compare & 1 || a.parentNode && a.parentNode.nodeType === 11 ) { |
| | 4269 | if ( a === doc || contains( preferredDoc, a ) ) { |
| | 4270 | return -1; |
| | 4271 | } |
| | 4272 | if ( b === doc || contains( preferredDoc, b ) ) { |
| | 4273 | return 1; |
| | 4274 | } |
| | 4275 | return 0; |
| | 4276 | } |
| | 4277 | return compare & 4 ? -1 : 1; |
| | 4278 | } |
| | 4279 | |
| | 4280 | return a.compareDocumentPosition ? -1 : 1; |
| | 4281 | } : |
| | 4282 | function( a, b ) { |
| | 4283 | var cur, |
| | 4284 | i = 0, |
| | 4285 | aup = a.parentNode, |
| | 4286 | bup = b.parentNode, |
| | 4287 | ap = [ a ], |
| | 4288 | bp = [ b ]; |
| | 4289 | |
| | 4290 | // The nodes are identical, we can exit early |
| | 4291 | if ( a === b ) { |
| | 4292 | hasDuplicate = true; |
| | 4293 | return 0; |
| | 4294 | |
| | 4295 | // Fallback to using sourceIndex (in IE) if it's available on both nodes |
| | 4296 | } else if ( a.sourceIndex && b.sourceIndex ) { |
| | 4297 | return ( ~b.sourceIndex || MAX_NEGATIVE ) - ( contains( preferredDoc, a ) && ~a.sourceIndex || MAX_NEGATIVE ); |
| | 4298 | |
| | 4299 | // Parentless nodes are either documents or disconnected |
| | 4300 | } else if ( !aup || !bup ) { |
| | 4301 | return a === doc ? -1 : |
| | 4302 | b === doc ? 1 : |
| | 4303 | aup ? -1 : |
| | 4304 | bup ? 1 : |
| | 4305 | 0; |
| | 4306 | |
| | 4307 | // If the nodes are siblings, we can do a quick check |
| | 4308 | } else if ( aup === bup ) { |
| | 4309 | return siblingCheck( a, b ); |
| | 4310 | } |
| | 4311 | |
| | 4312 | // Otherwise we need full lists of their ancestors for comparison |
| | 4313 | cur = a; |
| | 4314 | while ( (cur = cur.parentNode) ) { |
| | 4315 | ap.unshift( cur ); |
| | 4316 | } |
| | 4317 | cur = b; |
| | 4318 | while ( (cur = cur.parentNode) ) { |
| | 4319 | bp.unshift( cur ); |
| | 4320 | } |
| | 4321 | |
| | 4322 | // Walk down the tree looking for a discrepancy |
| | 4323 | while ( ap[i] === bp[i] ) { |
| | 4324 | i++; |
| | 4325 | } |
| | 4326 | |
| | 4327 | return i ? |
| | 4328 | // Do a sibling check if the nodes have a common ancestor |
| | 4329 | siblingCheck( ap[i], bp[i] ) : |
| | 4330 | |
| | 4331 | // Otherwise nodes in our document sort first |
| | 4332 | ap[i] === preferredDoc ? -1 : |
| | 4333 | bp[i] === preferredDoc ? 1 : |
| | 4334 | 0; |
| | 4335 | }; |
| | 4336 | |
| | 4337 | // Always assume the presence of duplicates if sort doesn't |
| | 4338 | // pass them to our comparison function (as in Google Chrome). |
| | 4339 | hasDuplicate = false; |
| | 4340 | [0, 0].sort( sortOrder ); |
| | 4341 | support.detectDuplicates = hasDuplicate; |
| | 4342 | |
| | 4343 | return document; |
| | 4344 | }; |
| | 4345 | |
| | 4346 | Sizzle.matches = function( expr, elements ) { |
| | 4347 | return Sizzle( expr, window.document, null, elements ); |
| | 4348 | }; |
| | 4349 | |
| | 4350 | Sizzle.matchesSelector = function( elem, expr ) { |
| | 4351 | // Set document vars if needed |
| | 4352 | if ( elem && (( elem.ownerDocument || elem ) !== document) ) { |
| | 4353 | setDocument( elem ); |
| | 4354 | } |
| | 4355 | |
| | 4356 | // Make sure that attribute selectors are quoted |
| | 4357 | expr = expr.replace( rattributeQuotes, "='$1']" ); |
| | 4358 | |
| | 4359 | // rbuggyQSA always contains :focus, so no need for an existence check |
| | 4360 | if ( support.matchesSelector && !documentIsXML && (!rbuggyMatches || !rbuggyMatches.test(expr)) && !rbuggyQSA.test(expr) ) { |
| | 4361 | try { |
| | 4362 | var ret = matches.call( elem, expr ); |
| | 4363 | |
| | 4364 | // IE 9's matchesSelector returns false on disconnected nodes |
| | 4365 | if ( ret || support.disconnectedMatch || |
| | 4366 | // As well, disconnected nodes are said to be in a document |
| | 4367 | // fragment in IE 9 |
| | 4368 | elem.document && elem.document.nodeType !== 11 ) { |
| | 4369 | return ret; |
| | 4370 | } |
| | 4371 | } catch(e) {} |
| | 4372 | } |
| | 4373 | |
| | 4374 | return Sizzle( expr, document, null, [elem] ).length > 0; |
| | 4375 | }; |
| | 4376 | |
| | 4377 | Sizzle.contains = function( context, elem ) { |
| | 4378 | // Set document vars if needed |
| | 4379 | if ( context && (( context.ownerDocument || context ) !== document) ) { |
| | 4380 | setDocument( context ); |
| | 4381 | } |
| | 4382 | return contains( context, elem ); |
| | 4383 | }; |
| | 4384 | |
| | 4385 | Sizzle.attr = function( elem, name ) { |
| | 4386 | var val; |
| | 4387 | |
| | 4388 | // Set document vars if needed |
| | 4389 | if ( elem && (( elem.ownerDocument || elem ) !== document) ) { |
| | 4390 | setDocument( elem ); |
| | 4391 | } |
| | 4392 | |
| | 4393 | if ( !documentIsXML ) { |
| | 4394 | name = name.toLowerCase(); |
| | 4395 | } |
| | 4396 | if ( (val = Expr.attrHandle[ name ]) ) { |
| | 4397 | return val( elem ); |
| | 4398 | } |
| | 4399 | if ( documentIsXML || support.attributes ) { |
| | 4400 | return elem.getAttribute( name ); |
| | 4401 | } |
| | 4402 | return ( (val = elem.getAttributeNode( name )) || elem.getAttribute( name ) ) && elem[ name ] === true ? |
| | 4403 | name : |
| | 4404 | val && val.specified ? val.value : null; |
| | 4405 | }; |
| | 4406 | |
| | 4407 | Sizzle.error = function( msg ) { |
| | 4408 | throw new Error( "Syntax error, unrecognized expression: " + msg ); |
| | 4409 | }; |
| | 4410 | |
| | 4411 | // Document sorting and removing duplicates |
| | 4412 | Sizzle.uniqueSort = function( results ) { |
| | 4413 | var elem, |
| | 4414 | duplicates = [], |
| | 4415 | i = 1, |
| | 4416 | j = 0; |
| | 4417 | |
| | 4418 | // Unless we *know* we can detect duplicates, assume their presence |
| | 4419 | hasDuplicate = !support.detectDuplicates; |
| | 4420 | results.sort( sortOrder ); |
| | 4421 | |
| | 4422 | if ( hasDuplicate ) { |
| | 4423 | for ( ; (elem = results[i]); i++ ) { |
| | 4424 | if ( elem === results[ i - 1 ] ) { |
| | 4425 | j = duplicates.push( i ); |
| | 4426 | } |
| | 4427 | } |
| | 4428 | while ( j-- ) { |
| | 4429 | results.splice( duplicates[ j ], 1 ); |
| | 4430 | } |
| | 4431 | } |
| | 4432 | |
| | 4433 | return results; |
| | 4434 | }; |
| | 4435 | |
| | 4436 | function siblingCheck( a, b ) { |
| | 4437 | var cur = a && b && a.nextSibling; |
| | 4438 | |
| | 4439 | for ( ; cur; cur = cur.nextSibling ) { |
| | 4440 | if ( cur === b ) { |
| | 4441 | return -1; |
| | 4442 | } |
| | 4443 | } |
| | 4444 | |
| | 4445 | return a ? 1 : -1; |
| | 4446 | } |
| | 4447 | |
| | 4448 | // Returns a function to use in pseudos for input types |
| | 4449 | function createInputPseudo( type ) { |
| | 4450 | return function( elem ) { |
| | 4451 | var name = elem.nodeName.toLowerCase(); |
| | 4452 | return name === "input" && elem.type === type; |
| | 4453 | }; |
| | 4454 | } |
| | 4455 | |
| | 4456 | // Returns a function to use in pseudos for buttons |
| | 4457 | function createButtonPseudo( type ) { |
| | 4458 | return function( elem ) { |
| | 4459 | var name = elem.nodeName.toLowerCase(); |
| | 4460 | return (name === "input" || name === "button") && elem.type === type; |
| | 4461 | }; |
| | 4462 | } |
| | 4463 | |
| | 4464 | // Returns a function to use in pseudos for positionals |
| | 4465 | function createPositionalPseudo( fn ) { |
| | 4466 | return markFunction(function( argument ) { |
| | 4467 | argument = +argument; |
| | 4468 | return markFunction(function( seed, matches ) { |
| | 4469 | var j, |
| | 4470 | matchIndexes = fn( [], seed.length, argument ), |
| | 4471 | i = matchIndexes.length; |
| | 4472 | |
| | 4473 | // Match elements found at the specified indexes |
| | 4474 | while ( i-- ) { |
| | 4475 | if ( seed[ (j = matchIndexes[i]) ] ) { |
| | 4476 | seed[j] = !(matches[j] = seed[j]); |
| | 4477 | } |
| | 4478 | } |
| | 4479 | }); |
| | 4480 | }); |
| | 4481 | } |
| | 4482 | |
| | 4483 | /** |
| | 4484 | * Utility function for retrieving the text value of an array of DOM nodes |
| | 4485 | * @param {Array|Element} elem |
| | 4486 | */ |
| | 4487 | getText = Sizzle.getText = function( elem ) { |
| | 4488 | var node, |
| | 4489 | ret = "", |
| | 4490 | i = 0, |
| | 4491 | nodeType = elem.nodeType; |
| | 4492 | |
| | 4493 | if ( !nodeType ) { |
| | 4494 | // If no nodeType, this is expected to be an array |
| | 4495 | for ( ; (node = elem[i]); i++ ) { |
| | 4496 | // Do not traverse comment nodes |
| | 4497 | ret += getText( node ); |
| | 4498 | } |
| | 4499 | } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { |
| | 4500 | // Use textContent for elements |
| | 4501 | // innerText usage removed for consistency of new lines (see #11153) |
| | 4502 | if ( typeof elem.textContent === "string" ) { |
| | 4503 | return elem.textContent; |
| | 4504 | } else { |
| | 4505 | // Traverse its children |
| | 4506 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
| | 4507 | ret += getText( elem ); |
| | 4508 | } |
| | 4509 | } |
| | 4510 | } else if ( nodeType === 3 || nodeType === 4 ) { |
| | 4511 | return elem.nodeValue; |
| | 4512 | } |
| | 4513 | // Do not include comment or processing instruction nodes |
| | 4514 | |
| | 4515 | return ret; |
| | 4516 | }; |
| | 4517 | |
| | 4518 | Expr = Sizzle.selectors = { |
| | 4519 | |
| | 4520 | // Can be adjusted by the user |
| | 4521 | cacheLength: 50, |
| | 4522 | |
| | 4523 | createPseudo: markFunction, |
| | 4524 | |
| | 4525 | match: matchExpr, |
| | 4526 | |
| | 4527 | find: {}, |
| | 4528 | |
| | 4529 | relative: { |
| | 4530 | ">": { dir: "parentNode", first: true }, |
| | 4531 | " ": { dir: "parentNode" }, |
| | 4532 | "+": { dir: "previousSibling", first: true }, |
| | 4533 | "~": { dir: "previousSibling" } |
| | 4534 | }, |
| | 4535 | |
| | 4536 | preFilter: { |
| | 4537 | "ATTR": function( match ) { |
| | 4538 | match[1] = match[1].replace( rbackslash, "" ); |
| | 4539 | |
| | 4540 | // Move the given value to match[3] whether quoted or unquoted |
| | 4541 | match[3] = ( match[4] || match[5] || "" ).replace( rbackslash, "" ); |
| | 4542 | |
| | 4543 | if ( match[2] === "~=" ) { |
| | 4544 | match[3] = " " + match[3] + " "; |
| | 4545 | } |
| | 4546 | |
| | 4547 | return match.slice( 0, 4 ); |
| | 4548 | }, |
| | 4549 | |
| | 4550 | "CHILD": function( match ) { |
| | 4551 | /* matches from matchExpr["CHILD"] |
| | 4552 | 1 type (only|nth|...) |
| | 4553 | 2 what (child|of-type) |
| | 4554 | 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) |
| | 4555 | 4 xn-component of xn+y argument ([+-]?\d*n|) |
| | 4556 | 5 sign of xn-component |
| | 4557 | 6 x of xn-component |
| | 4558 | 7 sign of y-component |
| | 4559 | 8 y of y-component |
| | 4560 | */ |
| | 4561 | match[1] = match[1].toLowerCase(); |
| | 4562 | |
| | 4563 | if ( match[1].slice( 0, 3 ) === "nth" ) { |
| | 4564 | // nth-* requires argument |
| | 4565 | if ( !match[3] ) { |
| | 4566 | Sizzle.error( match[0] ); |
| | 4567 | } |
| | 4568 | |
| | 4569 | // numeric x and y parameters for Expr.filter.CHILD |
| | 4570 | // remember that false/true cast respectively to 0/1 |
| | 4571 | match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); |
| | 4572 | match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); |
| | 4573 | |
| | 4574 | // other types prohibit arguments |
| | 4575 | } else if ( match[3] ) { |
| | 4576 | Sizzle.error( match[0] ); |
| | 4577 | } |
| | 4578 | |
| | 4579 | return match; |
| | 4580 | }, |
| | 4581 | |
| | 4582 | "PSEUDO": function( match ) { |
| | 4583 | var excess, |
| | 4584 | unquoted = !match[5] && match[2]; |
| | 4585 | |
| | 4586 | if ( matchExpr["CHILD"].test( match[0] ) ) { |
| | 4587 | return null; |
| | 4588 | } |
| | 4589 | |
| | 4590 | // Accept quoted arguments as-is |
| | 4591 | if ( match[4] ) { |
| | 4592 | match[2] = match[4]; |
| | 4593 | |
| | 4594 | // Strip excess characters from unquoted arguments |
| | 4595 | } else if ( unquoted && rpseudo.test( unquoted ) && |
| | 4596 | // Get excess from tokenize (recursively) |
| | 4597 | (excess = tokenize( unquoted, true )) && |
| | 4598 | // advance to the next closing parenthesis |
| | 4599 | (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { |
| | 4600 | |
| | 4601 | // excess is a negative index |
| | 4602 | match[0] = match[0].slice( 0, excess ); |
| | 4603 | match[2] = unquoted.slice( 0, excess ); |
| | 4604 | } |
| | 4605 | |
| | 4606 | // Return only captures needed by the pseudo filter method (type and argument) |
| | 4607 | return match.slice( 0, 3 ); |
| | 4608 | } |
| | 4609 | }, |
| | 4610 | |
| | 4611 | filter: { |
| | 4612 | |
| | 4613 | "TAG": function( nodeName ) { |
| | 4614 | if ( nodeName === "*" ) { |
| | 4615 | return function() { return true; }; |
| | 4616 | } |
| | 4617 | |
| | 4618 | nodeName = nodeName.replace( rbackslash, "" ).toLowerCase(); |
| | 4619 | return function( elem ) { |
| | 4620 | return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; |
| | 4621 | }; |
| | 4622 | }, |
| | 4623 | |
| | 4624 | "CLASS": function( className ) { |
| | 4625 | var pattern = classCache[ expando ][ className + " " ]; |
| | 4626 | |
| | 4627 | return pattern || |
| | 4628 | (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && |
| | 4629 | classCache( className, function( elem ) { |
| | 4630 | return pattern.test( elem.className || (typeof elem.getAttribute !== strundefined && elem.getAttribute("class")) || "" ); |
| | 4631 | }); |
| | 4632 | }, |
| | 4633 | |
| | 4634 | "ATTR": function( name, operator, check ) { |
| | 4635 | return function( elem ) { |
| | 4636 | var result = Sizzle.attr( elem, name ); |
| | 4637 | |
| | 4638 | if ( result == null ) { |
| | 4639 | return operator === "!="; |
| | 4640 | } |
| | 4641 | if ( !operator ) { |
| | 4642 | return true; |
| | 4643 | } |
| | 4644 | |
| | 4645 | result += ""; |
| | 4646 | |
| | 4647 | return operator === "=" ? result === check : |
| | 4648 | operator === "!=" ? result !== check : |
| | 4649 | operator === "^=" ? check && result.indexOf( check ) === 0 : |
| | 4650 | operator === "*=" ? check && result.indexOf( check ) > -1 : |
| | 4651 | operator === "$=" ? check && result.substr( result.length - check.length ) === check : |
| | 4652 | operator === "~=" ? ( " " + result + " " ).indexOf( check ) > -1 : |
| | 4653 | operator === "|=" ? result === check || result.substr( 0, check.length + 1 ) === check + "-" : |
| | 4654 | false; |
| | 4655 | }; |
| | 4656 | }, |
| | 4657 | |
| | 4658 | "CHILD": function( type, what, argument, first, last ) { |
| | 4659 | var simple = type.slice( 0, 3 ) !== "nth", |
| | 4660 | forward = type.slice( -4 ) !== "last", |
| | 4661 | ofType = what === "of-type"; |
| | 4662 | |
| | 4663 | return first === 1 && last === 0 ? |
| | 4664 | |
| | 4665 | // Shortcut for :nth-*(n) |
| | 4666 | function( elem ) { |
| | 4667 | return !!elem.parentNode; |
| | 4668 | } : |
| | 4669 | |
| | 4670 | function( elem, context, xml ) { |
| | 4671 | var cache, outerCache, node, diff, nodeIndex, start, |
| | 4672 | dir = simple !== forward ? "nextSibling" : "previousSibling", |
| | 4673 | parent = elem.parentNode, |
| | 4674 | name = ofType && elem.nodeName.toLowerCase(), |
| | 4675 | useCache = !xml && !ofType; |
| | 4676 | |
| | 4677 | if ( parent ) { |
| | 4678 | |
| | 4679 | // :(first|last|only)-(child|of-type) |
| | 4680 | if ( simple ) { |
| | 4681 | while ( dir ) { |
| | 4682 | node = elem; |
| | 4683 | while ( (node = node[ dir ]) ) { |
| | 4684 | if ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) { |
| | 4685 | return false; |
| | 4686 | } |
| | 4687 | } |
| | 4688 | // Reverse direction for :only-* (if we haven't yet done so) |
| | 4689 | start = dir = type === "only" && !start && "nextSibling"; |
| | 4690 | } |
| | 4691 | return true; |
| | 4692 | } |
| | 4693 | |
| | 4694 | start = [ forward ? parent.firstChild : parent.lastChild ]; |
| | 4695 | |
| | 4696 | // non-xml :nth-child(...) stores cache data on `parent` |
| | 4697 | if ( forward && useCache ) { |
| | 4698 | // Seek `elem` from a previously-cached index |
| | 4699 | outerCache = parent[ expando ] || (parent[ expando ] = {}); |
| | 4700 | cache = outerCache[ type ] || []; |
| | 4701 | nodeIndex = cache[0] === dirruns && cache[1]; |
| | 4702 | diff = cache[0] === dirruns && cache[2]; |
| | 4703 | node = nodeIndex && parent.childNodes[ nodeIndex ]; |
| | 4704 | |
| | 4705 | while ( (node = ++nodeIndex && node && node[ dir ] || |
| | 4706 | |
| | 4707 | // Fallback to seeking `elem` from the start |
| | 4708 | (diff = nodeIndex = 0) || start.pop()) ) { |
| | 4709 | |
| | 4710 | // When found, cache indexes on `parent` and break |
| | 4711 | if ( node.nodeType === 1 && ++diff && node === elem ) { |
| | 4712 | outerCache[ type ] = [ dirruns, nodeIndex, diff ]; |
| | 4713 | break; |
| | 4714 | } |
| | 4715 | } |
| | 4716 | |
| | 4717 | // Use previously-cached element index if available |
| | 4718 | } else if ( useCache && (cache = (elem[ expando ] || (elem[ expando ] = {}))[ type ]) && cache[0] === dirruns ) { |
| | 4719 | diff = cache[1]; |
| | 4720 | |
| | 4721 | // xml :nth-child(...) or :nth-last-child(...) or :nth(-last)?-of-type(...) |
| | 4722 | } else { |
| | 4723 | // Use the same loop as above to seek `elem` from the start |
| | 4724 | while ( (node = ++nodeIndex && node && node[ dir ] || |
| | 4725 | (diff = nodeIndex = 0) || start.pop()) ) { |
| | 4726 | |
| | 4727 | if ( ( ofType ? node.nodeName.toLowerCase() === name : node.nodeType === 1 ) && ++diff ) { |
| | 4728 | // Cache the index of each encountered element |
| | 4729 | if ( useCache ) { |
| | 4730 | (node[ expando ] || (node[ expando ] = {}))[ type ] = [ dirruns, diff ]; |
| | 4731 | } |
| | 4732 | |
| | 4733 | if ( node === elem ) { |
| | 4734 | break; |
| | 4735 | } |
| | 4736 | } |
| | 4737 | } |
| | 4738 | } |
| | 4739 | |
| | 4740 | // Incorporate the offset, then check against cycle size |
| | 4741 | diff -= last; |
| | 4742 | return diff === first || ( diff % first === 0 && diff / first >= 0 ); |
| | 4743 | } |
| | 4744 | }; |
| | 4745 | }, |
| | 4746 | |
| | 4747 | "PSEUDO": function( pseudo, argument ) { |
| | 4748 | // pseudo-class names are case-insensitive |
| | 4749 | // http://www.w3.org/TR/selectors/#pseudo-classes |
| | 4750 | // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters |
| | 4751 | // Remember that setFilters inherits from pseudos |
| | 4752 | var args, |
| | 4753 | fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || |
| | 4754 | Sizzle.error( "unsupported pseudo: " + pseudo ); |
| | 4755 | |
| | 4756 | // The user may use createPseudo to indicate that |
| | 4757 | // arguments are needed to create the filter function |
| | 4758 | // just as Sizzle does |
| | 4759 | if ( fn[ expando ] ) { |
| | 4760 | return fn( argument ); |
| | 4761 | } |
| | 4762 | |
| | 4763 | // But maintain support for old signatures |
| | 4764 | if ( fn.length > 1 ) { |
| | 4765 | args = [ pseudo, pseudo, "", argument ]; |
| | 4766 | return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? |
| | 4767 | markFunction(function( seed, matches ) { |
| | 4768 | var idx, |
| | 4769 | matched = fn( seed, argument ), |
| | 4770 | i = matched.length; |
| | 4771 | while ( i-- ) { |
| | 4772 | idx = indexOf.call( seed, matched[i] ); |
| | 4773 | seed[ idx ] = !( matches[ idx ] = matched[i] ); |
| | 4774 | } |
| | 4775 | }) : |
| | 4776 | function( elem ) { |
| | 4777 | return fn( elem, 0, args ); |
| | 4778 | }; |
| | 4779 | } |
| | 4780 | |
| | 4781 | return fn; |
| | 4782 | } |
| | 4783 | }, |
| | 4784 | |
| | 4785 | pseudos: { |
| | 4786 | // Potentially complex pseudos |
| | 4787 | "not": markFunction(function( selector ) { |
| | 4788 | // Trim the selector passed to compile |
| | 4789 | // to avoid treating leading and trailing |
| | 4790 | // spaces as combinators |
| | 4791 | var input = [], |
| | 4792 | results = [], |
| | 4793 | matcher = compile( selector.replace( rtrim, "$1" ) ); |
| | 4794 | |
| | 4795 | return matcher[ expando ] ? |
| | 4796 | markFunction(function( seed, matches, context, xml ) { |
| | 4797 | var elem, |
| | 4798 | unmatched = matcher( seed, null, xml, [] ), |
| | 4799 | i = seed.length; |
| | 4800 | |
| | 4801 | // Match elements unmatched by `matcher` |
| | 4802 | while ( i-- ) { |
| | 4803 | if ( (elem = unmatched[i]) ) { |
| | 4804 | seed[i] = !(matches[i] = elem); |
| | 4805 | } |
| | 4806 | } |
| | 4807 | }) : |
| | 4808 | function( elem, context, xml ) { |
| | 4809 | input[0] = elem; |
| | 4810 | matcher( input, null, xml, results ); |
| | 4811 | return !results.pop(); |
| | 4812 | }; |
| | 4813 | }), |
| | 4814 | |
| | 4815 | "has": markFunction(function( selector ) { |
| | 4816 | return function( elem ) { |
| | 4817 | return Sizzle( selector, elem ).length > 0; |
| | 4818 | }; |
| | 4819 | }), |
| | 4820 | |
| | 4821 | "contains": markFunction(function( text ) { |
| | 4822 | return function( elem ) { |
| | 4823 | return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; |
| | 4824 | }; |
| | 4825 | }), |
| | 4826 | |
| | 4827 | // Miscellaneous |
| | 4828 | "target": function( elem ) { |
| | 4829 | var hash = window.location && window.location.hash; |
| | 4830 | return hash && hash.slice( 1 ) === elem.id; |
| | 4831 | }, |
| | 4832 | |
| | 4833 | "root": function( elem ) { |
| | 4834 | return elem === docElem; |
| | 4835 | }, |
| | 4836 | |
| | 4837 | "focus": function( elem ) { |
| | 4838 | return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); |
| | 4839 | }, |
| | 4840 | |
| | 4841 | // Boolean properties |
| | 4842 | "enabled": function( elem ) { |
| | 4843 | return elem.disabled === false; |
| | 4844 | }, |
| | 4845 | |
| | 4846 | "disabled": function( elem ) { |
| | 4847 | return elem.disabled === true; |
| | 4848 | }, |
| | 4849 | |
| | 4850 | "checked": function( elem ) { |
| | 4851 | // In CSS3, :checked should return both checked and selected elements |
| | 4852 | // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked |
| | 4853 | var nodeName = elem.nodeName.toLowerCase(); |
| | 4854 | return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); |
| | 4855 | }, |
| | 4856 | |
| | 4857 | "selected": function( elem ) { |
| | 4858 | // Accessing this property makes selected-by-default |
| | 4859 | // options in Safari work properly |
| | 4860 | if ( elem.parentNode ) { |
| | 4861 | elem.parentNode.selectedIndex; |
| | 4862 | } |
| | 4863 | |
| | 4864 | return elem.selected === true; |
| | 4865 | }, |
| | 4866 | |
| | 4867 | // Contents |
| | 4868 | "empty": function( elem ) { |
| | 4869 | // http://www.w3.org/TR/selectors/#empty-pseudo |
| | 4870 | // :empty is only affected by element nodes and content nodes(including text(3), cdata(4)), |
| | 4871 | // not comment, processing instructions, or others |
| | 4872 | // Thanks to Diego Perini for the nodeName shortcut |
| | 4873 | // Greater than "@" means alpha characters (specifically not starting with "#" or "?") |
| | 4874 | for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { |
| | 4875 | if ( elem.nodeName > "@" || elem.nodeType === 3 || elem.nodeType === 4 ) { |
| | 4876 | return false; |
| | 4877 | } |
| | 4878 | } |
| | 4879 | return true; |
| | 4880 | }, |
| | 4881 | |
| | 4882 | "parent": function( elem ) { |
| | 4883 | return !Expr.pseudos["empty"]( elem ); |
| | 4884 | }, |
| | 4885 | |
| | 4886 | // Element/input types |
| | 4887 | "header": function( elem ) { |
| | 4888 | return rheader.test( elem.nodeName ); |
| | 4889 | }, |
| | 4890 | |
| | 4891 | "input": function( elem ) { |
| | 4892 | return rinputs.test( elem.nodeName ); |
| | 4893 | }, |
| | 4894 | |
| | 4895 | "button": function( elem ) { |
| | 4896 | var name = elem.nodeName.toLowerCase(); |
| | 4897 | return name === "input" && elem.type === "button" || name === "button"; |
| | 4898 | }, |
| | 4899 | |
| | 4900 | "text": function( elem ) { |
| | 4901 | var attr; |
| | 4902 | // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) |
| | 4903 | // use getAttribute instead to test this case |
| | 4904 | return elem.nodeName.toLowerCase() === "input" && |
| | 4905 | elem.type === "text" && |
| | 4906 | ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === elem.type ); |
| | 4907 | }, |
| | 4908 | |
| | 4909 | // Position-in-collection |
| | 4910 | "first": createPositionalPseudo(function() { |
| | 4911 | return [ 0 ]; |
| | 4912 | }), |
| | 4913 | |
| | 4914 | "last": createPositionalPseudo(function( matchIndexes, length ) { |
| | 4915 | return [ length - 1 ]; |
| | 4916 | }), |
| | 4917 | |
| | 4918 | "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { |
| | 4919 | return [ argument < 0 ? argument + length : argument ]; |
| | 4920 | }), |
| | 4921 | |
| | 4922 | "even": createPositionalPseudo(function( matchIndexes, length ) { |
| | 4923 | var i = 0; |
| | 4924 | for ( ; i < length; i += 2 ) { |
| | 4925 | matchIndexes.push( i ); |
| | 4926 | } |
| | 4927 | return matchIndexes; |
| | 4928 | }), |
| | 4929 | |
| | 4930 | "odd": createPositionalPseudo(function( matchIndexes, length ) { |
| | 4931 | var i = 1; |
| | 4932 | for ( ; i < length; i += 2 ) { |
| | 4933 | matchIndexes.push( i ); |
| | 4934 | } |
| | 4935 | return matchIndexes; |
| | 4936 | }), |
| | 4937 | |
| | 4938 | "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
| | 4939 | var i = argument < 0 ? argument + length : argument; |
| | 4940 | for ( ; --i >= 0; ) { |
| | 4941 | matchIndexes.push( i ); |
| | 4942 | } |
| | 4943 | return matchIndexes; |
| | 4944 | }), |
| | 4945 | |
| | 4946 | "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { |
| | 4947 | var i = argument < 0 ? argument + length : argument; |
| | 4948 | for ( ; ++i < length; ) { |
| | 4949 | matchIndexes.push( i ); |
| | 4950 | } |
| | 4951 | return matchIndexes; |
| | 4952 | }) |
| | 4953 | } |
| | 4954 | }; |
| | 4955 | |
| | 4956 | // Add button/input type pseudos |
| | 4957 | for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { |
| | 4958 | Expr.pseudos[ i ] = createInputPseudo( i ); |
| | 4959 | } |
| | 4960 | for ( i in { submit: true, reset: true } ) { |
| | 4961 | Expr.pseudos[ i ] = createButtonPseudo( i ); |
| | 4962 | } |
| | 4963 | |
| | 4964 | function tokenize( selector, parseOnly ) { |
| | 4965 | var matched, match, tokens, type, |
| | 4966 | soFar, groups, preFilters, |
| | 4967 | cached = tokenCache[ expando ][ selector + " " ]; |
| | 4968 | |
| | 4969 | if ( cached ) { |
| | 4970 | return parseOnly ? 0 : cached.slice( 0 ); |
| | 4971 | } |
| | 4972 | |
| | 4973 | soFar = selector; |
| | 4974 | groups = []; |
| | 4975 | preFilters = Expr.preFilter; |
| | 4976 | |
| | 4977 | while ( soFar ) { |
| | 4978 | |
| | 4979 | // Comma and first run |
| | 4980 | if ( !matched || (match = rcomma.exec( soFar )) ) { |
| | 4981 | if ( match ) { |
| | 4982 | // Don't consume trailing commas as valid |
| | 4983 | soFar = soFar.slice( match[0].length ) || soFar; |
| | 4984 | } |
| | 4985 | groups.push( tokens = [] ); |
| | 4986 | } |
| | 4987 | |
| | 4988 | matched = false; |
| | 4989 | |
| | 4990 | // Combinators |
| | 4991 | if ( (match = rcombinators.exec( soFar )) ) { |
| | 4992 | tokens.push( matched = new Token( match.shift() ) ); |
| | 4993 | soFar = soFar.slice( matched.length ); |
| | 4994 | |
| | 4995 | // Cast descendant combinators to space |
| | 4996 | matched.type = match[0].replace( rtrim, " " ); |
| | 4997 | } |
| | 4998 | |
| | 4999 | // Filters |
| | 5000 | for ( type in Expr.filter ) { |
| | 5001 | if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || |
| | 5002 | (match = preFilters[ type ]( match ))) ) { |
| | 5003 | |
| | 5004 | tokens.push( matched = new Token( match.shift() ) ); |
| | 5005 | soFar = soFar.slice( matched.length ); |
| | 5006 | matched.type = type; |
| | 5007 | matched.matches = match; |
| | 5008 | } |
| | 5009 | } |
| | 5010 | |
| | 5011 | if ( !matched ) { |
| | 5012 | break; |
| | 5013 | } |
| | 5014 | } |
| | 5015 | |
| | 5016 | // Return the length of the invalid excess |
| | 5017 | // if we're just parsing |
| | 5018 | // Otherwise, throw an error or return tokens |
| | 5019 | return parseOnly ? |
| | 5020 | soFar.length : |
| | 5021 | soFar ? |
| | 5022 | Sizzle.error( selector ) : |
| | 5023 | // Cache the tokens |
| | 5024 | tokenCache( selector, groups ).slice( 0 ); |
| | 5025 | } |
| | 5026 | |
| | 5027 | function addCombinator( matcher, combinator, base ) { |
| | 5028 | var dir = combinator.dir, |
| | 5029 | checkNonElements = base && combinator.dir === "parentNode", |
| | 5030 | doneName = done++; |
| | 5031 | |
| | 5032 | return combinator.first ? |
| | 5033 | // Check against closest ancestor/preceding element |
| | 5034 | function( elem, context, xml ) { |
| | 5035 | while ( (elem = elem[ dir ]) ) { |
| | 5036 | if ( elem.nodeType === 1 || checkNonElements ) { |
| | 5037 | return matcher( elem, context, xml ); |
| | 5038 | } |
| | 5039 | } |
| | 5040 | } : |
| | 5041 | |
| | 5042 | // Check against all ancestor/preceding elements |
| | 5043 | function( elem, context, xml ) { |
| | 5044 | var data, cache, outerCache, |
| | 5045 | dirkey = dirruns + " " + doneName; |
| | 5046 | |
| | 5047 | // We can't set arbitrary data on XML nodes, so they don't benefit from dir caching |
| | 5048 | if ( xml ) { |
| | 5049 | while ( (elem = elem[ dir ]) ) { |
| | 5050 | if ( elem.nodeType === 1 || checkNonElements ) { |
| | 5051 | if ( matcher( elem, context, xml ) ) { |
| | 5052 | return true; |
| | 5053 | } |
| | 5054 | } |
| | 5055 | } |
| | 5056 | } else { |
| | 5057 | while ( (elem = elem[ dir ]) ) { |
| | 5058 | if ( elem.nodeType === 1 || checkNonElements ) { |
| | 5059 | outerCache = elem[ expando ] || (elem[ expando ] = {}); |
| | 5060 | if ( (cache = outerCache[ dir ]) && cache[0] === dirkey ) { |
| | 5061 | if ( (data = cache[1]) === true || data === cachedruns ) { |
| | 5062 | return data === true; |
| | 5063 | } |
| | 5064 | } else { |
| | 5065 | cache = outerCache[ dir ] = [ dirkey ]; |
| | 5066 | cache[1] = matcher( elem, context, xml ) || cachedruns; |
| | 5067 | if ( cache[1] === true ) { |
| | 5068 | return true; |
| | 5069 | } |
| | 5070 | } |
| | 5071 | } |
| | 5072 | } |
| | 5073 | } |
| | 5074 | }; |
| | 5075 | } |
| | 5076 | |
| | 5077 | function elementMatcher( matchers ) { |
| | 5078 | return matchers.length > 1 ? |
| | 5079 | function( elem, context, xml ) { |
| | 5080 | var i = matchers.length; |
| | 5081 | while ( i-- ) { |
| | 5082 | if ( !matchers[i]( elem, context, xml ) ) { |
| | 5083 | return false; |
| | 5084 | } |
| | 5085 | } |
| | 5086 | return true; |
| | 5087 | } : |
| | 5088 | matchers[0]; |
| | 5089 | } |
| | 5090 | |
| | 5091 | function condense( unmatched, map, filter, context, xml ) { |
| | 5092 | var elem, |
| | 5093 | newUnmatched = [], |
| | 5094 | i = 0, |
| | 5095 | len = unmatched.length, |
| | 5096 | mapped = map != null; |
| | 5097 | |
| | 5098 | for ( ; i < len; i++ ) { |
| | 5099 | if ( (elem = unmatched[i]) ) { |
| | 5100 | if ( !filter || filter( elem, context, xml ) ) { |
| | 5101 | newUnmatched.push( elem ); |
| | 5102 | if ( mapped ) { |
| | 5103 | map.push( i ); |
| | 5104 | } |
| | 5105 | } |
| | 5106 | } |
| | 5107 | } |
| | 5108 | |
| | 5109 | return newUnmatched; |
| | 5110 | } |
| | 5111 | |
| | 5112 | function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { |
| | 5113 | if ( postFilter && !postFilter[ expando ] ) { |
| | 5114 | postFilter = setMatcher( postFilter ); |
| | 5115 | } |
| | 5116 | if ( postFinder && !postFinder[ expando ] ) { |
| | 5117 | postFinder = setMatcher( postFinder, postSelector ); |
| | 5118 | } |
| | 5119 | return markFunction(function( seed, results, context, xml ) { |
| | 5120 | var temp, i, elem, |
| | 5121 | preMap = [], |
| | 5122 | postMap = [], |
| | 5123 | preexisting = results.length, |
| | 5124 | |
| | 5125 | // Get initial elements from seed or context |
| | 5126 | elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), |
| | 5127 | |
| | 5128 | // Prefilter to get matcher input, preserving a map for seed-results synchronization |
| | 5129 | matcherIn = preFilter && ( seed || !selector ) ? |
| | 5130 | condense( elems, preMap, preFilter, context, xml ) : |
| | 5131 | elems, |
| | 5132 | |
| | 5133 | matcherOut = matcher ? |
| | 5134 | // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, |
| | 5135 | postFinder || ( seed ? preFilter : preexisting || postFilter ) ? |
| | 5136 | |
| | 5137 | // ...intermediate processing is necessary |
| | 5138 | [] : |
| | 5139 | |
| | 5140 | // ...otherwise use results directly |
| | 5141 | results : |
| | 5142 | matcherIn; |
| | 5143 | |
| | 5144 | // Find primary matches |
| | 5145 | if ( matcher ) { |
| | 5146 | matcher( matcherIn, matcherOut, context, xml ); |
| | 5147 | } |
| | 5148 | |
| | 5149 | // Apply postFilter |
| | 5150 | if ( postFilter ) { |
| | 5151 | temp = condense( matcherOut, postMap ); |
| | 5152 | postFilter( temp, [], context, xml ); |
| | 5153 | |
| | 5154 | // Un-match failing elements by moving them back to matcherIn |
| | 5155 | i = temp.length; |
| | 5156 | while ( i-- ) { |
| | 5157 | if ( (elem = temp[i]) ) { |
| | 5158 | matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); |
| | 5159 | } |
| | 5160 | } |
| | 5161 | } |
| | 5162 | |
| | 5163 | if ( seed ) { |
| | 5164 | if ( postFinder || preFilter ) { |
| | 5165 | if ( postFinder ) { |
| | 5166 | // Get the final matcherOut by condensing this intermediate into postFinder contexts |
| | 5167 | temp = []; |
| | 5168 | i = matcherOut.length; |
| | 5169 | while ( i-- ) { |
| | 5170 | if ( (elem = matcherOut[i]) ) { |
| | 5171 | // Restore matcherIn since elem is not yet a final match |
| | 5172 | temp.push( (matcherIn[i] = elem) ); |
| | 5173 | } |
| | 5174 | } |
| | 5175 | postFinder( null, (matcherOut = []), temp, xml ); |
| | 5176 | } |
| | 5177 | |
| | 5178 | // Move matched elements from seed to results to keep them synchronized |
| | 5179 | i = matcherOut.length; |
| | 5180 | while ( i-- ) { |
| | 5181 | if ( (elem = matcherOut[i]) && |
| | 5182 | (temp = postFinder ? indexOf.call( seed, elem ) : preMap[i]) > -1 ) { |
| | 5183 | |
| | 5184 | seed[temp] = !(results[temp] = elem); |
| | 5185 | } |
| | 5186 | } |
| | 5187 | } |
| | 5188 | |
| | 5189 | // Add elements to results, through postFinder if defined |
| | 5190 | } else { |
| | 5191 | matcherOut = condense( |
| | 5192 | matcherOut === results ? |
| | 5193 | matcherOut.splice( preexisting, matcherOut.length ) : |
| | 5194 | matcherOut |
| | 5195 | ); |
| | 5196 | if ( postFinder ) { |
| | 5197 | postFinder( null, results, matcherOut, xml ); |
| | 5198 | } else { |
| | 5199 | push.apply( results, matcherOut ); |
| | 5200 | } |
| | 5201 | } |
| | 5202 | }); |
| | 5203 | } |
| | 5204 | |
| | 5205 | function matcherFromTokens( tokens ) { |
| | 5206 | var checkContext, matcher, j, |
| | 5207 | len = tokens.length, |
| | 5208 | leadingRelative = Expr.relative[ tokens[0].type ], |
| | 5209 | implicitRelative = leadingRelative || Expr.relative[" "], |
| | 5210 | i = leadingRelative ? 1 : 0, |
| | 5211 | |
| | 5212 | // The foundational matcher ensures that elements are reachable from top-level context(s) |
| | 5213 | matchContext = addCombinator( function( elem ) { |
| | 5214 | return elem === checkContext; |
| | 5215 | }, implicitRelative, true ), |
| | 5216 | matchAnyContext = addCombinator( function( elem ) { |
| | 5217 | return indexOf.call( checkContext, elem ) > -1; |
| | 5218 | }, implicitRelative, true ), |
| | 5219 | matchers = [ function( elem, context, xml ) { |
| | 5220 | return ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( |
| | 5221 | (checkContext = context).nodeType ? |
| | 5222 | matchContext( elem, context, xml ) : |
| | 5223 | matchAnyContext( elem, context, xml ) ); |
| | 5224 | } ]; |
| | 5225 | |
| | 5226 | for ( ; i < len; i++ ) { |
| | 5227 | if ( (matcher = Expr.relative[ tokens[i].type ]) ) { |
| | 5228 | matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; |
| | 5229 | } else { |
| | 5230 | matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); |
| | 5231 | |
| | 5232 | // Return special upon seeing a positional matcher |
| | 5233 | if ( matcher[ expando ] ) { |
| | 5234 | // Find the next relative operator (if any) for proper handling |
| | 5235 | j = ++i; |
| | 5236 | for ( ; j < len; j++ ) { |
| | 5237 | if ( Expr.relative[ tokens[j].type ] ) { |
| | 5238 | break; |
| | 5239 | } |
| | 5240 | } |
| | 5241 | return setMatcher( |
| | 5242 | i > 1 && elementMatcher( matchers ), |
| | 5243 | i > 1 && tokens.slice( 0, i - 1 ).join("").replace( rtrim, "$1" ), |
| | 5244 | matcher, |
| | 5245 | i < j && matcherFromTokens( tokens.slice( i, j ) ), |
| | 5246 | j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), |
| | 5247 | j < len && tokens.join("") |
| | 5248 | ); |
| | 5249 | } |
| | 5250 | matchers.push( matcher ); |
| | 5251 | } |
| | 5252 | } |
| | 5253 | |
| | 5254 | return elementMatcher( matchers ); |
| | 5255 | } |
| | 5256 | |
| | 5257 | function matcherFromGroupMatchers( elementMatchers, setMatchers ) { |
| | 5258 | // A counter to specify which element is currently being matched |
| | 5259 | var matcherCachedRuns = 0, |
| | 5260 | bySet = setMatchers.length > 0, |
| | 5261 | byElement = elementMatchers.length > 0, |
| | 5262 | superMatcher = function( seed, context, xml, results, expandContext ) { |
| | 5263 | var elem, j, matcher, |
| | 5264 | setMatched = [], |
| | 5265 | matchedCount = 0, |
| | 5266 | i = "0", |
| | 5267 | unmatched = seed && [], |
| | 5268 | outermost = expandContext != null, |
| | 5269 | contextBackup = outermostContext, |
| | 5270 | // We must always have either seed elements or context |
| | 5271 | elems = seed || byElement && Expr.find["TAG"]( "*", expandContext && context.parentNode || context ), |
| | 5272 | // Nested matchers should use non-integer dirruns |
| | 5273 | dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.E); |
| | 5274 | |
| | 5275 | if ( outermost ) { |
| | 5276 | outermostContext = context !== document && context; |
| | 5277 | cachedruns = matcherCachedRuns; |
| | 5278 | } |
| | 5279 | |
| | 5280 | // Add elements passing elementMatchers directly to results |
| | 5281 | for ( ; (elem = elems[i]) != null; i++ ) { |
| | 5282 | if ( byElement && elem ) { |
| | 5283 | for ( j = 0; (matcher = elementMatchers[j]); j++ ) { |
| | 5284 | if ( matcher( elem, context, xml ) ) { |
| | 5285 | results.push( elem ); |
| | 5286 | break; |
| | 5287 | } |
| | 5288 | } |
| | 5289 | if ( outermost ) { |
| | 5290 | dirruns = dirrunsUnique; |
| | 5291 | cachedruns = ++matcherCachedRuns; |
| | 5292 | } |
| | 5293 | } |
| | 5294 | |
| | 5295 | // Track unmatched elements for set filters |
| | 5296 | if ( bySet ) { |
| | 5297 | // They will have gone through all possible matchers |
| | 5298 | if ( (elem = !matcher && elem) ) { |
| | 5299 | matchedCount--; |
| | 5300 | } |
| | 5301 | |
| | 5302 | // Lengthen the array for every element, matched or not |
| | 5303 | if ( seed ) { |
| | 5304 | unmatched.push( elem ); |
| | 5305 | } |
| | 5306 | } |
| | 5307 | } |
| | 5308 | |
| | 5309 | // Apply set filters to unmatched elements |
| | 5310 | // `i` starts as a string, so matchedCount would equal "00" if there are no elements |
| | 5311 | matchedCount += i; |
| | 5312 | if ( bySet && i !== matchedCount ) { |
| | 5313 | for ( j = 0; (matcher = setMatchers[j]); j++ ) { |
| | 5314 | matcher( unmatched, setMatched, context, xml ); |
| | 5315 | } |
| | 5316 | |
| | 5317 | if ( seed ) { |
| | 5318 | // Reintegrate element matches to eliminate the need for sorting |
| | 5319 | if ( matchedCount > 0 ) { |
| | 5320 | while ( i-- ) { |
| | 5321 | if ( !(unmatched[i] || setMatched[i]) ) { |
| | 5322 | setMatched[i] = pop.call( results ); |
| | 5323 | } |
| | 5324 | } |
| | 5325 | } |
| | 5326 | |
| | 5327 | // Discard index placeholder values to get only actual matches |
| | 5328 | setMatched = condense( setMatched ); |
| | 5329 | } |
| | 5330 | |
| | 5331 | // Add matches to results |
| | 5332 | push.apply( results, setMatched ); |
| | 5333 | |
| | 5334 | // Seedless set matches succeeding multiple successful matchers stipulate sorting |
| | 5335 | if ( outermost && !seed && setMatched.length > 0 && |
| | 5336 | ( matchedCount + setMatchers.length ) > 1 ) { |
| | 5337 | |
| | 5338 | Sizzle.uniqueSort( results ); |
| | 5339 | } |
| | 5340 | } |
| | 5341 | |
| | 5342 | // Override manipulation of globals by nested matchers |
| | 5343 | if ( outermost ) { |
| | 5344 | dirruns = dirrunsUnique; |
| | 5345 | outermostContext = contextBackup; |
| | 5346 | } |
| | 5347 | |
| | 5348 | return unmatched; |
| | 5349 | }; |
| | 5350 | |
| | 5351 | return bySet ? |
| | 5352 | markFunction( superMatcher ) : |
| | 5353 | superMatcher; |
| | 5354 | } |
| | 5355 | |
| | 5356 | compile = Sizzle.compile = function( selector, group /* Internal Use Only */ ) { |
| | 5357 | var i, |
| | 5358 | setMatchers = [], |
| | 5359 | elementMatchers = [], |
| | 5360 | cached = compilerCache[ expando ][ selector + " " ]; |
| | 5361 | |
| | 5362 | if ( !cached ) { |
| | 5363 | // Generate a function of recursive functions that can be used to check each element |
| | 5364 | if ( !group ) { |
| | 5365 | group = tokenize( selector ); |
| | 5366 | } |
| | 5367 | i = group.length; |
| | 5368 | while ( i-- ) { |
| | 5369 | cached = matcherFromTokens( group[i] ); |
| | 5370 | if ( cached[ expando ] ) { |
| | 5371 | setMatchers.push( cached ); |
| | 5372 | } else { |
| | 5373 | elementMatchers.push( cached ); |
| | 5374 | } |
| | 5375 | } |
| | 5376 | |
| | 5377 | // Cache the compiled function |
| | 5378 | cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); |
| | 5379 | } |
| | 5380 | return cached; |
| | 5381 | }; |
| | 5382 | |
| | 5383 | function multipleContexts( selector, contexts, results ) { |
| | 5384 | var i = 0, |
| | 5385 | len = contexts.length; |
| | 5386 | for ( ; i < len; i++ ) { |
| | 5387 | Sizzle( selector, contexts[i], results ); |
| | 5388 | } |
| | 5389 | return results; |
| | 5390 | } |
| | 5391 | |
| | 5392 | function select( selector, context, results, seed ) { |
| | 5393 | var i, tokens, token, type, find, |
| | 5394 | match = tokenize( selector ); |
| | 5395 | |
| | 5396 | if ( !seed ) { |
| | 5397 | // Try to minimize operations if there is only one group |
| | 5398 | if ( match.length === 1 ) { |
| | 5399 | |
| | 5400 | // Take a shortcut and set the context if the root selector is an ID |
| | 5401 | tokens = match[0] = match[0].slice( 0 ); |
| | 5402 | if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && |
| | 5403 | context.nodeType === 9 && !documentIsXML && |
| | 5404 | Expr.relative[ tokens[1].type ] ) { |
| | 5405 | |
| | 5406 | context = Expr.find["ID"]( token.matches[0].replace( rbackslash, "" ), context )[0]; |
| | 5407 | if ( !context ) { |
| | 5408 | return results; |
| | 5409 | } |
| | 5410 | |
| | 5411 | selector = selector.slice( tokens.shift().length ); |
| | 5412 | } |
| | 5413 | |
| | 5414 | // Fetch a seed set for right-to-left matching |
| | 5415 | for ( i = matchExpr["needsContext"].test( selector ) ? -1 : tokens.length - 1; i >= 0; i-- ) { |
| | 5416 | token = tokens[i]; |
| | 5417 | |
| | 5418 | // Abort if we hit a combinator |
| | 5419 | if ( Expr.relative[ (type = token.type) ] ) { |
| | 5420 | break; |
| | 5421 | } |
| | 5422 | if ( (find = Expr.find[ type ]) ) { |
| | 5423 | // Search, expanding context for leading sibling combinators |
| | 5424 | if ( (seed = find( |
| | 5425 | token.matches[0].replace( rbackslash, "" ), |
| | 5426 | rsibling.test( tokens[0].type ) && context.parentNode || context |
| | 5427 | )) ) { |
| | 5428 | |
| | 5429 | // If seed is empty or no tokens remain, we can return early |
| | 5430 | tokens.splice( i, 1 ); |
| | 5431 | selector = seed.length && tokens.join(""); |
| | 5432 | if ( !selector ) { |
| | 5433 | push.apply( results, slice.call( seed, 0 ) ); |
| | 5434 | return results; |
| | 5435 | } |
| | 5436 | |
| | 5437 | break; |
| | 5438 | } |
| | 5439 | } |
| | 5440 | } |
| | 5441 | } |
| | 5442 | } |
| | 5443 | |
| | 5444 | // Compile and execute a filtering function |
| | 5445 | // Provide `match` to avoid retokenization if we modified the selector above |
| | 5446 | compile( selector, match )( |
| | 5447 | seed, |
| | 5448 | context, |
| | 5449 | documentIsXML, |
| | 5450 | results, |
| | 5451 | rsibling.test( selector ) |
| | 5452 | ); |
| | 5453 | return results; |
| | 5454 | } |
| | 5455 | |
| | 5456 | // Deprecated |
| | 5457 | Expr.pseudos["nth"] = Expr.pseudos["eq"]; |
| | 5458 | |
| | 5459 | // Easy API for creating new setFilters |
| | 5460 | function setFilters() {} |
| | 5461 | Expr.filters = setFilters.prototype = Expr.pseudos; |
| | 5462 | Expr.setFilters = new setFilters(); |
| | 5463 | |
| | 5464 | // Initialize with the default document |
| | 5465 | setDocument(); |
| | 5466 | |
| | 5467 | // Override sizzle attribute retrieval |
| | 5468 | Sizzle.attr = jQuery.attr; |
| | 5469 | jQuery.find = Sizzle; |
| | 5470 | jQuery.expr = Sizzle.selectors; |
| | 5471 | jQuery.expr[":"] = jQuery.expr.pseudos; |
| | 5472 | jQuery.unique = Sizzle.uniqueSort; |
| | 5473 | jQuery.text = Sizzle.getText; |
| | 5474 | jQuery.isXMLDoc = Sizzle.isXML; |
| | 5475 | jQuery.contains = Sizzle.contains; |
| | 5476 | |
| | 5477 | |
| | 5478 | })( window ); |
| | 5479 | var runtil = /Until$/, |
| | 5480 | rparentsprev = /^(?:parents|prev(?:Until|All))/, |
| | 5481 | isSimple = /^.[^:#\[\.,]*$/, |
| | 5482 | rneedsContext = jQuery.expr.match.needsContext, |
| | 5483 | // methods guaranteed to produce a unique set when starting from a unique set |
| | 5484 | guaranteedUnique = { |
| | 5485 | children: true, |
| | 5486 | contents: true, |
| | 5487 | next: true, |
| | 5488 | prev: true |
| | 5489 | }; |
| | 5490 | |
| | 5491 | jQuery.fn.extend({ |
| | 5492 | find: function( selector ) { |
| | 5493 | var i, ret, self; |
| | 5494 | |
| | 5495 | if ( typeof selector !== "string" ) { |
| | 5496 | self = this; |
| | 5497 | return this.pushStack( jQuery( selector ).filter(function() { |
| | 5498 | for ( i = 0; i < self.length; i++ ) { |
| | 5499 | if ( jQuery.contains( self[ i ], this ) ) { |
| | 5500 | return true; |
| | 5501 | } |
| | 5502 | } |
| | 5503 | }) ); |
| | 5504 | } |
| | 5505 | |
| | 5506 | ret = []; |
| | 5507 | for ( i = 0; i < this.length; i++ ) { |
| | 5508 | jQuery.find( selector, this[ i ], ret ); |
| | 5509 | } |
| | 5510 | |
| | 5511 | // Needed because $( selector, context ) becomes $( context ).find( selector ) |
| | 5512 | ret = this.pushStack( jQuery.unique( ret ) ); |
| | 5513 | ret.selector = ( this.selector ? this.selector + " " : "" ) + selector; |
| | 5514 | return ret; |
| | 5515 | }, |
| | 5516 | |
| | 5517 | has: function( target ) { |
| | 5518 | var i, |
| | 5519 | targets = jQuery( target, this ), |
| | 5520 | len = targets.length; |
| | 5521 | |
| | 5522 | return this.filter(function() { |
| | 5523 | for ( i = 0; i < len; i++ ) { |
| | 5524 | if ( jQuery.contains( this, targets[i] ) ) { |
| | 5525 | return true; |
| | 5526 | } |
| | 5527 | } |
| | 5528 | }); |
| | 5529 | }, |
| | 5530 | |
| | 5531 | not: function( selector ) { |
| | 5532 | return this.pushStack( winnow(this, selector, false) ); |
| | 5533 | }, |
| | 5534 | |
| | 5535 | filter: function( selector ) { |
| | 5536 | return this.pushStack( winnow(this, selector, true) ); |
| | 5537 | }, |
| | 5538 | |
| | 5539 | is: function( selector ) { |
| | 5540 | return !!selector && ( |
| | 5541 | typeof selector === "string" ? |
| | 5542 | // If this is a positional/relative selector, check membership in the returned set |
| | 5543 | // so $("p:first").is("p:last") won't return true for a doc with two "p". |
| | 5544 | rneedsContext.test( selector ) ? |
| | 5545 | jQuery( selector, this.context ).index( this[0] ) >= 0 : |
| | 5546 | jQuery.filter( selector, this ).length > 0 : |
| | 5547 | this.filter( selector ).length > 0 ); |
| | 5548 | }, |
| | 5549 | |
| | 5550 | closest: function( selectors, context ) { |
| | 5551 | var cur, |
| | 5552 | i = 0, |
| | 5553 | l = this.length, |
| | 5554 | ret = [], |
| | 5555 | pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ? |
| | 5556 | jQuery( selectors, context || this.context ) : |
| | 5557 | 0; |
| | 5558 | |
| | 5559 | for ( ; i < l; i++ ) { |
| | 5560 | cur = this[i]; |
| | 5561 | |
| | 5562 | while ( cur && cur.ownerDocument && cur !== context && cur.nodeType !== 11 ) { |
| | 5563 | if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { |
| | 5564 | ret.push( cur ); |
| | 5565 | break; |
| | 5566 | } |
| | 5567 | cur = cur.parentNode; |
| | 5568 | } |
| | 5569 | } |
| | 5570 | |
| | 5571 | return this.pushStack( ret.length > 1 ? jQuery.unique( ret ) : ret ); |
| | 5572 | }, |
| | 5573 | |
| | 5574 | // Determine the position of an element within |
| | 5575 | // the matched set of elements |
| | 5576 | index: function( elem ) { |
| | 5577 | |
| | 5578 | // No argument, return index in parent |
| | 5579 | if ( !elem ) { |
| | 5580 | return ( this[0] && this[0].parentNode ) ? this.first().prevAll().length : -1; |
| | 5581 | } |
| | 5582 | |
| | 5583 | // index in selector |
| | 5584 | if ( typeof elem === "string" ) { |
| | 5585 | return jQuery.inArray( this[0], jQuery( elem ) ); |
| | 5586 | } |
| | 5587 | |
| | 5588 | // Locate the position of the desired element |
| | 5589 | return jQuery.inArray( |
| | 5590 | // If it receives a jQuery object, the first element is used |
| | 5591 | elem.jquery ? elem[0] : elem, this ); |
| | 5592 | }, |
| | 5593 | |
| | 5594 | add: function( selector, context ) { |
| | 5595 | var set = typeof selector === "string" ? |
| | 5596 | jQuery( selector, context ) : |
| | 5597 | jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), |
| | 5598 | all = jQuery.merge( this.get(), set ); |
| | 5599 | |
| | 5600 | return this.pushStack( jQuery.unique(all) ); |
| | 5601 | }, |
| | 5602 | |
| | 5603 | addBack: function( selector ) { |
| | 5604 | return this.add( selector == null ? |
| | 5605 | this.prevObject : this.prevObject.filter(selector) |
| | 5606 | ); |
| | 5607 | } |
| | 5608 | }); |
| | 5609 | |
| | 5610 | jQuery.fn.andSelf = jQuery.fn.addBack; |
| | 5611 | |
| | 5612 | function sibling( cur, dir ) { |
| | 5613 | do { |
| | 5614 | cur = cur[ dir ]; |
| | 5615 | } while ( cur && cur.nodeType !== 1 ); |
| | 5616 | |
| | 5617 | return cur; |
| | 5618 | } |
| | 5619 | |
| | 5620 | jQuery.each({ |
| | 5621 | parent: function( elem ) { |
| | 5622 | var parent = elem.parentNode; |
| | 5623 | return parent && parent.nodeType !== 11 ? parent : null; |
| | 5624 | }, |
| | 5625 | parents: function( elem ) { |
| | 5626 | return jQuery.dir( elem, "parentNode" ); |
| | 5627 | }, |
| | 5628 | parentsUntil: function( elem, i, until ) { |
| | 5629 | return jQuery.dir( elem, "parentNode", until ); |
| | 5630 | }, |
| | 5631 | next: function( elem ) { |
| | 5632 | return sibling( elem, "nextSibling" ); |
| | 5633 | }, |
| | 5634 | prev: function( elem ) { |
| | 5635 | return sibling( elem, "previousSibling" ); |
| | 5636 | }, |
| | 5637 | nextAll: function( elem ) { |
| | 5638 | return jQuery.dir( elem, "nextSibling" ); |
| | 5639 | }, |
| | 5640 | prevAll: function( elem ) { |
| | 5641 | return jQuery.dir( elem, "previousSibling" ); |
| | 5642 | }, |
| | 5643 | nextUntil: function( elem, i, until ) { |
| | 5644 | return jQuery.dir( elem, "nextSibling", until ); |
| | 5645 | }, |
| | 5646 | prevUntil: function( elem, i, until ) { |
| | 5647 | return jQuery.dir( elem, "previousSibling", until ); |
| | 5648 | }, |
| | 5649 | siblings: function( elem ) { |
| | 5650 | return jQuery.sibling( ( elem.parentNode || {} ).firstChild, elem ); |
| | 5651 | }, |
| | 5652 | children: function( elem ) { |
| | 5653 | return jQuery.sibling( elem.firstChild ); |
| | 5654 | }, |
| | 5655 | contents: function( elem ) { |
| | 5656 | return jQuery.nodeName( elem, "iframe" ) ? |
| | 5657 | elem.contentDocument || elem.contentWindow.document : |
| | 5658 | jQuery.merge( [], elem.childNodes ); |
| | 5659 | } |
| | 5660 | }, function( name, fn ) { |
| | 5661 | jQuery.fn[ name ] = function( until, selector ) { |
| | 5662 | var ret = jQuery.map( this, fn, until ); |
| | 5663 | |
| | 5664 | if ( !runtil.test( name ) ) { |
| | 5665 | selector = until; |
| | 5666 | } |
| | 5667 | |
| | 5668 | if ( selector && typeof selector === "string" ) { |
| | 5669 | ret = jQuery.filter( selector, ret ); |
| | 5670 | } |
| | 5671 | |
| | 5672 | ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; |
| | 5673 | |
| | 5674 | if ( this.length > 1 && rparentsprev.test( name ) ) { |
| | 5675 | ret = ret.reverse(); |
| | 5676 | } |
| | 5677 | |
| | 5678 | return this.pushStack( ret ); |
| | 5679 | }; |
| | 5680 | }); |
| | 5681 | |
| | 5682 | jQuery.extend({ |
| | 5683 | filter: function( expr, elems, not ) { |
| | 5684 | if ( not ) { |
| | 5685 | expr = ":not(" + expr + ")"; |
| | 5686 | } |
| | 5687 | |
| | 5688 | return elems.length === 1 ? |
| | 5689 | jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : |
| | 5690 | jQuery.find.matches(expr, elems); |
| | 5691 | }, |
| | 5692 | |
| | 5693 | dir: function( elem, dir, until ) { |
| | 5694 | var matched = [], |
| | 5695 | cur = elem[ dir ]; |
| | 5696 | |
| | 5697 | while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { |
| | 5698 | if ( cur.nodeType === 1 ) { |
| | 5699 | matched.push( cur ); |
| | 5700 | } |
| | 5701 | cur = cur[dir]; |
| | 5702 | } |
| | 5703 | return matched; |
| | 5704 | }, |
| | 5705 | |
| | 5706 | sibling: function( n, elem ) { |
| | 5707 | var r = []; |
| | 5708 | |
| | 5709 | for ( ; n; n = n.nextSibling ) { |
| | 5710 | if ( n.nodeType === 1 && n !== elem ) { |
| | 5711 | r.push( n ); |
| | 5712 | } |
| | 5713 | } |
| | 5714 | |
| | 5715 | return r; |
| | 5716 | } |
| | 5717 | }); |
| | 5718 | |
| | 5719 | // Implement the identical functionality for filter and not |
| | 5720 | function winnow( elements, qualifier, keep ) { |
| | 5721 | |
| | 5722 | // Can't pass null or undefined to indexOf in Firefox 4 |
| | 5723 | // Set to 0 to skip string check |
| | 5724 | qualifier = qualifier || 0; |
| | 5725 | |
| | 5726 | if ( jQuery.isFunction( qualifier ) ) { |
| | 5727 | return jQuery.grep(elements, function( elem, i ) { |
| | 5728 | var retVal = !!qualifier.call( elem, i, elem ); |
| | 5729 | return retVal === keep; |
| | 5730 | }); |
| | 5731 | |
| | 5732 | } else if ( qualifier.nodeType ) { |
| | 5733 | return jQuery.grep(elements, function( elem ) { |
| | 5734 | return ( elem === qualifier ) === keep; |
| | 5735 | }); |
| | 5736 | |
| | 5737 | } else if ( typeof qualifier === "string" ) { |
| | 5738 | var filtered = jQuery.grep(elements, function( elem ) { |
| | 5739 | return elem.nodeType === 1; |
| | 5740 | }); |
| | 5741 | |
| | 5742 | if ( isSimple.test( qualifier ) ) { |
| | 5743 | return jQuery.filter(qualifier, filtered, !keep); |
| | 5744 | } else { |
| | 5745 | qualifier = jQuery.filter( qualifier, filtered ); |
| | 5746 | } |
| | 5747 | } |
| | 5748 | |
| | 5749 | return jQuery.grep(elements, function( elem ) { |
| | 5750 | return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; |
| | 5751 | }); |
| | 5752 | } |
| | 5753 | function createSafeFragment( document ) { |
| | 5754 | var list = nodeNames.split( "|" ), |
| | 5755 | safeFrag = document.createDocumentFragment(); |
| | 5756 | |
| | 5757 | if ( safeFrag.createElement ) { |
| | 5758 | while ( list.length ) { |
| | 5759 | safeFrag.createElement( |
| | 5760 | list.pop() |
| | 5761 | ); |
| | 5762 | } |
| | 5763 | } |
| | 5764 | return safeFrag; |
| | 5765 | } |
| | 5766 | |
| | 5767 | var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|details|figcaption|figure|footer|" + |
| | 5768 | "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", |
| | 5769 | rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, |
| | 5770 | rnoshimcache = new RegExp("<(?:" + nodeNames + ")[\\s/>]", "i"), |
| | 5771 | rleadingWhitespace = /^\s+/, |
| | 5772 | rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi, |
| | 5773 | rtagName = /<([\w:]+)/, |
| | 5774 | rtbody = /<tbody/i, |
| | 5775 | rhtml = /<|&#?\w+;/, |
| | 5776 | rnoInnerhtml = /<(?:script|style|link)/i, |
| | 5777 | manipulation_rcheckableType = /^(?:checkbox|radio)$/i, |
| | 5778 | // checked="checked" or checked |
| | 5779 | rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, |
| | 5780 | rscriptType = /^$|\/(?:java|ecma)script/i, |
| | 5781 | rscriptTypeMasked = /^true\/(.*)/, |
| | 5782 | rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, |
| | 5783 | wrapMap = { |
| | 5784 | option: [ 1, "<select multiple='multiple'>" ], |
| | 5785 | legend: [ 1, "<fieldset>" ], |
| | 5786 | area: [ 1, "<map>" ], |
| | 5787 | param: [ 1, "<object>" ], |
| | 5788 | thead: [ 1, "<table>" ], |
| | 5789 | tr: [ 2, "<table><tbody>" ], |
| | 5790 | col: [ 2, "<table><tbody></tbody><colgroup>", "</table>" ], |
| | 5791 | td: [ 3, "<table><tbody><tr>" ], |
| | 5792 | |
| | 5793 | // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, |
| | 5794 | // unless wrapped in a div with non-breaking characters in front of it. |
| | 5795 | _default: jQuery.support.htmlSerialize ? [ 0, "" ] : [ 1, "X<div>" ] |
| | 5796 | }, |
| | 5797 | safeFragment = createSafeFragment( document ), |
| | 5798 | fragmentDiv = safeFragment.appendChild( document.createElement("div") ); |
| | 5799 | |
| | 5800 | wrapMap.optgroup = wrapMap.option; |
| | 5801 | wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; |
| | 5802 | wrapMap.th = wrapMap.td; |
| | 5803 | |
| | 5804 | jQuery.fn.extend({ |
| | 5805 | text: function( value ) { |
| | 5806 | return jQuery.access( this, function( value ) { |
| | 5807 | return value === undefined ? |
| | 5808 | jQuery.text( this ) : |
| | 5809 | this.empty().append( ( this[0] && this[0].ownerDocument || document ).createTextNode( value ) ); |
| | 5810 | }, null, value, arguments.length ); |
| | 5811 | }, |
| | 5812 | |
| | 5813 | wrapAll: function( html ) { |
| | 5814 | if ( jQuery.isFunction( html ) ) { |
| | 5815 | return this.each(function(i) { |
| | 5816 | jQuery(this).wrapAll( html.call(this, i) ); |
| | 5817 | }); |
| | 5818 | } |
| | 5819 | |
| | 5820 | if ( this[0] ) { |
| | 5821 | // The elements to wrap the target around |
| | 5822 | var wrap = jQuery( html, this[0].ownerDocument ).eq(0).clone(true); |
| | 5823 | |
| | 5824 | if ( this[0].parentNode ) { |
| | 5825 | wrap.insertBefore( this[0] ); |
| | 5826 | } |
| | 5827 | |
| | 5828 | wrap.map(function() { |
| | 5829 | var elem = this; |
| | 5830 | |
| | 5831 | while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { |
| | 5832 | elem = elem.firstChild; |
| | 5833 | } |
| | 5834 | |
| | 5835 | return elem; |
| | 5836 | }).append( this ); |
| | 5837 | } |
| | 5838 | |
| | 5839 | return this; |
| | 5840 | }, |
| | 5841 | |
| | 5842 | wrapInner: function( html ) { |
| | 5843 | if ( jQuery.isFunction( html ) ) { |
| | 5844 | return this.each(function(i) { |
| | 5845 | jQuery(this).wrapInner( html.call(this, i) ); |
| | 5846 | }); |
| | 5847 | } |
| | 5848 | |
| | 5849 | return this.each(function() { |
| | 5850 | var self = jQuery( this ), |
| | 5851 | contents = self.contents(); |
| | 5852 | |
| | 5853 | if ( contents.length ) { |
| | 5854 | contents.wrapAll( html ); |
| | 5855 | |
| | 5856 | } else { |
| | 5857 | self.append( html ); |
| | 5858 | } |
| | 5859 | }); |
| | 5860 | }, |
| | 5861 | |
| | 5862 | wrap: function( html ) { |
| | 5863 | var isFunction = jQuery.isFunction( html ); |
| | 5864 | |
| | 5865 | return this.each(function(i) { |
| | 5866 | jQuery( this ).wrapAll( isFunction ? html.call(this, i) : html ); |
| | 5867 | }); |
| | 5868 | }, |
| | 5869 | |
| | 5870 | unwrap: function() { |
| | 5871 | return this.parent().each(function() { |
| | 5872 | if ( !jQuery.nodeName( this, "body" ) ) { |
| | 5873 | jQuery( this ).replaceWith( this.childNodes ); |
| | 5874 | } |
| | 5875 | }).end(); |
| | 5876 | }, |
| | 5877 | |
| | 5878 | append: function() { |
| | 5879 | return this.domManip(arguments, true, function( elem ) { |
| | 5880 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
| | 5881 | this.appendChild( elem ); |
| | 5882 | } |
| | 5883 | }); |
| | 5884 | }, |
| | 5885 | |
| | 5886 | prepend: function() { |
| | 5887 | return this.domManip(arguments, true, function( elem ) { |
| | 5888 | if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { |
| | 5889 | this.insertBefore( elem, this.firstChild ); |
| | 5890 | } |
| | 5891 | }); |
| | 5892 | }, |
| | 5893 | |
| | 5894 | before: function() { |
| | 5895 | return this.domManip( arguments, false, function( elem ) { |
| | 5896 | if ( this.parentNode ) { |
| | 5897 | this.parentNode.insertBefore( elem, this ); |
| | 5898 | } |
| | 5899 | }); |
| | 5900 | }, |
| | 5901 | |
| | 5902 | after: function() { |
| | 5903 | return this.domManip( arguments, false, function( elem ) { |
| | 5904 | if ( this.parentNode ) { |
| | 5905 | this.parentNode.insertBefore( elem, this.nextSibling ); |
| | 5906 | } |
| | 5907 | }); |
| | 5908 | }, |
| | 5909 | |
| | 5910 | // keepData is for internal use only--do not document |
| | 5911 | remove: function( selector, keepData ) { |
| | 5912 | var elem, |
| | 5913 | i = 0; |
| | 5914 | |
| | 5915 | for ( ; (elem = this[i]) != null; i++ ) { |
| | 5916 | if ( !selector || jQuery.filter( selector, [ elem ] ).length > 0 ) { |
| | 5917 | if ( !keepData && elem.nodeType === 1 ) { |
| | 5918 | jQuery.cleanData( getAll( elem ) ); |
| | 5919 | } |
| | 5920 | |
| | 5921 | if ( elem.parentNode ) { |
| | 5922 | if ( keepData && jQuery.contains( elem.ownerDocument, elem ) ) { |
| | 5923 | setGlobalEval( getAll( elem, "script" ) ); |
| | 5924 | } |
| | 5925 | elem.parentNode.removeChild( elem ); |
| | 5926 | } |
| | 5927 | } |
| | 5928 | } |
| | 5929 | |
| | 5930 | return this; |
| | 5931 | }, |
| | 5932 | |
| | 5933 | empty: function() { |
| | 5934 | var elem, |
| | 5935 | i = 0; |
| | 5936 | |
| | 5937 | for ( ; (elem = this[i]) != null; i++ ) { |
| | 5938 | // Remove element nodes and prevent memory leaks |
| | 5939 | if ( elem.nodeType === 1 ) { |
| | 5940 | jQuery.cleanData( getAll( elem, false ) ); |
| | 5941 | } |
| | 5942 | |
| | 5943 | // Remove any remaining nodes |
| | 5944 | while ( elem.firstChild ) { |
| | 5945 | elem.removeChild( elem.firstChild ); |
| | 5946 | } |
| | 5947 | } |
| | 5948 | |
| | 5949 | return this; |
| | 5950 | }, |
| | 5951 | |
| | 5952 | clone: function( dataAndEvents, deepDataAndEvents ) { |
| | 5953 | dataAndEvents = dataAndEvents == null ? false : dataAndEvents; |
| | 5954 | deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; |
| | 5955 | |
| | 5956 | return this.map( function () { |
| | 5957 | return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); |
| | 5958 | }); |
| | 5959 | }, |
| | 5960 | |
| | 5961 | html: function( value ) { |
| | 5962 | return jQuery.access( this, function( value ) { |
| | 5963 | var elem = this[0] || {}, |
| | 5964 | i = 0, |
| | 5965 | l = this.length; |
| | 5966 | |
| | 5967 | if ( value === undefined ) { |
| | 5968 | return elem.nodeType === 1 ? |
| | 5969 | elem.innerHTML.replace( rinlinejQuery, "" ) : |
| | 5970 | undefined; |
| | 5971 | } |
| | 5972 | |
| | 5973 | // See if we can take a shortcut and just use innerHTML |
| | 5974 | if ( typeof value === "string" && !rnoInnerhtml.test( value ) && |
| | 5975 | ( jQuery.support.htmlSerialize || !rnoshimcache.test( value ) ) && |
| | 5976 | ( jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && |
| | 5977 | !wrapMap[ ( rtagName.exec( value ) || ["", ""] )[1].toLowerCase() ] ) { |
| | 5978 | |
| | 5979 | value = value.replace( rxhtmlTag, "<$1></$2>" ); |
| | 5980 | |
| | 5981 | try { |
| | 5982 | for (; i < l; i++ ) { |
| | 5983 | // Remove element nodes and prevent memory leaks |
| | 5984 | elem = this[i] || {}; |
| | 5985 | if ( elem.nodeType === 1 ) { |
| | 5986 | jQuery.cleanData( getAll( elem, false ) ); |
| | 5987 | elem.innerHTML = value; |
| | 5988 | } |
| | 5989 | } |
| | 5990 | |
| | 5991 | elem = 0; |
| | 5992 | |
| | 5993 | // If using innerHTML throws an exception, use the fallback method |
| | 5994 | } catch(e) {} |
| | 5995 | } |
| | 5996 | |
| | 5997 | if ( elem ) { |
| | 5998 | this.empty().append( value ); |
| | 5999 | } |
| | 6000 | }, null, value, arguments.length ); |
| | 6001 | }, |
| | 6002 | |
| | 6003 | replaceWith: function( value ) { |
| | 6004 | var isFunc = jQuery.isFunction( value ); |
| | 6005 | |
| | 6006 | // Make sure that the elements are removed from the DOM before they are inserted |
| | 6007 | // this can help fix replacing a parent with child elements |
| | 6008 | if ( !isFunc && typeof value !== "string" ) { |
| | 6009 | value = jQuery( value ).not( this ).detach(); |
| | 6010 | } |
| | 6011 | |
| | 6012 | return this.domManip( [ value ], true, function( elem ) { |
| | 6013 | var next = this.nextSibling, |
| | 6014 | parent = this.parentNode; |
| | 6015 | |
| | 6016 | if ( parent && this.nodeType === 1 || this.nodeType === 11 ) { |
| | 6017 | |
| | 6018 | jQuery( this ).remove(); |
| | 6019 | |
| | 6020 | if ( next ) { |
| | 6021 | next.parentNode.insertBefore( elem, next ); |
| | 6022 | } else { |
| | 6023 | parent.appendChild( elem ); |
| | 6024 | } |
| | 6025 | } |
| | 6026 | }); |
| | 6027 | }, |
| | 6028 | |
| | 6029 | detach: function( selector ) { |
| | 6030 | return this.remove( selector, true ); |
| | 6031 | }, |
| | 6032 | |
| | 6033 | domManip: function( args, table, callback ) { |
| | 6034 | |
| | 6035 | // Flatten any nested arrays |
| | 6036 | args = core_concat.apply( [], args ); |
| | 6037 | |
| | 6038 | var fragment, first, scripts, hasScripts, node, doc, |
| | 6039 | i = 0, |
| | 6040 | l = this.length, |
| | 6041 | iNoClone = l - 1, |
| | 6042 | value = args[0], |
| | 6043 | isFunction = jQuery.isFunction( value ); |
| | 6044 | |
| | 6045 | // We can't cloneNode fragments that contain checked, in WebKit |
| | 6046 | if ( isFunction || !( l <= 1 || typeof value !== "string" || jQuery.support.checkClone || !rchecked.test( value ) ) ) { |
| | 6047 | return this.each(function() { |
| | 6048 | var self = jQuery( this ); |
| | 6049 | if ( isFunction ) { |
| | 6050 | args[0] = value.call( this, i, table ? self.html() : undefined ); |
| | 6051 | } |
| | 6052 | self.domManip( args, table, callback ); |
| | 6053 | }); |
| | 6054 | } |
| | 6055 | |
| | 6056 | if ( this[0] ) { |
| | 6057 | doc = this[0].ownerDocument; |
| | 6058 | fragment = doc.createDocumentFragment(); |
| | 6059 | jQuery.clean( args, doc, fragment, undefined, this ); |
| | 6060 | first = fragment.firstChild; |
| | 6061 | |
| | 6062 | if ( fragment.childNodes.length === 1 ) { |
| | 6063 | fragment = first; |
| | 6064 | } |
| | 6065 | |
| | 6066 | if ( first ) { |
| | 6067 | table = table && jQuery.nodeName( first, "tr" ); |
| | 6068 | scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); |
| | 6069 | hasScripts = scripts.length; |
| | 6070 | |
| | 6071 | // Use the original fragment for the last item instead of the first because it can end up |
| | 6072 | // being emptied incorrectly in certain situations (#8070). |
| | 6073 | for ( ; i < l; i++ ) { |
| | 6074 | node = fragment; |
| | 6075 | |
| | 6076 | if ( i !== iNoClone ) { |
| | 6077 | node = jQuery.clone( node, true, true ); |
| | 6078 | |
| | 6079 | // Keep references to cloned scripts for later restoration |
| | 6080 | if ( hasScripts ) { |
| | 6081 | jQuery.merge( scripts, getAll( node, "script" ) ); |
| | 6082 | } |
| | 6083 | } |
| | 6084 | |
| | 6085 | callback.call( |
| | 6086 | table && jQuery.nodeName( this[i], "table" ) ? |
| | 6087 | findOrAppend( this[i], "tbody" ) : |
| | 6088 | this[i], |
| | 6089 | node, |
| | 6090 | i |
| | 6091 | ); |
| | 6092 | } |
| | 6093 | |
| | 6094 | if ( hasScripts ) { |
| | 6095 | doc = scripts[ scripts.length - 1 ].ownerDocument; |
| | 6096 | |
| | 6097 | // Reenable scripts |
| | 6098 | jQuery.map( scripts, restoreScript ); |
| | 6099 | |
| | 6100 | // Evaluate executable scripts on first document insertion |
| | 6101 | for ( i = 0; i < hasScripts; i++ ) { |
| | 6102 | node = scripts[ i ]; |
| | 6103 | if ( rscriptType.test( node.type || "" ) && |
| | 6104 | !jQuery._data( node, "globalEval" ) && jQuery.contains( doc, node ) ) { |
| | 6105 | |
| | 6106 | if ( node.src ) { |
| | 6107 | // Hope ajax is available... |
| | 6108 | jQuery.ajax({ |
| | 6109 | url: node.src, |
| | 6110 | type: "GET", |
| | 6111 | dataType: "script", |
| | 6112 | async: false, |
| | 6113 | global: false, |
| | 6114 | "throws": true |
| | 6115 | }); |
| | 6116 | } else { |
| | 6117 | jQuery.globalEval( ( node.text || node.textContent || node.innerHTML || "" ).replace( rcleanScript, "" ) ); |
| | 6118 | } |
| | 6119 | } |
| | 6120 | } |
| | 6121 | } |
| | 6122 | |
| | 6123 | // Fix #11809: Avoid leaking memory |
| | 6124 | fragment = first = null; |
| | 6125 | } |
| | 6126 | } |
| | 6127 | |
| | 6128 | return this; |
| | 6129 | } |
| | 6130 | }); |
| | 6131 | |
| | 6132 | function findOrAppend( elem, tag ) { |
| | 6133 | return elem.getElementsByTagName( tag )[0] || elem.appendChild( elem.ownerDocument.createElement( tag ) ); |
| | 6134 | } |
| | 6135 | |
| | 6136 | // Replace/restore the type attribute of script elements for safe DOM manipulation |
| | 6137 | function disableScript( elem ) { |
| | 6138 | var attr = elem.getAttributeNode("type"); |
| | 6139 | elem.type = ( attr && attr.specified ) + "/" + elem.type; |
| | 6140 | return elem; |
| | 6141 | } |
| | 6142 | function restoreScript( elem ) { |
| | 6143 | var match = rscriptTypeMasked.exec( elem.type ); |
| | 6144 | if ( match ) { |
| | 6145 | elem.type = match[1]; |
| | 6146 | } else { |
| | 6147 | elem.removeAttribute("type"); |
| | 6148 | } |
| | 6149 | return elem; |
| | 6150 | } |
| | 6151 | |
| | 6152 | // Mark scripts as having already been evaluated |
| | 6153 | function setGlobalEval( elems, refElements ) { |
| | 6154 | var elem, |
| | 6155 | i = 0; |
| | 6156 | for ( ; (elem = elems[i]) != null; i++ ) { |
| | 6157 | jQuery._data( elem, "globalEval", !refElements || jQuery._data( refElements[i], "globalEval" ) ); |
| | 6158 | } |
| | 6159 | } |
| | 6160 | |
| | 6161 | function cloneCopyEvent( src, dest ) { |
| | 6162 | |
| | 6163 | if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { |
| | 6164 | return; |
| | 6165 | } |
| | 6166 | |
| | 6167 | var type, i, l, |
| | 6168 | oldData = jQuery._data( src ), |
| | 6169 | curData = jQuery._data( dest, oldData ), |
| | 6170 | events = oldData.events; |
| | 6171 | |
| | 6172 | if ( events ) { |
| | 6173 | delete curData.handle; |
| | 6174 | curData.events = {}; |
| | 6175 | |
| | 6176 | for ( type in events ) { |
| | 6177 | for ( i = 0, l = events[ type ].length; i < l; i++ ) { |
| | 6178 | jQuery.event.add( dest, type, events[ type ][ i ] ); |
| | 6179 | } |
| | 6180 | } |
| | 6181 | } |
| | 6182 | |
| | 6183 | // make the cloned public data object a copy from the original |
| | 6184 | if ( curData.data ) { |
| | 6185 | curData.data = jQuery.extend( {}, curData.data ); |
| | 6186 | } |
| | 6187 | } |
| | 6188 | |
| | 6189 | function fixCloneNodeIssues( src, dest ) { |
| | 6190 | var nodeName, data, e; |
| | 6191 | |
| | 6192 | // We do not need to do anything for non-Elements |
| | 6193 | if ( dest.nodeType !== 1 ) { |
| | 6194 | return; |
| | 6195 | } |
| | 6196 | |
| | 6197 | nodeName = dest.nodeName.toLowerCase(); |
| | 6198 | |
| | 6199 | // IE6-8 copies events bound via attachEvent when using cloneNode. |
| | 6200 | if ( !jQuery.support.noCloneEvent && dest[ jQuery.expando ] ) { |
| | 6201 | data = jQuery._data( dest ); |
| | 6202 | |
| | 6203 | for ( e in data.events ) { |
| | 6204 | jQuery.removeEvent( dest, e, data.handle ); |
| | 6205 | } |
| | 6206 | |
| | 6207 | // Event data gets referenced instead of copied if the expando gets copied too |
| | 6208 | dest.removeAttribute( jQuery.expando ); |
| | 6209 | } |
| | 6210 | |
| | 6211 | // IE blanks contents when cloning scripts, and tries to evaluate newly-set text |
| | 6212 | if ( nodeName === "script" && dest.text !== src.text ) { |
| | 6213 | disableScript( dest ).text = src.text; |
| | 6214 | restoreScript( dest ); |
| | 6215 | |
| | 6216 | // IE6-10 improperly clones children of object elements using classid. |
| | 6217 | // IE10 throws NoModificationAllowedError if parent is null, #12132. |
| | 6218 | } else if ( nodeName === "object" ) { |
| | 6219 | if ( dest.parentNode ) { |
| | 6220 | dest.outerHTML = src.outerHTML; |
| | 6221 | } |
| | 6222 | |
| | 6223 | // This path appears unavoidable for IE9. When cloning an object |
| | 6224 | // element in IE9, the outerHTML strategy above is not sufficient. |
| | 6225 | // If the src has innerHTML and the destination does not, |
| | 6226 | // copy the src.innerHTML into the dest.innerHTML. #10324 |
| | 6227 | if ( jQuery.support.html5Clone && ( src.innerHTML && !jQuery.trim(dest.innerHTML) ) ) { |
| | 6228 | dest.innerHTML = src.innerHTML; |
| | 6229 | } |
| | 6230 | |
| | 6231 | } else if ( nodeName === "input" && manipulation_rcheckableType.test( src.type ) ) { |
| | 6232 | // IE6-8 fails to persist the checked state of a cloned checkbox |
| | 6233 | // or radio button. Worse, IE6-7 fail to give the cloned element |
| | 6234 | // a checked appearance if the defaultChecked value isn't also set |
| | 6235 | |
| | 6236 | dest.defaultChecked = dest.checked = src.checked; |
| | 6237 | |
| | 6238 | // IE6-7 get confused and end up setting the value of a cloned |
| | 6239 | // checkbox/radio button to an empty string instead of "on" |
| | 6240 | if ( dest.value !== src.value ) { |
| | 6241 | dest.value = src.value; |
| | 6242 | } |
| | 6243 | |
| | 6244 | // IE6-8 fails to return the selected option to the default selected |
| | 6245 | // state when cloning options |
| | 6246 | } else if ( nodeName === "option" ) { |
| | 6247 | dest.defaultSelected = dest.selected = src.defaultSelected; |
| | 6248 | |
| | 6249 | // IE6-8 fails to set the defaultValue to the correct value when |
| | 6250 | // cloning other types of input fields |
| | 6251 | } else if ( nodeName === "input" || nodeName === "textarea" ) { |
| | 6252 | dest.defaultValue = src.defaultValue; |
| | 6253 | } |
| | 6254 | } |
| | 6255 | |
| | 6256 | jQuery.each({ |
| | 6257 | appendTo: "append", |
| | 6258 | prependTo: "prepend", |
| | 6259 | insertBefore: "before", |
| | 6260 | insertAfter: "after", |
| | 6261 | replaceAll: "replaceWith" |
| | 6262 | }, function( name, original ) { |
| | 6263 | jQuery.fn[ name ] = function( selector ) { |
| | 6264 | var elems, |
| | 6265 | i = 0, |
| | 6266 | ret = [], |
| | 6267 | insert = jQuery( selector ), |
| | 6268 | last = insert.length - 1; |
| | 6269 | |
| | 6270 | for ( ; i <= last; i++ ) { |
| | 6271 | elems = i === last ? this : this.clone(true); |
| | 6272 | jQuery( insert[i] )[ original ]( elems ); |
| | 6273 | |
| | 6274 | // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() |
| | 6275 | core_push.apply( ret, elems.get() ); |
| | 6276 | } |
| | 6277 | |
| | 6278 | return this.pushStack( ret ); |
| | 6279 | }; |
| | 6280 | }); |
| | 6281 | |
| | 6282 | function getAll( context, tag ) { |
| | 6283 | var elems, elem, |
| | 6284 | i = 0, |
| | 6285 | found = typeof context.getElementsByTagName !== "undefined" ? context.getElementsByTagName( tag || "*" ) : |
| | 6286 | typeof context.querySelectorAll !== "undefined" ? context.querySelectorAll( tag || "*" ) : |
| | 6287 | undefined; |
| | 6288 | |
| | 6289 | if ( !found ) { |
| | 6290 | for ( found = [], elems = context.childNodes || context; (elem = elems[i]) != null; i++ ) { |
| | 6291 | if ( !tag || jQuery.nodeName( elem, tag ) ) { |
| | 6292 | found.push( elem ); |
| | 6293 | } else { |
| | 6294 | jQuery.merge( found, getAll( elem, tag ) ); |
| | 6295 | } |
| | 6296 | } |
| | 6297 | } |
| | 6298 | |
| | 6299 | return tag === undefined || tag && jQuery.nodeName( context, tag ) ? |
| | 6300 | jQuery.merge( [ context ], found ) : |
| | 6301 | found; |
| | 6302 | } |
| | 6303 | |
| | 6304 | // Used in clean, fixes the defaultChecked property |
| | 6305 | function fixDefaultChecked( elem ) { |
| | 6306 | if ( manipulation_rcheckableType.test( elem.type ) ) { |
| | 6307 | elem.defaultChecked = elem.checked; |
| | 6308 | } |
| | 6309 | } |
| | 6310 | |
| | 6311 | jQuery.extend({ |
| | 6312 | clone: function( elem, dataAndEvents, deepDataAndEvents ) { |
| | 6313 | var destElements, srcElements, node, i, clone, |
| | 6314 | inPage = jQuery.contains( elem.ownerDocument, elem ); |
| | 6315 | |
| | 6316 | if ( jQuery.support.html5Clone || jQuery.isXMLDoc(elem) || !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { |
| | 6317 | clone = elem.cloneNode( true ); |
| | 6318 | |
| | 6319 | // IE<=8 does not properly clone detached, unknown element nodes |
| | 6320 | } else { |
| | 6321 | fragmentDiv.innerHTML = elem.outerHTML; |
| | 6322 | fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); |
| | 6323 | } |
| | 6324 | |
| | 6325 | if ( (!jQuery.support.noCloneEvent || !jQuery.support.noCloneChecked) && |
| | 6326 | (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem) ) { |
| | 6327 | |
| | 6328 | // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 |
| | 6329 | destElements = getAll( clone ); |
| | 6330 | srcElements = getAll( elem ); |
| | 6331 | |
| | 6332 | // Fix all IE cloning issues |
| | 6333 | for ( i = 0; (node = srcElements[i]) != null; ++i ) { |
| | 6334 | // Ensure that the destination node is not null; Fixes #9587 |
| | 6335 | if ( destElements[i] ) { |
| | 6336 | fixCloneNodeIssues( node, destElements[i] ); |
| | 6337 | } |
| | 6338 | } |
| | 6339 | } |
| | 6340 | |
| | 6341 | // Copy the events from the original to the clone |
| | 6342 | if ( dataAndEvents ) { |
| | 6343 | if ( deepDataAndEvents ) { |
| | 6344 | srcElements = srcElements || getAll( elem ); |
| | 6345 | destElements = destElements || getAll( clone ); |
| | 6346 | |
| | 6347 | for ( i = 0; (node = srcElements[i]) != null; i++ ) { |
| | 6348 | cloneCopyEvent( node, destElements[i] ); |
| | 6349 | } |
| | 6350 | } else { |
| | 6351 | cloneCopyEvent( elem, clone ); |
| | 6352 | } |
| | 6353 | } |
| | 6354 | |
| | 6355 | // Preserve script evaluation history |
| | 6356 | destElements = getAll( clone, "script" ); |
| | 6357 | if ( destElements.length > 0 ) { |
| | 6358 | setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); |
| | 6359 | } |
| | 6360 | |
| | 6361 | destElements = srcElements = node = null; |
| | 6362 | |
| | 6363 | // Return the cloned set |
| | 6364 | return clone; |
| | 6365 | }, |
| | 6366 | |
| | 6367 | clean: function( elems, context, fragment, scripts, selection ) { |
| | 6368 | var elem, i, j, tmp, tag, wrap, tbody, |
| | 6369 | ret = [], |
| | 6370 | safe = context === document && safeFragment; |
| | 6371 | |
| | 6372 | // Ensure that context is a document |
| | 6373 | if ( !context || typeof context.createDocumentFragment === "undefined" ) { |
| | 6374 | context = document; |
| | 6375 | } |
| | 6376 | |
| | 6377 | for ( i = 0; (elem = elems[i]) != null; i++ ) { |
| | 6378 | if ( elem || elem === 0 ) { |
| | 6379 | // Add nodes directly |
| | 6380 | if ( jQuery.type( elem ) === "object" ) { |
| | 6381 | jQuery.merge( ret, elem.nodeType ? [ elem ] : elem ); |
| | 6382 | |
| | 6383 | // Convert non-html into a text node |
| | 6384 | } else if ( !rhtml.test( elem ) ) { |
| | 6385 | ret.push( context.createTextNode( elem ) ); |
| | 6386 | |
| | 6387 | // Convert html into DOM nodes |
| | 6388 | } else { |
| | 6389 | // Ensure a safe container |
| | 6390 | safe = safe || createSafeFragment( context ); |
| | 6391 | tmp = tmp || safe.appendChild( context.createElement("div") ); |
| | 6392 | |
| | 6393 | // Deserialize a standard representation |
| | 6394 | tag = ( rtagName.exec( elem ) || ["", ""] )[1].toLowerCase(); |
| | 6395 | wrap = wrapMap[ tag ] || wrapMap._default; |
| | 6396 | tmp.innerHTML = wrap[1] + elem.replace( rxhtmlTag, "<$1></$2>" ) + ( wrap[2] || "" ); |
| | 6397 | |
| | 6398 | // Descend through wrappers to the right content |
| | 6399 | j = wrap[0]; |
| | 6400 | while ( j-- ) { |
| | 6401 | tmp = tmp.lastChild; |
| | 6402 | } |
| | 6403 | |
| | 6404 | // Manually add leading whitespace removed by IE |
| | 6405 | if ( !jQuery.support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { |
| | 6406 | ret.push( context.createTextNode( rleadingWhitespace.exec( elem )[0] ) ); |
| | 6407 | } |
| | 6408 | |
| | 6409 | // Remove IE's autoinserted <tbody> from table fragments |
| | 6410 | if ( !jQuery.support.tbody ) { |
| | 6411 | |
| | 6412 | // String was a <table>, *may* have spurious <tbody> |
| | 6413 | elem = tag === "table" && !rtbody.test( elem ) ? |
| | 6414 | tmp.firstChild : |
| | 6415 | |
| | 6416 | // String was a bare <thead> or <tfoot> |
| | 6417 | wrap[1] === "<table>" && !rtbody.test( elem ) ? |
| | 6418 | tmp : |
| | 6419 | 0; |
| | 6420 | |
| | 6421 | j = elem && elem.childNodes.length; |
| | 6422 | while ( j-- ) { |
| | 6423 | if ( jQuery.nodeName( (tbody = elem.childNodes[j]), "tbody" ) && !tbody.childNodes.length ) { |
| | 6424 | elem.removeChild( tbody ); |
| | 6425 | } |
| | 6426 | } |
| | 6427 | } |
| | 6428 | |
| | 6429 | jQuery.merge( ret, tmp.childNodes ); |
| | 6430 | |
| | 6431 | // Fix #12392 for WebKit and IE > 9 |
| | 6432 | tmp.textContent = ""; |
| | 6433 | |
| | 6434 | // Fix #12392 for oldIE |
| | 6435 | while ( tmp.firstChild ) { |
| | 6436 | tmp.removeChild( tmp.firstChild ); |
| | 6437 | } |
| | 6438 | |
| | 6439 | // Remember the top-level container for proper cleanup |
| | 6440 | tmp = safe.lastChild; |
| | 6441 | } |
| | 6442 | } |
| | 6443 | } |
| | 6444 | |
| | 6445 | // Fix #11356: Clear elements from safeFragment |
| | 6446 | if ( tmp ) { |
| | 6447 | safe.removeChild( tmp ); |
| | 6448 | } |
| | 6449 | |
| | 6450 | // Reset defaultChecked for any radios and checkboxes |
| | 6451 | // about to be appended to the DOM in IE 6/7 (#8060) |
| | 6452 | if ( !jQuery.support.appendChecked ) { |
| | 6453 | jQuery.grep( getAll( ret, "input" ), fixDefaultChecked ); |
| | 6454 | } |
| | 6455 | |
| | 6456 | if ( fragment ) { |
| | 6457 | for ( i = 0; (elem = ret[i]) != null; i++ ) { |
| | 6458 | safe = jQuery.contains( elem.ownerDocument, elem ); |
| | 6459 | |
| | 6460 | // Append to fragment |
| | 6461 | // #4087 - If origin and destination elements are the same, and this is |
| | 6462 | // that element, do not append to fragment |
| | 6463 | if ( !selection || jQuery.inArray( elem, selection ) === -1 ) { |
| | 6464 | fragment.appendChild( elem ); |
| | 6465 | } |
| | 6466 | tmp = getAll( elem, "script" ); |
| | 6467 | |
| | 6468 | // Preserve script evaluation history |
| | 6469 | if ( safe ) { |
| | 6470 | setGlobalEval( tmp ); |
| | 6471 | } |
| | 6472 | |
| | 6473 | // Capture executables |
| | 6474 | if ( scripts ) { |
| | 6475 | for ( j = 0; (elem = tmp[j]) != null; j++ ) { |
| | 6476 | if ( rscriptType.test( elem.type || "" ) ) { |
| | 6477 | scripts.push( elem ); |
| | 6478 | } |
| | 6479 | } |
| | 6480 | } |
| | 6481 | } |
| | 6482 | } |
| | 6483 | |
| | 6484 | elem = tmp = safe = null; |
| | 6485 | |
| | 6486 | return ret; |
| | 6487 | }, |
| | 6488 | |
| | 6489 | cleanData: function( elems, /* internal */ acceptData ) { |
| | 6490 | var data, id, elem, type, |
| | 6491 | i = 0, |
| | 6492 | internalKey = jQuery.expando, |
| | 6493 | cache = jQuery.cache, |
| | 6494 | deleteExpando = jQuery.support.deleteExpando, |
| | 6495 | special = jQuery.event.special; |
| | 6496 | |
| | 6497 | for ( ; (elem = elems[i]) != null; i++ ) { |
| | 6498 | |
| | 6499 | if ( acceptData || jQuery.acceptData( elem ) ) { |
| | 6500 | |
| | 6501 | id = elem[ internalKey ]; |
| | 6502 | data = id && cache[ id ]; |
| | 6503 | |
| | 6504 | if ( data ) { |
| | 6505 | if ( data.events ) { |
| | 6506 | for ( type in data.events ) { |
| | 6507 | if ( special[ type ] ) { |
| | 6508 | jQuery.event.remove( elem, type ); |
| | 6509 | |
| | 6510 | // This is a shortcut to avoid jQuery.event.remove's overhead |
| | 6511 | } else { |
| | 6512 | jQuery.removeEvent( elem, type, data.handle ); |
| | 6513 | } |
| | 6514 | } |
| | 6515 | } |
| | 6516 | |
| | 6517 | // Remove cache only if it was not already removed by jQuery.event.remove |
| | 6518 | if ( cache[ id ] ) { |
| | 6519 | |
| | 6520 | delete cache[ id ]; |
| | 6521 | |
| | 6522 | // IE does not allow us to delete expando properties from nodes, |
| | 6523 | // nor does it have a removeAttribute function on Document nodes; |
| | 6524 | // we must handle all of these cases |
| | 6525 | if ( deleteExpando ) { |
| | 6526 | delete elem[ internalKey ]; |
| | 6527 | |
| | 6528 | } else if ( elem.removeAttribute ) { |
| | 6529 | elem.removeAttribute( internalKey ); |
| | 6530 | |
| | 6531 | } else { |
| | 6532 | elem[ internalKey ] = null; |
| | 6533 | } |
| | 6534 | |
| | 6535 | core_deletedIds.push( id ); |
| | 6536 | } |
| | 6537 | } |
| | 6538 | } |
| | 6539 | } |
| | 6540 | } |
| | 6541 | }); |
| | 6542 | var curCSS, getStyles, iframe, |
| | 6543 | ralpha = /alpha\([^)]*\)/i, |
| | 6544 | ropacity = /opacity\s*=\s*([^)]*)/, |
| | 6545 | rposition = /^(top|right|bottom|left)$/, |
| | 6546 | // swappable if display is none or starts with table except "table", "table-cell", or "table-caption" |
| | 6547 | // see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display |
| | 6548 | rdisplayswap = /^(none|table(?!-c[ea]).+)/, |
| | 6549 | rmargin = /^margin/, |
| | 6550 | rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ), |
| | 6551 | rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ), |
| | 6552 | rrelNum = new RegExp( "^([+-])=(" + core_pnum + ")", "i" ), |
| | 6553 | elemdisplay = { BODY: "block" }, |
| | 6554 | |
| | 6555 | cssShow = { position: "absolute", visibility: "hidden", display: "block" }, |
| | 6556 | cssNormalTransform = { |
| | 6557 | letterSpacing: 0, |
| | 6558 | fontWeight: 400 |
| | 6559 | }, |
| | 6560 | |
| | 6561 | cssExpand = [ "Top", "Right", "Bottom", "Left" ], |
| | 6562 | cssPrefixes = [ "Webkit", "O", "Moz", "ms" ]; |
| | 6563 | |
| | 6564 | // return a css property mapped to a potentially vendor prefixed property |
| | 6565 | function vendorPropName( style, name ) { |
| | 6566 | |
| | 6567 | // shortcut for names that are not vendor prefixed |
| | 6568 | if ( name in style ) { |
| | 6569 | return name; |
| | 6570 | } |
| | 6571 | |
| | 6572 | // check for vendor prefixed names |
| | 6573 | var capName = name.charAt(0).toUpperCase() + name.slice(1), |
| | 6574 | origName = name, |
| | 6575 | i = cssPrefixes.length; |
| | 6576 | |
| | 6577 | while ( i-- ) { |
| | 6578 | name = cssPrefixes[ i ] + capName; |
| | 6579 | if ( name in style ) { |
| | 6580 | return name; |
| | 6581 | } |
| | 6582 | } |
| | 6583 | |
| | 6584 | return origName; |
| | 6585 | } |
| | 6586 | |
| | 6587 | function isHidden( elem, el ) { |
| | 6588 | // isHidden might be called from jQuery#filter function; |
| | 6589 | // in that case, element will be second argument |
| | 6590 | elem = el || elem; |
| | 6591 | return jQuery.css( elem, "display" ) === "none" || !jQuery.contains( elem.ownerDocument, elem ); |
| | 6592 | } |
| | 6593 | |
| | 6594 | function showHide( elements, show ) { |
| | 6595 | var elem, |
| | 6596 | values = [], |
| | 6597 | index = 0, |
| | 6598 | length = elements.length; |
| | 6599 | |
| | 6600 | for ( ; index < length; index++ ) { |
| | 6601 | elem = elements[ index ]; |
| | 6602 | if ( !elem.style ) { |
| | 6603 | continue; |
| | 6604 | } |
| | 6605 | values[ index ] = jQuery._data( elem, "olddisplay" ); |
| | 6606 | if ( show ) { |
| | 6607 | // Reset the inline display of this element to learn if it is |
| | 6608 | // being hidden by cascaded rules or not |
| | 6609 | if ( !values[ index ] && elem.style.display === "none" ) { |
| | 6610 | elem.style.display = ""; |
| | 6611 | } |
| | 6612 | |
| | 6613 | // Set elements which have been overridden with display: none |
| | 6614 | // in a stylesheet to whatever the default browser style is |
| | 6615 | // for such an element |
| | 6616 | if ( elem.style.display === "" && isHidden( elem ) ) { |
| | 6617 | values[ index ] = jQuery._data( elem, "olddisplay", css_defaultDisplay(elem.nodeName) ); |
| | 6618 | } |
| | 6619 | } else if ( !values[ index ] && !isHidden( elem ) ) { |
| | 6620 | jQuery._data( elem, "olddisplay", jQuery.css( elem, "display" ) ); |
| | 6621 | } |
| | 6622 | } |
| | 6623 | |
| | 6624 | // Set the display of most of the elements in a second loop |
| | 6625 | // to avoid the constant reflow |
| | 6626 | for ( index = 0; index < length; index++ ) { |
| | 6627 | elem = elements[ index ]; |
| | 6628 | if ( !elem.style ) { |
| | 6629 | continue; |
| | 6630 | } |
| | 6631 | if ( !show || elem.style.display === "none" || elem.style.display === "" ) { |
| | 6632 | elem.style.display = show ? values[ index ] || "" : "none"; |
| | 6633 | } |
| | 6634 | } |
| | 6635 | |
| | 6636 | return elements; |
| | 6637 | } |
| | 6638 | |
| | 6639 | jQuery.fn.extend({ |
| | 6640 | css: function( name, value ) { |
| | 6641 | return jQuery.access( this, function( elem, name, value ) { |
| | 6642 | var styles, len, |
| | 6643 | map = {}, |
| | 6644 | i = 0; |
| | 6645 | |
| | 6646 | if ( jQuery.isArray( name ) ) { |
| | 6647 | styles = getStyles( elem ); |
| | 6648 | len = name.length; |
| | 6649 | |
| | 6650 | for ( ; i < len; i++ ) { |
| | 6651 | map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); |
| | 6652 | } |
| | 6653 | |
| | 6654 | return map; |
| | 6655 | } |
| | 6656 | |
| | 6657 | return value !== undefined ? |
| | 6658 | jQuery.style( elem, name, value ) : |
| | 6659 | jQuery.css( elem, name ); |
| | 6660 | }, name, value, arguments.length > 1 ); |
| | 6661 | }, |
| | 6662 | show: function() { |
| | 6663 | return showHide( this, true ); |
| | 6664 | }, |
| | 6665 | hide: function() { |
| | 6666 | return showHide( this ); |
| | 6667 | }, |
| | 6668 | toggle: function( state ) { |
| | 6669 | var bool = typeof state === "boolean"; |
| | 6670 | |
| | 6671 | return this.each(function() { |
| | 6672 | if ( bool ? state : isHidden( this ) ) { |
| | 6673 | jQuery( this ).show(); |
| | 6674 | } else { |
| | 6675 | jQuery( this ).hide(); |
| | 6676 | } |
| | 6677 | }); |
| | 6678 | } |
| | 6679 | }); |
| | 6680 | |
| | 6681 | jQuery.extend({ |
| | 6682 | // Add in style property hooks for overriding the default |
| | 6683 | // behavior of getting and setting a style property |
| | 6684 | cssHooks: { |
| | 6685 | opacity: { |
| | 6686 | get: function( elem, computed ) { |
| | 6687 | if ( computed ) { |
| | 6688 | // We should always get a number back from opacity |
| | 6689 | var ret = curCSS( elem, "opacity" ); |
| | 6690 | return ret === "" ? "1" : ret; |
| | 6691 | } |
| | 6692 | } |
| | 6693 | } |
| | 6694 | }, |
| | 6695 | |
| | 6696 | // Exclude the following css properties to add px |
| | 6697 | cssNumber: { |
| | 6698 | "columnCount": true, |
| | 6699 | "fillOpacity": true, |
| | 6700 | "fontWeight": true, |
| | 6701 | "lineHeight": true, |
| | 6702 | "opacity": true, |
| | 6703 | "orphans": true, |
| | 6704 | "widows": true, |
| | 6705 | "zIndex": true, |
| | 6706 | "zoom": true |
| | 6707 | }, |
| | 6708 | |
| | 6709 | // Add in properties whose names you wish to fix before |
| | 6710 | // setting or getting the value |
| | 6711 | cssProps: { |
| | 6712 | // normalize float css property |
| | 6713 | "float": jQuery.support.cssFloat ? "cssFloat" : "styleFloat" |
| | 6714 | }, |
| | 6715 | |
| | 6716 | // Get and set the style property on a DOM Node |
| | 6717 | style: function( elem, name, value, extra ) { |
| | 6718 | // Don't set styles on text and comment nodes |
| | 6719 | if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { |
| | 6720 | return; |
| | 6721 | } |
| | 6722 | |
| | 6723 | // Make sure that we're working with the right name |
| | 6724 | var ret, type, hooks, |
| | 6725 | origName = jQuery.camelCase( name ), |
| | 6726 | style = elem.style; |
| | 6727 | |
| | 6728 | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( style, origName ) ); |
| | 6729 | |
| | 6730 | // gets hook for the prefixed version |
| | 6731 | // followed by the unprefixed version |
| | 6732 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
| | 6733 | |
| | 6734 | // Check if we're setting a value |
| | 6735 | if ( value !== undefined ) { |
| | 6736 | type = typeof value; |
| | 6737 | |
| | 6738 | // convert relative number strings (+= or -=) to relative numbers. #7345 |
| | 6739 | if ( type === "string" && (ret = rrelNum.exec( value )) ) { |
| | 6740 | value = ( ret[1] + 1 ) * ret[2] + parseFloat( jQuery.css( elem, name ) ); |
| | 6741 | // Fixes bug #9237 |
| | 6742 | type = "number"; |
| | 6743 | } |
| | 6744 | |
| | 6745 | // Make sure that NaN and null values aren't set. See: #7116 |
| | 6746 | if ( value == null || type === "number" && isNaN( value ) ) { |
| | 6747 | return; |
| | 6748 | } |
| | 6749 | |
| | 6750 | // If a number was passed in, add 'px' to the (except for certain CSS properties) |
| | 6751 | if ( type === "number" && !jQuery.cssNumber[ origName ] ) { |
| | 6752 | value += "px"; |
| | 6753 | } |
| | 6754 | |
| | 6755 | // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, |
| | 6756 | // but it would mean to define eight (for every problematic property) identical functions |
| | 6757 | if ( value === "" && name.indexOf("background") === 0 ) { |
| | 6758 | value = " "; |
| | 6759 | } |
| | 6760 | |
| | 6761 | // If a hook was provided, use that value, otherwise just set the specified value |
| | 6762 | if ( !hooks || !("set" in hooks) || (value = hooks.set( elem, value, extra )) !== undefined ) { |
| | 6763 | |
| | 6764 | // Wrapped to prevent IE from throwing errors when 'invalid' values are provided |
| | 6765 | // Fixes bug #5509 |
| | 6766 | try { |
| | 6767 | style[ name ] = value; |
| | 6768 | } catch(e) {} |
| | 6769 | } |
| | 6770 | |
| | 6771 | } else { |
| | 6772 | // If a hook was provided get the non-computed value from there |
| | 6773 | if ( hooks && "get" in hooks && (ret = hooks.get( elem, false, extra )) !== undefined ) { |
| | 6774 | return ret; |
| | 6775 | } |
| | 6776 | |
| | 6777 | // Otherwise just get the value from the style object |
| | 6778 | return style[ name ]; |
| | 6779 | } |
| | 6780 | }, |
| | 6781 | |
| | 6782 | css: function( elem, name, extra, styles ) { |
| | 6783 | var val, num, hooks, |
| | 6784 | origName = jQuery.camelCase( name ); |
| | 6785 | |
| | 6786 | // Make sure that we're working with the right name |
| | 6787 | name = jQuery.cssProps[ origName ] || ( jQuery.cssProps[ origName ] = vendorPropName( elem.style, origName ) ); |
| | 6788 | |
| | 6789 | // gets hook for the prefixed version |
| | 6790 | // followed by the unprefixed version |
| | 6791 | hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; |
| | 6792 | |
| | 6793 | // If a hook was provided get the computed value from there |
| | 6794 | if ( hooks && "get" in hooks ) { |
| | 6795 | val = hooks.get( elem, true, extra ); |
| | 6796 | } |
| | 6797 | |
| | 6798 | // Otherwise, if a way to get the computed value exists, use that |
| | 6799 | if ( val === undefined ) { |
| | 6800 | val = curCSS( elem, name, styles ); |
| | 6801 | } |
| | 6802 | |
| | 6803 | //convert "normal" to computed value |
| | 6804 | if ( val === "normal" && name in cssNormalTransform ) { |
| | 6805 | val = cssNormalTransform[ name ]; |
| | 6806 | } |
| | 6807 | |
| | 6808 | // Return, converting to number if forced or a qualifier was provided and val looks numeric |
| | 6809 | if ( extra ) { |
| | 6810 | num = parseFloat( val ); |
| | 6811 | return extra === true || jQuery.isNumeric( num ) ? num || 0 : val; |
| | 6812 | } |
| | 6813 | return val; |
| | 6814 | }, |
| | 6815 | |
| | 6816 | // A method for quickly swapping in/out CSS properties to get correct calculations |
| | 6817 | swap: function( elem, options, callback, args ) { |
| | 6818 | var ret, name, |
| | 6819 | old = {}; |
| | 6820 | |
| | 6821 | // Remember the old values, and insert the new ones |
| | 6822 | for ( name in options ) { |
| | 6823 | old[ name ] = elem.style[ name ]; |
| | 6824 | elem.style[ name ] = options[ name ]; |
| | 6825 | } |
| | 6826 | |
| | 6827 | ret = callback.apply( elem, args || [] ); |
| | 6828 | |
| | 6829 | // Revert the old values |
| | 6830 | for ( name in options ) { |
| | 6831 | elem.style[ name ] = old[ name ]; |
| | 6832 | } |
| | 6833 | |
| | 6834 | return ret; |
| | 6835 | } |
| | 6836 | }); |
| | 6837 | |
| | 6838 | // NOTE: we've included the "window" in window.getComputedStyle |
| | 6839 | // because jsdom on node.js will break without it. |
| | 6840 | if ( window.getComputedStyle ) { |
| | 6841 | getStyles = function( elem ) { |
| | 6842 | return window.getComputedStyle( elem, null ); |
| | 6843 | }; |
| | 6844 | |
| | 6845 | curCSS = function( elem, name, _computed ) { |
| | 6846 | var width, minWidth, maxWidth, |
| | 6847 | computed = _computed || getStyles( elem ), |
| | 6848 | |
| | 6849 | // getPropertyValue is only needed for .css('filter') in IE9, see #12537 |
| | 6850 | ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined, |
| | 6851 | style = elem.style; |
| | 6852 | |
| | 6853 | if ( computed ) { |
| | 6854 | |
| | 6855 | if ( ret === "" && !jQuery.contains( elem.ownerDocument, elem ) ) { |
| | 6856 | ret = jQuery.style( elem, name ); |
| | 6857 | } |
| | 6858 | |
| | 6859 | // A tribute to the "awesome hack by Dean Edwards" |
| | 6860 | // Chrome < 17 and Safari 5.0 uses "computed value" instead of "used value" for margin-right |
| | 6861 | // Safari 5.1.7 (at least) returns percentage for a larger set of values, but width seems to be reliably pixels |
| | 6862 | // this is against the CSSOM draft spec: http://dev.w3.org/csswg/cssom/#resolved-values |
| | 6863 | if ( rnumnonpx.test( ret ) && rmargin.test( name ) ) { |
| | 6864 | |
| | 6865 | // Remember the original values |
| | 6866 | width = style.width; |
| | 6867 | minWidth = style.minWidth; |
| | 6868 | maxWidth = style.maxWidth; |
| | 6869 | |
| | 6870 | // Put in the new values to get a computed value out |
| | 6871 | style.minWidth = style.maxWidth = style.width = ret; |
| | 6872 | ret = computed.width; |
| | 6873 | |
| | 6874 | // Revert the changed values |
| | 6875 | style.width = width; |
| | 6876 | style.minWidth = minWidth; |
| | 6877 | style.maxWidth = maxWidth; |
| | 6878 | } |
| | 6879 | } |
| | 6880 | |
| | 6881 | return ret; |
| | 6882 | }; |
| | 6883 | } else if ( document.documentElement.currentStyle ) { |
| | 6884 | getStyles = function( elem ) { |
| | 6885 | return elem.currentStyle; |
| | 6886 | }; |
| | 6887 | |
| | 6888 | curCSS = function( elem, name, _computed ) { |
| | 6889 | var left, rs, rsLeft, |
| | 6890 | computed = _computed || getStyles( elem ), |
| | 6891 | ret = computed ? computed[ name ] : undefined, |
| | 6892 | style = elem.style; |
| | 6893 | |
| | 6894 | // Avoid setting ret to empty string here |
| | 6895 | // so we don't default to auto |
| | 6896 | if ( ret == null && style && style[ name ] ) { |
| | 6897 | ret = style[ name ]; |
| | 6898 | } |
| | 6899 | |
| | 6900 | // From the awesome hack by Dean Edwards |
| | 6901 | // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 |
| | 6902 | |
| | 6903 | // If we're not dealing with a regular pixel number |
| | 6904 | // but a number that has a weird ending, we need to convert it to pixels |
| | 6905 | // but not position css attributes, as those are proportional to the parent element instead |
| | 6906 | // and we can't measure the parent instead because it might trigger a "stacking dolls" problem |
| | 6907 | if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { |
| | 6908 | |
| | 6909 | // Remember the original values |
| | 6910 | left = style.left; |
| | 6911 | rs = elem.runtimeStyle; |
| | 6912 | rsLeft = rs && rs.left; |
| | 6913 | |
| | 6914 | // Put in the new values to get a computed value out |
| | 6915 | if ( rsLeft ) { |
| | 6916 | rs.left = elem.currentStyle.left; |
| | 6917 | } |
| | 6918 | style.left = name === "fontSize" ? "1em" : ret; |
| | 6919 | ret = style.pixelLeft + "px"; |
| | 6920 | |
| | 6921 | // Revert the changed values |
| | 6922 | style.left = left; |
| | 6923 | if ( rsLeft ) { |
| | 6924 | rs.left = rsLeft; |
| | 6925 | } |
| | 6926 | } |
| | 6927 | |
| | 6928 | return ret === "" ? "auto" : ret; |
| | 6929 | }; |
| | 6930 | } |
| | 6931 | |
| | 6932 | function setPositiveNumber( elem, value, subtract ) { |
| | 6933 | var matches = rnumsplit.exec( value ); |
| | 6934 | return matches ? |
| | 6935 | // Guard against undefined "subtract", e.g., when used as in cssHooks |
| | 6936 | Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : |
| | 6937 | value; |
| | 6938 | } |
| | 6939 | |
| | 6940 | function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { |
| | 6941 | var i = extra === ( isBorderBox ? "border" : "content" ) ? |
| | 6942 | // If we already have the right measurement, avoid augmentation |
| | 6943 | 4 : |
| | 6944 | // Otherwise initialize for horizontal or vertical properties |
| | 6945 | name === "width" ? 1 : 0, |
| | 6946 | |
| | 6947 | val = 0; |
| | 6948 | |
| | 6949 | for ( ; i < 4; i += 2 ) { |
| | 6950 | // both box models exclude margin, so add it if we want it |
| | 6951 | if ( extra === "margin" ) { |
| | 6952 | val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); |
| | 6953 | } |
| | 6954 | |
| | 6955 | if ( isBorderBox ) { |
| | 6956 | // border-box includes padding, so remove it if we want content |
| | 6957 | if ( extra === "content" ) { |
| | 6958 | val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
| | 6959 | } |
| | 6960 | |
| | 6961 | // at this point, extra isn't border nor margin, so remove border |
| | 6962 | if ( extra !== "margin" ) { |
| | 6963 | val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
| | 6964 | } |
| | 6965 | } else { |
| | 6966 | // at this point, extra isn't content, so add padding |
| | 6967 | val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); |
| | 6968 | |
| | 6969 | // at this point, extra isn't content nor padding, so add border |
| | 6970 | if ( extra !== "padding" ) { |
| | 6971 | val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); |
| | 6972 | } |
| | 6973 | } |
| | 6974 | } |
| | 6975 | |
| | 6976 | return val; |
| | 6977 | } |
| | 6978 | |
| | 6979 | function getWidthOrHeight( elem, name, extra ) { |
| | 6980 | |
| | 6981 | // Start with offset property, which is equivalent to the border-box value |
| | 6982 | var valueIsBorderBox = true, |
| | 6983 | val = name === "width" ? elem.offsetWidth : elem.offsetHeight, |
| | 6984 | styles = getStyles( elem ), |
| | 6985 | isBorderBox = jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; |
| | 6986 | |
| | 6987 | // some non-html elements return undefined for offsetWidth, so check for null/undefined |
| | 6988 | // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 |
| | 6989 | // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 |
| | 6990 | if ( val <= 0 || val == null ) { |
| | 6991 | // Fall back to computed then uncomputed css if necessary |
| | 6992 | val = curCSS( elem, name, styles ); |
| | 6993 | if ( val < 0 || val == null ) { |
| | 6994 | val = elem.style[ name ]; |
| | 6995 | } |
| | 6996 | |
| | 6997 | // Computed unit is not pixels. Stop here and return. |
| | 6998 | if ( rnumnonpx.test(val) ) { |
| | 6999 | return val; |
| | 7000 | } |
| | 7001 | |
| | 7002 | // we need the check for style in case a browser which returns unreliable values |
| | 7003 | // for getComputedStyle silently falls back to the reliable elem.style |
| | 7004 | valueIsBorderBox = isBorderBox && ( jQuery.support.boxSizingReliable || val === elem.style[ name ] ); |
| | 7005 | |
| | 7006 | // Normalize "", auto, and prepare for extra |
| | 7007 | val = parseFloat( val ) || 0; |
| | 7008 | } |
| | 7009 | |
| | 7010 | // use the active box-sizing model to add/subtract irrelevant styles |
| | 7011 | return ( val + |
| | 7012 | augmentWidthOrHeight( |
| | 7013 | elem, |
| | 7014 | name, |
| | 7015 | extra || ( isBorderBox ? "border" : "content" ), |
| | 7016 | valueIsBorderBox, |
| | 7017 | styles |
| | 7018 | ) |
| | 7019 | ) + "px"; |
| | 7020 | } |
| | 7021 | |
| | 7022 | // Try to determine the default display value of an element |
| | 7023 | function css_defaultDisplay( nodeName ) { |
| | 7024 | var doc = document, |
| | 7025 | display = elemdisplay[ nodeName ]; |
| | 7026 | |
| | 7027 | if ( !display ) { |
| | 7028 | display = actualDisplay( nodeName, doc ); |
| | 7029 | |
| | 7030 | // If the simple way fails, read from inside an iframe |
| | 7031 | if ( display === "none" || !display ) { |
| | 7032 | // Use the already-created iframe if possible |
| | 7033 | iframe = ( iframe || |
| | 7034 | jQuery("<iframe frameborder='0' width='0' height='0'/>") |
| | 7035 | .css( "cssText", "display:block !important" ) |
| | 7036 | ).appendTo( doc.documentElement ); |
| | 7037 | |
| | 7038 | // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse |
| | 7039 | doc = ( iframe[0].contentWindow || iframe[0].contentDocument ).document; |
| | 7040 | doc.write("<!doctype html><html><body>"); |
| | 7041 | doc.close(); |
| | 7042 | |
| | 7043 | display = actualDisplay( nodeName, doc ); |
| | 7044 | iframe.detach(); |
| | 7045 | } |
| | 7046 | |
| | 7047 | // Store the correct default display |
| | 7048 | elemdisplay[ nodeName ] = display; |
| | 7049 | } |
| | 7050 | |
| | 7051 | return display; |
| | 7052 | } |
| | 7053 | |
| | 7054 | // Called ONLY from within css_defaultDisplay |
| | 7055 | function actualDisplay( name, doc ) { |
| | 7056 | var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), |
| | 7057 | display = jQuery.css( elem[0], "display" ); |
| | 7058 | elem.remove(); |
| | 7059 | return display; |
| | 7060 | } |
| | 7061 | |
| | 7062 | jQuery.each([ "height", "width" ], function( i, name ) { |
| | 7063 | jQuery.cssHooks[ name ] = { |
| | 7064 | get: function( elem, computed, extra ) { |
| | 7065 | if ( computed ) { |
| | 7066 | // certain elements can have dimension info if we invisibly show them |
| | 7067 | // however, it must have a current display style that would benefit from this |
| | 7068 | return elem.offsetWidth === 0 && rdisplayswap.test( jQuery.css( elem, "display" ) ) ? |
| | 7069 | jQuery.swap( elem, cssShow, function() { |
| | 7070 | return getWidthOrHeight( elem, name, extra ); |
| | 7071 | }) : |
| | 7072 | getWidthOrHeight( elem, name, extra ); |
| | 7073 | } |
| | 7074 | }, |
| | 7075 | |
| | 7076 | set: function( elem, value, extra ) { |
| | 7077 | var styles = extra && getStyles( elem ); |
| | 7078 | return setPositiveNumber( elem, value, extra ? |
| | 7079 | augmentWidthOrHeight( |
| | 7080 | elem, |
| | 7081 | name, |
| | 7082 | extra, |
| | 7083 | jQuery.support.boxSizing && jQuery.css( elem, "boxSizing", false, styles ) === "border-box", |
| | 7084 | styles |
| | 7085 | ) : 0 |
| | 7086 | ); |
| | 7087 | } |
| | 7088 | }; |
| | 7089 | }); |
| | 7090 | |
| | 7091 | if ( !jQuery.support.opacity ) { |
| | 7092 | jQuery.cssHooks.opacity = { |
| | 7093 | get: function( elem, computed ) { |
| | 7094 | // IE uses filters for opacity |
| | 7095 | return ropacity.test( (computed && elem.currentStyle ? elem.currentStyle.filter : elem.style.filter) || "" ) ? |
| | 7096 | ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : |
| | 7097 | computed ? "1" : ""; |
| | 7098 | }, |
| | 7099 | |
| | 7100 | set: function( elem, value ) { |
| | 7101 | var style = elem.style, |
| | 7102 | currentStyle = elem.currentStyle, |
| | 7103 | opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", |
| | 7104 | filter = currentStyle && currentStyle.filter || style.filter || ""; |
| | 7105 | |
| | 7106 | // IE has trouble with opacity if it does not have layout |
| | 7107 | // Force it by setting the zoom level |
| | 7108 | style.zoom = 1; |
| | 7109 | |
| | 7110 | // if setting opacity to 1, and no other filters exist - attempt to remove filter attribute #6652 |
| | 7111 | // if value === "", then remove inline opacity #12685 |
| | 7112 | if ( ( value >= 1 || value === "" ) && |
| | 7113 | jQuery.trim( filter.replace( ralpha, "" ) ) === "" && |
| | 7114 | style.removeAttribute ) { |
| | 7115 | |
| | 7116 | // Setting style.filter to null, "" & " " still leave "filter:" in the cssText |
| | 7117 | // if "filter:" is present at all, clearType is disabled, we want to avoid this |
| | 7118 | // style.removeAttribute is IE Only, but so apparently is this code path... |
| | 7119 | style.removeAttribute( "filter" ); |
| | 7120 | |
| | 7121 | // if there is no filter style applied in a css rule or unset inline opacity, we are done |
| | 7122 | if ( value === "" || currentStyle && !currentStyle.filter ) { |
| | 7123 | return; |
| | 7124 | } |
| | 7125 | } |
| | 7126 | |
| | 7127 | // otherwise, set new filter values |
| | 7128 | style.filter = ralpha.test( filter ) ? |
| | 7129 | filter.replace( ralpha, opacity ) : |
| | 7130 | filter + " " + opacity; |
| | 7131 | } |
| | 7132 | }; |
| | 7133 | } |
| | 7134 | |
| | 7135 | // These hooks cannot be added until DOM ready because the support test |
| | 7136 | // for it is not run until after DOM ready |
| | 7137 | jQuery(function() { |
| | 7138 | if ( !jQuery.support.reliableMarginRight ) { |
| | 7139 | jQuery.cssHooks.marginRight = { |
| | 7140 | get: function( elem, computed ) { |
| | 7141 | if ( computed ) { |
| | 7142 | // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right |
| | 7143 | // Work around by temporarily setting element display to inline-block |
| | 7144 | return jQuery.swap( elem, { "display": "inline-block" }, |
| | 7145 | curCSS, [ elem, "marginRight" ] ); |
| | 7146 | } |
| | 7147 | } |
| | 7148 | }; |
| | 7149 | } |
| | 7150 | |
| | 7151 | // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 |
| | 7152 | // getComputedStyle returns percent when specified for top/left/bottom/right |
| | 7153 | // rather than make the css module depend on the offset module, we just check for it here |
| | 7154 | if ( !jQuery.support.pixelPosition && jQuery.fn.position ) { |
| | 7155 | jQuery.each( [ "top", "left" ], function( i, prop ) { |
| | 7156 | jQuery.cssHooks[ prop ] = { |
| | 7157 | get: function( elem, computed ) { |
| | 7158 | if ( computed ) { |
| | 7159 | computed = curCSS( elem, prop ); |
| | 7160 | // if curCSS returns percentage, fallback to offset |
| | 7161 | return rnumnonpx.test( computed ) ? |
| | 7162 | jQuery( elem ).position()[ prop ] + "px" : |
| | 7163 | computed; |
| | 7164 | } |
| | 7165 | } |
| | 7166 | }; |
| | 7167 | }); |
| | 7168 | } |
| | 7169 | |
| | 7170 | }); |
| | 7171 | |
| | 7172 | if ( jQuery.expr && jQuery.expr.filters ) { |
| | 7173 | jQuery.expr.filters.hidden = function( elem ) { |
| | 7174 | return ( elem.offsetWidth === 0 && elem.offsetHeight === 0 ) || (!jQuery.support.reliableHiddenOffsets && ((elem.style && elem.style.display) || jQuery.css( elem, "display" )) === "none"); |
| | 7175 | }; |
| | 7176 | |
| | 7177 | jQuery.expr.filters.visible = function( elem ) { |
| | 7178 | return !jQuery.expr.filters.hidden( elem ); |
| | 7179 | }; |
| | 7180 | } |
| | 7181 | |
| | 7182 | // These hooks are used by animate to expand properties |
| | 7183 | jQuery.each({ |
| | 7184 | margin: "", |
| | 7185 | padding: "", |
| | 7186 | border: "Width" |
| | 7187 | }, function( prefix, suffix ) { |
| | 7188 | jQuery.cssHooks[ prefix + suffix ] = { |
| | 7189 | expand: function( value ) { |
| | 7190 | var i = 0, |
| | 7191 | expanded = {}, |
| | 7192 | |
| | 7193 | // assumes a single number if not a string |
| | 7194 | parts = typeof value === "string" ? value.split(" ") : [ value ]; |
| | 7195 | |
| | 7196 | for ( ; i < 4; i++ ) { |
| | 7197 | expanded[ prefix + cssExpand[ i ] + suffix ] = |
| | 7198 | parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; |
| | 7199 | } |
| | 7200 | |
| | 7201 | return expanded; |
| | 7202 | } |
| | 7203 | }; |
| | 7204 | |
| | 7205 | if ( !rmargin.test( prefix ) ) { |
| | 7206 | jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; |
| | 7207 | } |
| | 7208 | }); |
| | 7209 | var r20 = /%20/g, |
| | 7210 | rbracket = /\[\]$/, |
| | 7211 | rCRLF = /\r?\n/g, |
| | 7212 | rsubmitterTypes = /^(?:submit|button|image|reset)$/i, |
| | 7213 | rsubmittable = /^(?:input|select|textarea|keygen)/i; |
| | 7214 | |
| | 7215 | jQuery.fn.extend({ |
| | 7216 | serialize: function() { |
| | 7217 | return jQuery.param( this.serializeArray() ); |
| | 7218 | }, |
| | 7219 | serializeArray: function() { |
| | 7220 | return this.map(function(){ |
| | 7221 | // Can add propHook for "elements" to filter or add form elements |
| | 7222 | var elements = jQuery.prop( this, "elements" ); |
| | 7223 | return elements ? jQuery.makeArray( elements ) : this; |
| | 7224 | }) |
| | 7225 | .filter(function(){ |
| | 7226 | var type = this.type; |
| | 7227 | // Use .is(":disabled") so that fieldset[disabled] works |
| | 7228 | return this.name && !jQuery( this ).is( ":disabled" ) && |
| | 7229 | rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && |
| | 7230 | ( this.checked || !manipulation_rcheckableType.test( type ) ); |
| | 7231 | }) |
| | 7232 | .map(function( i, elem ){ |
| | 7233 | var val = jQuery( this ).val(); |
| | 7234 | |
| | 7235 | return val == null ? |
| | 7236 | null : |
| | 7237 | jQuery.isArray( val ) ? |
| | 7238 | jQuery.map( val, function( val ){ |
| | 7239 | return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
| | 7240 | }) : |
| | 7241 | { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; |
| | 7242 | }).get(); |
| | 7243 | } |
| | 7244 | }); |
| | 7245 | |
| | 7246 | //Serialize an array of form elements or a set of |
| | 7247 | //key/values into a query string |
| | 7248 | jQuery.param = function( a, traditional ) { |
| | 7249 | var prefix, |
| | 7250 | s = [], |
| | 7251 | add = function( key, value ) { |
| | 7252 | // If value is a function, invoke it and return its value |
| | 7253 | value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); |
| | 7254 | s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); |
| | 7255 | }; |
| | 7256 | |
| | 7257 | // Set traditional to true for jQuery <= 1.3.2 behavior. |
| | 7258 | if ( traditional === undefined ) { |
| | 7259 | traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; |
| | 7260 | } |
| | 7261 | |
| | 7262 | // If an array was passed in, assume that it is an array of form elements. |
| | 7263 | if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { |
| | 7264 | // Serialize the form elements |
| | 7265 | jQuery.each( a, function() { |
| | 7266 | add( this.name, this.value ); |
| | 7267 | }); |
| | 7268 | |
| | 7269 | } else { |
| | 7270 | // If traditional, encode the "old" way (the way 1.3.2 or older |
| | 7271 | // did it), otherwise encode params recursively. |
| | 7272 | for ( prefix in a ) { |
| | 7273 | buildParams( prefix, a[ prefix ], traditional, add ); |
| | 7274 | } |
| | 7275 | } |
| | 7276 | |
| | 7277 | // Return the resulting serialization |
| | 7278 | return s.join( "&" ).replace( r20, "+" ); |
| | 7279 | }; |
| | 7280 | |
| | 7281 | function buildParams( prefix, obj, traditional, add ) { |
| | 7282 | var name; |
| | 7283 | |
| | 7284 | if ( jQuery.isArray( obj ) ) { |
| | 7285 | // Serialize array item. |
| | 7286 | jQuery.each( obj, function( i, v ) { |
| | 7287 | if ( traditional || rbracket.test( prefix ) ) { |
| | 7288 | // Treat each array item as a scalar. |
| | 7289 | add( prefix, v ); |
| | 7290 | |
| | 7291 | } else { |
| | 7292 | // Item is non-scalar (array or object), encode its numeric index. |
| | 7293 | buildParams( prefix + "[" + ( typeof v === "object" ? i : "" ) + "]", v, traditional, add ); |
| | 7294 | } |
| | 7295 | }); |
| | 7296 | |
| | 7297 | } else if ( !traditional && jQuery.type( obj ) === "object" ) { |
| | 7298 | // Serialize object item. |
| | 7299 | for ( name in obj ) { |
| | 7300 | buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); |
| | 7301 | } |
| | 7302 | |
| | 7303 | } else { |
| | 7304 | // Serialize scalar item. |
| | 7305 | add( prefix, obj ); |
| | 7306 | } |
| | 7307 | } |
| | 7308 | var |
| | 7309 | // Document location |
| | 7310 | ajaxLocParts, |
| | 7311 | ajaxLocation, |
| | 7312 | |
| | 7313 | ajax_nonce = jQuery.now(), |
| | 7314 | |
| | 7315 | ajax_rquery = /\?/, |
| | 7316 | rhash = /#.*$/, |
| | 7317 | rts = /([?&])_=[^&]*/, |
| | 7318 | rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL |
| | 7319 | // #7653, #8125, #8152: local protocol detection |
| | 7320 | rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, |
| | 7321 | rnoContent = /^(?:GET|HEAD)$/, |
| | 7322 | rprotocol = /^\/\//, |
| | 7323 | rurl = /^([\w.+-]+:)(?:\/\/([^\/?#:]*)(?::(\d+)|)|)/, |
| | 7324 | |
| | 7325 | // Keep a copy of the old load method |
| | 7326 | _load = jQuery.fn.load, |
| | 7327 | |
| | 7328 | /* Prefilters |
| | 7329 | * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) |
| | 7330 | * 2) These are called: |
| | 7331 | * - BEFORE asking for a transport |
| | 7332 | * - AFTER param serialization (s.data is a string if s.processData is true) |
| | 7333 | * 3) key is the dataType |
| | 7334 | * 4) the catchall symbol "*" can be used |
| | 7335 | * 5) execution will start with transport dataType and THEN continue down to "*" if needed |
| | 7336 | */ |
| | 7337 | prefilters = {}, |
| | 7338 | |
| | 7339 | /* Transports bindings |
| | 7340 | * 1) key is the dataType |
| | 7341 | * 2) the catchall symbol "*" can be used |
| | 7342 | * 3) selection will start with transport dataType and THEN go to "*" if needed |
| | 7343 | */ |
| | 7344 | transports = {}, |
| | 7345 | |
| | 7346 | // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression |
| | 7347 | allTypes = "*/".concat("*"); |
| | 7348 | |
| | 7349 | // #8138, IE may throw an exception when accessing |
| | 7350 | // a field from window.location if document.domain has been set |
| | 7351 | try { |
| | 7352 | ajaxLocation = location.href; |
| | 7353 | } catch( e ) { |
| | 7354 | // Use the href attribute of an A element |
| | 7355 | // since IE will modify it given document.location |
| | 7356 | ajaxLocation = document.createElement( "a" ); |
| | 7357 | ajaxLocation.href = ""; |
| | 7358 | ajaxLocation = ajaxLocation.href; |
| | 7359 | } |
| | 7360 | |
| | 7361 | // Segment location into parts |
| | 7362 | ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; |
| | 7363 | |
| | 7364 | // Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport |
| | 7365 | function addToPrefiltersOrTransports( structure ) { |
| | 7366 | |
| | 7367 | // dataTypeExpression is optional and defaults to "*" |
| | 7368 | return function( dataTypeExpression, func ) { |
| | 7369 | |
| | 7370 | if ( typeof dataTypeExpression !== "string" ) { |
| | 7371 | func = dataTypeExpression; |
| | 7372 | dataTypeExpression = "*"; |
| | 7373 | } |
| | 7374 | |
| | 7375 | var dataType, |
| | 7376 | i = 0, |
| | 7377 | dataTypes = dataTypeExpression.toLowerCase().match( core_rnotwhite ) || []; |
| | 7378 | |
| | 7379 | if ( jQuery.isFunction( func ) ) { |
| | 7380 | // For each dataType in the dataTypeExpression |
| | 7381 | while ( (dataType = dataTypes[i++]) ) { |
| | 7382 | // Prepend if requested |
| | 7383 | if ( dataType[0] === "+" ) { |
| | 7384 | dataType = dataType.slice( 1 ) || "*"; |
| | 7385 | (structure[ dataType ] = structure[ dataType ] || []).unshift( func ); |
| | 7386 | |
| | 7387 | // Otherwise append |
| | 7388 | } else { |
| | 7389 | (structure[ dataType ] = structure[ dataType ] || []).push( func ); |
| | 7390 | } |
| | 7391 | } |
| | 7392 | } |
| | 7393 | }; |
| | 7394 | } |
| | 7395 | |
| | 7396 | // Base inspection function for prefilters and transports |
| | 7397 | function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { |
| | 7398 | |
| | 7399 | var inspected = {}, |
| | 7400 | seekingTransport = ( structure === transports ); |
| | 7401 | |
| | 7402 | function inspect( dataType ) { |
| | 7403 | var selected; |
| | 7404 | inspected[ dataType ] = true; |
| | 7405 | jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { |
| | 7406 | var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); |
| | 7407 | if( typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[ dataTypeOrTransport ] ) { |
| | 7408 | options.dataTypes.unshift( dataTypeOrTransport ); |
| | 7409 | inspect( dataTypeOrTransport ); |
| | 7410 | return false; |
| | 7411 | } else if ( seekingTransport ) { |
| | 7412 | return !( selected = dataTypeOrTransport ); |
| | 7413 | } |
| | 7414 | }); |
| | 7415 | return selected; |
| | 7416 | } |
| | 7417 | |
| | 7418 | return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); |
| | 7419 | } |
| | 7420 | |
| | 7421 | // A special extend for ajax options |
| | 7422 | // that takes "flat" options (not to be deep extended) |
| | 7423 | // Fixes #9887 |
| | 7424 | function ajaxExtend( target, src ) { |
| | 7425 | var key, deep, |
| | 7426 | flatOptions = jQuery.ajaxSettings.flatOptions || {}; |
| | 7427 | |
| | 7428 | for ( key in src ) { |
| | 7429 | if ( src[ key ] !== undefined ) { |
| | 7430 | ( flatOptions[ key ] ? target : ( deep || (deep = {}) ) )[ key ] = src[ key ]; |
| | 7431 | } |
| | 7432 | } |
| | 7433 | if ( deep ) { |
| | 7434 | jQuery.extend( true, target, deep ); |
| | 7435 | } |
| | 7436 | |
| | 7437 | return target; |
| | 7438 | } |
| | 7439 | |
| | 7440 | jQuery.fn.load = function( url, params, callback ) { |
| | 7441 | if ( typeof url !== "string" && _load ) { |
| | 7442 | return _load.apply( this, arguments ); |
| | 7443 | } |
| | 7444 | |
| | 7445 | var selector, type, response, |
| | 7446 | self = this, |
| | 7447 | off = url.indexOf(" "); |
| | 7448 | |
| | 7449 | if ( off >= 0 ) { |
| | 7450 | selector = url.slice( off, url.length ); |
| | 7451 | url = url.slice( 0, off ); |
| | 7452 | } |
| | 7453 | |
| | 7454 | // If it's a function |
| | 7455 | if ( jQuery.isFunction( params ) ) { |
| | 7456 | |
| | 7457 | // We assume that it's the callback |
| | 7458 | callback = params; |
| | 7459 | params = undefined; |
| | 7460 | |
| | 7461 | // Otherwise, build a param string |
| | 7462 | } else if ( params && typeof params === "object" ) { |
| | 7463 | type = "POST"; |
| | 7464 | } |
| | 7465 | |
| | 7466 | // If we have elements to modify, make the request |
| | 7467 | if ( self.length > 0 ) { |
| | 7468 | jQuery.ajax({ |
| | 7469 | url: url, |
| | 7470 | |
| | 7471 | // if "type" variable is undefined, then "GET" method will be used |
| | 7472 | type: type, |
| | 7473 | dataType: "html", |
| | 7474 | data: params |
| | 7475 | }).done(function( responseText ) { |
| | 7476 | |
| | 7477 | // Save response for use in complete callback |
| | 7478 | response = arguments; |
| | 7479 | |
| | 7480 | self.html( selector ? |
| | 7481 | |
| | 7482 | // If a selector was specified, locate the right elements in a dummy div |
| | 7483 | // Exclude scripts to avoid IE 'Permission Denied' errors |
| | 7484 | jQuery("<div>").append( jQuery.parseHTML( responseText ) ).find( selector ) : |
| | 7485 | |
| | 7486 | // Otherwise use the full result |
| | 7487 | responseText ); |
| | 7488 | |
| | 7489 | }).complete( callback && function( jqXHR, status ) { |
| | 7490 | self.each( callback, response || [ jqXHR.responseText, status, jqXHR ] ); |
| | 7491 | }); |
| | 7492 | } |
| | 7493 | |
| | 7494 | return this; |
| | 7495 | }; |
| | 7496 | |
| | 7497 | // Attach a bunch of functions for handling common AJAX events |
| | 7498 | jQuery.each( [ "ajaxStart", "ajaxStop", "ajaxComplete", "ajaxError", "ajaxSuccess", "ajaxSend" ], function( i, type ){ |
| | 7499 | jQuery.fn[ type ] = function( fn ){ |
| | 7500 | return this.on( type, fn ); |
| | 7501 | }; |
| | 7502 | }); |
| | 7503 | |
| | 7504 | jQuery.each( [ "get", "post" ], function( i, method ) { |
| | 7505 | jQuery[ method ] = function( url, data, callback, type ) { |
| | 7506 | // shift arguments if data argument was omitted |
| | 7507 | if ( jQuery.isFunction( data ) ) { |
| | 7508 | type = type || callback; |
| | 7509 | callback = data; |
| | 7510 | data = undefined; |
| | 7511 | } |
| | 7512 | |
| | 7513 | return jQuery.ajax({ |
| | 7514 | url: url, |
| | 7515 | type: method, |
| | 7516 | dataType: type, |
| | 7517 | data: data, |
| | 7518 | success: callback |
| | 7519 | }); |
| | 7520 | }; |
| | 7521 | }); |
| | 7522 | |
| | 7523 | jQuery.extend({ |
| | 7524 | |
| | 7525 | // Counter for holding the number of active queries |
| | 7526 | active: 0, |
| | 7527 | |
| | 7528 | // Last-Modified header cache for next request |
| | 7529 | lastModified: {}, |
| | 7530 | etag: {}, |
| | 7531 | |
| | 7532 | ajaxSettings: { |
| | 7533 | url: ajaxLocation, |
| | 7534 | type: "GET", |
| | 7535 | isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), |
| | 7536 | global: true, |
| | 7537 | processData: true, |
| | 7538 | async: true, |
| | 7539 | contentType: "application/x-www-form-urlencoded; charset=UTF-8", |
| | 7540 | /* |
| | 7541 | timeout: 0, |
| | 7542 | data: null, |
| | 7543 | dataType: null, |
| | 7544 | username: null, |
| | 7545 | password: null, |
| | 7546 | cache: null, |
| | 7547 | throws: false, |
| | 7548 | traditional: false, |
| | 7549 | headers: {}, |
| | 7550 | */ |
| | 7551 | |
| | 7552 | accepts: { |
| | 7553 | "*": allTypes, |
| | 7554 | text: "text/plain", |
| | 7555 | html: "text/html", |
| | 7556 | xml: "application/xml, text/xml", |
| | 7557 | json: "application/json, text/javascript" |
| | 7558 | }, |
| | 7559 | |
| | 7560 | contents: { |
| | 7561 | xml: /xml/, |
| | 7562 | html: /html/, |
| | 7563 | json: /json/ |
| | 7564 | }, |
| | 7565 | |
| | 7566 | responseFields: { |
| | 7567 | xml: "responseXML", |
| | 7568 | text: "responseText" |
| | 7569 | }, |
| | 7570 | |
| | 7571 | // Data converters |
| | 7572 | // Keys separate source (or catchall "*") and destination types with a single space |
| | 7573 | converters: { |
| | 7574 | |
| | 7575 | // Convert anything to text |
| | 7576 | "* text": window.String, |
| | 7577 | |
| | 7578 | // Text to html (true = no transformation) |
| | 7579 | "text html": true, |
| | 7580 | |
| | 7581 | // Evaluate text as a json expression |
| | 7582 | "text json": jQuery.parseJSON, |
| | 7583 | |
| | 7584 | // Parse text as xml |
| | 7585 | "text xml": jQuery.parseXML |
| | 7586 | }, |
| | 7587 | |
| | 7588 | // For options that shouldn't be deep extended: |
| | 7589 | // you can add your own custom options here if |
| | 7590 | // and when you create one that shouldn't be |
| | 7591 | // deep extended (see ajaxExtend) |
| | 7592 | flatOptions: { |
| | 7593 | url: true, |
| | 7594 | context: true |
| | 7595 | } |
| | 7596 | }, |
| | 7597 | |
| | 7598 | // Creates a full fledged settings object into target |
| | 7599 | // with both ajaxSettings and settings fields. |
| | 7600 | // If target is omitted, writes into ajaxSettings. |
| | 7601 | ajaxSetup: function( target, settings ) { |
| | 7602 | return settings ? |
| | 7603 | |
| | 7604 | // Building a settings object |
| | 7605 | ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : |
| | 7606 | |
| | 7607 | // Extending ajaxSettings |
| | 7608 | ajaxExtend( jQuery.ajaxSettings, target ); |
| | 7609 | }, |
| | 7610 | |
| | 7611 | ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), |
| | 7612 | ajaxTransport: addToPrefiltersOrTransports( transports ), |
| | 7613 | |
| | 7614 | // Main method |
| | 7615 | ajax: function( url, options ) { |
| | 7616 | |
| | 7617 | // If url is an object, simulate pre-1.5 signature |
| | 7618 | if ( typeof url === "object" ) { |
| | 7619 | options = url; |
| | 7620 | url = undefined; |
| | 7621 | } |
| | 7622 | |
| | 7623 | // Force options to be an object |
| | 7624 | options = options || {}; |
| | 7625 | |
| | 7626 | var transport, |
| | 7627 | // URL without anti-cache param |
| | 7628 | cacheURL, |
| | 7629 | // Response headers |
| | 7630 | responseHeadersString, |
| | 7631 | responseHeaders, |
| | 7632 | // timeout handle |
| | 7633 | timeoutTimer, |
| | 7634 | // Cross-domain detection vars |
| | 7635 | parts, |
| | 7636 | // To know if global events are to be dispatched |
| | 7637 | fireGlobals, |
| | 7638 | // Loop variable |
| | 7639 | i, |
| | 7640 | // Create the final options object |
| | 7641 | s = jQuery.ajaxSetup( {}, options ), |
| | 7642 | // Callbacks context |
| | 7643 | callbackContext = s.context || s, |
| | 7644 | // Context for global events is callbackContext if it is a DOM node or jQuery collection |
| | 7645 | globalEventContext = s.context && ( callbackContext.nodeType || callbackContext.jquery ) ? |
| | 7646 | jQuery( callbackContext ) : |
| | 7647 | jQuery.event, |
| | 7648 | // Deferreds |
| | 7649 | deferred = jQuery.Deferred(), |
| | 7650 | completeDeferred = jQuery.Callbacks("once memory"), |
| | 7651 | // Status-dependent callbacks |
| | 7652 | statusCode = s.statusCode || {}, |
| | 7653 | // Headers (they are sent all at once) |
| | 7654 | requestHeaders = {}, |
| | 7655 | requestHeadersNames = {}, |
| | 7656 | // The jqXHR state |
| | 7657 | state = 0, |
| | 7658 | // Default abort message |
| | 7659 | strAbort = "canceled", |
| | 7660 | // Fake xhr |
| | 7661 | jqXHR = { |
| | 7662 | readyState: 0, |
| | 7663 | |
| | 7664 | // Builds headers hashtable if needed |
| | 7665 | getResponseHeader: function( key ) { |
| | 7666 | var match; |
| | 7667 | if ( state === 2 ) { |
| | 7668 | if ( !responseHeaders ) { |
| | 7669 | responseHeaders = {}; |
| | 7670 | while ( (match = rheaders.exec( responseHeadersString )) ) { |
| | 7671 | responseHeaders[ match[1].toLowerCase() ] = match[ 2 ]; |
| | 7672 | } |
| | 7673 | } |
| | 7674 | match = responseHeaders[ key.toLowerCase() ]; |
| | 7675 | } |
| | 7676 | return match == null ? null : match; |
| | 7677 | }, |
| | 7678 | |
| | 7679 | // Raw string |
| | 7680 | getAllResponseHeaders: function() { |
| | 7681 | return state === 2 ? responseHeadersString : null; |
| | 7682 | }, |
| | 7683 | |
| | 7684 | // Caches the header |
| | 7685 | setRequestHeader: function( name, value ) { |
| | 7686 | var lname = name.toLowerCase(); |
| | 7687 | if ( !state ) { |
| | 7688 | name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; |
| | 7689 | requestHeaders[ name ] = value; |
| | 7690 | } |
| | 7691 | return this; |
| | 7692 | }, |
| | 7693 | |
| | 7694 | // Overrides response content-type header |
| | 7695 | overrideMimeType: function( type ) { |
| | 7696 | if ( !state ) { |
| | 7697 | s.mimeType = type; |
| | 7698 | } |
| | 7699 | return this; |
| | 7700 | }, |
| | 7701 | |
| | 7702 | // Status-dependent callbacks |
| | 7703 | statusCode: function( map ) { |
| | 7704 | var code; |
| | 7705 | if ( map ) { |
| | 7706 | if ( state < 2 ) { |
| | 7707 | for ( code in map ) { |
| | 7708 | // Lazy-add the new callback in a way that preserves old ones |
| | 7709 | statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; |
| | 7710 | } |
| | 7711 | } else { |
| | 7712 | // Execute the appropriate callbacks |
| | 7713 | jqXHR.always( map[ jqXHR.status ] ); |
| | 7714 | } |
| | 7715 | } |
| | 7716 | return this; |
| | 7717 | }, |
| | 7718 | |
| | 7719 | // Cancel the request |
| | 7720 | abort: function( statusText ) { |
| | 7721 | var finalText = statusText || strAbort; |
| | 7722 | if ( transport ) { |
| | 7723 | transport.abort( finalText ); |
| | 7724 | } |
| | 7725 | done( 0, finalText ); |
| | 7726 | return this; |
| | 7727 | } |
| | 7728 | }; |
| | 7729 | |
| | 7730 | // Attach deferreds |
| | 7731 | deferred.promise( jqXHR ).complete = completeDeferred.add; |
| | 7732 | jqXHR.success = jqXHR.done; |
| | 7733 | jqXHR.error = jqXHR.fail; |
| | 7734 | |
| | 7735 | // Remove hash character (#7531: and string promotion) |
| | 7736 | // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) |
| | 7737 | // Handle falsy url in the settings object (#10093: consistency with old signature) |
| | 7738 | // We also use the url parameter if available |
| | 7739 | s.url = ( ( url || s.url || ajaxLocation ) + "" ).replace( rhash, "" ).replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); |
| | 7740 | |
| | 7741 | // Alias method option to type as per ticket #12004 |
| | 7742 | s.type = options.method || options.type || s.method || s.type; |
| | 7743 | |
| | 7744 | // Extract dataTypes list |
| | 7745 | s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( core_rnotwhite ) || [""]; |
| | 7746 | |
| | 7747 | // A cross-domain request is in order when we have a protocol:host:port mismatch |
| | 7748 | if ( s.crossDomain == null ) { |
| | 7749 | parts = rurl.exec( s.url.toLowerCase() ); |
| | 7750 | s.crossDomain = !!( parts && |
| | 7751 | ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || |
| | 7752 | ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) != |
| | 7753 | ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) ) |
| | 7754 | ); |
| | 7755 | } |
| | 7756 | |
| | 7757 | // Convert data if not already a string |
| | 7758 | if ( s.data && s.processData && typeof s.data !== "string" ) { |
| | 7759 | s.data = jQuery.param( s.data, s.traditional ); |
| | 7760 | } |
| | 7761 | |
| | 7762 | // Apply prefilters |
| | 7763 | inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); |
| | 7764 | |
| | 7765 | // If request was aborted inside a prefilter, stop there |
| | 7766 | if ( state === 2 ) { |
| | 7767 | return jqXHR; |
| | 7768 | } |
| | 7769 | |
| | 7770 | // We can fire global events as of now if asked to |
| | 7771 | fireGlobals = s.global; |
| | 7772 | |
| | 7773 | // Watch for a new set of requests |
| | 7774 | if ( fireGlobals && jQuery.active++ === 0 ) { |
| | 7775 | jQuery.event.trigger("ajaxStart"); |
| | 7776 | } |
| | 7777 | |
| | 7778 | // Uppercase the type |
| | 7779 | s.type = s.type.toUpperCase(); |
| | 7780 | |
| | 7781 | // Determine if request has content |
| | 7782 | s.hasContent = !rnoContent.test( s.type ); |
| | 7783 | |
| | 7784 | // Save the URL in case we're toying with the If-Modified-Since |
| | 7785 | // and/or If-None-Match header later on |
| | 7786 | cacheURL = s.url; |
| | 7787 | |
| | 7788 | // More options handling for requests with no content |
| | 7789 | if ( !s.hasContent ) { |
| | 7790 | |
| | 7791 | // If data is available, append data to url |
| | 7792 | if ( s.data ) { |
| | 7793 | cacheURL = ( s.url += ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); |
| | 7794 | // #9682: remove data so that it's not used in an eventual retry |
| | 7795 | delete s.data; |
| | 7796 | } |
| | 7797 | |
| | 7798 | // Add anti-cache in url if needed |
| | 7799 | if ( s.cache === false ) { |
| | 7800 | s.url = rts.test( cacheURL ) ? |
| | 7801 | |
| | 7802 | // If there is already a '_' parameter, set its value |
| | 7803 | cacheURL.replace( rts, "$1_=" + ajax_nonce++ ) : |
| | 7804 | |
| | 7805 | // Otherwise add one to the end |
| | 7806 | cacheURL + ( ajax_rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + ajax_nonce++; |
| | 7807 | } |
| | 7808 | } |
| | 7809 | |
| | 7810 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| | 7811 | if ( s.ifModified ) { |
| | 7812 | if ( jQuery.lastModified[ cacheURL ] ) { |
| | 7813 | jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); |
| | 7814 | } |
| | 7815 | if ( jQuery.etag[ cacheURL ] ) { |
| | 7816 | jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); |
| | 7817 | } |
| | 7818 | } |
| | 7819 | |
| | 7820 | // Set the correct header, if data is being sent |
| | 7821 | if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { |
| | 7822 | jqXHR.setRequestHeader( "Content-Type", s.contentType ); |
| | 7823 | } |
| | 7824 | |
| | 7825 | // Set the Accepts header for the server, depending on the dataType |
| | 7826 | jqXHR.setRequestHeader( |
| | 7827 | "Accept", |
| | 7828 | s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[0] ] ? |
| | 7829 | s.accepts[ s.dataTypes[0] ] + ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : |
| | 7830 | s.accepts[ "*" ] |
| | 7831 | ); |
| | 7832 | |
| | 7833 | // Check for headers option |
| | 7834 | for ( i in s.headers ) { |
| | 7835 | jqXHR.setRequestHeader( i, s.headers[ i ] ); |
| | 7836 | } |
| | 7837 | |
| | 7838 | // Allow custom headers/mimetypes and early abort |
| | 7839 | if ( s.beforeSend && ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { |
| | 7840 | // Abort if not done already and return |
| | 7841 | return jqXHR.abort(); |
| | 7842 | } |
| | 7843 | |
| | 7844 | // aborting is no longer a cancellation |
| | 7845 | strAbort = "abort"; |
| | 7846 | |
| | 7847 | // Install callbacks on deferreds |
| | 7848 | for ( i in { success: 1, error: 1, complete: 1 } ) { |
| | 7849 | jqXHR[ i ]( s[ i ] ); |
| | 7850 | } |
| | 7851 | |
| | 7852 | // Get transport |
| | 7853 | transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); |
| | 7854 | |
| | 7855 | // If no transport, we auto-abort |
| | 7856 | if ( !transport ) { |
| | 7857 | done( -1, "No Transport" ); |
| | 7858 | } else { |
| | 7859 | jqXHR.readyState = 1; |
| | 7860 | |
| | 7861 | // Send global event |
| | 7862 | if ( fireGlobals ) { |
| | 7863 | globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); |
| | 7864 | } |
| | 7865 | // Timeout |
| | 7866 | if ( s.async && s.timeout > 0 ) { |
| | 7867 | timeoutTimer = setTimeout(function() { |
| | 7868 | jqXHR.abort("timeout"); |
| | 7869 | }, s.timeout ); |
| | 7870 | } |
| | 7871 | |
| | 7872 | try { |
| | 7873 | state = 1; |
| | 7874 | transport.send( requestHeaders, done ); |
| | 7875 | } catch ( e ) { |
| | 7876 | // Propagate exception as error if not done |
| | 7877 | if ( state < 2 ) { |
| | 7878 | done( -1, e ); |
| | 7879 | // Simply rethrow otherwise |
| | 7880 | } else { |
| | 7881 | throw e; |
| | 7882 | } |
| | 7883 | } |
| | 7884 | } |
| | 7885 | |
| | 7886 | // Callback for when everything is done |
| | 7887 | function done( status, nativeStatusText, responses, headers ) { |
| | 7888 | var isSuccess, success, error, response, modified, |
| | 7889 | statusText = nativeStatusText; |
| | 7890 | |
| | 7891 | // Called once |
| | 7892 | if ( state === 2 ) { |
| | 7893 | return; |
| | 7894 | } |
| | 7895 | |
| | 7896 | // State is "done" now |
| | 7897 | state = 2; |
| | 7898 | |
| | 7899 | // Clear timeout if it exists |
| | 7900 | if ( timeoutTimer ) { |
| | 7901 | clearTimeout( timeoutTimer ); |
| | 7902 | } |
| | 7903 | |
| | 7904 | // Dereference transport for early garbage collection |
| | 7905 | // (no matter how long the jqXHR object will be used) |
| | 7906 | transport = undefined; |
| | 7907 | |
| | 7908 | // Cache response headers |
| | 7909 | responseHeadersString = headers || ""; |
| | 7910 | |
| | 7911 | // Set readyState |
| | 7912 | jqXHR.readyState = status > 0 ? 4 : 0; |
| | 7913 | |
| | 7914 | // Get response data |
| | 7915 | if ( responses ) { |
| | 7916 | response = ajaxHandleResponses( s, jqXHR, responses ); |
| | 7917 | } |
| | 7918 | |
| | 7919 | // If successful, handle type chaining |
| | 7920 | if ( status >= 200 && status < 300 || status === 304 ) { |
| | 7921 | |
| | 7922 | // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. |
| | 7923 | if ( s.ifModified ) { |
| | 7924 | modified = jqXHR.getResponseHeader("Last-Modified"); |
| | 7925 | if ( modified ) { |
| | 7926 | jQuery.lastModified[ cacheURL ] = modified; |
| | 7927 | } |
| | 7928 | modified = jqXHR.getResponseHeader("etag"); |
| | 7929 | if ( modified ) { |
| | 7930 | jQuery.etag[ cacheURL ] = modified; |
| | 7931 | } |
| | 7932 | } |
| | 7933 | |
| | 7934 | // If not modified |
| | 7935 | if ( status === 304 ) { |
| | 7936 | isSuccess = true; |
| | 7937 | statusText = "notmodified"; |
| | 7938 | |
| | 7939 | // If we have data |
| | 7940 | } else { |
| | 7941 | isSuccess = ajaxConvert( s, response ); |
| | 7942 | statusText = isSuccess.state; |
| | 7943 | success = isSuccess.data; |
| | 7944 | error = isSuccess.error; |
| | 7945 | isSuccess = !error; |
| | 7946 | } |
| | 7947 | } else { |
| | 7948 | // We extract error from statusText |
| | 7949 | // then normalize statusText and status for non-aborts |
| | 7950 | error = statusText; |
| | 7951 | if ( status || !statusText ) { |
| | 7952 | statusText = "error"; |
| | 7953 | if ( status < 0 ) { |
| | 7954 | status = 0; |
| | 7955 | } |
| | 7956 | } |
| | 7957 | } |
| | 7958 | |
| | 7959 | // Set data for the fake xhr object |
| | 7960 | jqXHR.status = status; |
| | 7961 | jqXHR.statusText = ( nativeStatusText || statusText ) + ""; |
| | 7962 | |
| | 7963 | // Success/Error |
| | 7964 | if ( isSuccess ) { |
| | 7965 | deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); |
| | 7966 | } else { |
| | 7967 | deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); |
| | 7968 | } |
| | 7969 | |
| | 7970 | // Status-dependent callbacks |
| | 7971 | jqXHR.statusCode( statusCode ); |
| | 7972 | statusCode = undefined; |
| | 7973 | |
| | 7974 | if ( fireGlobals ) { |
| | 7975 | globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", |
| | 7976 | [ jqXHR, s, isSuccess ? success : error ] ); |
| | 7977 | } |
| | 7978 | |
| | 7979 | // Complete |
| | 7980 | completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); |
| | 7981 | |
| | 7982 | if ( fireGlobals ) { |
| | 7983 | globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); |
| | 7984 | // Handle the global AJAX counter |
| | 7985 | if ( !( --jQuery.active ) ) { |
| | 7986 | jQuery.event.trigger("ajaxStop"); |
| | 7987 | } |
| | 7988 | } |
| | 7989 | } |
| | 7990 | |
| | 7991 | return jqXHR; |
| | 7992 | }, |
| | 7993 | |
| | 7994 | getScript: function( url, callback ) { |
| | 7995 | return jQuery.get( url, undefined, callback, "script" ); |
| | 7996 | }, |
| | 7997 | |
| | 7998 | getJSON: function( url, data, callback ) { |
| | 7999 | return jQuery.get( url, data, callback, "json" ); |
| | 8000 | } |
| | 8001 | }); |
| | 8002 | |
| | 8003 | /* Handles responses to an ajax request: |
| | 8004 | * - sets all responseXXX fields accordingly |
| | 8005 | * - finds the right dataType (mediates between content-type and expected dataType) |
| | 8006 | * - returns the corresponding response |
| | 8007 | */ |
| | 8008 | function ajaxHandleResponses( s, jqXHR, responses ) { |
| | 8009 | |
| | 8010 | var ct, type, finalDataType, firstDataType, |
| | 8011 | contents = s.contents, |
| | 8012 | dataTypes = s.dataTypes, |
| | 8013 | responseFields = s.responseFields; |
| | 8014 | |
| | 8015 | // Fill responseXXX fields |
| | 8016 | for ( type in responseFields ) { |
| | 8017 | if ( type in responses ) { |
| | 8018 | jqXHR[ responseFields[type] ] = responses[ type ]; |
| | 8019 | } |
| | 8020 | } |
| | 8021 | |
| | 8022 | // Remove auto dataType and get content-type in the process |
| | 8023 | while( dataTypes[ 0 ] === "*" ) { |
| | 8024 | dataTypes.shift(); |
| | 8025 | if ( ct === undefined ) { |
| | 8026 | ct = s.mimeType || jqXHR.getResponseHeader("Content-Type"); |
| | 8027 | } |
| | 8028 | } |
| | 8029 | |
| | 8030 | // Check if we're dealing with a known content-type |
| | 8031 | if ( ct ) { |
| | 8032 | for ( type in contents ) { |
| | 8033 | if ( contents[ type ] && contents[ type ].test( ct ) ) { |
| | 8034 | dataTypes.unshift( type ); |
| | 8035 | break; |
| | 8036 | } |
| | 8037 | } |
| | 8038 | } |
| | 8039 | |
| | 8040 | // Check to see if we have a response for the expected dataType |
| | 8041 | if ( dataTypes[ 0 ] in responses ) { |
| | 8042 | finalDataType = dataTypes[ 0 ]; |
| | 8043 | } else { |
| | 8044 | // Try convertible dataTypes |
| | 8045 | for ( type in responses ) { |
| | 8046 | if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[0] ] ) { |
| | 8047 | finalDataType = type; |
| | 8048 | break; |
| | 8049 | } |
| | 8050 | if ( !firstDataType ) { |
| | 8051 | firstDataType = type; |
| | 8052 | } |
| | 8053 | } |
| | 8054 | // Or just use first one |
| | 8055 | finalDataType = finalDataType || firstDataType; |
| | 8056 | } |
| | 8057 | |
| | 8058 | // If we found a dataType |
| | 8059 | // We add the dataType to the list if needed |
| | 8060 | // and return the corresponding response |
| | 8061 | if ( finalDataType ) { |
| | 8062 | if ( finalDataType !== dataTypes[ 0 ] ) { |
| | 8063 | dataTypes.unshift( finalDataType ); |
| | 8064 | } |
| | 8065 | return responses[ finalDataType ]; |
| | 8066 | } |
| | 8067 | } |
| | 8068 | |
| | 8069 | // Chain conversions given the request and the original response |
| | 8070 | function ajaxConvert( s, response ) { |
| | 8071 | |
| | 8072 | var conv, conv2, current, tmp, |
| | 8073 | converters = {}, |
| | 8074 | i = 0, |
| | 8075 | // Work with a copy of dataTypes in case we need to modify it for conversion |
| | 8076 | dataTypes = s.dataTypes.slice(), |
| | 8077 | prev = dataTypes[ 0 ]; |
| | 8078 | |
| | 8079 | // Apply the dataFilter if provided |
| | 8080 | if ( s.dataFilter ) { |
| | 8081 | response = s.dataFilter( response, s.dataType ); |
| | 8082 | } |
| | 8083 | |
| | 8084 | // Create converters map with lowercased keys |
| | 8085 | if ( dataTypes[ 1 ] ) { |
| | 8086 | for ( conv in s.converters ) { |
| | 8087 | converters[ conv.toLowerCase() ] = s.converters[ conv ]; |
| | 8088 | } |
| | 8089 | } |
| | 8090 | |
| | 8091 | // Convert to each sequential dataType, tolerating list modification |
| | 8092 | for ( ; (current = dataTypes[++i]); ) { |
| | 8093 | |
| | 8094 | // There's only work to do if current dataType is non-auto |
| | 8095 | if ( current !== "*" ) { |
| | 8096 | |
| | 8097 | // Convert response if prev dataType is non-auto and differs from current |
| | 8098 | if ( prev !== "*" && prev !== current ) { |
| | 8099 | |
| | 8100 | // Seek a direct converter |
| | 8101 | conv = converters[ prev + " " + current ] || converters[ "* " + current ]; |
| | 8102 | |
| | 8103 | // If none found, seek a pair |
| | 8104 | if ( !conv ) { |
| | 8105 | for ( conv2 in converters ) { |
| | 8106 | |
| | 8107 | // If conv2 outputs current |
| | 8108 | tmp = conv2.split(" "); |
| | 8109 | if ( tmp[ 1 ] === current ) { |
| | 8110 | |
| | 8111 | // If prev can be converted to accepted input |
| | 8112 | conv = converters[ prev + " " + tmp[ 0 ] ] || |
| | 8113 | converters[ "* " + tmp[ 0 ] ]; |
| | 8114 | if ( conv ) { |
| | 8115 | // Condense equivalence converters |
| | 8116 | if ( conv === true ) { |
| | 8117 | conv = converters[ conv2 ]; |
| | 8118 | |
| | 8119 | // Otherwise, insert the intermediate dataType |
| | 8120 | } else if ( converters[ conv2 ] !== true ) { |
| | 8121 | current = tmp[ 0 ]; |
| | 8122 | dataTypes.splice( i--, 0, current ); |
| | 8123 | } |
| | 8124 | |
| | 8125 | break; |
| | 8126 | } |
| | 8127 | } |
| | 8128 | } |
| | 8129 | } |
| | 8130 | |
| | 8131 | // Apply converter (if not an equivalence) |
| | 8132 | if ( conv !== true ) { |
| | 8133 | |
| | 8134 | // Unless errors are allowed to bubble, catch and return them |
| | 8135 | if ( conv && s["throws"] ) { |
| | 8136 | response = conv( response ); |
| | 8137 | } else { |
| | 8138 | try { |
| | 8139 | response = conv( response ); |
| | 8140 | } catch ( e ) { |
| | 8141 | return { state: "parsererror", error: conv ? e : "No conversion from " + prev + " to " + current }; |
| | 8142 | } |
| | 8143 | } |
| | 8144 | } |
| | 8145 | } |
| | 8146 | |
| | 8147 | // Update prev for next iteration |
| | 8148 | prev = current; |
| | 8149 | } |
| | 8150 | } |
| | 8151 | |
| | 8152 | return { state: "success", data: response }; |
| | 8153 | } |
| | 8154 | // Install script dataType |
| | 8155 | jQuery.ajaxSetup({ |
| | 8156 | accepts: { |
| | 8157 | script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript" |
| | 8158 | }, |
| | 8159 | contents: { |
| | 8160 | script: /(?:java|ecma)script/ |
| | 8161 | }, |
| | 8162 | converters: { |
| | 8163 | "text script": function( text ) { |
| | 8164 | jQuery.globalEval( text ); |
| | 8165 | return text; |
| | 8166 | } |
| | 8167 | } |
| | 8168 | }); |
| | 8169 | |
| | 8170 | // Handle cache's special case and global |
| | 8171 | jQuery.ajaxPrefilter( "script", function( s ) { |
| | 8172 | if ( s.cache === undefined ) { |
| | 8173 | s.cache = false; |
| | 8174 | } |
| | 8175 | if ( s.crossDomain ) { |
| | 8176 | s.type = "GET"; |
| | 8177 | s.global = false; |
| | 8178 | } |
| | 8179 | }); |
| | 8180 | |
| | 8181 | // Bind script tag hack transport |
| | 8182 | jQuery.ajaxTransport( "script", function(s) { |
| | 8183 | |
| | 8184 | // This transport only deals with cross domain requests |
| | 8185 | if ( s.crossDomain ) { |
| | 8186 | |
| | 8187 | var script, |
| | 8188 | head = document.head || jQuery("head")[0] || document.documentElement; |
| | 8189 | |
| | 8190 | return { |
| | 8191 | |
| | 8192 | send: function( _, callback ) { |
| | 8193 | |
| | 8194 | script = document.createElement("script"); |
| | 8195 | |
| | 8196 | script.async = true; |
| | 8197 | |
| | 8198 | if ( s.scriptCharset ) { |
| | 8199 | script.charset = s.scriptCharset; |
| | 8200 | } |
| | 8201 | |
| | 8202 | script.src = s.url; |
| | 8203 | |
| | 8204 | // Attach handlers for all browsers |
| | 8205 | script.onload = script.onreadystatechange = function( _, isAbort ) { |
| | 8206 | |
| | 8207 | if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { |
| | 8208 | |
| | 8209 | // Handle memory leak in IE |
| | 8210 | script.onload = script.onreadystatechange = null; |
| | 8211 | |
| | 8212 | // Remove the script |
| | 8213 | if ( script.parentNode ) { |
| | 8214 | script.parentNode.removeChild( script ); |
| | 8215 | } |
| | 8216 | |
| | 8217 | // Dereference the script |
| | 8218 | script = null; |
| | 8219 | |
| | 8220 | // Callback if not abort |
| | 8221 | if ( !isAbort ) { |
| | 8222 | callback( 200, "success" ); |
| | 8223 | } |
| | 8224 | } |
| | 8225 | }; |
| | 8226 | |
| | 8227 | // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending |
| | 8228 | // Use native DOM manipulation to avoid our domManip AJAX trickery |
| | 8229 | head.insertBefore( script, head.firstChild ); |
| | 8230 | }, |
| | 8231 | |
| | 8232 | abort: function() { |
| | 8233 | if ( script ) { |
| | 8234 | script.onload( undefined, true ); |
| | 8235 | } |
| | 8236 | } |
| | 8237 | }; |
| | 8238 | } |
| | 8239 | }); |
| | 8240 | var oldCallbacks = [], |
| | 8241 | rjsonp = /(=)\?(?=&|$)|\?\?/; |
| | 8242 | |
| | 8243 | // Default jsonp settings |
| | 8244 | jQuery.ajaxSetup({ |
| | 8245 | jsonp: "callback", |
| | 8246 | jsonpCallback: function() { |
| | 8247 | var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( ajax_nonce++ ) ); |
| | 8248 | this[ callback ] = true; |
| | 8249 | return callback; |
| | 8250 | } |
| | 8251 | }); |
| | 8252 | |
| | 8253 | // Detect, normalize options and install callbacks for jsonp requests |
| | 8254 | jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { |
| | 8255 | |
| | 8256 | var callbackName, overwritten, responseContainer, |
| | 8257 | jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? |
| | 8258 | "url" : |
| | 8259 | typeof s.data === "string" && !( s.contentType || "" ).indexOf("application/x-www-form-urlencoded") && rjsonp.test( s.data ) && "data" |
| | 8260 | ); |
| | 8261 | |
| | 8262 | // Handle iff the expected data type is "jsonp" or we have a parameter to set |
| | 8263 | if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { |
| | 8264 | |
| | 8265 | // Get callback name, remembering preexisting value associated with it |
| | 8266 | callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? |
| | 8267 | s.jsonpCallback() : |
| | 8268 | s.jsonpCallback; |
| | 8269 | |
| | 8270 | // Insert callback into url or form data |
| | 8271 | if ( jsonProp ) { |
| | 8272 | s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); |
| | 8273 | } else if ( s.jsonp !== false ) { |
| | 8274 | s.url += ( ajax_rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; |
| | 8275 | } |
| | 8276 | |
| | 8277 | // Use data converter to retrieve json after script execution |
| | 8278 | s.converters["script json"] = function() { |
| | 8279 | if ( !responseContainer ) { |
| | 8280 | jQuery.error( callbackName + " was not called" ); |
| | 8281 | } |
| | 8282 | return responseContainer[ 0 ]; |
| | 8283 | }; |
| | 8284 | |
| | 8285 | // force json dataType |
| | 8286 | s.dataTypes[ 0 ] = "json"; |
| | 8287 | |
| | 8288 | // Install callback |
| | 8289 | overwritten = window[ callbackName ]; |
| | 8290 | window[ callbackName ] = function() { |
| | 8291 | responseContainer = arguments; |
| | 8292 | }; |
| | 8293 | |
| | 8294 | // Clean-up function (fires after converters) |
| | 8295 | jqXHR.always(function() { |
| | 8296 | // Restore preexisting value |
| | 8297 | window[ callbackName ] = overwritten; |
| | 8298 | |
| | 8299 | // Save back as free |
| | 8300 | if ( s[ callbackName ] ) { |
| | 8301 | // make sure that re-using the options doesn't screw things around |
| | 8302 | s.jsonpCallback = originalSettings.jsonpCallback; |
| | 8303 | |
| | 8304 | // save the callback name for future use |
| | 8305 | oldCallbacks.push( callbackName ); |
| | 8306 | } |
| | 8307 | |
| | 8308 | // Call if it was a function and we have a response |
| | 8309 | if ( responseContainer && jQuery.isFunction( overwritten ) ) { |
| | 8310 | overwritten( responseContainer[ 0 ] ); |
| | 8311 | } |
| | 8312 | |
| | 8313 | responseContainer = overwritten = undefined; |
| | 8314 | }); |
| | 8315 | |
| | 8316 | // Delegate to script |
| | 8317 | return "script"; |
| | 8318 | } |
| | 8319 | }); |
| | 8320 | var xhrCallbacks, xhrSupported, |
| | 8321 | xhrId = 0, |
| | 8322 | // #5280: Internet Explorer will keep connections alive if we don't abort on unload |
| | 8323 | xhrOnUnloadAbort = window.ActiveXObject && function() { |
| | 8324 | // Abort all pending requests |
| | 8325 | var key; |
| | 8326 | for ( key in xhrCallbacks ) { |
| | 8327 | xhrCallbacks[ key ]( undefined, true ); |
| | 8328 | } |
| | 8329 | }; |
| | 8330 | |
| | 8331 | // Functions to create xhrs |
| | 8332 | function createStandardXHR() { |
| | 8333 | try { |
| | 8334 | return new window.XMLHttpRequest(); |
| | 8335 | } catch( e ) {} |
| | 8336 | } |
| | 8337 | |
| | 8338 | function createActiveXHR() { |
| | 8339 | try { |
| | 8340 | return new window.ActiveXObject("Microsoft.XMLHTTP"); |
| | 8341 | } catch( e ) {} |
| | 8342 | } |
| | 8343 | |
| | 8344 | // Create the request object |
| | 8345 | // (This is still attached to ajaxSettings for backward compatibility) |
| | 8346 | jQuery.ajaxSettings.xhr = window.ActiveXObject ? |
| | 8347 | /* Microsoft failed to properly |
| | 8348 | * implement the XMLHttpRequest in IE7 (can't request local files), |
| | 8349 | * so we use the ActiveXObject when it is available |
| | 8350 | * Additionally XMLHttpRequest can be disabled in IE7/IE8 so |
| | 8351 | * we need a fallback. |
| | 8352 | */ |
| | 8353 | function() { |
| | 8354 | return !this.isLocal && createStandardXHR() || createActiveXHR(); |
| | 8355 | } : |
| | 8356 | // For all other browsers, use the standard XMLHttpRequest object |
| | 8357 | createStandardXHR; |
| | 8358 | |
| | 8359 | // Determine support properties |
| | 8360 | xhrSupported = jQuery.ajaxSettings.xhr(); |
| | 8361 | jQuery.support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); |
| | 8362 | xhrSupported = jQuery.support.ajax = !!xhrSupported; |
| | 8363 | |
| | 8364 | // Create transport if the browser can provide an xhr |
| | 8365 | if ( xhrSupported ) { |
| | 8366 | |
| | 8367 | jQuery.ajaxTransport(function( s ) { |
| | 8368 | // Cross domain only allowed if supported through XMLHttpRequest |
| | 8369 | if ( !s.crossDomain || jQuery.support.cors ) { |
| | 8370 | |
| | 8371 | var callback; |
| | 8372 | |
| | 8373 | return { |
| | 8374 | send: function( headers, complete ) { |
| | 8375 | |
| | 8376 | // Get a new xhr |
| | 8377 | var handle, i, |
| | 8378 | xhr = s.xhr(); |
| | 8379 | |
| | 8380 | // Open the socket |
| | 8381 | // Passing null username, generates a login popup on Opera (#2865) |
| | 8382 | if ( s.username ) { |
| | 8383 | xhr.open( s.type, s.url, s.async, s.username, s.password ); |
| | 8384 | } else { |
| | 8385 | xhr.open( s.type, s.url, s.async ); |
| | 8386 | } |
| | 8387 | |
| | 8388 | // Apply custom fields if provided |
| | 8389 | if ( s.xhrFields ) { |
| | 8390 | for ( i in s.xhrFields ) { |
| | 8391 | xhr[ i ] = s.xhrFields[ i ]; |
| | 8392 | } |
| | 8393 | } |
| | 8394 | |
| | 8395 | // Override mime type if needed |
| | 8396 | if ( s.mimeType && xhr.overrideMimeType ) { |
| | 8397 | xhr.overrideMimeType( s.mimeType ); |
| | 8398 | } |
| | 8399 | |
| | 8400 | // X-Requested-With header |
| | 8401 | // For cross-domain requests, seeing as conditions for a preflight are |
| | 8402 | // akin to a jigsaw puzzle, we simply never set it to be sure. |
| | 8403 | // (it can always be set on a per-request basis or even using ajaxSetup) |
| | 8404 | // For same-domain requests, won't change header if already provided. |
| | 8405 | if ( !s.crossDomain && !headers["X-Requested-With"] ) { |
| | 8406 | headers["X-Requested-With"] = "XMLHttpRequest"; |
| | 8407 | } |
| | 8408 | |
| | 8409 | // Need an extra try/catch for cross domain requests in Firefox 3 |
| | 8410 | try { |
| | 8411 | for ( i in headers ) { |
| | 8412 | xhr.setRequestHeader( i, headers[ i ] ); |
| | 8413 | } |
| | 8414 | } catch( err ) {} |
| | 8415 | |
| | 8416 | // Do send the request |
| | 8417 | // This may raise an exception which is actually |
| | 8418 | // handled in jQuery.ajax (so no try/catch here) |
| | 8419 | xhr.send( ( s.hasContent && s.data ) || null ); |
| | 8420 | |
| | 8421 | // Listener |
| | 8422 | callback = function( _, isAbort ) { |
| | 8423 | |
| | 8424 | var status, |
| | 8425 | statusText, |
| | 8426 | responseHeaders, |
| | 8427 | responses, |
| | 8428 | xml; |
| | 8429 | |
| | 8430 | // Firefox throws exceptions when accessing properties |
| | 8431 | // of an xhr when a network error occurred |
| | 8432 | // http://helpful.knobs-dials.com/index.php/Component_returned_failure_code:_0x80040111_(NS_ERROR_NOT_AVAILABLE) |
| | 8433 | try { |
| | 8434 | |
| | 8435 | // Was never called and is aborted or complete |
| | 8436 | if ( callback && ( isAbort || xhr.readyState === 4 ) ) { |
| | 8437 | |
| | 8438 | // Only called once |
| | 8439 | callback = undefined; |
| | 8440 | |
| | 8441 | // Do not keep as active anymore |
| | 8442 | if ( handle ) { |
| | 8443 | xhr.onreadystatechange = jQuery.noop; |
| | 8444 | if ( xhrOnUnloadAbort ) { |
| | 8445 | delete xhrCallbacks[ handle ]; |
| | 8446 | } |
| | 8447 | } |
| | 8448 | |
| | 8449 | // If it's an abort |
| | 8450 | if ( isAbort ) { |
| | 8451 | // Abort it manually if needed |
| | 8452 | if ( xhr.readyState !== 4 ) { |
| | 8453 | xhr.abort(); |
| | 8454 | } |
| | 8455 | } else { |
| | 8456 | responses = {}; |
| | 8457 | status = xhr.status; |
| | 8458 | xml = xhr.responseXML; |
| | 8459 | responseHeaders = xhr.getAllResponseHeaders(); |
| | 8460 | |
| | 8461 | // Construct response list |
| | 8462 | if ( xml && xml.documentElement /* #4958 */ ) { |
| | 8463 | responses.xml = xml; |
| | 8464 | } |
| | 8465 | |
| | 8466 | // When requesting binary data, IE6-9 will throw an exception |
| | 8467 | // on any attempt to access responseText (#11426) |
| | 8468 | if ( typeof xhr.responseText === "string" ) { |
| | 8469 | responses.text = xhr.responseText; |
| | 8470 | } |
| | 8471 | |
| | 8472 | // Firefox throws an exception when accessing |
| | 8473 | // statusText for faulty cross-domain requests |
| | 8474 | try { |
| | 8475 | statusText = xhr.statusText; |
| | 8476 | } catch( e ) { |
| | 8477 | // We normalize with Webkit giving an empty statusText |
| | 8478 | statusText = ""; |
| | 8479 | } |
| | 8480 | |
| | 8481 | // Filter status for non standard behaviors |
| | 8482 | |
| | 8483 | // If the request is local and we have data: assume a success |
| | 8484 | // (success with no data won't get notified, that's the best we |
| | 8485 | // can do given current implementations) |
| | 8486 | if ( !status && s.isLocal && !s.crossDomain ) { |
| | 8487 | status = responses.text ? 200 : 404; |
| | 8488 | // IE - #1450: sometimes returns 1223 when it should be 204 |
| | 8489 | } else if ( status === 1223 ) { |
| | 8490 | status = 204; |
| | 8491 | } |
| | 8492 | } |
| | 8493 | } |
| | 8494 | } catch( firefoxAccessException ) { |
| | 8495 | if ( !isAbort ) { |
| | 8496 | complete( -1, firefoxAccessException ); |
| | 8497 | } |
| | 8498 | } |
| | 8499 | |
| | 8500 | // Call complete if needed |
| | 8501 | if ( responses ) { |
| | 8502 | complete( status, statusText, responses, responseHeaders ); |
| | 8503 | } |
| | 8504 | }; |
| | 8505 | |
| | 8506 | if ( !s.async ) { |
| | 8507 | // if we're in sync mode we fire the callback |
| | 8508 | callback(); |
| | 8509 | } else if ( xhr.readyState === 4 ) { |
| | 8510 | // (IE6 & IE7) if it's in cache and has been |
| | 8511 | // retrieved directly we need to fire the callback |
| | 8512 | setTimeout( callback ); |
| | 8513 | } else { |
| | 8514 | handle = ++xhrId; |
| | 8515 | if ( xhrOnUnloadAbort ) { |
| | 8516 | // Create the active xhrs callbacks list if needed |
| | 8517 | // and attach the unload handler |
| | 8518 | if ( !xhrCallbacks ) { |
| | 8519 | xhrCallbacks = {}; |
| | 8520 | jQuery( window ).unload( xhrOnUnloadAbort ); |
| | 8521 | } |
| | 8522 | // Add to list of active xhrs callbacks |
| | 8523 | xhrCallbacks[ handle ] = callback; |
| | 8524 | } |
| | 8525 | xhr.onreadystatechange = callback; |
| | 8526 | } |
| | 8527 | }, |
| | 8528 | |
| | 8529 | abort: function() { |
| | 8530 | if ( callback ) { |
| | 8531 | callback( undefined, true ); |
| | 8532 | } |
| | 8533 | } |
| | 8534 | }; |
| | 8535 | } |
| | 8536 | }); |
| | 8537 | } |
| | 8538 | var fxNow, timerId, |
| | 8539 | rfxtypes = /^(?:toggle|show|hide)$/, |
| | 8540 | rfxnum = new RegExp( "^(?:([+-])=|)(" + core_pnum + ")([a-z%]*)$", "i" ), |
| | 8541 | rrun = /queueHooks$/, |
| | 8542 | animationPrefilters = [ defaultPrefilter ], |
| | 8543 | tweeners = { |
| | 8544 | "*": [function( prop, value ) { |
| | 8545 | var end, unit, |
| | 8546 | tween = this.createTween( prop, value ), |
| | 8547 | parts = rfxnum.exec( value ), |
| | 8548 | target = tween.cur(), |
| | 8549 | start = +target || 0, |
| | 8550 | scale = 1, |
| | 8551 | maxIterations = 20; |
| | 8552 | |
| | 8553 | if ( parts ) { |
| | 8554 | end = +parts[2]; |
| | 8555 | unit = parts[3] || ( jQuery.cssNumber[ prop ] ? "" : "px" ); |
| | 8556 | |
| | 8557 | // We need to compute starting value |
| | 8558 | if ( unit !== "px" && start ) { |
| | 8559 | // Iteratively approximate from a nonzero starting point |
| | 8560 | // Prefer the current property, because this process will be trivial if it uses the same units |
| | 8561 | // Fallback to end or a simple constant |
| | 8562 | start = jQuery.css( tween.elem, prop, true ) || end || 1; |
| | 8563 | |
| | 8564 | do { |
| | 8565 | // If previous iteration zeroed out, double until we get *something* |
| | 8566 | // Use a string for doubling factor so we don't accidentally see scale as unchanged below |
| | 8567 | scale = scale || ".5"; |
| | 8568 | |
| | 8569 | // Adjust and apply |
| | 8570 | start = start / scale; |
| | 8571 | jQuery.style( tween.elem, prop, start + unit ); |
| | 8572 | |
| | 8573 | // Update scale, tolerating zero or NaN from tween.cur() |
| | 8574 | // And breaking the loop if scale is unchanged or perfect, or if we've just had enough |
| | 8575 | } while ( scale !== (scale = tween.cur() / target) && scale !== 1 && --maxIterations ); |
| | 8576 | } |
| | 8577 | |
| | 8578 | tween.unit = unit; |
| | 8579 | tween.start = start; |
| | 8580 | // If a +=/-= token was provided, we're doing a relative animation |
| | 8581 | tween.end = parts[1] ? start + ( parts[1] + 1 ) * end : end; |
| | 8582 | } |
| | 8583 | return tween; |
| | 8584 | }] |
| | 8585 | }; |
| | 8586 | |
| | 8587 | // Animations created synchronously will run synchronously |
| | 8588 | function createFxNow() { |
| | 8589 | setTimeout(function() { |
| | 8590 | fxNow = undefined; |
| | 8591 | }); |
| | 8592 | return ( fxNow = jQuery.now() ); |
| | 8593 | } |
| | 8594 | |
| | 8595 | function createTweens( animation, props ) { |
| | 8596 | jQuery.each( props, function( prop, value ) { |
| | 8597 | var collection = ( tweeners[ prop ] || [] ).concat( tweeners[ "*" ] ), |
| | 8598 | index = 0, |
| | 8599 | length = collection.length; |
| | 8600 | for ( ; index < length; index++ ) { |
| | 8601 | if ( collection[ index ].call( animation, prop, value ) ) { |
| | 8602 | |
| | 8603 | // we're done with this property |
| | 8604 | return; |
| | 8605 | } |
| | 8606 | } |
| | 8607 | }); |
| | 8608 | } |
| | 8609 | |
| | 8610 | function Animation( elem, properties, options ) { |
| | 8611 | var result, |
| | 8612 | index = 0, |
| | 8613 | length = animationPrefilters.length, |
| | 8614 | deferred = jQuery.Deferred().always( function() { |
| | 8615 | // don't match elem in the :animated selector |
| | 8616 | delete tick.elem; |
| | 8617 | }), |
| | 8618 | tick = function() { |
| | 8619 | var currentTime = fxNow || createFxNow(), |
| | 8620 | remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), |
| | 8621 | // archaic crash bug won't allow us to use 1 - ( 0.5 || 0 ) (#12497) |
| | 8622 | temp = remaining / animation.duration || 0, |
| | 8623 | percent = 1 - temp, |
| | 8624 | index = 0, |
| | 8625 | length = animation.tweens.length; |
| | 8626 | |
| | 8627 | for ( ; index < length ; index++ ) { |
| | 8628 | animation.tweens[ index ].run( percent ); |
| | 8629 | } |
| | 8630 | |
| | 8631 | deferred.notifyWith( elem, [ animation, percent, remaining ]); |
| | 8632 | |
| | 8633 | if ( percent < 1 && length ) { |
| | 8634 | return remaining; |
| | 8635 | } else { |
| | 8636 | deferred.resolveWith( elem, [ animation ] ); |
| | 8637 | return false; |
| | 8638 | } |
| | 8639 | }, |
| | 8640 | animation = deferred.promise({ |
| | 8641 | elem: elem, |
| | 8642 | props: jQuery.extend( {}, properties ), |
| | 8643 | opts: jQuery.extend( true, { specialEasing: {} }, options ), |
| | 8644 | originalProperties: properties, |
| | 8645 | originalOptions: options, |
| | 8646 | startTime: fxNow || createFxNow(), |
| | 8647 | duration: options.duration, |
| | 8648 | tweens: [], |
| | 8649 | createTween: function( prop, end ) { |
| | 8650 | var tween = jQuery.Tween( elem, animation.opts, prop, end, |
| | 8651 | animation.opts.specialEasing[ prop ] || animation.opts.easing ); |
| | 8652 | animation.tweens.push( tween ); |
| | 8653 | return tween; |
| | 8654 | }, |
| | 8655 | stop: function( gotoEnd ) { |
| | 8656 | var index = 0, |
| | 8657 | // if we are going to the end, we want to run all the tweens |
| | 8658 | // otherwise we skip this part |
| | 8659 | length = gotoEnd ? animation.tweens.length : 0; |
| | 8660 | |
| | 8661 | for ( ; index < length ; index++ ) { |
| | 8662 | animation.tweens[ index ].run( 1 ); |
| | 8663 | } |
| | 8664 | |
| | 8665 | // resolve when we played the last frame |
| | 8666 | // otherwise, reject |
| | 8667 | if ( gotoEnd ) { |
| | 8668 | deferred.resolveWith( elem, [ animation, gotoEnd ] ); |
| | 8669 | } else { |
| | 8670 | deferred.rejectWith( elem, [ animation, gotoEnd ] ); |
| | 8671 | } |
| | 8672 | return this; |
| | 8673 | } |
| | 8674 | }), |
| | 8675 | props = animation.props; |
| | 8676 | |
| | 8677 | propFilter( props, animation.opts.specialEasing ); |
| | 8678 | |
| | 8679 | for ( ; index < length ; index++ ) { |
| | 8680 | result = animationPrefilters[ index ].call( animation, elem, props, animation.opts ); |
| | 8681 | if ( result ) { |
| | 8682 | return result; |
| | 8683 | } |
| | 8684 | } |
| | 8685 | |
| | 8686 | createTweens( animation, props ); |
| | 8687 | |
| | 8688 | if ( jQuery.isFunction( animation.opts.start ) ) { |
| | 8689 | animation.opts.start.call( elem, animation ); |
| | 8690 | } |
| | 8691 | |
| | 8692 | jQuery.fx.timer( |
| | 8693 | jQuery.extend( tick, { |
| | 8694 | anim: animation, |
| | 8695 | queue: animation.opts.queue, |
| | 8696 | elem: elem |
| | 8697 | }) |
| | 8698 | ); |
| | 8699 | |
| | 8700 | // attach callbacks from options |
| | 8701 | return animation.progress( animation.opts.progress ) |
| | 8702 | .done( animation.opts.done, animation.opts.complete ) |
| | 8703 | .fail( animation.opts.fail ) |
| | 8704 | .always( animation.opts.always ); |
| | 8705 | } |
| | 8706 | |
| | 8707 | function propFilter( props, specialEasing ) { |
| | 8708 | var index, name, easing, value, hooks; |
| | 8709 | |
| | 8710 | // camelCase, specialEasing and expand cssHook pass |
| | 8711 | for ( index in props ) { |
| | 8712 | name = jQuery.camelCase( index ); |
| | 8713 | easing = specialEasing[ name ]; |
| | 8714 | value = props[ index ]; |
| | 8715 | if ( jQuery.isArray( value ) ) { |
| | 8716 | easing = value[ 1 ]; |
| | 8717 | value = props[ index ] = value[ 0 ]; |
| | 8718 | } |
| | 8719 | |
| | 8720 | if ( index !== name ) { |
| | 8721 | props[ name ] = value; |
| | 8722 | delete props[ index ]; |
| | 8723 | } |
| | 8724 | |
| | 8725 | hooks = jQuery.cssHooks[ name ]; |
| | 8726 | if ( hooks && "expand" in hooks ) { |
| | 8727 | value = hooks.expand( value ); |
| | 8728 | delete props[ name ]; |
| | 8729 | |
| | 8730 | // not quite $.extend, this wont overwrite keys already present. |
| | 8731 | // also - reusing 'index' from above because we have the correct "name" |
| | 8732 | for ( index in value ) { |
| | 8733 | if ( !( index in props ) ) { |
| | 8734 | props[ index ] = value[ index ]; |
| | 8735 | specialEasing[ index ] = easing; |
| | 8736 | } |
| | 8737 | } |
| | 8738 | } else { |
| | 8739 | specialEasing[ name ] = easing; |
| | 8740 | } |
| | 8741 | } |
| | 8742 | } |
| | 8743 | |
| | 8744 | jQuery.Animation = jQuery.extend( Animation, { |
| | 8745 | |
| | 8746 | tweener: function( props, callback ) { |
| | 8747 | if ( jQuery.isFunction( props ) ) { |
| | 8748 | callback = props; |
| | 8749 | props = [ "*" ]; |
| | 8750 | } else { |
| | 8751 | props = props.split(" "); |
| | 8752 | } |
| | 8753 | |
| | 8754 | var prop, |
| | 8755 | index = 0, |
| | 8756 | length = props.length; |
| | 8757 | |
| | 8758 | for ( ; index < length ; index++ ) { |
| | 8759 | prop = props[ index ]; |
| | 8760 | tweeners[ prop ] = tweeners[ prop ] || []; |
| | 8761 | tweeners[ prop ].unshift( callback ); |
| | 8762 | } |
| | 8763 | }, |
| | 8764 | |
| | 8765 | prefilter: function( callback, prepend ) { |
| | 8766 | if ( prepend ) { |
| | 8767 | animationPrefilters.unshift( callback ); |
| | 8768 | } else { |
| | 8769 | animationPrefilters.push( callback ); |
| | 8770 | } |
| | 8771 | } |
| | 8772 | }); |
| | 8773 | |
| | 8774 | function defaultPrefilter( elem, props, opts ) { |
| | 8775 | /*jshint validthis:true */ |
| | 8776 | var index, prop, value, length, dataShow, toggle, tween, hooks, oldfire, |
| | 8777 | anim = this, |
| | 8778 | style = elem.style, |
| | 8779 | orig = {}, |
| | 8780 | handled = [], |
| | 8781 | hidden = elem.nodeType && isHidden( elem ); |
| | 8782 | |
| | 8783 | // handle queue: false promises |
| | 8784 | if ( !opts.queue ) { |
| | 8785 | hooks = jQuery._queueHooks( elem, "fx" ); |
| | 8786 | if ( hooks.unqueued == null ) { |
| | 8787 | hooks.unqueued = 0; |
| | 8788 | oldfire = hooks.empty.fire; |
| | 8789 | hooks.empty.fire = function() { |
| | 8790 | if ( !hooks.unqueued ) { |
| | 8791 | oldfire(); |
| | 8792 | } |
| | 8793 | }; |
| | 8794 | } |
| | 8795 | hooks.unqueued++; |
| | 8796 | |
| | 8797 | anim.always(function() { |
| | 8798 | // doing this makes sure that the complete handler will be called |
| | 8799 | // before this completes |
| | 8800 | anim.always(function() { |
| | 8801 | hooks.unqueued--; |
| | 8802 | if ( !jQuery.queue( elem, "fx" ).length ) { |
| | 8803 | hooks.empty.fire(); |
| | 8804 | } |
| | 8805 | }); |
| | 8806 | }); |
| | 8807 | } |
| | 8808 | |
| | 8809 | // height/width overflow pass |
| | 8810 | if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { |
| | 8811 | // Make sure that nothing sneaks out |
| | 8812 | // Record all 3 overflow attributes because IE does not |
| | 8813 | // change the overflow attribute when overflowX and |
| | 8814 | // overflowY are set to the same value |
| | 8815 | opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; |
| | 8816 | |
| | 8817 | // Set display property to inline-block for height/width |
| | 8818 | // animations on inline elements that are having width/height animated |
| | 8819 | if ( jQuery.css( elem, "display" ) === "inline" && |
| | 8820 | jQuery.css( elem, "float" ) === "none" ) { |
| | 8821 | |
| | 8822 | // inline-level elements accept inline-block; |
| | 8823 | // block-level elements need to be inline with layout |
| | 8824 | if ( !jQuery.support.inlineBlockNeedsLayout || css_defaultDisplay( elem.nodeName ) === "inline" ) { |
| | 8825 | style.display = "inline-block"; |
| | 8826 | |
| | 8827 | } else { |
| | 8828 | style.zoom = 1; |
| | 8829 | } |
| | 8830 | } |
| | 8831 | } |
| | 8832 | |
| | 8833 | if ( opts.overflow ) { |
| | 8834 | style.overflow = "hidden"; |
| | 8835 | if ( !jQuery.support.shrinkWrapBlocks ) { |
| | 8836 | anim.done(function() { |
| | 8837 | style.overflow = opts.overflow[ 0 ]; |
| | 8838 | style.overflowX = opts.overflow[ 1 ]; |
| | 8839 | style.overflowY = opts.overflow[ 2 ]; |
| | 8840 | }); |
| | 8841 | } |
| | 8842 | } |
| | 8843 | |
| | 8844 | |
| | 8845 | // show/hide pass |
| | 8846 | for ( index in props ) { |
| | 8847 | value = props[ index ]; |
| | 8848 | if ( rfxtypes.exec( value ) ) { |
| | 8849 | delete props[ index ]; |
| | 8850 | toggle = toggle || value === "toggle"; |
| | 8851 | if ( value === ( hidden ? "hide" : "show" ) ) { |
| | 8852 | continue; |
| | 8853 | } |
| | 8854 | handled.push( index ); |
| | 8855 | } |
| | 8856 | } |
| | 8857 | |
| | 8858 | length = handled.length; |
| | 8859 | if ( length ) { |
| | 8860 | dataShow = jQuery._data( elem, "fxshow" ) || jQuery._data( elem, "fxshow", {} ); |
| | 8861 | if ( "hidden" in dataShow ) { |
| | 8862 | hidden = dataShow.hidden; |
| | 8863 | } |
| | 8864 | |
| | 8865 | // store state if its toggle - enables .stop().toggle() to "reverse" |
| | 8866 | if ( toggle ) { |
| | 8867 | dataShow.hidden = !hidden; |
| | 8868 | } |
| | 8869 | if ( hidden ) { |
| | 8870 | jQuery( elem ).show(); |
| | 8871 | } else { |
| | 8872 | anim.done(function() { |
| | 8873 | jQuery( elem ).hide(); |
| | 8874 | }); |
| | 8875 | } |
| | 8876 | anim.done(function() { |
| | 8877 | var prop; |
| | 8878 | jQuery._removeData( elem, "fxshow" ); |
| | 8879 | for ( prop in orig ) { |
| | 8880 | jQuery.style( elem, prop, orig[ prop ] ); |
| | 8881 | } |
| | 8882 | }); |
| | 8883 | for ( index = 0 ; index < length ; index++ ) { |
| | 8884 | prop = handled[ index ]; |
| | 8885 | tween = anim.createTween( prop, hidden ? dataShow[ prop ] : 0 ); |
| | 8886 | orig[ prop ] = dataShow[ prop ] || jQuery.style( elem, prop ); |
| | 8887 | |
| | 8888 | if ( !( prop in dataShow ) ) { |
| | 8889 | dataShow[ prop ] = tween.start; |
| | 8890 | if ( hidden ) { |
| | 8891 | tween.end = tween.start; |
| | 8892 | tween.start = prop === "width" || prop === "height" ? 1 : 0; |
| | 8893 | } |
| | 8894 | } |
| | 8895 | } |
| | 8896 | } |
| | 8897 | } |
| | 8898 | |
| | 8899 | function Tween( elem, options, prop, end, easing ) { |
| | 8900 | return new Tween.prototype.init( elem, options, prop, end, easing ); |
| | 8901 | } |
| | 8902 | jQuery.Tween = Tween; |
| | 8903 | |
| | 8904 | Tween.prototype = { |
| | 8905 | constructor: Tween, |
| | 8906 | init: function( elem, options, prop, end, easing, unit ) { |
| | 8907 | this.elem = elem; |
| | 8908 | this.prop = prop; |
| | 8909 | this.easing = easing || "swing"; |
| | 8910 | this.options = options; |
| | 8911 | this.start = this.now = this.cur(); |
| | 8912 | this.end = end; |
| | 8913 | this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); |
| | 8914 | }, |
| | 8915 | cur: function() { |
| | 8916 | var hooks = Tween.propHooks[ this.prop ]; |
| | 8917 | |
| | 8918 | return hooks && hooks.get ? |
| | 8919 | hooks.get( this ) : |
| | 8920 | Tween.propHooks._default.get( this ); |
| | 8921 | }, |
| | 8922 | run: function( percent ) { |
| | 8923 | var eased, |
| | 8924 | hooks = Tween.propHooks[ this.prop ]; |
| | 8925 | |
| | 8926 | if ( this.options.duration ) { |
| | 8927 | this.pos = eased = jQuery.easing[ this.easing ]( |
| | 8928 | percent, this.options.duration * percent, 0, 1, this.options.duration |
| | 8929 | ); |
| | 8930 | } else { |
| | 8931 | this.pos = eased = percent; |
| | 8932 | } |
| | 8933 | this.now = ( this.end - this.start ) * eased + this.start; |
| | 8934 | |
| | 8935 | if ( this.options.step ) { |
| | 8936 | this.options.step.call( this.elem, this.now, this ); |
| | 8937 | } |
| | 8938 | |
| | 8939 | if ( hooks && hooks.set ) { |
| | 8940 | hooks.set( this ); |
| | 8941 | } else { |
| | 8942 | Tween.propHooks._default.set( this ); |
| | 8943 | } |
| | 8944 | return this; |
| | 8945 | } |
| | 8946 | }; |
| | 8947 | |
| | 8948 | Tween.prototype.init.prototype = Tween.prototype; |
| | 8949 | |
| | 8950 | Tween.propHooks = { |
| | 8951 | _default: { |
| | 8952 | get: function( tween ) { |
| | 8953 | var result; |
| | 8954 | |
| | 8955 | if ( tween.elem[ tween.prop ] != null && |
| | 8956 | (!tween.elem.style || tween.elem.style[ tween.prop ] == null) ) { |
| | 8957 | return tween.elem[ tween.prop ]; |
| | 8958 | } |
| | 8959 | |
| | 8960 | // passing a non empty string as a 3rd parameter to .css will automatically |
| | 8961 | // attempt a parseFloat and fallback to a string if the parse fails |
| | 8962 | // so, simple values such as "10px" are parsed to Float. |
| | 8963 | // complex values such as "rotate(1rad)" are returned as is. |
| | 8964 | result = jQuery.css( tween.elem, tween.prop, "auto" ); |
| | 8965 | // Empty strings, null, undefined and "auto" are converted to 0. |
| | 8966 | return !result || result === "auto" ? 0 : result; |
| | 8967 | }, |
| | 8968 | set: function( tween ) { |
| | 8969 | // use step hook for back compat - use cssHook if its there - use .style if its |
| | 8970 | // available and use plain properties where available |
| | 8971 | if ( jQuery.fx.step[ tween.prop ] ) { |
| | 8972 | jQuery.fx.step[ tween.prop ]( tween ); |
| | 8973 | } else if ( tween.elem.style && ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || jQuery.cssHooks[ tween.prop ] ) ) { |
| | 8974 | jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); |
| | 8975 | } else { |
| | 8976 | tween.elem[ tween.prop ] = tween.now; |
| | 8977 | } |
| | 8978 | } |
| | 8979 | } |
| | 8980 | }; |
| | 8981 | |
| | 8982 | // Remove in 2.0 - this supports IE8's panic based approach |
| | 8983 | // to setting things on disconnected nodes |
| | 8984 | |
| | 8985 | Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { |
| | 8986 | set: function( tween ) { |
| | 8987 | if ( tween.elem.nodeType && tween.elem.parentNode ) { |
| | 8988 | tween.elem[ tween.prop ] = tween.now; |
| | 8989 | } |
| | 8990 | } |
| | 8991 | }; |
| | 8992 | |
| | 8993 | jQuery.each([ "toggle", "show", "hide" ], function( i, name ) { |
| | 8994 | var cssFn = jQuery.fn[ name ]; |
| | 8995 | jQuery.fn[ name ] = function( speed, easing, callback ) { |
| | 8996 | return speed == null || typeof speed === "boolean" ? |
| | 8997 | cssFn.apply( this, arguments ) : |
| | 8998 | this.animate( genFx( name, true ), speed, easing, callback ); |
| | 8999 | }; |
| | 9000 | }); |
| | 9001 | |
| | 9002 | jQuery.fn.extend({ |
| | 9003 | fadeTo: function( speed, to, easing, callback ) { |
| | 9004 | |
| | 9005 | // show any hidden elements after setting opacity to 0 |
| | 9006 | return this.filter( isHidden ).css( "opacity", 0 ).show() |
| | 9007 | |
| | 9008 | // animate to the value specified |
| | 9009 | .end().animate({ opacity: to }, speed, easing, callback ); |
| | 9010 | }, |
| | 9011 | animate: function( prop, speed, easing, callback ) { |
| | 9012 | var empty = jQuery.isEmptyObject( prop ), |
| | 9013 | optall = jQuery.speed( speed, easing, callback ), |
| | 9014 | doAnimation = function() { |
| | 9015 | // Operate on a copy of prop so per-property easing won't be lost |
| | 9016 | var anim = Animation( this, jQuery.extend( {}, prop ), optall ); |
| | 9017 | |
| | 9018 | // Empty animations resolve immediately |
| | 9019 | if ( empty ) { |
| | 9020 | anim.stop( true ); |
| | 9021 | } |
| | 9022 | }; |
| | 9023 | |
| | 9024 | return empty || optall.queue === false ? |
| | 9025 | this.each( doAnimation ) : |
| | 9026 | this.queue( optall.queue, doAnimation ); |
| | 9027 | }, |
| | 9028 | stop: function( type, clearQueue, gotoEnd ) { |
| | 9029 | var stopQueue = function( hooks ) { |
| | 9030 | var stop = hooks.stop; |
| | 9031 | delete hooks.stop; |
| | 9032 | stop( gotoEnd ); |
| | 9033 | }; |
| | 9034 | |
| | 9035 | if ( typeof type !== "string" ) { |
| | 9036 | gotoEnd = clearQueue; |
| | 9037 | clearQueue = type; |
| | 9038 | type = undefined; |
| | 9039 | } |
| | 9040 | if ( clearQueue && type !== false ) { |
| | 9041 | this.queue( type || "fx", [] ); |
| | 9042 | } |
| | 9043 | |
| | 9044 | return this.each(function() { |
| | 9045 | var dequeue = true, |
| | 9046 | index = type != null && type + "queueHooks", |
| | 9047 | timers = jQuery.timers, |
| | 9048 | data = jQuery._data( this ); |
| | 9049 | |
| | 9050 | if ( index ) { |
| | 9051 | if ( data[ index ] && data[ index ].stop ) { |
| | 9052 | stopQueue( data[ index ] ); |
| | 9053 | } |
| | 9054 | } else { |
| | 9055 | for ( index in data ) { |
| | 9056 | if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { |
| | 9057 | stopQueue( data[ index ] ); |
| | 9058 | } |
| | 9059 | } |
| | 9060 | } |
| | 9061 | |
| | 9062 | for ( index = timers.length; index--; ) { |
| | 9063 | if ( timers[ index ].elem === this && (type == null || timers[ index ].queue === type) ) { |
| | 9064 | timers[ index ].anim.stop( gotoEnd ); |
| | 9065 | dequeue = false; |
| | 9066 | timers.splice( index, 1 ); |
| | 9067 | } |
| | 9068 | } |
| | 9069 | |
| | 9070 | // start the next in the queue if the last step wasn't forced |
| | 9071 | // timers currently will call their complete callbacks, which will dequeue |
| | 9072 | // but only if they were gotoEnd |
| | 9073 | if ( dequeue || !gotoEnd ) { |
| | 9074 | jQuery.dequeue( this, type ); |
| | 9075 | } |
| | 9076 | }); |
| | 9077 | } |
| | 9078 | }); |
| | 9079 | |
| | 9080 | // Generate parameters to create a standard animation |
| | 9081 | function genFx( type, includeWidth ) { |
| | 9082 | var which, |
| | 9083 | attrs = { height: type }, |
| | 9084 | i = 0; |
| | 9085 | |
| | 9086 | // if we include width, step value is 1 to do all cssExpand values, |
| | 9087 | // if we don't include width, step value is 2 to skip over Left and Right |
| | 9088 | includeWidth = includeWidth? 1 : 0; |
| | 9089 | for( ; i < 4 ; i += 2 - includeWidth ) { |
| | 9090 | which = cssExpand[ i ]; |
| | 9091 | attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; |
| | 9092 | } |
| | 9093 | |
| | 9094 | if ( includeWidth ) { |
| | 9095 | attrs.opacity = attrs.width = type; |
| | 9096 | } |
| | 9097 | |
| | 9098 | return attrs; |
| | 9099 | } |
| | 9100 | |
| | 9101 | // Generate shortcuts for custom animations |
| | 9102 | jQuery.each({ |
| | 9103 | slideDown: genFx("show"), |
| | 9104 | slideUp: genFx("hide"), |
| | 9105 | slideToggle: genFx("toggle"), |
| | 9106 | fadeIn: { opacity: "show" }, |
| | 9107 | fadeOut: { opacity: "hide" }, |
| | 9108 | fadeToggle: { opacity: "toggle" } |
| | 9109 | }, function( name, props ) { |
| | 9110 | jQuery.fn[ name ] = function( speed, easing, callback ) { |
| | 9111 | return this.animate( props, speed, easing, callback ); |
| | 9112 | }; |
| | 9113 | }); |
| | 9114 | |
| | 9115 | jQuery.speed = function( speed, easing, fn ) { |
| | 9116 | var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { |
| | 9117 | complete: fn || !fn && easing || |
| | 9118 | jQuery.isFunction( speed ) && speed, |
| | 9119 | duration: speed, |
| | 9120 | easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing |
| | 9121 | }; |
| | 9122 | |
| | 9123 | opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : |
| | 9124 | opt.duration in jQuery.fx.speeds ? jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; |
| | 9125 | |
| | 9126 | // normalize opt.queue - true/undefined/null -> "fx" |
| | 9127 | if ( opt.queue == null || opt.queue === true ) { |
| | 9128 | opt.queue = "fx"; |
| | 9129 | } |
| | 9130 | |
| | 9131 | // Queueing |
| | 9132 | opt.old = opt.complete; |
| | 9133 | |
| | 9134 | opt.complete = function() { |
| | 9135 | if ( jQuery.isFunction( opt.old ) ) { |
| | 9136 | opt.old.call( this ); |
| | 9137 | } |
| | 9138 | |
| | 9139 | if ( opt.queue ) { |
| | 9140 | jQuery.dequeue( this, opt.queue ); |
| | 9141 | } |
| | 9142 | }; |
| | 9143 | |
| | 9144 | return opt; |
| | 9145 | }; |
| | 9146 | |
| | 9147 | jQuery.easing = { |
| | 9148 | linear: function( p ) { |
| | 9149 | return p; |
| | 9150 | }, |
| | 9151 | swing: function( p ) { |
| | 9152 | return 0.5 - Math.cos( p*Math.PI ) / 2; |
| | 9153 | } |
| | 9154 | }; |
| | 9155 | |
| | 9156 | jQuery.timers = []; |
| | 9157 | jQuery.fx = Tween.prototype.init; |
| | 9158 | jQuery.fx.tick = function() { |
| | 9159 | var timer, |
| | 9160 | timers = jQuery.timers, |
| | 9161 | i = 0; |
| | 9162 | |
| | 9163 | fxNow = jQuery.now(); |
| | 9164 | |
| | 9165 | for ( ; i < timers.length; i++ ) { |
| | 9166 | timer = timers[ i ]; |
| | 9167 | // Checks the timer has not already been removed |
| | 9168 | if ( !timer() && timers[ i ] === timer ) { |
| | 9169 | timers.splice( i--, 1 ); |
| | 9170 | } |
| | 9171 | } |
| | 9172 | |
| | 9173 | if ( !timers.length ) { |
| | 9174 | jQuery.fx.stop(); |
| | 9175 | } |
| | 9176 | fxNow = undefined; |
| | 9177 | }; |
| | 9178 | |
| | 9179 | jQuery.fx.timer = function( timer ) { |
| | 9180 | if ( timer() && jQuery.timers.push( timer ) ) { |
| | 9181 | jQuery.fx.start(); |
| | 9182 | } |
| | 9183 | }; |
| | 9184 | |
| | 9185 | jQuery.fx.interval = 13; |
| | 9186 | |
| | 9187 | jQuery.fx.start = function() { |
| | 9188 | if ( !timerId ) { |
| | 9189 | timerId = setInterval( jQuery.fx.tick, jQuery.fx.interval ); |
| | 9190 | } |
| | 9191 | }; |
| | 9192 | |
| | 9193 | jQuery.fx.stop = function() { |
| | 9194 | clearInterval( timerId ); |
| | 9195 | timerId = null; |
| | 9196 | }; |
| | 9197 | |
| | 9198 | jQuery.fx.speeds = { |
| | 9199 | slow: 600, |
| | 9200 | fast: 200, |
| | 9201 | // Default speed |
| | 9202 | _default: 400 |
| | 9203 | }; |
| | 9204 | |
| | 9205 | // Back Compat <1.8 extension point |
| | 9206 | jQuery.fx.step = {}; |
| | 9207 | |
| | 9208 | if ( jQuery.expr && jQuery.expr.filters ) { |
| | 9209 | jQuery.expr.filters.animated = function( elem ) { |
| | 9210 | return jQuery.grep(jQuery.timers, function( fn ) { |
| | 9211 | return elem === fn.elem; |
| | 9212 | }).length; |
| | 9213 | }; |
| | 9214 | } |
| | 9215 | jQuery.fn.offset = function( options ) { |
| | 9216 | if ( arguments.length ) { |
| | 9217 | return options === undefined ? |
| | 9218 | this : |
| | 9219 | this.each(function( i ) { |
| | 9220 | jQuery.offset.setOffset( this, options, i ); |
| | 9221 | }); |
| | 9222 | } |
| | 9223 | |
| | 9224 | var docElem, win, |
| | 9225 | box = { top: 0, left: 0 }, |
| | 9226 | elem = this[ 0 ], |
| | 9227 | doc = elem && elem.ownerDocument; |
| | 9228 | |
| | 9229 | if ( !doc ) { |
| | 9230 | return; |
| | 9231 | } |
| | 9232 | |
| | 9233 | docElem = doc.documentElement; |
| | 9234 | |
| | 9235 | // Make sure it's not a disconnected DOM node |
| | 9236 | if ( !jQuery.contains( docElem, elem ) ) { |
| | 9237 | return box; |
| | 9238 | } |
| | 9239 | |
| | 9240 | // If we don't have gBCR, just use 0,0 rather than error |
| | 9241 | // BlackBerry 5, iOS 3 (original iPhone) |
| | 9242 | if ( typeof elem.getBoundingClientRect !== "undefined" ) { |
| | 9243 | box = elem.getBoundingClientRect(); |
| | 9244 | } |
| | 9245 | win = getWindow( doc ); |
| | 9246 | return { |
| | 9247 | top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), |
| | 9248 | left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) |
| | 9249 | }; |
| | 9250 | }; |
| | 9251 | |
| | 9252 | jQuery.offset = { |
| | 9253 | |
| | 9254 | setOffset: function( elem, options, i ) { |
| | 9255 | var position = jQuery.css( elem, "position" ); |
| | 9256 | |
| | 9257 | // set position first, in-case top/left are set even on static elem |
| | 9258 | if ( position === "static" ) { |
| | 9259 | elem.style.position = "relative"; |
| | 9260 | } |
| | 9261 | |
| | 9262 | var curElem = jQuery( elem ), |
| | 9263 | curOffset = curElem.offset(), |
| | 9264 | curCSSTop = jQuery.css( elem, "top" ), |
| | 9265 | curCSSLeft = jQuery.css( elem, "left" ), |
| | 9266 | calculatePosition = ( position === "absolute" || position === "fixed" ) && jQuery.inArray("auto", [curCSSTop, curCSSLeft]) > -1, |
| | 9267 | props = {}, curPosition = {}, curTop, curLeft; |
| | 9268 | |
| | 9269 | // need to be able to calculate position if either top or left is auto and position is either absolute or fixed |
| | 9270 | if ( calculatePosition ) { |
| | 9271 | curPosition = curElem.position(); |
| | 9272 | curTop = curPosition.top; |
| | 9273 | curLeft = curPosition.left; |
| | 9274 | } else { |
| | 9275 | curTop = parseFloat( curCSSTop ) || 0; |
| | 9276 | curLeft = parseFloat( curCSSLeft ) || 0; |
| | 9277 | } |
| | 9278 | |
| | 9279 | if ( jQuery.isFunction( options ) ) { |
| | 9280 | options = options.call( elem, i, curOffset ); |
| | 9281 | } |
| | 9282 | |
| | 9283 | if ( options.top != null ) { |
| | 9284 | props.top = ( options.top - curOffset.top ) + curTop; |
| | 9285 | } |
| | 9286 | if ( options.left != null ) { |
| | 9287 | props.left = ( options.left - curOffset.left ) + curLeft; |
| | 9288 | } |
| | 9289 | |
| | 9290 | if ( "using" in options ) { |
| | 9291 | options.using.call( elem, props ); |
| | 9292 | } else { |
| | 9293 | curElem.css( props ); |
| | 9294 | } |
| | 9295 | } |
| | 9296 | }; |
| | 9297 | |
| | 9298 | |
| | 9299 | jQuery.fn.extend({ |
| | 9300 | |
| | 9301 | position: function() { |
| | 9302 | if ( !this[ 0 ] ) { |
| | 9303 | return; |
| | 9304 | } |
| | 9305 | |
| | 9306 | var offsetParent, offset, |
| | 9307 | parentOffset = { top: 0, left: 0 }, |
| | 9308 | elem = this[ 0 ]; |
| | 9309 | |
| | 9310 | // fixed elements are offset from window (parentOffset = {top:0, left: 0}, because it is it's only offset parent |
| | 9311 | if ( jQuery.css( elem, "position" ) === "fixed" ) { |
| | 9312 | // we assume that getBoundingClientRect is available when computed position is fixed |
| | 9313 | offset = elem.getBoundingClientRect(); |
| | 9314 | } else { |
| | 9315 | // Get *real* offsetParent |
| | 9316 | offsetParent = this.offsetParent(); |
| | 9317 | |
| | 9318 | // Get correct offsets |
| | 9319 | offset = this.offset(); |
| | 9320 | if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { |
| | 9321 | parentOffset = offsetParent.offset(); |
| | 9322 | } |
| | 9323 | |
| | 9324 | // Add offsetParent borders |
| | 9325 | parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); |
| | 9326 | parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); |
| | 9327 | } |
| | 9328 | |
| | 9329 | // Subtract parent offsets and element margins |
| | 9330 | // note: when an element has margin: auto the offsetLeft and marginLeft |
| | 9331 | // are the same in Safari causing offset.left to incorrectly be 0 |
| | 9332 | return { |
| | 9333 | top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), |
| | 9334 | left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true) |
| | 9335 | }; |
| | 9336 | }, |
| | 9337 | |
| | 9338 | offsetParent: function() { |
| | 9339 | return this.map(function() { |
| | 9340 | var offsetParent = this.offsetParent || document.documentElement; |
| | 9341 | while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && jQuery.css( offsetParent, "position") === "static" ) ) { |
| | 9342 | offsetParent = offsetParent.offsetParent; |
| | 9343 | } |
| | 9344 | return offsetParent || document.documentElement; |
| | 9345 | }); |
| | 9346 | } |
| | 9347 | }); |
| | 9348 | |
| | 9349 | |
| | 9350 | // Create scrollLeft and scrollTop methods |
| | 9351 | jQuery.each( {scrollLeft: "pageXOffset", scrollTop: "pageYOffset"}, function( method, prop ) { |
| | 9352 | var top = /Y/.test( prop ); |
| | 9353 | |
| | 9354 | jQuery.fn[ method ] = function( val ) { |
| | 9355 | return jQuery.access( this, function( elem, method, val ) { |
| | 9356 | var win = getWindow( elem ); |
| | 9357 | |
| | 9358 | if ( val === undefined ) { |
| | 9359 | return win ? (prop in win) ? win[ prop ] : |
| | 9360 | win.document.documentElement[ method ] : |
| | 9361 | elem[ method ]; |
| | 9362 | } |
| | 9363 | |
| | 9364 | if ( win ) { |
| | 9365 | win.scrollTo( |
| | 9366 | !top ? val : jQuery( win ).scrollLeft(), |
| | 9367 | top ? val : jQuery( win ).scrollTop() |
| | 9368 | ); |
| | 9369 | |
| | 9370 | } else { |
| | 9371 | elem[ method ] = val; |
| | 9372 | } |
| | 9373 | }, method, val, arguments.length, null ); |
| | 9374 | }; |
| | 9375 | }); |
| | 9376 | |
| | 9377 | function getWindow( elem ) { |
| | 9378 | return jQuery.isWindow( elem ) ? |
| | 9379 | elem : |
| | 9380 | elem.nodeType === 9 ? |
| | 9381 | elem.defaultView || elem.parentWindow : |
| | 9382 | false; |
| | 9383 | } |
| | 9384 | // Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods |
| | 9385 | jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { |
| | 9386 | jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, function( defaultExtra, funcName ) { |
| | 9387 | // margin is only for outerHeight, outerWidth |
| | 9388 | jQuery.fn[ funcName ] = function( margin, value ) { |
| | 9389 | var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), |
| | 9390 | extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); |
| | 9391 | |
| | 9392 | return jQuery.access( this, function( elem, type, value ) { |
| | 9393 | var doc; |
| | 9394 | |
| | 9395 | if ( jQuery.isWindow( elem ) ) { |
| | 9396 | // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there |
| | 9397 | // isn't a whole lot we can do. See pull request at this URL for discussion: |
| | 9398 | // https://github.com/jquery/jquery/pull/764 |
| | 9399 | return elem.document.documentElement[ "client" + name ]; |
| | 9400 | } |
| | 9401 | |
| | 9402 | // Get document width or height |
| | 9403 | if ( elem.nodeType === 9 ) { |
| | 9404 | doc = elem.documentElement; |
| | 9405 | |
| | 9406 | // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], whichever is greatest |
| | 9407 | // unfortunately, this causes bug #3838 in IE6/8 only, but there is currently no good, small way to fix it. |
| | 9408 | return Math.max( |
| | 9409 | elem.body[ "scroll" + name ], doc[ "scroll" + name ], |
| | 9410 | elem.body[ "offset" + name ], doc[ "offset" + name ], |
| | 9411 | doc[ "client" + name ] |
| | 9412 | ); |
| | 9413 | } |
| | 9414 | |
| | 9415 | return value === undefined ? |
| | 9416 | // Get width or height on the element, requesting but not forcing parseFloat |
| | 9417 | jQuery.css( elem, type, extra ) : |
| | 9418 | |
| | 9419 | // Set width or height on the element |
| | 9420 | jQuery.style( elem, type, value, extra ); |
| | 9421 | }, type, chainable ? margin : undefined, chainable, null ); |
| | 9422 | }; |
| | 9423 | }); |
| | 9424 | }); |
| | 9425 | // Limit scope pollution from any deprecated API |
| | 9426 | // (function() { |
| | 9427 | |
| | 9428 | // })(); |
| | 9429 | // Expose jQuery to the global object |
| | 9430 | window.jQuery = window.$ = jQuery; |
| | 9431 | |
| | 9432 | // Expose jQuery as an AMD module, but only for AMD loaders that |
| | 9433 | // understand the issues with loading multiple versions of jQuery |
| | 9434 | // in a page that all might call define(). The loader will indicate |
| | 9435 | // they have special allowances for multiple jQuery versions by |
| | 9436 | // specifying define.amd.jQuery = true. Register as a named module, |
| | 9437 | // since jQuery can be concatenated with other files that may use define, |
| | 9438 | // but not use a proper concatenation script that understands anonymous |
| | 9439 | // AMD modules. A named AMD is safest and most robust way to register. |
| | 9440 | // Lowercase jquery is used because AMD module names are derived from |
| | 9441 | // file names, and jQuery is normally delivered in a lowercase file name. |
| | 9442 | // Do this after creating the global so that if an AMD module wants to call |
| | 9443 | // noConflict to hide this version of jQuery, it will work. |
| | 9444 | if ( typeof define === "function" && define.amd && define.amd.jQuery ) { |
| | 9445 | define( "jquery", [], function () { return jQuery; } ); |
| | 9446 | } |
| | 9447 | |
| | 9448 | })( window ); |