vendor: 38,519 bytes, lines 1-6
1/* 2Turbolinks 5.2.0 3Copyright © 2018 Basecamp, LLC 4 */ 5(function(){var t=this;(function(){(function(){this.Turbolinks={supported:function(){return null!=window.history.pushState&&null!=window.requestAnimationFrame&&null!=window.addEventListener}(),visit:function(t,r){return e.controller.visit(t,r)},clearCache:function(){return e.controller.clearCache()},setProgressBarDelay:function(t){return e.controller.setProgressBarDelay(t)}}}).call(this)}).call(t);var e=t.Turbolinks;(function(){(function(){var t,r,n,o=[].slice;e.copyObject=function(t){var e,r,n;r={};for(e in t)n=t[e],r[e]=n;return r},e.closest=function(e,r){return t.call(e,r)},t=function(){var t,e;return t=document.documentElement,null!=(e=t.closest)?e:function(t){var e;for(e=this;e;){if(e.nodeType===Node.ELEMENT_NODE&&r.call(e,t))return e;e=e.parentNode}}}(),e.defer=function(t){return setTimeout(t,1)},e.throttle=function(t){var e;return e=null,function(){var r;return r=1<=arguments.length?o.call(arguments,0):[],null!=e?e:e=requestAnimationFrame(function(n){return function(){return e=null,t.apply(n,r)}}(this))}},e.dispatch=function(t,e){var r,o,i,s,a,u;return a=null!=e?e:{},u=a.target,r=a.cancelable,o=a.data,i=document.createEvent("Events"),i.initEvent(t,!0,r===!0),i.data=null!=o?o:{},i.cancelable&&!n&&(s=i.preventDefault,i.preventDefault=function(){return this.defaultPrevented||Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}}),s.call(this)}),(null!=u?u:document).dispatchEvent(i),i},n=function(){var t;return t=document.createEvent("Events"),t.initEvent("test",!0,!0),t.preventDefault(),t.defaultPrevented}(),e.match=function(t,e){return r.call(t,e)},r=function(){var t,e,r,n;return t=document.documentElement,null!=(e=null!=(r=null!=(n=t.matchesSelector)?n:t.webkitMatchesSelector)?r:t.msMatchesSelector)?e:t.mozMatchesSelector}(),e.uuid=function(){var t,e,r;for(r="",t=e=1;36>=e;t=++e)r+=9===t||14===t||19===t||24===t?"-":15===t?"4":20===t?(Math.floor(4*Math.random())+8).toString(16):Math.floor(15*Math.random()).toString(16);return r}}).call(this),function(){e.Location=function(){function t(t){var e,r;null==t&&(t=""),r=document.createElement("a"),r.href=t.toString(),this.absoluteURL=r.href,e=r.hash.length,2>e?this.requestURL=this.absoluteURL:(this.requestURL=this.absoluteURL.slice(0,-e),this.anchor=r.hash.slice(1))}var e,r,n,o;return t.wrap=function(t){return t instanceof this?t:new this(t)},t.prototype.getOrigin=function(){return this.absoluteURL.split("/",3).join("/")},t.prototype.getPath=function(){var t,e;return null!=(t=null!=(e=this.requestURL.match(/\/\/[^\/]*(\/[^?;]*)/))?e[1]:void 0)?t:"/"},t.prototype.getPathComponents=function(){return this.getPath().split("/").slice(1)},t.prototype.getLastPathComponent=function(){return this.getPathComponents().slice(-1)[0]},t.prototype.getExtension=function(){var t,e;return null!=(t=null!=(e=this.getLastPathComponent().match(/\.[^.]*$/))?e[0]:void 0)?t:""},t.prototype.isHTML=function(){return this.getExtension().match(/^(?:|\.(?:htm|html|xhtml))$/)},t.prototype.isPrefixedBy=function(t){var e;return e=r(t),this.isEqualTo(t)||o(this.absoluteURL,e)},t.prototype.isEqualTo=function(t){return this.absoluteURL===(null!=t?t.absoluteURL:void 0)},t.prototype.toCacheKey=function(){return this.requestURL},t.prototype.toJSON=function(){return this.absoluteURL},t.prototype.toString=function(){return this.absoluteURL},t.prototype.valueOf=function(){return this.absoluteURL},r=function(t){return e(t.getOrigin()+t.getPath())},e=function(t){return n(t,"/")?t:t+"/"},o=function(t,e){return t.slice(0,e.length)===e},n=function(t,e){return t.slice(-e.length)===e},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.HttpRequest=function(){function r(r,n,o){this.delegate=r,this.requestCanceled=t(this.requestCanceled,this),this.requestTimedOut=t(this.requestTimedOut,this),this.requestFailed=t(this.requestFailed,this),this.requestLoaded=t(this.requestLoaded,this),this.requestProgressed=t(this.requestProgressed,this),this.url=e.Location.wrap(n).requestURL,this.referrer=e.Location.wrap(o).absoluteURL,this.createXHR()}return r.NETWORK_FAILURE=0,r.TIMEOUT_FAILURE=-1,r.timeout=60,r.prototype.send=function(){var t;return this.xhr&&!this.sent?(this.notifyApplicationBeforeRequestStart(),this.setProgress(0),this.xhr.send(),this.sent=!0,"function"==typeof(t=this.delegate).requestStarted?t.requestStarted():void 0):void 0},r.prototype.cancel=function(){return this.xhr&&this.sent?this.xhr.abort():void 0},r.prototype.requestProgressed=function(t){return t.lengthComputable?this.setProgress(t.loaded/t.total):void 0},r.prototype.requestLoaded=function(){return this.endRequest(function(t){return function(){var e;return 200<=(e=t.xhr.status)&&300>e?t.delegate.requestCompletedWithResponse(t.xhr.responseText,t.xhr.getResponseHeader("Turbolinks-Location")):(t.failed=!0,t.delegate.requestFailedWithStatusCode(t.xhr.status,t.xhr.responseText))}}(this))},r.prototype.requestFailed=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.NETWORK_FAILURE)}}(this))},r.prototype.requestTimedOut=function(){return this.endRequest(function(t){return function(){return t.failed=!0,t.delegate.requestFailedWithStatusCode(t.constructor.TIMEOUT_FAILURE)}}(this))},r.prototype.requestCanceled=function(){return this.endRequest()},r.prototype.notifyApplicationBeforeRequestStart=function(){return e.dispatch("turbolinks:request-start",{data:{url:this.url,xhr:this.xhr}})},r.prototype.notifyApplicationAfterRequestEnd=function(){return e.dispatch("turbolinks:request-end",{data:{url:this.url,xhr:this.xhr}})},r.prototype.createXHR=function(){return this.xhr=new XMLHttpRequest,this.xhr.open("GET",this.url,!0),this.xhr.timeout=1e3*this.constructor.timeout,this.xhr.setRequestHeader("Accept","text/html, application/xhtml+xml"),this.xhr.setRequestHeader("Turbolinks-Referrer",this.referrer),this.xhr.onprogress=this.requestProgressed,this.xhr.onload=this.requestLoaded,this.xhr.onerror=this.requestFailed,this.xhr.ontimeout=this.requestTimedOut,this.xhr.onabort=this.requestCanceled},r.prototype.endRequest=function(t){return this.xhr?(this.notifyApplicationAfterRequestEnd(),null!=t&&t.call(this),this.destroy()):void 0},r.prototype.setProgress=function(t){var e;return this.progress=t,"function"==typeof(e=this.delegate).requestProgressed?e.requestProgressed(this.progress):void 0},r.prototype.destroy=function(){var t;return this.setProgress(1),"function"==typeof(t=this.delegate).requestFinished&&t.requestFinished(),this.delegate=null,this.xhr=null},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ProgressBar=function(){function e(){this.trickle=t(this.trickle,this),this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement()}var r;return r=300,e.defaultCSS=".turbolinks-progress-bar {\n position: fixed;\n display: block;\n top: 0;\n left: 0;\n height: 3px;\n background: #0076ff;\n z-index: 9999;\n transition: width "+r+"ms ease-out, opacity "+r/2+"ms "+r/2+"ms ease-in;\n transform: translate3d(0, 0, 0);\n}",e.prototype.show=function(){return this.visible?void 0:(this.visible=!0,this.installStylesheetElement(),this.installProgressElement(),this.startTrickling())},e.prototype.hide=function(){return this.visible&&!this.hiding?(this.hiding=!0,this.fadeProgressElement(function(t){return function(){return t.uninstallProgressElement(),t.stopTrickling(),t.visible=!1,t.hiding=!1}}(this))):void 0},e.prototype.setValue=function(t){return this.value=t,this.refresh()},e.prototype.installStylesheetElement=function(){return document.head.insertBefore(this.stylesheetElement,document.head.firstChild)},e.prototype.installProgressElement=function(){return this.progressElement.style.width=0,this.progressElement.style.opacity=1,document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()},e.prototype.fadeProgressElement=function(t){return this.progressElement.style.opacity=0,setTimeout(t,1.5*r)},e.prototype.uninstallProgressElement=function(){return this.progressElement.parentNode?document.documentElement.removeChild(this.progressElement):void 0},e.prototype.startTrickling=function(){return null!=this.trickleInterval?this.trickleInterval:this.trickleInterval=setInterval(this.trickle,r)},e.prototype.stopTrickling=function(){return clearInterval(this.trickleInterval),this.trickleInterval=null},e.prototype.trickle=function(){return this.setValue(this.value+Math.random()/100)},e.prototype.refresh=function(){return requestAnimationFrame(function(t){return function(){return t.progressElement.style.width=10+90*t.value+"%"}}(this))},e.prototype.createStylesheetElement=function(){var t;return t=document.createElement("style"),t.type="text/css",t.textContent=this.constructor.defaultCSS,t},e.prototype.createProgressElement=function(){var t;return t=document.createElement("div"),t.className="turbolinks-progress-bar",t},e}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.BrowserAdapter=function(){function r(r){this.controller=r,this.showProgressBar=t(this.showProgressBar,this),this.progressBar=new e.ProgressBar}var n,o,i;return i=e.HttpRequest,n=i.NETWORK_FAILURE,o=i.TIMEOUT_FAILURE,r.prototype.visitProposedToLocationWithAction=function(t,e){return this.controller.startVisitToLocationWithAction(t,e)},r.prototype.visitStarted=function(t){return t.issueRequest(),t.changeHistory(),t.loadCachedSnapshot()},r.prototype.visitRequestStarted=function(t){return this.progressBar.setValue(0),t.hasCachedSnapshot()||"restore"!==t.action?this.showProgressBarAfterDelay():this.showProgressBar()},r.prototype.visitRequestProgressed=function(t){return this.progressBar.setValue(t.progress)},r.prototype.visitRequestCompleted=function(t){return t.loadResponse()},r.prototype.visitRequestFailedWithStatusCode=function(t,e){switch(e){case n:case o:return this.reload();default:return t.loadResponse()}},r.prototype.visitRequestFinished=function(t){return this.hideProgressBar()},r.prototype.visitCompleted=function(t){return t.followRedirect()},r.prototype.pageInvalidated=function(){return this.reload()},r.prototype.showProgressBarAfterDelay=function(){return this.progressBarTimeout=setTimeout(this.showProgressBar,this.controller.progressBarDelay)},r.prototype.showProgressBar=function(){return this.progressBar.show()},r.prototype.hideProgressBar=function(){return this.progressBar.hide(),clearTimeout(this.progressBarTimeout)},r.prototype.reload=function(){return window.location.reload()},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.History=function(){function r(e){this.delegate=e,this.onPageLoad=t(this.onPageLoad,this),this.onPopState=t(this.onPopState,this)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1):void 0},r.prototype.push=function(t,r){return t=e.Location.wrap(t),this.update("push",t,r)},r.prototype.replace=function(t,r){return t=e.Location.wrap(t),this.update("replace",t,r)},r.prototype.onPopState=function(t){var r,n,o,i;return this.shouldHandlePopState()&&(i=null!=(n=t.state)?n.turbolinks:void 0)?(r=e.Location.wrap(window.location),o=i.restorationIdentifier,this.delegate.historyPoppedToLocationWithRestorationIdentifier(r,o)):void 0},r.prototype.onPageLoad=function(t){return e.defer(function(t){return function(){return t.pageLoaded=!0}}(this))},r.prototype.shouldHandlePopState=function(){return this.pageIsLoaded()},r.prototype.pageIsLoaded=function(){return this.pageLoaded||"complete"===document.readyState},r.prototype.update=function(t,e,r){var n;return n={turbolinks:{restorationIdentifier:r}},history[t+"State"](n,null,e)},r}()}.call(this),function(){e.HeadDetails=function(){function t(t){var e,r,n,s,a,u;for(this.elements={},n=0,a=t.length;a>n;n++)u=t[n],u.nodeType===Node.ELEMENT_NODE&&(s=u.outerHTML,r=null!=(e=this.elements)[s]?e[s]:e[s]={type:i(u),tracked:o(u),elements:[]},r.elements.push(u))}var e,r,n,o,i;return t.fromHeadElement=function(t){var e;return new this(null!=(e=null!=t?t.childNodes:void 0)?e:[])},t.prototype.hasElementWithKey=function(t){return t in this.elements},t.prototype.getTrackedElementSignature=function(){var t,e;return function(){var r,n;r=this.elements,n=[];for(t in r)e=r[t].tracked,e&&n.push(t);return n}.call(this).join("")},t.prototype.getScriptElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("script",t)},t.prototype.getStylesheetElementsNotInDetails=function(t){return this.getElementsMatchingTypeNotInDetails("stylesheet",t)},t.prototype.getElementsMatchingTypeNotInDetails=function(t,e){var r,n,o,i,s,a;o=this.elements,s=[];for(n in o)i=o[n],a=i.type,r=i.elements,a!==t||e.hasElementWithKey(n)||s.push(r[0]);return s},t.prototype.getProvisionalElements=function(){var t,e,r,n,o,i,s;r=[],n=this.elements;for(e in n)o=n[e],s=o.type,i=o.tracked,t=o.elements,null!=s||i?t.length>1&&r.push.apply(r,t.slice(1)):r.push.apply(r,t);return r},t.prototype.getMetaValue=function(t){var e;return null!=(e=this.findMetaElementByName(t))?e.getAttribute("content"):void 0},t.prototype.findMetaElementByName=function(t){var r,n,o,i;r=void 0,i=this.elements;for(o in i)n=i[o].elements,e(n[0],t)&&(r=n[0]);return r},i=function(t){return r(t)?"script":n(t)?"stylesheet":void 0},o=function(t){return"reload"===t.getAttribute("data-turbolinks-track")},r=function(t){var e;return e=t.tagName.toLowerCase(),"script"===e},n=function(t){var e;return e=t.tagName.toLowerCase(),"style"===e||"link"===e&&"stylesheet"===t.getAttribute("rel")},e=function(t,e){var r;return r=t.tagName.toLowerCase(),"meta"===r&&t.getAttribute("name")===e},t}()}.call(this),function(){e.Snapshot=function(){function t(t,e){this.headDetails=t,this.bodyElement=e}return t.wrap=function(t){return t instanceof this?t:"string"==typeof t?this.fromHTMLString(t):this.fromHTMLElement(t)},t.fromHTMLString=function(t){var e;return e=document.createElement("html"),e.innerHTML=t,this.fromHTMLElement(e)},t.fromHTMLElement=function(t){var r,n,o,i;return o=t.querySelector("head"),r=null!=(i=t.querySelector("body"))?i:document.createElement("body"),n=e.HeadDetails.fromHeadElement(o),new this(n,r)},t.prototype.clone=function(){return new this.constructor(this.headDetails,this.bodyElement.cloneNode(!0))},t.prototype.getRootLocation=function(){var t,r;return r=null!=(t=this.getSetting("root"))?t:"/",new e.Location(r)},t.prototype.getCacheControlValue=function(){return this.getSetting("cache-control")},t.prototype.getElementForAnchor=function(t){try{return this.bodyElement.querySelector("[id='"+t+"'], a[name='"+t+"']")}catch(e){}},t.prototype.getPermanentElements=function(){return this.bodyElement.querySelectorAll("[id][data-turbolinks-permanent]")},t.prototype.getPermanentElementById=function(t){return this.bodyElement.querySelector("#"+t+"[data-turbolinks-permanent]")},t.prototype.getPermanentElementsPresentInSnapshot=function(t){var e,r,n,o,i;for(o=this.getPermanentElements(),i=[],r=0,n=o.length;n>r;r++)e=o[r],t.getPermanentElementById(e.id)&&i.push(e);return i},t.prototype.findFirstAutofocusableElement=function(){return this.bodyElement.querySelector("[autofocus]")},t.prototype.hasAnchor=function(t){return null!=this.getElementForAnchor(t)},t.prototype.isPreviewable=function(){return"no-preview"!==this.getCacheControlValue()},t.prototype.isCacheable=function(){return"no-cache"!==this.getCacheControlValue()},t.prototype.isVisitable=function(){return"reload"!==this.getSetting("visit-control")},t.prototype.getSetting=function(t){return this.headDetails.getMetaValue("turbolinks-"+t)},t}()}.call(this),function(){var t=[].slice;e.Renderer=function(){function e(){}var r;return e.render=function(){var e,r,n,o;return n=arguments[0],r=arguments[1],e=3<=arguments.length?t.call(arguments,2):[],o=function(t,e,r){r.prototype=t.prototype;var n=new r,o=t.apply(n,e);return Object(o)===o?o:n}(this,e,function(){}),o.delegate=n,o.render(r),o},e.prototype.renderView=function(t){return this.delegate.viewWillRender(this.newBody),t(),this.delegate.viewRendered(this.newBody)},e.prototype.invalidateView=function(){return this.delegate.viewInvalidated()},e.prototype.createScriptElement=function(t){var e;return"false"===t.getAttribute("data-turbolinks-eval")?t:(e=document.createElement("script"),e.textContent=t.textContent,e.async=!1,r(e,t),e)},r=function(t,e){var r,n,o,i,s,a,u;for(i=e.attributes,a=[],r=0,n=i.length;n>r;r++)s=i[r],o=s.name,u=s.value,a.push(t.setAttribute(o,u));return a},e}()}.call(this),function(){var t,r,n=function(t,e){function r(){this.constructor=t}for(var n in e)o.call(e,n)&&(t[n]=e[n]);return r.prototype=e.prototype,t.prototype=new r,t.__super__=e.prototype,t},o={}.hasOwnProperty;e.SnapshotRenderer=function(e){function o(t,e,r){this.currentSnapshot=t,this.newSnapshot=e,this.isPreview=r,this.currentHeadDetails=this.currentSnapshot.headDetails,this.newHeadDetails=this.newSnapshot.headDetails,this.currentBody=this.currentSnapshot.bodyElement,this.newBody=this.newSnapshot.bodyElement}return n(o,e),o.prototype.render=function(t){return this.shouldRender()?(this.mergeHead(),this.renderView(function(e){return function(){return e.replaceBody(),e.isPreview||e.focusFirstAutofocusableElement(),t()}}(this))):this.invalidateView()},o.prototype.mergeHead=function(){return this.copyNewHeadStylesheetElements(),this.copyNewHeadScriptElements(),this.removeCurrentHeadProvisionalElements(),this.copyNewHeadProvisionalElements()},o.prototype.replaceBody=function(){var t;return t=this.relocateCurrentBodyPermanentElements(),this.activateNewBodyScriptElements(),this.assignNewBody(),this.replacePlaceholderElementsWithClonedPermanentElements(t)},o.prototype.shouldRender=function(){return this.newSnapshot.isVisitable()&&this.trackedElementsAreIdentical()},o.prototype.trackedElementsAreIdentical=function(){return this.currentHeadDetails.getTrackedElementSignature()===this.newHeadDetails.getTrackedElementSignature()},o.prototype.copyNewHeadStylesheetElements=function(){var t,e,r,n,o;for(n=this.getNewHeadStylesheetElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},o.prototype.copyNewHeadScriptElements=function(){var t,e,r,n,o;for(n=this.getNewHeadScriptElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(this.createScriptElement(t)));return o},o.prototype.removeCurrentHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getCurrentHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.removeChild(t));return o},o.prototype.copyNewHeadProvisionalElements=function(){var t,e,r,n,o;for(n=this.getNewHeadProvisionalElements(),o=[],e=0,r=n.length;r>e;e++)t=n[e],o.push(document.head.appendChild(t));return o},o.prototype.relocateCurrentBodyPermanentElements=function(){var e,n,o,i,s,a,u;for(a=this.getCurrentBodyPermanentElements(),u=[],e=0,n=a.length;n>e;e++)i=a[e],s=t(i),o=this.newSnapshot.getPermanentElementById(i.id),r(i,s.element),r(o,i),u.push(s);return u},o.prototype.replacePlaceholderElementsWithClonedPermanentElements=function(t){var e,n,o,i,s,a,u;for(u=[],o=0,i=t.length;i>o;o++)a=t[o],n=a.element,s=a.permanentElement,e=s.cloneNode(!0),u.push(r(n,e));return u},o.prototype.activateNewBodyScriptElements=function(){var t,e,n,o,i,s;for(i=this.getNewBodyScriptElements(),s=[],e=0,o=i.length;o>e;e++)n=i[e],t=this.createScriptElement(n),s.push(r(n,t));return s},o.prototype.assignNewBody=function(){return document.body=this.newBody},o.prototype.focusFirstAutofocusableElement=function(){var t;return null!=(t=this.newSnapshot.findFirstAutofocusableElement())?t.focus():void 0},o.prototype.getNewHeadStylesheetElements=function(){return this.newHeadDetails.getStylesheetElementsNotInDetails(this.currentHeadDetails)},o.prototype.getNewHeadScriptElements=function(){return this.newHeadDetails.getScriptElementsNotInDetails(this.currentHeadDetails)},o.prototype.getCurrentHeadProvisionalElements=function(){return this.currentHeadDetails.getProvisionalElements()},o.prototype.getNewHeadProvisionalElements=function(){return this.newHeadDetails.getProvisionalElements()},o.prototype.getCurrentBodyPermanentElements=function(){return this.currentSnapshot.getPermanentElementsPresentInSnapshot(this.newSnapshot)},o.prototype.getNewBodyScriptElements=function(){return this.newBody.querySelectorAll("script")},o}(e.Renderer),t=function(t){var e;return e=document.createElement("meta"),e.setAttribute("name","turbolinks-permanent-placeholder"),e.setAttribute("content",t.id),{element:e,permanentElement:t}},r=function(t,e){var r;return(r=t.parentNode)?r.replaceChild(e,t):void 0}}.call(this),function(){var t=function(t,e){function n(){this.constructor=t}for(var o in e)r.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},r={}.hasOwnProperty;e.ErrorRenderer=function(e){function r(t){var e;e=document.createElement("html"),e.innerHTML=t,this.newHead=e.querySelector("head"),this.newBody=e.querySelector("body")}return t(r,e),r.prototype.render=function(t){return this.renderView(function(e){return function(){return e.replaceHeadAndBody(),e.activateBodyScriptElements(),t()}}(this))},r.prototype.replaceHeadAndBody=function(){var t,e;return e=document.head,t=document.body,e.parentNode.replaceChild(this.newHead,e),t.parentNode.replaceChild(this.newBody,t)},r.prototype.activateBodyScriptElements=function(){var t,e,r,n,o,i;for(n=this.getScriptElements(),i=[],e=0,r=n.length;r>e;e++)o=n[e],t=this.createScriptElement(o),i.push(o.parentNode.replaceChild(t,o));return i},r.prototype.getScriptElements=function(){return document.documentElement.querySelectorAll("script")},r}(e.Renderer)}.call(this),function(){e.View=function(){function t(t){this.delegate=t,this.htmlElement=document.documentElement}return t.prototype.getRootLocation=function(){return this.getSnapshot().getRootLocation()},t.prototype.getElementForAnchor=function(t){return this.getSnapshot().getElementForAnchor(t)},t.prototype.getSnapshot=function(){return e.Snapshot.fromHTMLElement(this.htmlElement)},t.prototype.render=function(t,e){var r,n,o;return o=t.snapshot,r=t.error,n=t.isPreview,this.markAsPreview(n),null!=o?this.renderSnapshot(o,n,e):this.renderError(r,e)},t.prototype.markAsPreview=function(t){return t?this.htmlElement.setAttribute("data-turbolinks-preview",""):this.htmlElement.removeAttribute("data-turbolinks-preview")},t.prototype.renderSnapshot=function(t,r,n){return e.SnapshotRenderer.render(this.delegate,n,this.getSnapshot(),e.Snapshot.wrap(t),r)},t.prototype.renderError=function(t,r){return e.ErrorRenderer.render(this.delegate,r,t)},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.ScrollManager=function(){function r(r){this.delegate=r,this.onScroll=t(this.onScroll,this),this.onScroll=e.throttle(this.onScroll)}return r.prototype.start=function(){return this.started?void 0:(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)},r.prototype.stop=function(){return this.started?(removeEventListener("scroll",this.onScroll,!1),this.started=!1):void 0},r.prototype.scrollToElement=function(t){return t.scrollIntoView()},r.prototype.scrollToPosition=function(t){var e,r;return e=t.x,r=t.y,window.scrollTo(e,r)},r.prototype.onScroll=function(t){return this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})},r.prototype.updatePosition=function(t){var e;return this.position=t,null!=(e=this.delegate)?e.scrollPositionChanged(this.position):void 0},r}()}.call(this),function(){e.SnapshotCache=function(){function t(t){this.size=t,this.keys=[],this.snapshots={}}var r;return t.prototype.has=function(t){var e;return e=r(t),e in this.snapshots},t.prototype.get=function(t){var e;if(this.has(t))return e=this.read(t),this.touch(t),e},t.prototype.put=function(t,e){return this.write(t,e),this.touch(t),e},t.prototype.read=function(t){var e;return e=r(t),this.snapshots[e]},t.prototype.write=function(t,e){var n;return n=r(t),this.snapshots[n]=e},t.prototype.touch=function(t){var e,n;return n=r(t),e=this.keys.indexOf(n),e>-1&&this.keys.splice(e,1),this.keys.unshift(n),this.trim()},t.prototype.trim=function(){var t,e,r,n,o;for(n=this.keys.splice(this.size),o=[],t=0,r=n.length;r>t;t++)e=n[t],o.push(delete this.snapshots[e]);return o},r=function(t){return e.Location.wrap(t).toCacheKey()},t}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Visit=function(){function r(r,n,o){this.controller=r,this.action=o,this.performScroll=t(this.performScroll,this),this.identifier=e.uuid(),this.location=e.Location.wrap(n),this.adapter=this.controller.adapter,this.state="initialized",this.timingMetrics={}}var n;return r.prototype.start=function(){return"initialized"===this.state?(this.recordTimingMetric("visitStart"),this.state="started",this.adapter.visitStarted(this)):void 0},r.prototype.cancel=function(){var t;return"started"===this.state?(null!=(t=this.request)&&t.cancel(),this.cancelRender(),this.state="canceled"):void 0},r.prototype.complete=function(){var t;return"started"===this.state?(this.recordTimingMetric("visitEnd"),this.state="completed","function"==typeof(t=this.adapter).visitCompleted&&t.visitCompleted(this),this.controller.visitCompleted(this)):void 0},r.prototype.fail=function(){var t;return"started"===this.state?(this.state="failed","function"==typeof(t=this.adapter).visitFailed?t.visitFailed(this):void 0):void 0},r.prototype.changeHistory=function(){var t,e;return this.historyChanged?void 0:(t=this.location.isEqualTo(this.referrer)?"replace":this.action,e=n(t),this.controller[e](this.location,this.restorationIdentifier),this.historyChanged=!0)},r.prototype.issueRequest=function(){return this.shouldIssueRequest()&&null==this.request?(this.progress=0,this.request=new e.HttpRequest(this,this.location,this.referrer),this.request.send()):void 0},r.prototype.getCachedSnapshot=function(){var t;return!(t=this.controller.getCachedSnapshotForLocation(this.location))||null!=this.location.anchor&&!t.hasAnchor(this.location.anchor)||"restore"!==this.action&&!t.isPreviewable()?void 0:t},r.prototype.hasCachedSnapshot=function(){return null!=this.getCachedSnapshot()},r.prototype.loadCachedSnapshot=function(){var t,e;return(e=this.getCachedSnapshot())?(t=this.shouldIssueRequest(),this.render(function(){var r;return this.cacheSnapshot(),this.controller.render({snapshot:e,isPreview:t},this.performScroll),"function"==typeof(r=this.adapter).visitRendered&&r.visitRendered(this),t?void 0:this.complete()})):void 0},r.prototype.loadResponse=function(){return null!=this.response?this.render(function(){var t,e;return this.cacheSnapshot(),this.request.failed?(this.controller.render({error:this.response},this.performScroll),"function"==typeof(t=this.adapter).visitRendered&&t.visitRendered(this),this.fail()):(this.controller.render({snapshot:this.response},this.performScroll),"function"==typeof(e=this.adapter).visitRendered&&e.visitRendered(this),this.complete())}):void 0},r.prototype.followRedirect=function(){return this.redirectedToLocation&&!this.followedRedirect?(this.location=this.redirectedToLocation,this.controller.replaceHistoryWithLocationAndRestorationIdentifier(this.redirectedToLocation,this.restorationIdentifier),this.followedRedirect=!0):void 0},r.prototype.requestStarted=function(){var t;return this.recordTimingMetric("requestStart"),"function"==typeof(t=this.adapter).visitRequestStarted?t.visitRequestStarted(this):void 0},r.prototype.requestProgressed=function(t){var e;return this.progress=t,"function"==typeof(e=this.adapter).visitRequestProgressed?e.visitRequestProgressed(this):void 0},r.prototype.requestCompletedWithResponse=function(t,r){return this.response=t,null!=r&&(this.redirectedToLocation=e.Location.wrap(r)),this.adapter.visitRequestCompleted(this)},r.prototype.requestFailedWithStatusCode=function(t,e){return this.response=e,this.adapter.visitRequestFailedWithStatusCode(this,t)},r.prototype.requestFinished=function(){var t;return this.recordTimingMetric("requestEnd"),"function"==typeof(t=this.adapter).visitRequestFinished?t.visitRequestFinished(this):void 0},r.prototype.performScroll=function(){return this.scrolled?void 0:("restore"===this.action?this.scrollToRestoredPosition()||this.scrollToTop():this.scrollToAnchor()||this.scrollToTop(),this.scrolled=!0)},r.prototype.scrollToRestoredPosition=function(){var t,e;return t=null!=(e=this.restorationData)?e.scrollPosition:void 0,null!=t?(this.controller.scrollToPosition(t),!0):void 0},r.prototype.scrollToAnchor=function(){return null!=this.location.anchor?(this.controller.scrollToAnchor(this.location.anchor),!0):void 0},r.prototype.scrollToTop=function(){return this.controller.scrollToPosition({x:0,y:0})},r.prototype.recordTimingMetric=function(t){var e;return null!=(e=this.timingMetrics)[t]?e[t]:e[t]=(new Date).getTime()},r.prototype.getTimingMetrics=function(){return e.copyObject(this.timingMetrics)},n=function(t){switch(t){case"replace":return"replaceHistoryWithLocationAndRestorationIdentifier";case"advance":case"restore":return"pushHistoryWithLocationAndRestorationIdentifier"}},r.prototype.shouldIssueRequest=function(){return"restore"===this.action?!this.hasCachedSnapshot():!0},r.prototype.cacheSnapshot=function(){return this.snapshotCached?void 0:(this.controller.cacheSnapshot(),this.snapshotCached=!0)},r.prototype.render=function(t){return this.cancelRender(),this.frame=requestAnimationFrame(function(e){return function(){return e.frame=null,t.call(e)}}(this))},r.prototype.cancelRender=function(){return this.frame?cancelAnimationFrame(this.frame):void 0},r}()}.call(this),function(){var t=function(t,e){return function(){return t.apply(e,arguments)}};e.Controller=function(){function r(){this.clickBubbled=t(this.clickBubbled,this),this.clickCaptured=t(this.clickCaptured,this),this.pageLoaded=t(this.pageLoaded,this),this.history=new e.History(this),this.view=new e.View(this),this.scrollManager=new e.ScrollManager(this),this.restorationData={},this.clearCache(),this.setProgressBarDelay(500)}return r.prototype.start=function(){return e.supported&&!this.started?(addEventListener("click",this.clickCaptured,!0),addEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.start(),this.startHistory(),this.started=!0,this.enabled=!0):void 0},r.prototype.disable=function(){return this.enabled=!1},r.prototype.stop=function(){return this.started?(removeEventListener("click",this.clickCaptured,!0),removeEventListener("DOMContentLoaded",this.pageLoaded,!1),this.scrollManager.stop(),this.stopHistory(),this.started=!1):void 0},r.prototype.clearCache=function(){return this.cache=new e.SnapshotCache(10)},r.prototype.visit=function(t,r){var n,o;return null==r&&(r={}),t=e.Location.wrap(t),this.applicationAllowsVisitingLocation(t)?this.locationIsVisitable(t)?(n=null!=(o=r.action)?o:"advance",this.adapter.visitProposedToLocationWithAction(t,n)):window.location=t:void 0},r.prototype.startVisitToLocationWithAction=function(t,r,n){var o;return e.supported?(o=this.getRestorationDataForIdentifier(n),this.startVisit(t,r,{restorationData:o})):window.location=t},r.prototype.setProgressBarDelay=function(t){return this.progressBarDelay=t},r.prototype.startHistory=function(){return this.location=e.Location.wrap(window.location),this.restorationIdentifier=e.uuid(),this.history.start(),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.stopHistory=function(){return this.history.stop()},r.prototype.pushHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.push(this.location,this.restorationIdentifier)},r.prototype.replaceHistoryWithLocationAndRestorationIdentifier=function(t,r){return this.restorationIdentifier=r,this.location=e.Location.wrap(t),this.history.replace(this.location,this.restorationIdentifier)},r.prototype.historyPoppedToLocationWithRestorationIdentifier=function(t,r){var n;return this.restorationIdentifier=r,this.enabled?(n=this.getRestorationDataForIdentifier(this.restorationIdentifier),this.startVisit(t,"restore",{restorationIdentifier:this.restorationIdentifier,restorationData:n,historyChanged:!0}),this.location=e.Location.wrap(t)):this.adapter.pageInvalidated()},r.prototype.getCachedSnapshotForLocation=function(t){var e;return null!=(e=this.cache.get(t))?e.clone():void 0},r.prototype.shouldCacheSnapshot=function(){return this.view.getSnapshot().isCacheable(); 6},r.prototype.cacheSnapshot=function(){var t,r;return this.shouldCacheSnapshot()?(this.notifyApplicationBeforeCachingSnapshot(),r=this.view.getSnapshot(),t=this.lastRenderedLocation,e.defer(function(e){return function(){return e.cache.put(t,r.clone())}}(this))):void 0},r.prototype.scrollToAnchor=function(t){var e;return(e=this.view.getElementForAnchor(t))?this.scrollToElement(e):this.scrollToPosition({x:0,y:0})},r.prototype.scrollToElement=function(t){return this.scrollManager.scrollToElement(t)},r.prototype.scrollToPosition=function(t){return this.scrollManager.scrollToPosition(t)},r.prototype.scrollPositionChanged=function(t){var e;return e=this.getCurrentRestorationData(),e.scrollPosition=t},r.prototype.render=function(t,e){return this.view.render(t,e)},r.prototype.viewInvalidated=function(){return this.adapter.pageInvalidated()},r.prototype.viewWillRender=function(t){return this.notifyApplicationBeforeRender(t)},r.prototype.viewRendered=function(){return this.lastRenderedLocation=this.currentVisit.location,this.notifyApplicationAfterRender()},r.prototype.pageLoaded=function(){return this.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()},r.prototype.clickCaptured=function(){return removeEventListener("click",this.clickBubbled,!1),addEventListener("click",this.clickBubbled,!1)},r.prototype.clickBubbled=function(t){var e,r,n;return this.enabled&&this.clickEventIsSignificant(t)&&(r=this.getVisitableLinkForNode(t.target))&&(n=this.getVisitableLocationForLink(r))&&this.applicationAllowsFollowingLinkToLocation(r,n)?(t.preventDefault(),e=this.getActionForLink(r),this.visit(n,{action:e})):void 0},r.prototype.applicationAllowsFollowingLinkToLocation=function(t,e){var r;return r=this.notifyApplicationAfterClickingLinkToLocation(t,e),!r.defaultPrevented},r.prototype.applicationAllowsVisitingLocation=function(t){var e;return e=this.notifyApplicationBeforeVisitingLocation(t),!e.defaultPrevented},r.prototype.notifyApplicationAfterClickingLinkToLocation=function(t,r){return e.dispatch("turbolinks:click",{target:t,data:{url:r.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationBeforeVisitingLocation=function(t){return e.dispatch("turbolinks:before-visit",{data:{url:t.absoluteURL},cancelable:!0})},r.prototype.notifyApplicationAfterVisitingLocation=function(t){return e.dispatch("turbolinks:visit",{data:{url:t.absoluteURL}})},r.prototype.notifyApplicationBeforeCachingSnapshot=function(){return e.dispatch("turbolinks:before-cache")},r.prototype.notifyApplicationBeforeRender=function(t){return e.dispatch("turbolinks:before-render",{data:{newBody:t}})},r.prototype.notifyApplicationAfterRender=function(){return e.dispatch("turbolinks:render")},r.prototype.notifyApplicationAfterPageLoad=function(t){return null==t&&(t={}),e.dispatch("turbolinks:load",{data:{url:this.location.absoluteURL,timing:t}})},r.prototype.startVisit=function(t,e,r){var n;return null!=(n=this.currentVisit)&&n.cancel(),this.currentVisit=this.createVisit(t,e,r),this.currentVisit.start(),this.notifyApplicationAfterVisitingLocation(t)},r.prototype.createVisit=function(t,r,n){var o,i,s,a,u;return i=null!=n?n:{},a=i.restorationIdentifier,s=i.restorationData,o=i.historyChanged,u=new e.Visit(this,t,r),u.restorationIdentifier=null!=a?a:e.uuid(),u.restorationData=e.copyObject(s),u.historyChanged=o,u.referrer=this.location,u},r.prototype.visitCompleted=function(t){return this.notifyApplicationAfterPageLoad(t.getTimingMetrics())},r.prototype.clickEventIsSignificant=function(t){return!(t.defaultPrevented||t.target.isContentEditable||t.which>1||t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)},r.prototype.getVisitableLinkForNode=function(t){return this.nodeIsVisitable(t)?e.closest(t,"a[href]:not([target]):not([download])"):void 0},r.prototype.getVisitableLocationForLink=function(t){var r;return r=new e.Location(t.getAttribute("href")),this.locationIsVisitable(r)?r:void 0},r.prototype.getActionForLink=function(t){var e;return null!=(e=t.getAttribute("data-turbolinks-action"))?e:"advance"},r.prototype.nodeIsVisitable=function(t){var r;return(r=e.closest(t,"[data-turbolinks]"))?"false"!==r.getAttribute("data-turbolinks"):!0},r.prototype.locationIsVisitable=function(t){return t.isPrefixedBy(this.view.getRootLocation())&&t.isHTML()},r.prototype.getCurrentRestorationData=function(){return this.getRestorationDataForIdentifier(this.restorationIdentifier)},r.prototype.getRestorationDataForIdentifier=function(t){var e;return null!=(e=this.restorationData)[t]?e[t]:e[t]={}},r}()}.call(this),function(){!function(){var t,e;if((t=e=document.currentScript)&&!e.hasAttribute("data-turbolinks-suppress-warning"))for(;t=t.parentNode;)if(t===document.body)return console.warn("You are loading Turbolinks from a <script> element inside the <body> element. This is probably not what you meant to do!\n\nLoad your application\u2019s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.\n\nFor more information, see: https://github.com/turbolinks/turbolinks#working-with-script-elements\n\n\u2014\u2014\nSuppress this warning by adding a `data-turbolinks-suppress-warning` attribute to: %s",e.outerHTML)}()}.call(this),function(){var t,r,n;e.start=function(){return r()?(null==e.controller&&(e.controller=t()),e.controller.start()):void 0},r=function(){return null==window.Turbolinks&&(window.Turbolinks=e),n()},t=function(){var t;return t=new e.Controller,t.adapter=new e.BrowserAdapter(t),t},n=function(){return window.Turbolinks===e},n()&&e.start()}.call(this)}).call(this),"object"==typeof module&&module.exports?module.exports=e:"function"==typeof define&&define.amd&&define(e)}).call(this);
vendor: 3,258 bytes, lines 6-133
6 7/*! 8 * jQuery JavaScript Library v1.12.4 9 * http://jquery.com/ 10 * 11 * Includes Sizzle.js 12 * http://sizzlejs.com/ 13 * 14 * Copyright jQuery Foundation and other contributors 15 * Released under the MIT license 16 * http://jquery.org/license 17 * 18 * Date: 2016-05-20T17:17Z 19 */ 20 21(function( global, factory ) { 22 23 if ( typeof module === "object" && typeof module.exports === "object" ) { 24 // For CommonJS and CommonJS-like environments where a proper `window` 25 // is present, execute the factory and get jQuery. 26 // For environments that do not have a `window` with a `document` 27 // (such as Node.js), expose a factory as module.exports. 28 // This accentuates the need for the creation of a real `window`. 29 // e.g. var jQuery = require("jquery")(window); 30 // See ticket #14549 for more info. 31 module.exports = global.document ? 32 factory( global, true ) : 33 function( w ) { 34 if ( !w.document ) { 35 throw new Error( "jQuery requires a window with a document" ); 36 } 37 return factory( w ); 38 }; 39 } else { 40 factory( global ); 41 } 42 43// Pass this if window is not defined yet 44}(typeof window !== "undefined" ? window : this, function( window, noGlobal ) { 45 46// Support: Firefox 18+ 47// Can't be in strict mode, several libs including ASP.NET trace 48// the stack via arguments.caller.callee and Firefox dies if 49// you try to trace through "use strict" call chains. (#13335) 50//"use strict"; 51var deletedIds = []; 52 53var document = window.document; 54 55var slice = deletedIds.slice; 56 57var concat = deletedIds.concat; 58 59var push = deletedIds.push; 60 61var indexOf = deletedIds.indexOf; 62 63var class2type = {}; 64 65var toString = class2type.toString; 66 67var hasOwn = class2type.hasOwnProperty; 68 69var support = {}; 70 71 72 73var 74 version = "1.12.4", 75 76 // Define a local copy of jQuery 77 jQuery = function( selector, context ) { 78 79 // The jQuery object is actually just the init constructor 'enhanced' 80 // Need init if jQuery is called (just allow error to be thrown if not included) 81 return new jQuery.fn.init( selector, context ); 82 }, 83 84 // Support: Android<4.1, IE<9 85 // Make sure we trim BOM and NBSP 86 rtrim = /^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, 87 88 // Matches dashed string for camelizing 89 rmsPrefix = /^-ms-/, 90 rdashAlpha = /-([\da-z])/gi, 91 92 // Used by jQuery.camelCase as callback to replace() 93 fcamelCase = function( all, letter ) { 94 return letter.toUpperCase(); 95 }; 96 97jQuery.fn = jQuery.prototype = { 98 99 // The current version of jQuery being used 100 jquery: version, 101 102 constructor: jQuery, 103 104 // Start with an empty selector 105 selector: "", 106 107 // The default length of a jQuery object is 0 108 length: 0, 109 110 toArray: function() { 111 return slice.call( this ); 112 }, 113 114 // Get the Nth element in the matched element set OR 115 // Get the whole matched element set as a clean array 116 get: function( num ) { 117 return num != null ? 118 119 // Return just the one element from the set 120 ( num < 0 ? this[ num + this.length ] : this[ num ] ) : 121 122 // Return all the elements in a clean array 123 slice.call( this ); 124 }, 125 126 // Take an array of elements and push it onto the stack 127 // (returning the new matched element set) 128 pushStack: function( elems ) { 129 130 // Build a new jQuery matched element set 131 var ret = jQuery.merge( this.constructor(), elems ); 132 133 // Add the old object onto the stack (as a reference)
vendor: 4,189 bytes, lines 134-305
134 ret.prevObject = this; 135 ret.context = this.context; 136 137 // Return the newly-formed element set 138 return ret; 139 }, 140 141 // Execute a callback for every element in the matched set. 142 each: function( callback ) { 143 return jQuery.each( this, callback ); 144 }, 145 146 map: function( callback ) { 147 return this.pushStack( jQuery.map( this, function( elem, i ) { 148 return callback.call( elem, i, elem ); 149 } ) ); 150 }, 151 152 slice: function() { 153 return this.pushStack( slice.apply( this, arguments ) ); 154 }, 155 156 first: function() { 157 return this.eq( 0 ); 158 }, 159 160 last: function() { 161 return this.eq( -1 ); 162 }, 163 164 eq: function( i ) { 165 var len = this.length, 166 j = +i + ( i < 0 ? len : 0 ); 167 return this.pushStack( j >= 0 && j < len ? [ this[ j ] ] : [] ); 168 }, 169 170 end: function() { 171 return this.prevObject || this.constructor(); 172 }, 173 174 // For internal use only. 175 // Behaves like an Array's method, not like a jQuery method. 176 push: push, 177 sort: deletedIds.sort, 178 splice: deletedIds.splice 179}; 180 181jQuery.extend = jQuery.fn.extend = function() { 182 var src, copyIsArray, copy, name, options, clone, 183 target = arguments[ 0 ] || {}, 184 i = 1, 185 length = arguments.length, 186 deep = false; 187 188 // Handle a deep copy situation 189 if ( typeof target === "boolean" ) { 190 deep = target; 191 192 // skip the boolean and the target 193 target = arguments[ i ] || {}; 194 i++; 195 } 196 197 // Handle case when target is a string or something (possible in deep copy) 198 if ( typeof target !== "object" && !jQuery.isFunction( target ) ) { 199 target = {}; 200 } 201 202 // extend jQuery itself if only one argument is passed 203 if ( i === length ) { 204 target = this; 205 i--; 206 } 207 208 for ( ; i < length; i++ ) { 209 210 // Only deal with non-null/undefined values 211 if ( ( options = arguments[ i ] ) != null ) { 212 213 // Extend the base object 214 for ( name in options ) { 215 src = target[ name ]; 216 copy = options[ name ]; 217 218 // Prevent never-ending loop 219 if ( target === copy ) { 220 continue; 221 } 222 223 // Recurse if we're merging plain objects or arrays 224 if ( deep && copy && ( jQuery.isPlainObject( copy ) || 225 ( copyIsArray = jQuery.isArray( copy ) ) ) ) { 226 227 if ( copyIsArray ) { 228 copyIsArray = false; 229 clone = src && jQuery.isArray( src ) ? src : []; 230 231 } else { 232 clone = src && jQuery.isPlainObject( src ) ? src : {}; 233 } 234 235 // Never move original objects, clone them 236 target[ name ] = jQuery.extend( deep, clone, copy ); 237 238 // Don't bring in undefined values 239 } else if ( copy !== undefined ) { 240 target[ name ] = copy; 241 } 242 } 243 } 244 } 245 246 // Return the modified object 247 return target; 248}; 249 250jQuery.extend( { 251 252 // Unique for each copy of jQuery on the page 253 expando: "jQuery" + ( version + Math.random() ).replace( /\D/g, "" ), 254 255 // Assume jQuery is ready without the ready module 256 isReady: true, 257 258 error: function( msg ) { 259 throw new Error( msg ); 260 }, 261 262 noop: function() {}, 263 264 // See test/unit/core.js for details concerning isFunction. 265 // Since version 1.3, DOM methods and functions like alert 266 // aren't supported. They return false on IE (#2968). 267 isFunction: function( obj ) { 268 return jQuery.type( obj ) === "function"; 269 }, 270 271 isArray: Array.isArray || function( obj ) { 272 return jQuery.type( obj ) === "array"; 273 }, 274 275 isWindow: function( obj ) { 276 /* jshint eqeqeq: false */ 277 return obj != null && obj == obj.window; 278 }, 279 280 isNumeric: function( obj ) { 281 282 // parseFloat NaNs numeric-cast false positives (null|true|false|"") 283 // ...but misinterprets leading-number strings, particularly hex literals ("0x...") 284 // subtraction forces infinities to NaN 285 // adding 1 corrects loss of precision from parseFloat (#15100) 286 var realStringObj = obj && obj.toString(); 287 return !jQuery.isArray( obj ) && ( realStringObj - parseFloat( realStringObj ) + 1 ) >= 0; 288 }, 289 290 isEmptyObject: function( obj ) { 291 var name; 292 for ( name in obj ) { 293 return false; 294 } 295 return true; 296 }, 297 298 isPlainObject: function( obj ) { 299 var key; 300 301 // Must be an Object. 302 // Because of IE, we also have to check the presence of the constructor property. 303 // Make sure that DOM nodes and window objects don't pass through, as well 304 if ( !obj || jQuery.type( obj ) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { 305 return false;
vendor: 5,825 bytes, lines 306-559
306 } 307 308 try { 309 310 // Not own constructor property must be Object 311 if ( obj.constructor && 312 !hasOwn.call( obj, "constructor" ) && 313 !hasOwn.call( obj.constructor.prototype, "isPrototypeOf" ) ) { 314 return false; 315 } 316 } catch ( e ) { 317 318 // IE8,9 Will throw exceptions on certain host objects #9897 319 return false; 320 } 321 322 // Support: IE<9 323 // Handle iteration over inherited properties before own properties. 324 if ( !support.ownFirst ) { 325 for ( key in obj ) { 326 return hasOwn.call( obj, key ); 327 } 328 } 329 330 // Own properties are enumerated firstly, so to speed up, 331 // if last one is own, then all properties are own. 332 for ( key in obj ) {} 333 334 return key === undefined || hasOwn.call( obj, key ); 335 }, 336 337 type: function( obj ) { 338 if ( obj == null ) { 339 return obj + ""; 340 } 341 return typeof obj === "object" || typeof obj === "function" ? 342 class2type[ toString.call( obj ) ] || "object" : 343 typeof obj; 344 }, 345 346 // Workarounds based on findings by Jim Driscoll 347 // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context 348 globalEval: function( data ) { 349 if ( data && jQuery.trim( data ) ) { 350 351 // We use execScript on Internet Explorer 352 // We use an anonymous function so that context is window 353 // rather than jQuery in Firefox 354 ( window.execScript || function( data ) { 355 window[ "eval" ].call( window, data ); // jscs:ignore requireDotNotation 356 } )( data ); 357 } 358 }, 359 360 // Convert dashed to camelCase; used by the css and data modules 361 // Microsoft forgot to hump their vendor prefix (#9572) 362 camelCase: function( string ) { 363 return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); 364 }, 365 366 nodeName: function( elem, name ) { 367 return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase(); 368 }, 369 370 each: function( obj, callback ) { 371 var length, i = 0; 372 373 if ( isArrayLike( obj ) ) { 374 length = obj.length; 375 for ( ; i < length; i++ ) { 376 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 377 break; 378 } 379 } 380 } else { 381 for ( i in obj ) { 382 if ( callback.call( obj[ i ], i, obj[ i ] ) === false ) { 383 break; 384 } 385 } 386 } 387 388 return obj; 389 }, 390 391 // Support: Android<4.1, IE<9 392 trim: function( text ) { 393 return text == null ? 394 "" : 395 ( text + "" ).replace( rtrim, "" ); 396 }, 397 398 // results is for internal usage only 399 makeArray: function( arr, results ) { 400 var ret = results || []; 401 402 if ( arr != null ) { 403 if ( isArrayLike( Object( arr ) ) ) { 404 jQuery.merge( ret, 405 typeof arr === "string" ? 406 [ arr ] : arr 407 ); 408 } else { 409 push.call( ret, arr ); 410 } 411 } 412 413 return ret; 414 }, 415 416 inArray: function( elem, arr, i ) { 417 var len; 418 419 if ( arr ) { 420 if ( indexOf ) { 421 return indexOf.call( arr, elem, i ); 422 } 423 424 len = arr.length; 425 i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; 426 427 for ( ; i < len; i++ ) { 428 429 // Skip accessing in sparse arrays 430 if ( i in arr && arr[ i ] === elem ) { 431 return i; 432 } 433 } 434 } 435 436 return -1; 437 }, 438 439 merge: function( first, second ) { 440 var len = +second.length, 441 j = 0, 442 i = first.length; 443 444 while ( j < len ) { 445 first[ i++ ] = second[ j++ ]; 446 } 447 448 // Support: IE<9 449 // Workaround casting of .length to NaN on otherwise arraylike objects (e.g., NodeLists) 450 if ( len !== len ) { 451 while ( second[ j ] !== undefined ) { 452 first[ i++ ] = second[ j++ ]; 453 } 454 } 455 456 first.length = i; 457 458 return first; 459 }, 460 461 grep: function( elems, callback, invert ) { 462 var callbackInverse, 463 matches = [], 464 i = 0, 465 length = elems.length, 466 callbackExpect = !invert; 467 468 // Go through the array, only saving the items 469 // that pass the validator function 470 for ( ; i < length; i++ ) { 471 callbackInverse = !callback( elems[ i ], i ); 472 if ( callbackInverse !== callbackExpect ) { 473 matches.push( elems[ i ] ); 474 } 475 } 476 477 return matches; 478 }, 479 480 // arg is for internal usage only 481 map: function( elems, callback, arg ) { 482 var length, value, 483 i = 0, 484 ret = []; 485 486 // Go through the array, translating each of the items to their new values 487 if ( isArrayLike( elems ) ) { 488 length = elems.length; 489 for ( ; i < length; i++ ) { 490 value = callback( elems[ i ], i, arg ); 491 492 if ( value != null ) { 493 ret.push( value ); 494 } 495 } 496 497 // Go through every key on the object, 498 } else { 499 for ( i in elems ) { 500 value = callback( elems[ i ], i, arg ); 501 502 if ( value != null ) { 503 ret.push( value ); 504 } 505 } 506 } 507 508 // Flatten any nested arrays 509 return concat.apply( [], ret ); 510 }, 511 512 // A global GUID counter for objects 513 guid: 1, 514 515 // Bind a function to a context, optionally partially applying any 516 // arguments. 517 proxy: function( fn, context ) { 518 var args, proxy, tmp; 519 520 if ( typeof context === "string" ) { 521 tmp = fn[ context ]; 522 context = fn; 523 fn = tmp; 524 } 525 526 // Quick check to determine if target is callable, in the spec 527 // this throws a TypeError, but we will just return undefined. 528 if ( !jQuery.isFunction( fn ) ) { 529 return undefined; 530 } 531 532 // Simulated bind 533 args = slice.call( arguments, 2 ); 534 proxy = function() { 535 return fn.apply( context || this, args.concat( slice.call( arguments ) ) ); 536 }; 537 538 // Set the guid of unique handler to the same of original handler, so it can be removed 539 proxy.guid = fn.guid = fn.guid || jQuery.guid++; 540 541 return proxy; 542 }, 543 544 now: function() { 545 return +( new Date() ); 546 }, 547 548 // jQuery.support is not used in Core but other projects attach their 549 // properties to it so it needs to exist. 550 support: support 551} ); 552 553// JSHint would error on this code due to the Symbol not being defined in ES5. 554// Defining this global in .jshintrc would create a danger of using the global 555// unguarded in another place, it seems safer to just disable JSHint for these 556// three lines. 557/* jshint ignore: start */ 558if ( typeof Symbol === "function" ) { 559 jQuery.fn[ Symbol.iterator ] = deletedIds
vendor: 63,327 bytes, lines 559-2796
559[ Symbol.iterator ]; 560} 561/* jshint ignore: end */ 562 563// Populate the class2type map 564jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), 565function( i, name ) { 566 class2type[ "[object " + name + "]" ] = name.toLowerCase(); 567} ); 568 569function isArrayLike( obj ) { 570 571 // Support: iOS 8.2 (not reproducible in simulator) 572 // `in` check used to prevent JIT error (gh-2145) 573 // hasOwn isn't used here due to false negatives 574 // regarding Nodelist length in IE 575 var length = !!obj && "length" in obj && obj.length, 576 type = jQuery.type( obj ); 577 578 if ( type === "function" || jQuery.isWindow( obj ) ) { 579 return false; 580 } 581 582 return type === "array" || length === 0 || 583 typeof length === "number" && length > 0 && ( length - 1 ) in obj; 584} 585var Sizzle = 586/*! 587 * Sizzle CSS Selector Engine v2.2.1 588 * http://sizzlejs.com/ 589 * 590 * Copyright jQuery Foundation and other contributors 591 * Released under the MIT license 592 * http://jquery.org/license 593 * 594 * Date: 2015-10-17 595 */ 596(function( window ) { 597 598var i, 599 support, 600 Expr, 601 getText, 602 isXML, 603 tokenize, 604 compile, 605 select, 606 outermostContext, 607 sortInput, 608 hasDuplicate, 609 610 // Local document vars 611 setDocument, 612 document, 613 docElem, 614 documentIsHTML, 615 rbuggyQSA, 616 rbuggyMatches, 617 matches, 618 contains, 619 620 // Instance-specific data 621 expando = "sizzle" + 1 * new Date(), 622 preferredDoc = window.document, 623 dirruns = 0, 624 done = 0, 625 classCache = createCache(), 626 tokenCache = createCache(), 627 compilerCache = createCache(), 628 sortOrder = function( a, b ) { 629 if ( a === b ) { 630 hasDuplicate = true; 631 } 632 return 0; 633 }, 634 635 // General-purpose constants 636 MAX_NEGATIVE = 1 << 31, 637 638 // Instance methods 639 hasOwn = ({}).hasOwnProperty, 640 arr = [], 641 pop = arr.pop, 642 push_native = arr.push, 643 push = arr.push, 644 slice = arr.slice, 645 // Use a stripped-down indexOf as it's faster than native 646 // http://jsperf.com/thor-indexof-vs-for/5 647 indexOf = function( list, elem ) { 648 var i = 0, 649 len = list.length; 650 for ( ; i < len; i++ ) { 651 if ( list[i] === elem ) { 652 return i; 653 } 654 } 655 return -1; 656 }, 657 658 booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", 659 660 // Regular expressions 661 662 // http://www.w3.org/TR/css3-selectors/#whitespace 663 whitespace = "[\\x20\\t\\r\\n\\f]", 664 665 // http://www.w3.org/TR/CSS21/syndata.html#value-def-identifier 666 identifier = "(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+", 667 668 // Attribute selectors: http://www.w3.org/TR/selectors/#attribute-selectors 669 attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + 670 // Operator (capture 2) 671 "*([*^$|!~]?=)" + whitespace + 672 // "Attribute values must be CSS identifiers [capture 5] or strings [capture 3 or capture 4]" 673 "*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|(" + identifier + "))|)" + whitespace + 674 "*\\]", 675 676 pseudos = ":(" + identifier + ")(?:\\((" + 677 // To reduce the number of selectors needing tokenize in the preFilter, prefer arguments: 678 // 1. quoted (capture 3; capture 4 or capture 5) 679 "('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|" + 680 // 2. simple (capture 6) 681 "((?:\\\\.|[^\\\\()[\\]]|" + attributes + ")*)|" + 682 // 3. anything else (capture 2) 683 ".*" + 684 ")\\)|)", 685 686 // Leading and non-escaped trailing whitespace, capturing some non-whitespace characters preceding the latter 687 rwhitespace = new RegExp( whitespace + "+", "g" ), 688 rtrim = new RegExp( "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$", "g" ), 689 690 rcomma = new RegExp( "^" + whitespace + "*," + whitespace + "*" ), 691 rcombinators = new RegExp( "^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*" ), 692 693 rattributeQuotes = new RegExp( "=" + whitespace + "*([^\\]'\"]*?)" + whitespace + "*\\]", "g" ), 694 695 rpseudo = new RegExp( pseudos ), 696 ridentifier = new RegExp( "^" + identifier + "$" ), 697 698 matchExpr = { 699 "ID": new RegExp( "^#(" + identifier + ")" ), 700 "CLASS": new RegExp( "^\\.(" + identifier + ")" ), 701 "TAG": new RegExp( "^(" + identifier + "|[*])" ), 702 "ATTR": new RegExp( "^" + attributes ), 703 "PSEUDO": new RegExp( "^" + pseudos ), 704 "CHILD": new RegExp( "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + 705 "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + 706 "*(\\d+)|))" + whitespace + "*\\)|)", "i" ), 707 "bool": new RegExp( "^(?:" + booleans + ")$", "i" ), 708 // For use in libraries implementing .is() 709 // We use this for POS matching in `select` 710 "needsContext": new RegExp( "^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + 711 whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i" ) 712 }, 713 714 rinputs = /^(?:input|select|textarea|button)$/i, 715 rheader = /^h\d$/i, 716 717 rnative = /^[^{]+\{\s*\[native \w/, 718 719 // Easily-parseable/retrievable ID or TAG or CLASS selectors 720 rquickExpr = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, 721 722 rsibling = /[+~]/, 723 rescape = /'|\\/g, 724 725 // CSS escapes http://www.w3.org/TR/CSS21/syndata.html#escaped-characters 726 runescape = new RegExp( "\\\\([\\da-f]{1,6}" + whitespace + "?|(" + whitespace + ")|.)", "ig" ), 727 funescape = function( _, escaped, escapedWhitespace ) { 728 var high = "0x" + escaped - 0x10000; 729 // NaN means non-codepoint 730 // Support: Firefox<24 731 // Workaround erroneous numeric interpretation of +"0x" 732 return high !== high || escapedWhitespace ? 733 escaped : 734 high < 0 ? 735 // BMP codepoint 736 String.fromCharCode( high + 0x10000 ) : 737 // Supplemental Plane codepoint (surrogate pair) 738 String.fromCharCode( high >> 10 | 0xD800, high & 0x3FF | 0xDC00 ); 739 }, 740 741 // Used for iframes 742 // See setDocument() 743 // Removing the function wrapper causes a "Permission Denied" 744 // error in IE 745 unloadHandler = function() { 746 setDocument(); 747 }; 748 749// Optimize for push.apply( _, NodeList ) 750try { 751 push.apply( 752 (arr = slice.call( preferredDoc.childNodes )), 753 preferredDoc.childNodes 754 ); 755 // Support: Android<4.0 756 // Detect silently failing push.apply 757 arr[ preferredDoc.childNodes.length ].nodeType; 758} catch ( e ) { 759 push = { apply: arr.length ? 760 761 // Leverage slice if possible 762 function( target, els ) { 763 push_native.apply( target, slice.call(els) ); 764 } : 765 766 // Support: IE<9 767 // Otherwise append directly 768 function( target, els ) { 769 var j = target.length, 770 i = 0; 771 // Can't trust NodeList.length 772 while ( (target[j++] = els[i++]) ) {} 773 target.length = j - 1; 774 } 775 }; 776} 777 778function Sizzle( selector, context, results, seed ) { 779 var m, i, elem, nid, nidselect, match, groups, newSelector, 780 newContext = context && context.ownerDocument, 781 782 // nodeType defaults to 9, since context defaults to document 783 nodeType = context ? context.nodeType : 9; 784 785 results = results || []; 786 787 // Return early from calls with invalid selector or context 788 if ( typeof selector !== "string" || !selector || 789 nodeType !== 1 && nodeType !== 9 && nodeType !== 11 ) { 790 791 return results; 792 } 793 794 // Try to shortcut find operations (as opposed to filters) in HTML documents 795 if ( !seed ) { 796 797 if ( ( context ? context.ownerDocument || context : preferredDoc ) !== document ) { 798 setDocument( context ); 799 } 800 context = context || document; 801 802 if ( documentIsHTML ) { 803 804 // If the selector is sufficiently simple, try using a "get*By*" DOM method 805 // (excepting DocumentFragment context, where the methods don't exist) 806 if ( nodeType !== 11 && (match = rquickExpr.exec( selector )) ) { 807 808 // ID selector 809 if ( (m = match[1]) ) { 810 811 // Document context 812 if ( nodeType === 9 ) { 813 if ( (elem = context.getElementById( m )) ) { 814 815 // Support: IE, Opera, Webkit 816 // TODO: identify versions 817 // getElementById can match elements by name instead of ID 818 if ( elem.id === m ) { 819 results.push( elem ); 820 return results; 821 } 822 } else { 823 return results; 824 } 825 826 // Element context 827 } else { 828 829 // Support: IE, Opera, Webkit 830 // TODO: identify versions 831 // getElementById can match elements by name instead of ID 832 if ( newContext && (elem = newContext.getElementById( m )) && 833 contains( context, elem ) && 834 elem.id === m ) { 835 836 results.push( elem ); 837 return results; 838 } 839 } 840 841 // Type selector 842 } else if ( match[2] ) { 843 push.apply( results, context.getElementsByTagName( selector ) ); 844 return results; 845 846 // Class selector 847 } else if ( (m = match[3]) && support.getElementsByClassName && 848 context.getElementsByClassName ) { 849 850 push.apply( results, context.getElementsByClassName( m ) ); 851 return results; 852 } 853 } 854 855 // Take advantage of querySelectorAll 856 if ( support.qsa && 857 !compilerCache[ selector + " " ] && 858 (!rbuggyQSA || !rbuggyQSA.test( selector )) ) { 859 860 if ( nodeType !== 1 ) { 861 newContext = context; 862 newSelector = selector; 863 864 // qSA looks outside Element context, which is not what we want 865 // Thanks to Andrew Dupont for this workaround technique 866 // Support: IE <=8 867 // Exclude object elements 868 } else if ( context.nodeName.toLowerCase() !== "object" ) { 869 870 // Capture the context ID, setting it first if necessary 871 if ( (nid = context.getAttribute( "id" )) ) { 872 nid = nid.replace( rescape, "\\$&" ); 873 } else { 874 context.setAttribute( "id", (nid = expando) ); 875 } 876 877 // Prefix every selector in the list 878 groups = tokenize( selector ); 879 i = groups.length; 880 nidselect = ridentifier.test( nid ) ? "#" + nid : "[id='" + nid + "']"; 881 while ( i-- ) { 882 groups[i] = nidselect + " " + toSelector( groups[i] ); 883 } 884 newSelector = groups.join( "," ); 885 886 // Expand context for sibling selectors 887 newContext = rsibling.test( selector ) && testContext( context.parentNode ) || 888 context; 889 } 890 891 if ( newSelector ) { 892 try { 893 push.apply( results, 894 newContext.querySelectorAll( newSelector ) 895 ); 896 return results; 897 } catch ( qsaError ) { 898 } finally { 899 if ( nid === expando ) { 900 context.removeAttribute( "id" ); 901 } 902 } 903 } 904 } 905 } 906 } 907 908 // All others 909 return select( selector.replace( rtrim, "$1" ), context, results, seed ); 910} 911 912/** 913 * Create key-value caches of limited size 914 * @returns {function(string, object)} Returns the Object data after storing it on itself with 915 * property name the (space-suffixed) string and (if the cache is larger than Expr.cacheLength) 916 * deleting the oldest entry 917 */ 918function createCache() { 919 var keys = []; 920 921 function cache( key, value ) { 922 // Use (key + " ") to avoid collision with native prototype properties (see Issue #157) 923 if ( keys.push( key + " " ) > Expr.cacheLength ) { 924 // Only keep the most recent entries 925 delete cache[ keys.shift() ]; 926 } 927 return (cache[ key + " " ] = value); 928 } 929 return cache; 930} 931 932/** 933 * Mark a function for special use by Sizzle 934 * @param {Function} fn The function to mark 935 */ 936function markFunction( fn ) { 937 fn[ expando ] = true; 938 return fn; 939} 940 941/** 942 * Support testing using an element 943 * @param {Function} fn Passed the created div and expects a boolean result 944 */ 945function assert( fn ) { 946 var div = document.createElement("div"); 947 948 try { 949 return !!fn( div ); 950 } catch (e) { 951 return false; 952 } finally { 953 // Remove from its parent by default 954 if ( div.parentNode ) { 955 div.parentNode.removeChild( div ); 956 } 957 // release memory in IE 958 div = null; 959 } 960} 961 962/** 963 * Adds the same handler for all of the specified attrs 964 * @param {String} attrs Pipe-separated list of attributes 965 * @param {Function} handler The method that will be applied 966 */ 967function addHandle( attrs, handler ) { 968 var arr = attrs.split("|"), 969 i = arr.length; 970 971 while ( i-- ) { 972 Expr.attrHandle[ arr[i] ] = handler; 973 } 974} 975 976/** 977 * Checks document order of two siblings 978 * @param {Element} a 979 * @param {Element} b 980 * @returns {Number} Returns less than 0 if a precedes b, greater than 0 if a follows b 981 */ 982function siblingCheck( a, b ) { 983 var cur = b && a, 984 diff = cur && a.nodeType === 1 && b.nodeType === 1 && 985 ( ~b.sourceIndex || MAX_NEGATIVE ) - 986 ( ~a.sourceIndex || MAX_NEGATIVE ); 987 988 // Use IE sourceIndex if available on both nodes 989 if ( diff ) { 990 return diff; 991 } 992 993 // Check if b follows a 994 if ( cur ) { 995 while ( (cur = cur.nextSibling) ) { 996 if ( cur === b ) { 997 return -1; 998 } 999 } 1000 } 1001 1002 return a ? 1 : -1; 1003} 1004 1005/** 1006 * Returns a function to use in pseudos for input types 1007 * @param {String} type 1008 */ 1009function createInputPseudo( type ) { 1010 return function( elem ) { 1011 var name = elem.nodeName.toLowerCase(); 1012 return name === "input" && elem.type === type; 1013 }; 1014} 1015 1016/** 1017 * Returns a function to use in pseudos for buttons 1018 * @param {String} type 1019 */ 1020function createButtonPseudo( type ) { 1021 return function( elem ) { 1022 var name = elem.nodeName.toLowerCase(); 1023 return (name === "input" || name === "button") && elem.type === type; 1024 }; 1025} 1026 1027/** 1028 * Returns a function to use in pseudos for positionals 1029 * @param {Function} fn 1030 */ 1031function createPositionalPseudo( fn ) { 1032 return markFunction(function( argument ) { 1033 argument = +argument; 1034 return markFunction(function( seed, matches ) { 1035 var j, 1036 matchIndexes = fn( [], seed.length, argument ), 1037 i = matchIndexes.length; 1038 1039 // Match elements found at the specified indexes 1040 while ( i-- ) { 1041 if ( seed[ (j = matchIndexes[i]) ] ) { 1042 seed[j] = !(matches[j] = seed[j]); 1043 } 1044 } 1045 }); 1046 }); 1047} 1048 1049/** 1050 * Checks a node for validity as a Sizzle context 1051 * @param {Element|Object=} context 1052 * @returns {Element|Object|Boolean} The input node if acceptable, otherwise a falsy value 1053 */ 1054function testContext( context ) { 1055 return context && typeof context.getElementsByTagName !== "undefined" && context; 1056} 1057 1058// Expose support vars for convenience 1059support = Sizzle.support = {}; 1060 1061/** 1062 * Detects XML nodes 1063 * @param {Element|Object} elem An element or a document 1064 * @returns {Boolean} True iff elem is a non-HTML XML node 1065 */ 1066isXML = Sizzle.isXML = function( elem ) { 1067 // documentElement is verified for cases where it doesn't yet exist 1068 // (such as loading iframes in IE - #4833) 1069 var documentElement = elem && (elem.ownerDocument || elem).documentElement; 1070 return documentElement ? documentElement.nodeName !== "HTML" : false; 1071}; 1072 1073/** 1074 * Sets document-related variables once based on the current document 1075 * @param {Element|Object} [doc] An element or document object to use to set the document 1076 * @returns {Object} Returns the current document 1077 */ 1078setDocument = Sizzle.setDocument = function( node ) { 1079 var hasCompare, parent, 1080 doc = node ? node.ownerDocument || node : preferredDoc; 1081 1082 // Return early if doc is invalid or already selected 1083 if ( doc === document || doc.nodeType !== 9 || !doc.documentElement ) { 1084 return document; 1085 } 1086 1087 // Update global variables 1088 document = doc; 1089 docElem = document.documentElement; 1090 documentIsHTML = !isXML( document ); 1091 1092 // Support: IE 9-11, Edge 1093 // Accessing iframe documents after unload throws "permission denied" errors (jQuery #13936) 1094 if ( (parent = document.defaultView) && parent.top !== parent ) { 1095 // Support: IE 11 1096 if ( parent.addEventListener ) { 1097 parent.addEventListener( "unload", unloadHandler, false ); 1098 1099 // Support: IE 9 - 10 only 1100 } else if ( parent.attachEvent ) { 1101 parent.attachEvent( "onunload", unloadHandler ); 1102 } 1103 } 1104 1105 /* Attributes 1106 ---------------------------------------------------------------------- */ 1107 1108 // Support: IE<8 1109 // Verify that getAttribute really returns attributes and not properties 1110 // (excepting IE8 booleans) 1111 support.attributes = assert(function( div ) { 1112 div.className = "i"; 1113 return !div.getAttribute("className"); 1114 }); 1115 1116 /* getElement(s)By* 1117 ---------------------------------------------------------------------- */ 1118 1119 // Check if getElementsByTagName("*") returns only elements 1120 support.getElementsByTagName = assert(function( div ) { 1121 div.appendChild( document.createComment("") ); 1122 return !div.getElementsByTagName("*").length; 1123 }); 1124 1125 // Support: IE<9 1126 support.getElementsByClassName = rnative.test( document.getElementsByClassName ); 1127 1128 // Support: IE<10 1129 // Check if getElementById returns elements by name 1130 // The broken getElementById methods don't pick up programatically-set names, 1131 // so use a roundabout getElementsByName test 1132 support.getById = assert(function( div ) { 1133 docElem.appendChild( div ).id = expando; 1134 return !document.getElementsByName || !document.getElementsByName( expando ).length; 1135 }); 1136 1137 // ID find and filter 1138 if ( support.getById ) { 1139 Expr.find["ID"] = function( id, context ) { 1140 if ( typeof context.getElementById !== "undefined" && documentIsHTML ) { 1141 var m = context.getElementById( id ); 1142 return m ? [ m ] : []; 1143 } 1144 }; 1145 Expr.filter["ID"] = function( id ) { 1146 var attrId = id.replace( runescape, funescape ); 1147 return function( elem ) { 1148 return elem.getAttribute("id") === attrId; 1149 }; 1150 }; 1151 } else { 1152 // Support: IE6/7 1153 // getElementById is not reliable as a find shortcut 1154 delete Expr.find["ID"]; 1155 1156 Expr.filter["ID"] = function( id ) { 1157 var attrId = id.replace( runescape, funescape ); 1158 return function( elem ) { 1159 var node = typeof elem.getAttributeNode !== "undefined" && 1160 elem.getAttributeNode("id"); 1161 return node && node.value === attrId; 1162 }; 1163 }; 1164 } 1165 1166 // Tag 1167 Expr.find["TAG"] = support.getElementsByTagName ? 1168 function( tag, context ) { 1169 if ( typeof context.getElementsByTagName !== "undefined" ) { 1170 return context.getElementsByTagName( tag ); 1171 1172 // DocumentFragment nodes don't have gEBTN 1173 } else if ( support.qsa ) { 1174 return context.querySelectorAll( tag ); 1175 } 1176 } : 1177 1178 function( tag, context ) { 1179 var elem, 1180 tmp = [], 1181 i = 0, 1182 // By happy coincidence, a (broken) gEBTN appears on DocumentFragment nodes too 1183 results = context.getElementsByTagName( tag ); 1184 1185 // Filter out possible comments 1186 if ( tag === "*" ) { 1187 while ( (elem = results[i++]) ) { 1188 if ( elem.nodeType === 1 ) { 1189 tmp.push( elem ); 1190 } 1191 } 1192 1193 return tmp; 1194 } 1195 return results; 1196 }; 1197 1198 // Class 1199 Expr.find["CLASS"] = support.getElementsByClassName && function( className, context ) { 1200 if ( typeof context.getElementsByClassName !== "undefined" && documentIsHTML ) { 1201 return context.getElementsByClassName( className ); 1202 } 1203 }; 1204 1205 /* QSA/matchesSelector 1206 ---------------------------------------------------------------------- */ 1207 1208 // QSA and matchesSelector support 1209 1210 // matchesSelector(:active) reports false when true (IE9/Opera 11.5) 1211 rbuggyMatches = []; 1212 1213 // qSa(:focus) reports false when true (Chrome 21) 1214 // We allow this because of a bug in IE8/9 that throws an error 1215 // whenever `document.activeElement` is accessed on an iframe 1216 // So, we allow :focus to pass through QSA all the time to avoid the IE error 1217 // See http://bugs.jquery.com/ticket/13378 1218 rbuggyQSA = []; 1219 1220 if ( (support.qsa = rnative.test( document.querySelectorAll )) ) { 1221 // Build QSA regex 1222 // Regex strategy adopted from Diego Perini 1223 assert(function( div ) { 1224 // Select is set to empty string on purpose 1225 // This is to test IE's treatment of not explicitly 1226 // setting a boolean content attribute, 1227 // since its presence should be enough 1228 // http://bugs.jquery.com/ticket/12359 1229 docElem.appendChild( div ).innerHTML = "<a id='" + expando + "'></a>" + 1230 "<select id='" + expando + "-\r\\' msallowcapture=''>" + 1231 "<option selected=''></option></select>"; 1232 1233 // Support: IE8, Opera 11-12.16 1234 // Nothing should be selected when empty strings follow ^= or $= or *= 1235 // The test attribute must be unknown in Opera but "safe" for WinRT 1236 // http://msdn.microsoft.com/en-us/library/ie/hh465388.aspx#attribute_section 1237 if ( div.querySelectorAll("[msallowcapture^='']").length ) { 1238 rbuggyQSA.push( "[*^$]=" + whitespace + "*(?:''|\"\")" ); 1239 } 1240 1241 // Support: IE8 1242 // Boolean attributes and "value" are not treated correctly 1243 if ( !div.querySelectorAll("[selected]").length ) { 1244 rbuggyQSA.push( "\\[" + whitespace + "*(?:value|" + booleans + ")" ); 1245 } 1246 1247 // Support: Chrome<29, Android<4.4, Safari<7.0+, iOS<7.0+, PhantomJS<1.9.8+ 1248 if ( !div.querySelectorAll( "[id~=" + expando + "-]" ).length ) { 1249 rbuggyQSA.push("~="); 1250 } 1251 1252 // Webkit/Opera - :checked should return selected option elements 1253 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1254 // IE8 throws error here and will not see later tests 1255 if ( !div.querySelectorAll(":checked").length ) { 1256 rbuggyQSA.push(":checked"); 1257 } 1258 1259 // Support: Safari 8+, iOS 8+ 1260 // https://bugs.webkit.org/show_bug.cgi?id=136851 1261 // In-page `selector#id sibing-combinator selector` fails 1262 if ( !div.querySelectorAll( "a#" + expando + "+*" ).length ) { 1263 rbuggyQSA.push(".#.+[+~]"); 1264 } 1265 }); 1266 1267 assert(function( div ) { 1268 // Support: Windows 8 Native Apps 1269 // The type and name attributes are restricted during .innerHTML assignment 1270 var input = document.createElement("input"); 1271 input.setAttribute( "type", "hidden" ); 1272 div.appendChild( input ).setAttribute( "name", "D" ); 1273 1274 // Support: IE8 1275 // Enforce case-sensitivity of name attribute 1276 if ( div.querySelectorAll("[name=d]").length ) { 1277 rbuggyQSA.push( "name" + whitespace + "*[*^$|!~]?=" ); 1278 } 1279 1280 // FF 3.5 - :enabled/:disabled and hidden elements (hidden elements are still enabled) 1281 // IE8 throws error here and will not see later tests 1282 if ( !div.querySelectorAll(":enabled").length ) { 1283 rbuggyQSA.push( ":enabled", ":disabled" ); 1284 } 1285 1286 // Opera 10-11 does not throw on post-comma invalid pseudos 1287 div.querySelectorAll("*,:x"); 1288 rbuggyQSA.push(",.*:"); 1289 }); 1290 } 1291 1292 if ( (support.matchesSelector = rnative.test( (matches = docElem.matches || 1293 docElem.webkitMatchesSelector || 1294 docElem.mozMatchesSelector || 1295 docElem.oMatchesSelector || 1296 docElem.msMatchesSelector) )) ) { 1297 1298 assert(function( div ) { 1299 // Check to see if it's possible to do matchesSelector 1300 // on a disconnected node (IE 9) 1301 support.disconnectedMatch = matches.call( div, "div" ); 1302 1303 // This should fail with an exception 1304 // Gecko does not error, returns false instead 1305 matches.call( div, "[s!='']:x" ); 1306 rbuggyMatches.push( "!=", pseudos ); 1307 }); 1308 } 1309 1310 rbuggyQSA = rbuggyQSA.length && new RegExp( rbuggyQSA.join("|") ); 1311 rbuggyMatches = rbuggyMatches.length && new RegExp( rbuggyMatches.join("|") ); 1312 1313 /* Contains 1314 ---------------------------------------------------------------------- */ 1315 hasCompare = rnative.test( docElem.compareDocumentPosition ); 1316 1317 // Element contains another 1318 // Purposefully self-exclusive 1319 // As in, an element does not contain itself 1320 contains = hasCompare || rnative.test( docElem.contains ) ? 1321 function( a, b ) { 1322 var adown = a.nodeType === 9 ? a.documentElement : a, 1323 bup = b && b.parentNode; 1324 return a === bup || !!( bup && bup.nodeType === 1 && ( 1325 adown.contains ? 1326 adown.contains( bup ) : 1327 a.compareDocumentPosition && a.compareDocumentPosition( bup ) & 16 1328 )); 1329 } : 1330 function( a, b ) { 1331 if ( b ) { 1332 while ( (b = b.parentNode) ) { 1333 if ( b === a ) { 1334 return true; 1335 } 1336 } 1337 } 1338 return false; 1339 }; 1340 1341 /* Sorting 1342 ---------------------------------------------------------------------- */ 1343 1344 // Document order sorting 1345 sortOrder = hasCompare ? 1346 function( a, b ) { 1347 1348 // Flag for duplicate removal 1349 if ( a === b ) { 1350 hasDuplicate = true; 1351 return 0; 1352 } 1353 1354 // Sort on method existence if only one input has compareDocumentPosition 1355 var compare = !a.compareDocumentPosition - !b.compareDocumentPosition; 1356 if ( compare ) { 1357 return compare; 1358 } 1359 1360 // Calculate position if both inputs belong to the same document 1361 compare = ( a.ownerDocument || a ) === ( b.ownerDocument || b ) ? 1362 a.compareDocumentPosition( b ) : 1363 1364 // Otherwise we know they are disconnected 1365 1; 1366 1367 // Disconnected nodes 1368 if ( compare & 1 || 1369 (!support.sortDetached && b.compareDocumentPosition( a ) === compare) ) { 1370 1371 // Choose the first element that is related to our preferred document 1372 if ( a === document || a.ownerDocument === preferredDoc && contains(preferredDoc, a) ) { 1373 return -1; 1374 } 1375 if ( b === document || b.ownerDocument === preferredDoc && contains(preferredDoc, b) ) { 1376 return 1; 1377 } 1378 1379 // Maintain original order 1380 return sortInput ? 1381 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1382 0; 1383 } 1384 1385 return compare & 4 ? -1 : 1; 1386 } : 1387 function( a, b ) { 1388 // Exit early if the nodes are identical 1389 if ( a === b ) { 1390 hasDuplicate = true; 1391 return 0; 1392 } 1393 1394 var cur, 1395 i = 0, 1396 aup = a.parentNode, 1397 bup = b.parentNode, 1398 ap = [ a ], 1399 bp = [ b ]; 1400 1401 // Parentless nodes are either documents or disconnected 1402 if ( !aup || !bup ) { 1403 return a === document ? -1 : 1404 b === document ? 1 : 1405 aup ? -1 : 1406 bup ? 1 : 1407 sortInput ? 1408 ( indexOf( sortInput, a ) - indexOf( sortInput, b ) ) : 1409 0; 1410 1411 // If the nodes are siblings, we can do a quick check 1412 } else if ( aup === bup ) { 1413 return siblingCheck( a, b ); 1414 } 1415 1416 // Otherwise we need full lists of their ancestors for comparison 1417 cur = a; 1418 while ( (cur = cur.parentNode) ) { 1419 ap.unshift( cur ); 1420 } 1421 cur = b; 1422 while ( (cur = cur.parentNode) ) { 1423 bp.unshift( cur ); 1424 } 1425 1426 // Walk down the tree looking for a discrepancy 1427 while ( ap[i] === bp[i] ) { 1428 i++; 1429 } 1430 1431 return i ? 1432 // Do a sibling check if the nodes have a common ancestor 1433 siblingCheck( ap[i], bp[i] ) : 1434 1435 // Otherwise nodes in our document sort first 1436 ap[i] === preferredDoc ? -1 : 1437 bp[i] === preferredDoc ? 1 : 1438 0; 1439 }; 1440 1441 return document; 1442}; 1443 1444Sizzle.matches = function( expr, elements ) { 1445 return Sizzle( expr, null, null, elements ); 1446}; 1447 1448Sizzle.matchesSelector = function( elem, expr ) { 1449 // Set document vars if needed 1450 if ( ( elem.ownerDocument || elem ) !== document ) { 1451 setDocument( elem ); 1452 } 1453 1454 // Make sure that attribute selectors are quoted 1455 expr = expr.replace( rattributeQuotes, "='$1']" ); 1456 1457 if ( support.matchesSelector && documentIsHTML && 1458 !compilerCache[ expr + " " ] && 1459 ( !rbuggyMatches || !rbuggyMatches.test( expr ) ) && 1460 ( !rbuggyQSA || !rbuggyQSA.test( expr ) ) ) { 1461 1462 try { 1463 var ret = matches.call( elem, expr ); 1464 1465 // IE 9's matchesSelector returns false on disconnected nodes 1466 if ( ret || support.disconnectedMatch || 1467 // As well, disconnected nodes are said to be in a document 1468 // fragment in IE 9 1469 elem.document && elem.document.nodeType !== 11 ) { 1470 return ret; 1471 } 1472 } catch (e) {} 1473 } 1474 1475 return Sizzle( expr, document, null, [ elem ] ).length > 0; 1476}; 1477 1478Sizzle.contains = function( context, elem ) { 1479 // Set document vars if needed 1480 if ( ( context.ownerDocument || context ) !== document ) { 1481 setDocument( context ); 1482 } 1483 return contains( context, elem ); 1484}; 1485 1486Sizzle.attr = function( elem, name ) { 1487 // Set document vars if needed 1488 if ( ( elem.ownerDocument || elem ) !== document ) { 1489 setDocument( elem ); 1490 } 1491 1492 var fn = Expr.attrHandle[ name.toLowerCase() ], 1493 // Don't get fooled by Object.prototype properties (jQuery #13807) 1494 val = fn && hasOwn.call( Expr.attrHandle, name.toLowerCase() ) ? 1495 fn( elem, name, !documentIsHTML ) : 1496 undefined; 1497 1498 return val !== undefined ? 1499 val : 1500 support.attributes || !documentIsHTML ? 1501 elem.getAttribute( name ) : 1502 (val = elem.getAttributeNode(name)) && val.specified ? 1503 val.value : 1504 null; 1505}; 1506 1507Sizzle.error = function( msg ) { 1508 throw new Error( "Syntax error, unrecognized expression: " + msg ); 1509}; 1510 1511/** 1512 * Document sorting and removing duplicates 1513 * @param {ArrayLike} results 1514 */ 1515Sizzle.uniqueSort = function( results ) { 1516 var elem, 1517 duplicates = [], 1518 j = 0, 1519 i = 0; 1520 1521 // Unless we *know* we can detect duplicates, assume their presence 1522 hasDuplicate = !support.detectDuplicates; 1523 sortInput = !support.sortStable && results.slice( 0 ); 1524 results.sort( sortOrder ); 1525 1526 if ( hasDuplicate ) { 1527 while ( (elem = results[i++]) ) { 1528 if ( elem === results[ i ] ) { 1529 j = duplicates.push( i ); 1530 } 1531 } 1532 while ( j-- ) { 1533 results.splice( duplicates[ j ], 1 ); 1534 } 1535 } 1536 1537 // Clear input after sorting to release objects 1538 // See https://github.com/jquery/sizzle/pull/225 1539 sortInput = null; 1540 1541 return results; 1542}; 1543 1544/** 1545 * Utility function for retrieving the text value of an array of DOM nodes 1546 * @param {Array|Element} elem 1547 */ 1548getText = Sizzle.getText = function( elem ) { 1549 var node, 1550 ret = "", 1551 i = 0, 1552 nodeType = elem.nodeType; 1553 1554 if ( !nodeType ) { 1555 // If no nodeType, this is expected to be an array 1556 while ( (node = elem[i++]) ) { 1557 // Do not traverse comment nodes 1558 ret += getText( node ); 1559 } 1560 } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { 1561 // Use textContent for elements 1562 // innerText usage removed for consistency of new lines (jQuery #11153) 1563 if ( typeof elem.textContent === "string" ) { 1564 return elem.textContent; 1565 } else { 1566 // Traverse its children 1567 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 1568 ret += getText( elem ); 1569 } 1570 } 1571 } else if ( nodeType === 3 || nodeType === 4 ) { 1572 return elem.nodeValue; 1573 } 1574 // Do not include comment or processing instruction nodes 1575 1576 return ret; 1577}; 1578 1579Expr = Sizzle.selectors = { 1580 1581 // Can be adjusted by the user 1582 cacheLength: 50, 1583 1584 createPseudo: markFunction, 1585 1586 match: matchExpr, 1587 1588 attrHandle: {}, 1589 1590 find: {}, 1591 1592 relative: { 1593 ">": { dir: "parentNode", first: true }, 1594 " ": { dir: "parentNode" }, 1595 "+": { dir: "previousSibling", first: true }, 1596 "~": { dir: "previousSibling" } 1597 }, 1598 1599 preFilter: { 1600 "ATTR": function( match ) { 1601 match[1] = match[1].replace( runescape, funescape ); 1602 1603 // Move the given value to match[3] whether quoted or unquoted 1604 match[3] = ( match[3] || match[4] || match[5] || "" ).replace( runescape, funescape ); 1605 1606 if ( match[2] === "~=" ) { 1607 match[3] = " " + match[3] + " "; 1608 } 1609 1610 return match.slice( 0, 4 ); 1611 }, 1612 1613 "CHILD": function( match ) { 1614 /* matches from matchExpr["CHILD"] 1615 1 type (only|nth|...) 1616 2 what (child|of-type) 1617 3 argument (even|odd|\d*|\d*n([+-]\d+)?|...) 1618 4 xn-component of xn+y argument ([+-]?\d*n|) 1619 5 sign of xn-component 1620 6 x of xn-component 1621 7 sign of y-component 1622 8 y of y-component 1623 */ 1624 match[1] = match[1].toLowerCase(); 1625 1626 if ( match[1].slice( 0, 3 ) === "nth" ) { 1627 // nth-* requires argument 1628 if ( !match[3] ) { 1629 Sizzle.error( match[0] ); 1630 } 1631 1632 // numeric x and y parameters for Expr.filter.CHILD 1633 // remember that false/true cast respectively to 0/1 1634 match[4] = +( match[4] ? match[5] + (match[6] || 1) : 2 * ( match[3] === "even" || match[3] === "odd" ) ); 1635 match[5] = +( ( match[7] + match[8] ) || match[3] === "odd" ); 1636 1637 // other types prohibit arguments 1638 } else if ( match[3] ) { 1639 Sizzle.error( match[0] ); 1640 } 1641 1642 return match; 1643 }, 1644 1645 "PSEUDO": function( match ) { 1646 var excess, 1647 unquoted = !match[6] && match[2]; 1648 1649 if ( matchExpr["CHILD"].test( match[0] ) ) { 1650 return null; 1651 } 1652 1653 // Accept quoted arguments as-is 1654 if ( match[3] ) { 1655 match[2] = match[4] || match[5] || ""; 1656 1657 // Strip excess characters from unquoted arguments 1658 } else if ( unquoted && rpseudo.test( unquoted ) && 1659 // Get excess from tokenize (recursively) 1660 (excess = tokenize( unquoted, true )) && 1661 // advance to the next closing parenthesis 1662 (excess = unquoted.indexOf( ")", unquoted.length - excess ) - unquoted.length) ) { 1663 1664 // excess is a negative index 1665 match[0] = match[0].slice( 0, excess ); 1666 match[2] = unquoted.slice( 0, excess ); 1667 } 1668 1669 // Return only captures needed by the pseudo filter method (type and argument) 1670 return match.slice( 0, 3 ); 1671 } 1672 }, 1673 1674 filter: { 1675 1676 "TAG": function( nodeNameSelector ) { 1677 var nodeName = nodeNameSelector.replace( runescape, funescape ).toLowerCase(); 1678 return nodeNameSelector === "*" ? 1679 function() { return true; } : 1680 function( elem ) { 1681 return elem.nodeName && elem.nodeName.toLowerCase() === nodeName; 1682 }; 1683 }, 1684 1685 "CLASS": function( className ) { 1686 var pattern = classCache[ className + " " ]; 1687 1688 return pattern || 1689 (pattern = new RegExp( "(^|" + whitespace + ")" + className + "(" + whitespace + "|$)" )) && 1690 classCache( className, function( elem ) { 1691 return pattern.test( typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || "" ); 1692 }); 1693 }, 1694 1695 "ATTR": function( name, operator, check ) { 1696 return function( elem ) { 1697 var result = Sizzle.attr( elem, name ); 1698 1699 if ( result == null ) { 1700 return operator === "!="; 1701 } 1702 if ( !operator ) { 1703 return true; 1704 } 1705 1706 result += ""; 1707 1708 return operator === "=" ? result === check : 1709 operator === "!=" ? result !== check : 1710 operator === "^=" ? check && result.indexOf( check ) === 0 : 1711 operator === "*=" ? check && result.indexOf( check ) > -1 : 1712 operator === "$=" ? check && result.slice( -check.length ) === check : 1713 operator === "~=" ? ( " " + result.replace( rwhitespace, " " ) + " " ).indexOf( check ) > -1 : 1714 operator === "|=" ? result === check || result.slice( 0, check.length + 1 ) === check + "-" : 1715 false; 1716 }; 1717 }, 1718 1719 "CHILD": function( type, what, argument, first, last ) { 1720 var simple = type.slice( 0, 3 ) !== "nth", 1721 forward = type.slice( -4 ) !== "last", 1722 ofType = what === "of-type"; 1723 1724 return first === 1 && last === 0 ? 1725 1726 // Shortcut for :nth-*(n) 1727 function( elem ) { 1728 return !!elem.parentNode; 1729 } : 1730 1731 function( elem, context, xml ) { 1732 var cache, uniqueCache, outerCache, node, nodeIndex, start, 1733 dir = simple !== forward ? "nextSibling" : "previousSibling", 1734 parent = elem.parentNode, 1735 name = ofType && elem.nodeName.toLowerCase(), 1736 useCache = !xml && !ofType, 1737 diff = false; 1738 1739 if ( parent ) { 1740 1741 // :(first|last|only)-(child|of-type) 1742 if ( simple ) { 1743 while ( dir ) { 1744 node = elem; 1745 while ( (node = node[ dir ]) ) { 1746 if ( ofType ? 1747 node.nodeName.toLowerCase() === name : 1748 node.nodeType === 1 ) { 1749 1750 return false; 1751 } 1752 } 1753 // Reverse direction for :only-* (if we haven't yet done so) 1754 start = dir = type === "only" && !start && "nextSibling"; 1755 } 1756 return true; 1757 } 1758 1759 start = [ forward ? parent.firstChild : parent.lastChild ]; 1760 1761 // non-xml :nth-child(...) stores cache data on `parent` 1762 if ( forward && useCache ) { 1763 1764 // Seek `elem` from a previously-cached index 1765 1766 // ...in a gzip-friendly way 1767 node = parent; 1768 outerCache = node[ expando ] || (node[ expando ] = {}); 1769 1770 // Support: IE <9 only 1771 // Defend against cloned attroperties (jQuery gh-1709) 1772 uniqueCache = outerCache[ node.uniqueID ] || 1773 (outerCache[ node.uniqueID ] = {}); 1774 1775 cache = uniqueCache[ type ] || []; 1776 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1777 diff = nodeIndex && cache[ 2 ]; 1778 node = nodeIndex && parent.childNodes[ nodeIndex ]; 1779 1780 while ( (node = ++nodeIndex && node && node[ dir ] || 1781 1782 // Fallback to seeking `elem` from the start 1783 (diff = nodeIndex = 0) || start.pop()) ) { 1784 1785 // When found, cache indexes on `parent` and break 1786 if ( node.nodeType === 1 && ++diff && node === elem ) { 1787 uniqueCache[ type ] = [ dirruns, nodeIndex, diff ]; 1788 break; 1789 } 1790 } 1791 1792 } else { 1793 // Use previously-cached element index if available 1794 if ( useCache ) { 1795 // ...in a gzip-friendly way 1796 node = elem; 1797 outerCache = node[ expando ] || (node[ expando ] = {}); 1798 1799 // Support: IE <9 only 1800 // Defend against cloned attroperties (jQuery gh-1709) 1801 uniqueCache = outerCache[ node.uniqueID ] || 1802 (outerCache[ node.uniqueID ] = {}); 1803 1804 cache = uniqueCache[ type ] || []; 1805 nodeIndex = cache[ 0 ] === dirruns && cache[ 1 ]; 1806 diff = nodeIndex; 1807 } 1808 1809 // xml :nth-child(...) 1810 // or :nth-last-child(...) or :nth(-last)?-of-type(...) 1811 if ( diff === false ) { 1812 // Use the same loop as above to seek `elem` from the start 1813 while ( (node = ++nodeIndex && node && node[ dir ] || 1814 (diff = nodeIndex = 0) || start.pop()) ) { 1815 1816 if ( ( ofType ? 1817 node.nodeName.toLowerCase() === name : 1818 node.nodeType === 1 ) && 1819 ++diff ) { 1820 1821 // Cache the index of each encountered element 1822 if ( useCache ) { 1823 outerCache = node[ expando ] || (node[ expando ] = {}); 1824 1825 // Support: IE <9 only 1826 // Defend against cloned attroperties (jQuery gh-1709) 1827 uniqueCache = outerCache[ node.uniqueID ] || 1828 (outerCache[ node.uniqueID ] = {}); 1829 1830 uniqueCache[ type ] = [ dirruns, diff ]; 1831 } 1832 1833 if ( node === elem ) { 1834 break; 1835 } 1836 } 1837 } 1838 } 1839 } 1840 1841 // Incorporate the offset, then check against cycle size 1842 diff -= last; 1843 return diff === first || ( diff % first === 0 && diff / first >= 0 ); 1844 } 1845 }; 1846 }, 1847 1848 "PSEUDO": function( pseudo, argument ) { 1849 // pseudo-class names are case-insensitive 1850 // http://www.w3.org/TR/selectors/#pseudo-classes 1851 // Prioritize by case sensitivity in case custom pseudos are added with uppercase letters 1852 // Remember that setFilters inherits from pseudos 1853 var args, 1854 fn = Expr.pseudos[ pseudo ] || Expr.setFilters[ pseudo.toLowerCase() ] || 1855 Sizzle.error( "unsupported pseudo: " + pseudo ); 1856 1857 // The user may use createPseudo to indicate that 1858 // arguments are needed to create the filter function 1859 // just as Sizzle does 1860 if ( fn[ expando ] ) { 1861 return fn( argument ); 1862 } 1863 1864 // But maintain support for old signatures 1865 if ( fn.length > 1 ) { 1866 args = [ pseudo, pseudo, "", argument ]; 1867 return Expr.setFilters.hasOwnProperty( pseudo.toLowerCase() ) ? 1868 markFunction(function( seed, matches ) { 1869 var idx, 1870 matched = fn( seed, argument ), 1871 i = matched.length; 1872 while ( i-- ) { 1873 idx = indexOf( seed, matched[i] ); 1874 seed[ idx ] = !( matches[ idx ] = matched[i] ); 1875 } 1876 }) : 1877 function( elem ) { 1878 return fn( elem, 0, args ); 1879 }; 1880 } 1881 1882 return fn; 1883 } 1884 }, 1885 1886 pseudos: { 1887 // Potentially complex pseudos 1888 "not": markFunction(function( selector ) { 1889 // Trim the selector passed to compile 1890 // to avoid treating leading and trailing 1891 // spaces as combinators 1892 var input = [], 1893 results = [], 1894 matcher = compile( selector.replace( rtrim, "$1" ) ); 1895 1896 return matcher[ expando ] ? 1897 markFunction(function( seed, matches, context, xml ) { 1898 var elem, 1899 unmatched = matcher( seed, null, xml, [] ), 1900 i = seed.length; 1901 1902 // Match elements unmatched by `matcher` 1903 while ( i-- ) { 1904 if ( (elem = unmatched[i]) ) { 1905 seed[i] = !(matches[i] = elem); 1906 } 1907 } 1908 }) : 1909 function( elem, context, xml ) { 1910 input[0] = elem; 1911 matcher( input, null, xml, results ); 1912 // Don't keep the element (issue #299) 1913 input[0] = null; 1914 return !results.pop(); 1915 }; 1916 }), 1917 1918 "has": markFunction(function( selector ) { 1919 return function( elem ) { 1920 return Sizzle( selector, elem ).length > 0; 1921 }; 1922 }), 1923 1924 "contains": markFunction(function( text ) { 1925 text = text.replace( runescape, funescape ); 1926 return function( elem ) { 1927 return ( elem.textContent || elem.innerText || getText( elem ) ).indexOf( text ) > -1; 1928 }; 1929 }), 1930 1931 // "Whether an element is represented by a :lang() selector 1932 // is based solely on the element's language value 1933 // being equal to the identifier C, 1934 // or beginning with the identifier C immediately followed by "-". 1935 // The matching of C against the element's language value is performed case-insensitively. 1936 // The identifier C does not have to be a valid language name." 1937 // http://www.w3.org/TR/selectors/#lang-pseudo 1938 "lang": markFunction( function( lang ) { 1939 // lang value must be a valid identifier 1940 if ( !ridentifier.test(lang || "") ) { 1941 Sizzle.error( "unsupported lang: " + lang ); 1942 } 1943 lang = lang.replace( runescape, funescape ).toLowerCase(); 1944 return function( elem ) { 1945 var elemLang; 1946 do { 1947 if ( (elemLang = documentIsHTML ? 1948 elem.lang : 1949 elem.getAttribute("xml:lang") || elem.getAttribute("lang")) ) { 1950 1951 elemLang = elemLang.toLowerCase(); 1952 return elemLang === lang || elemLang.indexOf( lang + "-" ) === 0; 1953 } 1954 } while ( (elem = elem.parentNode) && elem.nodeType === 1 ); 1955 return false; 1956 }; 1957 }), 1958 1959 // Miscellaneous 1960 "target": function( elem ) { 1961 var hash = window.location && window.location.hash; 1962 return hash && hash.slice( 1 ) === elem.id; 1963 }, 1964 1965 "root": function( elem ) { 1966 return elem === docElem; 1967 }, 1968 1969 "focus": function( elem ) { 1970 return elem === document.activeElement && (!document.hasFocus || document.hasFocus()) && !!(elem.type || elem.href || ~elem.tabIndex); 1971 }, 1972 1973 // Boolean properties 1974 "enabled": function( elem ) { 1975 return elem.disabled === false; 1976 }, 1977 1978 "disabled": function( elem ) { 1979 return elem.disabled === true; 1980 }, 1981 1982 "checked": function( elem ) { 1983 // In CSS3, :checked should return both checked and selected elements 1984 // http://www.w3.org/TR/2011/REC-css3-selectors-20110929/#checked 1985 var nodeName = elem.nodeName.toLowerCase(); 1986 return (nodeName === "input" && !!elem.checked) || (nodeName === "option" && !!elem.selected); 1987 }, 1988 1989 "selected": function( elem ) { 1990 // Accessing this property makes selected-by-default 1991 // options in Safari work properly 1992 if ( elem.parentNode ) { 1993 elem.parentNode.selectedIndex; 1994 } 1995 1996 return elem.selected === true; 1997 }, 1998 1999 // Contents 2000 "empty": function( elem ) { 2001 // http://www.w3.org/TR/selectors/#empty-pseudo 2002 // :empty is negated by element (1) or content nodes (text: 3; cdata: 4; entity ref: 5), 2003 // but not by others (comment: 8; processing instruction: 7; etc.) 2004 // nodeType < 6 works because attributes (2) do not appear as children 2005 for ( elem = elem.firstChild; elem; elem = elem.nextSibling ) { 2006 if ( elem.nodeType < 6 ) { 2007 return false; 2008 } 2009 } 2010 return true; 2011 }, 2012 2013 "parent": function( elem ) { 2014 return !Expr.pseudos["empty"]( elem ); 2015 }, 2016 2017 // Element/input types 2018 "header": function( elem ) { 2019 return rheader.test( elem.nodeName ); 2020 }, 2021 2022 "input": function( elem ) { 2023 return rinputs.test( elem.nodeName ); 2024 }, 2025 2026 "button": function( elem ) { 2027 var name = elem.nodeName.toLowerCase(); 2028 return name === "input" && elem.type === "button" || name === "button"; 2029 }, 2030 2031 "text": function( elem ) { 2032 var attr; 2033 return elem.nodeName.toLowerCase() === "input" && 2034 elem.type === "text" && 2035 2036 // Support: IE<8 2037 // New HTML5 attribute values (e.g., "search") appear with elem.type === "text" 2038 ( (attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text" ); 2039 }, 2040 2041 // Position-in-collection 2042 "first": createPositionalPseudo(function() { 2043 return [ 0 ]; 2044 }), 2045 2046 "last": createPositionalPseudo(function( matchIndexes, length ) { 2047 return [ length - 1 ]; 2048 }), 2049 2050 "eq": createPositionalPseudo(function( matchIndexes, length, argument ) { 2051 return [ argument < 0 ? argument + length : argument ]; 2052 }), 2053 2054 "even": createPositionalPseudo(function( matchIndexes, length ) { 2055 var i = 0; 2056 for ( ; i < length; i += 2 ) { 2057 matchIndexes.push( i ); 2058 } 2059 return matchIndexes; 2060 }), 2061 2062 "odd": createPositionalPseudo(function( matchIndexes, length ) { 2063 var i = 1; 2064 for ( ; i < length; i += 2 ) { 2065 matchIndexes.push( i ); 2066 } 2067 return matchIndexes; 2068 }), 2069 2070 "lt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2071 var i = argument < 0 ? argument + length : argument; 2072 for ( ; --i >= 0; ) { 2073 matchIndexes.push( i ); 2074 } 2075 return matchIndexes; 2076 }), 2077 2078 "gt": createPositionalPseudo(function( matchIndexes, length, argument ) { 2079 var i = argument < 0 ? argument + length : argument; 2080 for ( ; ++i < length; ) { 2081 matchIndexes.push( i ); 2082 } 2083 return matchIndexes; 2084 }) 2085 } 2086}; 2087 2088Expr.pseudos["nth"] = Expr.pseudos["eq"]; 2089 2090// Add button/input type pseudos 2091for ( i in { radio: true, checkbox: true, file: true, password: true, image: true } ) { 2092 Expr.pseudos[ i ] = createInputPseudo( i ); 2093} 2094for ( i in { submit: true, reset: true } ) { 2095 Expr.pseudos[ i ] = createButtonPseudo( i ); 2096} 2097 2098// Easy API for creating new setFilters 2099function setFilters() {} 2100setFilters.prototype = Expr.filters = Expr.pseudos; 2101Expr.setFilters = new setFilters(); 2102 2103tokenize = Sizzle.tokenize = function( selector, parseOnly ) { 2104 var matched, match, tokens, type, 2105 soFar, groups, preFilters, 2106 cached = tokenCache[ selector + " " ]; 2107 2108 if ( cached ) { 2109 return parseOnly ? 0 : cached.slice( 0 ); 2110 } 2111 2112 soFar = selector; 2113 groups = []; 2114 preFilters = Expr.preFilter; 2115 2116 while ( soFar ) { 2117 2118 // Comma and first run 2119 if ( !matched || (match = rcomma.exec( soFar )) ) { 2120 if ( match ) { 2121 // Don't consume trailing commas as valid 2122 soFar = soFar.slice( match[0].length ) || soFar; 2123 } 2124 groups.push( (tokens = []) ); 2125 } 2126 2127 matched = false; 2128 2129 // Combinators 2130 if ( (match = rcombinators.exec( soFar )) ) { 2131 matched = match.shift(); 2132 tokens.push({ 2133 value: matched, 2134 // Cast descendant combinators to space 2135 type: match[0].replace( rtrim, " " ) 2136 }); 2137 soFar = soFar.slice( matched.length ); 2138 } 2139 2140 // Filters 2141 for ( type in Expr.filter ) { 2142 if ( (match = matchExpr[ type ].exec( soFar )) && (!preFilters[ type ] || 2143 (match = preFilters[ type ]( match ))) ) { 2144 matched = match.shift(); 2145 tokens.push({ 2146 value: matched, 2147 type: type, 2148 matches: match 2149 }); 2150 soFar = soFar.slice( matched.length ); 2151 } 2152 } 2153 2154 if ( !matched ) { 2155 break; 2156 } 2157 } 2158 2159 // Return the length of the invalid excess 2160 // if we're just parsing 2161 // Otherwise, throw an error or return tokens 2162 return parseOnly ? 2163 soFar.length : 2164 soFar ? 2165 Sizzle.error( selector ) : 2166 // Cache the tokens 2167 tokenCache( selector, groups ).slice( 0 ); 2168}; 2169 2170function toSelector( tokens ) { 2171 var i = 0, 2172 len = tokens.length, 2173 selector = ""; 2174 for ( ; i < len; i++ ) { 2175 selector += tokens[i].value; 2176 } 2177 return selector; 2178} 2179 2180function addCombinator( matcher, combinator, base ) { 2181 var dir = combinator.dir, 2182 checkNonElements = base && dir === "parentNode", 2183 doneName = done++; 2184 2185 return combinator.first ? 2186 // Check against closest ancestor/preceding element 2187 function( elem, context, xml ) { 2188 while ( (elem = elem[ dir ]) ) { 2189 if ( elem.nodeType === 1 || checkNonElements ) { 2190 return matcher( elem, context, xml ); 2191 } 2192 } 2193 } : 2194 2195 // Check against all ancestor/preceding elements 2196 function( elem, context, xml ) { 2197 var oldCache, uniqueCache, outerCache, 2198 newCache = [ dirruns, doneName ]; 2199 2200 // We can't set arbitrary data on XML nodes, so they don't benefit from combinator caching 2201 if ( xml ) { 2202 while ( (elem = elem[ dir ]) ) { 2203 if ( elem.nodeType === 1 || checkNonElements ) { 2204 if ( matcher( elem, context, xml ) ) { 2205 return true; 2206 } 2207 } 2208 } 2209 } else { 2210 while ( (elem = elem[ dir ]) ) { 2211 if ( elem.nodeType === 1 || checkNonElements ) { 2212 outerCache = elem[ expando ] || (elem[ expando ] = {}); 2213 2214 // Support: IE <9 only 2215 // Defend against cloned attroperties (jQuery gh-1709) 2216 uniqueCache = outerCache[ elem.uniqueID ] || (outerCache[ elem.uniqueID ] = {}); 2217 2218 if ( (oldCache = uniqueCache[ dir ]) && 2219 oldCache[ 0 ] === dirruns && oldCache[ 1 ] === doneName ) { 2220 2221 // Assign to newCache so results back-propagate to previous elements 2222 return (newCache[ 2 ] = oldCache[ 2 ]); 2223 } else { 2224 // Reuse newcache so results back-propagate to previous elements 2225 uniqueCache[ dir ] = newCache; 2226 2227 // A match means we're done; a fail means we have to keep checking 2228 if ( (newCache[ 2 ] = matcher( elem, context, xml )) ) { 2229 return true; 2230 } 2231 } 2232 } 2233 } 2234 } 2235 }; 2236} 2237 2238function elementMatcher( matchers ) { 2239 return matchers.length > 1 ? 2240 function( elem, context, xml ) { 2241 var i = matchers.length; 2242 while ( i-- ) { 2243 if ( !matchers[i]( elem, context, xml ) ) { 2244 return false; 2245 } 2246 } 2247 return true; 2248 } : 2249 matchers[0]; 2250} 2251 2252function multipleContexts( selector, contexts, results ) { 2253 var i = 0, 2254 len = contexts.length; 2255 for ( ; i < len; i++ ) { 2256 Sizzle( selector, contexts[i], results ); 2257 } 2258 return results; 2259} 2260 2261function condense( unmatched, map, filter, context, xml ) { 2262 var elem, 2263 newUnmatched = [], 2264 i = 0, 2265 len = unmatched.length, 2266 mapped = map != null; 2267 2268 for ( ; i < len; i++ ) { 2269 if ( (elem = unmatched[i]) ) { 2270 if ( !filter || filter( elem, context, xml ) ) { 2271 newUnmatched.push( elem ); 2272 if ( mapped ) { 2273 map.push( i ); 2274 } 2275 } 2276 } 2277 } 2278 2279 return newUnmatched; 2280} 2281 2282function setMatcher( preFilter, selector, matcher, postFilter, postFinder, postSelector ) { 2283 if ( postFilter && !postFilter[ expando ] ) { 2284 postFilter = setMatcher( postFilter ); 2285 } 2286 if ( postFinder && !postFinder[ expando ] ) { 2287 postFinder = setMatcher( postFinder, postSelector ); 2288 } 2289 return markFunction(function( seed, results, context, xml ) { 2290 var temp, i, elem, 2291 preMap = [], 2292 postMap = [], 2293 preexisting = results.length, 2294 2295 // Get initial elements from seed or context 2296 elems = seed || multipleContexts( selector || "*", context.nodeType ? [ context ] : context, [] ), 2297 2298 // Prefilter to get matcher input, preserving a map for seed-results synchronization 2299 matcherIn = preFilter && ( seed || !selector ) ? 2300 condense( elems, preMap, preFilter, context, xml ) : 2301 elems, 2302 2303 matcherOut = matcher ? 2304 // If we have a postFinder, or filtered seed, or non-seed postFilter or preexisting results, 2305 postFinder || ( seed ? preFilter : preexisting || postFilter ) ? 2306 2307 // ...intermediate processing is necessary 2308 [] : 2309 2310 // ...otherwise use results directly 2311 results : 2312 matcherIn; 2313 2314 // Find primary matches 2315 if ( matcher ) { 2316 matcher( matcherIn, matcherOut, context, xml ); 2317 } 2318 2319 // Apply postFilter 2320 if ( postFilter ) { 2321 temp = condense( matcherOut, postMap ); 2322 postFilter( temp, [], context, xml ); 2323 2324 // Un-match failing elements by moving them back to matcherIn 2325 i = temp.length; 2326 while ( i-- ) { 2327 if ( (elem = temp[i]) ) { 2328 matcherOut[ postMap[i] ] = !(matcherIn[ postMap[i] ] = elem); 2329 } 2330 } 2331 } 2332 2333 if ( seed ) { 2334 if ( postFinder || preFilter ) { 2335 if ( postFinder ) { 2336 // Get the final matcherOut by condensing this intermediate into postFinder contexts 2337 temp = []; 2338 i = matcherOut.length; 2339 while ( i-- ) { 2340 if ( (elem = matcherOut[i]) ) { 2341 // Restore matcherIn since elem is not yet a final match 2342 temp.push( (matcherIn[i] = elem) ); 2343 } 2344 } 2345 postFinder( null, (matcherOut = []), temp, xml ); 2346 } 2347 2348 // Move matched elements from seed to results to keep them synchronized 2349 i = matcherOut.length; 2350 while ( i-- ) { 2351 if ( (elem = matcherOut[i]) && 2352 (temp = postFinder ? indexOf( seed, elem ) : preMap[i]) > -1 ) { 2353 2354 seed[temp] = !(results[temp] = elem); 2355 } 2356 } 2357 } 2358 2359 // Add elements to results, through postFinder if defined 2360 } else { 2361 matcherOut = condense( 2362 matcherOut === results ? 2363 matcherOut.splice( preexisting, matcherOut.length ) : 2364 matcherOut 2365 ); 2366 if ( postFinder ) { 2367 postFinder( null, results, matcherOut, xml ); 2368 } else { 2369 push.apply( results, matcherOut ); 2370 } 2371 } 2372 }); 2373} 2374 2375function matcherFromTokens( tokens ) { 2376 var checkContext, matcher, j, 2377 len = tokens.length, 2378 leadingRelative = Expr.relative[ tokens[0].type ], 2379 implicitRelative = leadingRelative || Expr.relative[" "], 2380 i = leadingRelative ? 1 : 0, 2381 2382 // The foundational matcher ensures that elements are reachable from top-level context(s) 2383 matchContext = addCombinator( function( elem ) { 2384 return elem === checkContext; 2385 }, implicitRelative, true ), 2386 matchAnyContext = addCombinator( function( elem ) { 2387 return indexOf( checkContext, elem ) > -1; 2388 }, implicitRelative, true ), 2389 matchers = [ function( elem, context, xml ) { 2390 var ret = ( !leadingRelative && ( xml || context !== outermostContext ) ) || ( 2391 (checkContext = context).nodeType ? 2392 matchContext( elem, context, xml ) : 2393 matchAnyContext( elem, context, xml ) ); 2394 // Avoid hanging onto element (issue #299) 2395 checkContext = null; 2396 return ret; 2397 } ]; 2398 2399 for ( ; i < len; i++ ) { 2400 if ( (matcher = Expr.relative[ tokens[i].type ]) ) { 2401 matchers = [ addCombinator(elementMatcher( matchers ), matcher) ]; 2402 } else { 2403 matcher = Expr.filter[ tokens[i].type ].apply( null, tokens[i].matches ); 2404 2405 // Return special upon seeing a positional matcher 2406 if ( matcher[ expando ] ) { 2407 // Find the next relative operator (if any) for proper handling 2408 j = ++i; 2409 for ( ; j < len; j++ ) { 2410 if ( Expr.relative[ tokens[j].type ] ) { 2411 break; 2412 } 2413 } 2414 return setMatcher( 2415 i > 1 && elementMatcher( matchers ), 2416 i > 1 && toSelector( 2417 // If the preceding token was a descendant combinator, insert an implicit any-element `*` 2418 tokens.slice( 0, i - 1 ).concat({ value: tokens[ i - 2 ].type === " " ? "*" : "" }) 2419 ).replace( rtrim, "$1" ), 2420 matcher, 2421 i < j && matcherFromTokens( tokens.slice( i, j ) ), 2422 j < len && matcherFromTokens( (tokens = tokens.slice( j )) ), 2423 j < len && toSelector( tokens ) 2424 ); 2425 } 2426 matchers.push( matcher ); 2427 } 2428 } 2429 2430 return elementMatcher( matchers ); 2431} 2432 2433function matcherFromGroupMatchers( elementMatchers, setMatchers ) { 2434 var bySet = setMatchers.length > 0, 2435 byElement = elementMatchers.length > 0, 2436 superMatcher = function( seed, context, xml, results, outermost ) { 2437 var elem, j, matcher, 2438 matchedCount = 0, 2439 i = "0", 2440 unmatched = seed && [], 2441 setMatched = [], 2442 contextBackup = outermostContext, 2443 // We must always have either seed elements or outermost context 2444 elems = seed || byElement && Expr.find["TAG"]( "*", outermost ), 2445 // Use integer dirruns iff this is the outermost matcher 2446 dirrunsUnique = (dirruns += contextBackup == null ? 1 : Math.random() || 0.1), 2447 len = elems.length; 2448 2449 if ( outermost ) { 2450 outermostContext = context === document || context || outermost; 2451 } 2452 2453 // Add elements passing elementMatchers directly to results 2454 // Support: IE<9, Safari 2455 // Tolerate NodeList properties (IE: "length"; Safari: <number>) matching elements by id 2456 for ( ; i !== len && (elem = elems[i]) != null; i++ ) { 2457 if ( byElement && elem ) { 2458 j = 0; 2459 if ( !context && elem.ownerDocument !== document ) { 2460 setDocument( elem ); 2461 xml = !documentIsHTML; 2462 } 2463 while ( (matcher = elementMatchers[j++]) ) { 2464 if ( matcher( elem, context || document, xml) ) { 2465 results.push( elem ); 2466 break; 2467 } 2468 } 2469 if ( outermost ) { 2470 dirruns = dirrunsUnique; 2471 } 2472 } 2473 2474 // Track unmatched elements for set filters 2475 if ( bySet ) { 2476 // They will have gone through all possible matchers 2477 if ( (elem = !matcher && elem) ) { 2478 matchedCount--; 2479 } 2480 2481 // Lengthen the array for every element, matched or not 2482 if ( seed ) { 2483 unmatched.push( elem ); 2484 } 2485 } 2486 } 2487 2488 // `i` is now the count of elements visited above, and adding it to `matchedCount` 2489 // makes the latter nonnegative. 2490 matchedCount += i; 2491 2492 // Apply set filters to unmatched elements 2493 // NOTE: This can be skipped if there are no unmatched elements (i.e., `matchedCount` 2494 // equals `i`), unless we didn't visit _any_ elements in the above loop because we have 2495 // no element matchers and no seed. 2496 // Incrementing an initially-string "0" `i` allows `i` to remain a string only in that 2497 // case, which will result in a "00" `matchedCount` that differs from `i` but is also 2498 // numerically zero. 2499 if ( bySet && i !== matchedCount ) { 2500 j = 0; 2501 while ( (matcher = setMatchers[j++]) ) { 2502 matcher( unmatched, setMatched, context, xml ); 2503 } 2504 2505 if ( seed ) { 2506 // Reintegrate element matches to eliminate the need for sorting 2507 if ( matchedCount > 0 ) { 2508 while ( i-- ) { 2509 if ( !(unmatched[i] || setMatched[i]) ) { 2510 setMatched[i] = pop.call( results ); 2511 } 2512 } 2513 } 2514 2515 // Discard index placeholder values to get only actual matches 2516 setMatched = condense( setMatched ); 2517 } 2518 2519 // Add matches to results 2520 push.apply( results, setMatched ); 2521 2522 // Seedless set matches succeeding multiple successful matchers stipulate sorting 2523 if ( outermost && !seed && setMatched.length > 0 && 2524 ( matchedCount + setMatchers.length ) > 1 ) { 2525 2526 Sizzle.uniqueSort( results ); 2527 } 2528 } 2529 2530 // Override manipulation of globals by nested matchers 2531 if ( outermost ) { 2532 dirruns = dirrunsUnique; 2533 outermostContext = contextBackup; 2534 } 2535 2536 return unmatched; 2537 }; 2538 2539 return bySet ? 2540 markFunction( superMatcher ) : 2541 superMatcher; 2542} 2543 2544compile = Sizzle.compile = function( selector, match /* Internal Use Only */ ) { 2545 var i, 2546 setMatchers = [], 2547 elementMatchers = [], 2548 cached = compilerCache[ selector + " " ]; 2549 2550 if ( !cached ) { 2551 // Generate a function of recursive functions that can be used to check each element 2552 if ( !match ) { 2553 match = tokenize( selector ); 2554 } 2555 i = match.length; 2556 while ( i-- ) { 2557 cached = matcherFromTokens( match[i] ); 2558 if ( cached[ expando ] ) { 2559 setMatchers.push( cached ); 2560 } else { 2561 elementMatchers.push( cached ); 2562 } 2563 } 2564 2565 // Cache the compiled function 2566 cached = compilerCache( selector, matcherFromGroupMatchers( elementMatchers, setMatchers ) ); 2567 2568 // Save selector and tokenization 2569 cached.selector = selector; 2570 } 2571 return cached; 2572}; 2573 2574/** 2575 * A low-level selection function that works with Sizzle's compiled 2576 * selector functions 2577 * @param {String|Function} selector A selector or a pre-compiled 2578 * selector function built with Sizzle.compile 2579 * @param {Element} context 2580 * @param {Array} [results] 2581 * @param {Array} [seed] A set of elements to match against 2582 */ 2583select = Sizzle.select = function( selector, context, results, seed ) { 2584 var i, tokens, token, type, find, 2585 compiled = typeof selector === "function" && selector, 2586 match = !seed && tokenize( (selector = compiled.selector || selector) ); 2587 2588 results = results || []; 2589 2590 // Try to minimize operations if there is only one selector in the list and no seed 2591 // (the latter of which guarantees us context) 2592 if ( match.length === 1 ) { 2593 2594 // Reduce context if the leading compound selector is an ID 2595 tokens = match[0] = match[0].slice( 0 ); 2596 if ( tokens.length > 2 && (token = tokens[0]).type === "ID" && 2597 support.getById && context.nodeType === 9 && documentIsHTML && 2598 Expr.relative[ tokens[1].type ] ) { 2599 2600 context = ( Expr.find["ID"]( token.matches[0].replace(runescape, funescape), context ) || [] )[0]; 2601 if ( !context ) { 2602 return results; 2603 2604 // Precompiled matchers will still verify ancestry, so step up a level 2605 } else if ( compiled ) { 2606 context = context.parentNode; 2607 } 2608 2609 selector = selector.slice( tokens.shift().value.length ); 2610 } 2611 2612 // Fetch a seed set for right-to-left matching 2613 i = matchExpr["needsContext"].test( selector ) ? 0 : tokens.length; 2614 while ( i-- ) { 2615 token = tokens[i]; 2616 2617 // Abort if we hit a combinator 2618 if ( Expr.relative[ (type = token.type) ] ) { 2619 break; 2620 } 2621 if ( (find = Expr.find[ type ]) ) { 2622 // Search, expanding context for leading sibling combinators 2623 if ( (seed = find( 2624 token.matches[0].replace( runescape, funescape ), 2625 rsibling.test( tokens[0].type ) && testContext( context.parentNode ) || context 2626 )) ) { 2627 2628 // If seed is empty or no tokens remain, we can return early 2629 tokens.splice( i, 1 ); 2630 selector = seed.length && toSelector( tokens ); 2631 if ( !selector ) { 2632 push.apply( results, seed ); 2633 return results; 2634 } 2635 2636 break; 2637 } 2638 } 2639 } 2640 } 2641 2642 // Compile and execute a filtering function if one is not provided 2643 // Provide `match` to avoid retokenization if we modified the selector above 2644 ( compiled || compile( selector, match ) )( 2645 seed, 2646 context, 2647 !documentIsHTML, 2648 results, 2649 !context || rsibling.test( selector ) && testContext( context.parentNode ) || context 2650 ); 2651 return results; 2652}; 2653 2654// One-time assignments 2655 2656// Sort stability 2657support.sortStable = expando.split("").sort( sortOrder ).join("") === expando; 2658 2659// Support: Chrome 14-35+ 2660// Always assume duplicates if they aren't passed to the comparison function 2661support.detectDuplicates = !!hasDuplicate; 2662 2663// Initialize against the default document 2664setDocument(); 2665 2666// Support: Webkit<537.32 - Safari 6.0.3/Chrome 25 (fixed in Chrome 27) 2667// Detached nodes confoundingly follow *each other* 2668support.sortDetached = assert(function( div1 ) { 2669 // Should return 1, but returns 4 (following) 2670 return div1.compareDocumentPosition( document.createElement("div") ) & 1; 2671}); 2672 2673// Support: IE<8 2674// Prevent attribute/property "interpolation" 2675// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 2676if ( !assert(function( div ) { 2677 div.innerHTML = "<a href='#'></a>"; 2678 return div.firstChild.getAttribute("href") === "#" ; 2679}) ) { 2680 addHandle( "type|href|height|width", function( elem, name, isXML ) { 2681 if ( !isXML ) { 2682 return elem.getAttribute( name, name.toLowerCase() === "type" ? 1 : 2 ); 2683 } 2684 }); 2685} 2686 2687// Support: IE<9 2688// Use defaultValue in place of getAttribute("value") 2689if ( !support.attributes || !assert(function( div ) { 2690 div.innerHTML = "<input/>"; 2691 div.firstChild.setAttribute( "value", "" ); 2692 return div.firstChild.getAttribute( "value" ) === ""; 2693}) ) { 2694 addHandle( "value", function( elem, name, isXML ) { 2695 if ( !isXML && elem.nodeName.toLowerCase() === "input" ) { 2696 return elem.defaultValue; 2697 } 2698 }); 2699} 2700 2701// Support: IE<9 2702// Use getAttributeNode to fetch booleans when getAttribute lies 2703if ( !assert(function( div ) { 2704 return div.getAttribute("disabled") == null; 2705}) ) { 2706 addHandle( booleans, function( elem, name, isXML ) { 2707 var val; 2708 if ( !isXML ) { 2709 return elem[ name ] === true ? name.toLowerCase() : 2710 (val = elem.getAttributeNode( name )) && val.specified ? 2711 val.value : 2712 null; 2713 } 2714 }); 2715} 2716 2717return Sizzle; 2718 2719})( window ); 2720 2721 2722 2723jQuery.find = Sizzle; 2724jQuery.expr = Sizzle.selectors; 2725jQuery.expr[ ":" ] = jQuery.expr.pseudos; 2726jQuery.uniqueSort = jQuery.unique = Sizzle.uniqueSort; 2727jQuery.text = Sizzle.getText; 2728jQuery.isXMLDoc = Sizzle.isXML; 2729jQuery.contains = Sizzle.contains; 2730 2731 2732 2733var dir = function( elem, dir, until ) { 2734 var matched = [], 2735 truncate = until !== undefined; 2736 2737 while ( ( elem = elem[ dir ] ) && elem.nodeType !== 9 ) { 2738 if ( elem.nodeType === 1 ) { 2739 if ( truncate && jQuery( elem ).is( until ) ) { 2740 break; 2741 } 2742 matched.push( elem ); 2743 } 2744 } 2745 return matched; 2746}; 2747 2748 2749var siblings = function( n, elem ) { 2750 var matched = []; 2751 2752 for ( ; n; n = n.nextSibling ) { 2753 if ( n.nodeType === 1 && n !== elem ) { 2754 matched.push( n ); 2755 } 2756 } 2757 2758 return matched; 2759}; 2760 2761 2762var rneedsContext = jQuery.expr.match.needsContext; 2763 2764var rsingleTag = ( /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/ ); 2765 2766 2767 2768var risSimple = /^.[^:#\[\.,]*$/; 2769 2770// Implement the identical functionality for filter and not 2771function winnow( elements, qualifier, not ) { 2772 if ( jQuery.isFunction( qualifier ) ) { 2773 return jQuery.grep( elements, function( elem, i ) { 2774 /* jshint -W018 */ 2775 return !!qualifier.call( elem, i, elem ) !== not; 2776 } ); 2777 2778 } 2779 2780 if ( qualifier.nodeType ) { 2781 return jQuery.grep( elements, function( elem ) { 2782 return ( elem === qualifier ) !== not; 2783 } ); 2784 2785 } 2786 2787 if ( typeof qualifier === "string" ) { 2788 if ( risSimple.test( qualifier ) ) { 2789 return jQuery.filter( qualifier, elements, not ); 2790 } 2791 2792 qualifier = jQuery.filter( qualifier, elements ); 2793 } 2794 2795 return jQuery.grep( elements, function( elem ) { 2796 return (
2796jQuery.inArray( elem, qualifier ) > -1 ) !== not; 2797 } ); 2798} 2799 2800jQuery.filter = function( expr, elems, not ) { 2801 var elem = elems[ 0 ]; 2802 2803 if ( not ) { 2804 expr = ":not(" + expr + ")"; 2805 } 2806 2807 return elems.length === 1 && elem.nodeType === 1 ? 2808 jQuery.find.matchesSelector( elem, expr ) ? [ elem ] : [] : 2809 jQuery.find.matches( expr, jQuery.grep( elems, function( elem ) { 2810 return elem.nodeType === 1; 2811 } ) ); 2812}; 2813 2814jQuery.fn.extend( { 2815 find: function( selector ) { 2816 var i, 2817 ret = [], 2818 self = this, 2819 len = self.length; 2820 2821 if ( typeof selector !== "string" ) {
vendor: 5,394 bytes, lines 2822-3024
2822 return this.pushStack( jQuery( selector ).filter( function() { 2823 for ( i = 0; i < len; i++ ) { 2824 if ( jQuery.contains( self[ i ], this ) ) { 2825 return true; 2826 } 2827 } 2828 } ) ); 2829 } 2830 2831 for ( i = 0; i < len; i++ ) { 2832 jQuery.find( selector, self[ i ], ret ); 2833 } 2834 2835 // Needed because $( selector, context ) becomes $( context ).find( selector ) 2836 ret = this.pushStack( len > 1 ? jQuery.unique( ret ) : ret ); 2837 ret.selector = this.selector ? this.selector + " " + selector : selector; 2838 return ret; 2839 }, 2840 filter: function( selector ) { 2841 return this.pushStack( winnow( this, selector || [], false ) ); 2842 }, 2843 not: function( selector ) { 2844 return this.pushStack( winnow( this, selector || [], true ) ); 2845 }, 2846 is: function( selector ) { 2847 return !!winnow( 2848 this, 2849 2850 // If this is a positional/relative selector, check membership in the returned set 2851 // so $("p:first").is("p:last") won't return true for a doc with two "p". 2852 typeof selector === "string" && rneedsContext.test( selector ) ? 2853 jQuery( selector ) : 2854 selector || [], 2855 false 2856 ).length; 2857 } 2858} ); 2859 2860 2861// Initialize a jQuery object 2862 2863 2864// A central reference to the root jQuery(document) 2865var rootjQuery, 2866 2867 // A simple way to check for HTML strings 2868 // Prioritize #id over <tag> to avoid XSS via location.hash (#9521) 2869 // Strict HTML recognition (#11290: must start with <) 2870 rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/, 2871 2872 init = jQuery.fn.init = function( selector, context, root ) { 2873 var match, elem; 2874 2875 // HANDLE: $(""), $(null), $(undefined), $(false) 2876 if ( !selector ) { 2877 return this; 2878 } 2879 2880 // init accepts an alternate rootjQuery 2881 // so migrate can support jQuery.sub (gh-2101) 2882 root = root || rootjQuery; 2883 2884 // Handle HTML strings 2885 if ( typeof selector === "string" ) { 2886 if ( selector.charAt( 0 ) === "<" && 2887 selector.charAt( selector.length - 1 ) === ">" && 2888 selector.length >= 3 ) { 2889 2890 // Assume that strings that start and end with <> are HTML and skip the regex check 2891 match = [ null, selector, null ]; 2892 2893 } else { 2894 match = rquickExpr.exec( selector ); 2895 } 2896 2897 // Match html or make sure no context is specified for #id 2898 if ( match && ( match[ 1 ] || !context ) ) { 2899 2900 // HANDLE: $(html) -> $(array) 2901 if ( match[ 1 ] ) { 2902 context = context instanceof jQuery ? context[ 0 ] : context; 2903 2904 // scripts is true for back-compat 2905 // Intentionally let the error be thrown if parseHTML is not present 2906 jQuery.merge( this, jQuery.parseHTML( 2907 match[ 1 ], 2908 context && context.nodeType ? context.ownerDocument || context : document, 2909 true 2910 ) ); 2911 2912 // HANDLE: $(html, props) 2913 if ( rsingleTag.test( match[ 1 ] ) && jQuery.isPlainObject( context ) ) { 2914 for ( match in context ) { 2915 2916 // Properties of context are called as methods if possible 2917 if ( jQuery.isFunction( this[ match ] ) ) { 2918 this[ match ]( context[ match ] ); 2919 2920 // ...and otherwise set as attributes 2921 } else { 2922 this.attr( match, context[ match ] ); 2923 } 2924 } 2925 } 2926 2927 return this; 2928 2929 // HANDLE: $(#id) 2930 } else { 2931 elem = document.getElementById( match[ 2 ] ); 2932 2933 // Check parentNode to catch when Blackberry 4.6 returns 2934 // nodes that are no longer in the document #6963 2935 if ( elem && elem.parentNode ) { 2936 2937 // Handle the case where IE and Opera return items 2938 // by name instead of ID 2939 if ( elem.id !== match[ 2 ] ) { 2940 return rootjQuery.find( selector ); 2941 } 2942 2943 // Otherwise, we inject the element directly into the jQuery object 2944 this.length = 1; 2945 this[ 0 ] = elem; 2946 } 2947 2948 this.context = document; 2949 this.selector = selector; 2950 return this; 2951 } 2952 2953 // HANDLE: $(expr, $(...)) 2954 } else if ( !context || context.jquery ) { 2955 return ( context || root ).find( selector ); 2956 2957 // HANDLE: $(expr, context) 2958 // (which is just equivalent to: $(context).find(expr) 2959 } else { 2960 return this.constructor( context ).find( selector ); 2961 } 2962 2963 // HANDLE: $(DOMElement) 2964 } else if ( selector.nodeType ) { 2965 this.context = this[ 0 ] = selector; 2966 this.length = 1; 2967 return this; 2968 2969 // HANDLE: $(function) 2970 // Shortcut for document ready 2971 } else if ( jQuery.isFunction( selector ) ) { 2972 return typeof root.ready !== "undefined" ? 2973 root.ready( selector ) : 2974 2975 // Execute immediately if ready is not present 2976 selector( jQuery ); 2977 } 2978 2979 if ( selector.selector !== undefined ) { 2980 this.selector = selector.selector; 2981 this.context = selector.context; 2982 } 2983 2984 return jQuery.makeArray( selector, this ); 2985 }; 2986 2987// Give the init function the jQuery prototype for later instantiation 2988init.prototype = jQuery.fn; 2989 2990// Initialize central reference 2991rootjQuery = jQuery( document ); 2992 2993 2994var rparentsprev = /^(?:parents|prev(?:Until|All))/, 2995 2996 // methods guaranteed to produce a unique set when starting from a unique set 2997 guaranteedUnique = { 2998 children: true, 2999 contents: true, 3000 next: true, 3001 prev: true 3002 }; 3003 3004jQuery.fn.extend( { 3005 has: function( target ) { 3006 var i, 3007 targets = jQuery( target, this ), 3008 len = targets.length; 3009 3010 return this.filter( function() { 3011 for ( i = 0; i < len; i++ ) { 3012 if ( jQuery.contains( this, targets[ i ] ) ) { 3013 return true; 3014 } 3015 } 3016 } ); 3017 }, 3018 3019 closest: function( selectors, context ) { 3020 var cur, 3021 i = 0, 3022 l = this.length, 3023 matched = [], 3024 pos = rneedsContext.test( selectors ) || typeof selectors !== "string" ?
vendor: 12,881 bytes, lines 3025-3533
3025 jQuery( selectors, context || this.context ) : 3026 0; 3027 3028 for ( ; i < l; i++ ) { 3029 for ( cur = this[ i ]; cur && cur !== context; cur = cur.parentNode ) { 3030 3031 // Always skip document fragments 3032 if ( cur.nodeType < 11 && ( pos ? 3033 pos.index( cur ) > -1 : 3034 3035 // Don't pass non-elements to Sizzle 3036 cur.nodeType === 1 && 3037 jQuery.find.matchesSelector( cur, selectors ) ) ) { 3038 3039 matched.push( cur ); 3040 break; 3041 } 3042 } 3043 } 3044 3045 return this.pushStack( matched.length > 1 ? jQuery.uniqueSort( matched ) : matched ); 3046 }, 3047 3048 // Determine the position of an element within 3049 // the matched set of elements 3050 index: function( elem ) { 3051 3052 // No argument, return index in parent 3053 if ( !elem ) { 3054 return ( this[ 0 ] && this[ 0 ].parentNode ) ? this.first().prevAll().length : -1; 3055 } 3056 3057 // index in selector 3058 if ( typeof elem === "string" ) { 3059 return jQuery.inArray( this[ 0 ], jQuery( elem ) ); 3060 } 3061 3062 // Locate the position of the desired element 3063 return jQuery.inArray( 3064 3065 // If it receives a jQuery object, the first element is used 3066 elem.jquery ? elem[ 0 ] : elem, this ); 3067 }, 3068 3069 add: function( selector, context ) { 3070 return this.pushStack( 3071 jQuery.uniqueSort( 3072 jQuery.merge( this.get(), jQuery( selector, context ) ) 3073 ) 3074 ); 3075 }, 3076 3077 addBack: function( selector ) { 3078 return this.add( selector == null ? 3079 this.prevObject : this.prevObject.filter( selector ) 3080 ); 3081 } 3082} ); 3083 3084function sibling( cur, dir ) { 3085 do { 3086 cur = cur[ dir ]; 3087 } while ( cur && cur.nodeType !== 1 ); 3088 3089 return cur; 3090} 3091 3092jQuery.each( { 3093 parent: function( elem ) { 3094 var parent = elem.parentNode; 3095 return parent && parent.nodeType !== 11 ? parent : null; 3096 }, 3097 parents: function( elem ) { 3098 return dir( elem, "parentNode" ); 3099 }, 3100 parentsUntil: function( elem, i, until ) { 3101 return dir( elem, "parentNode", until ); 3102 }, 3103 next: function( elem ) { 3104 return sibling( elem, "nextSibling" ); 3105 }, 3106 prev: function( elem ) { 3107 return sibling( elem, "previousSibling" ); 3108 }, 3109 nextAll: function( elem ) { 3110 return dir( elem, "nextSibling" ); 3111 }, 3112 prevAll: function( elem ) { 3113 return dir( elem, "previousSibling" ); 3114 }, 3115 nextUntil: function( elem, i, until ) { 3116 return dir( elem, "nextSibling", until ); 3117 }, 3118 prevUntil: function( elem, i, until ) { 3119 return dir( elem, "previousSibling", until ); 3120 }, 3121 siblings: function( elem ) { 3122 return siblings( ( elem.parentNode || {} ).firstChild, elem ); 3123 }, 3124 children: function( elem ) { 3125 return siblings( elem.firstChild ); 3126 }, 3127 contents: function( elem ) { 3128 return jQuery.nodeName( elem, "iframe" ) ? 3129 elem.contentDocument || elem.contentWindow.document : 3130 jQuery.merge( [], elem.childNodes ); 3131 } 3132}, function( name, fn ) { 3133 jQuery.fn[ name ] = function( until, selector ) { 3134 var ret = jQuery.map( this, fn, until ); 3135 3136 if ( name.slice( -5 ) !== "Until" ) { 3137 selector = until; 3138 } 3139 3140 if ( selector && typeof selector === "string" ) { 3141 ret = jQuery.filter( selector, ret ); 3142 } 3143 3144 if ( this.length > 1 ) { 3145 3146 // Remove duplicates 3147 if ( !guaranteedUnique[ name ] ) { 3148 ret = jQuery.uniqueSort( ret ); 3149 } 3150 3151 // Reverse order for parents* and prev-derivatives 3152 if ( rparentsprev.test( name ) ) { 3153 ret = ret.reverse(); 3154 } 3155 } 3156 3157 return this.pushStack( ret ); 3158 }; 3159} ); 3160var rnotwhite = ( /\S+/g ); 3161 3162 3163 3164// Convert String-formatted options into Object-formatted ones 3165function createOptions( options ) { 3166 var object = {}; 3167 jQuery.each( options.match( rnotwhite ) || [], function( _, flag ) { 3168 object[ flag ] = true; 3169 } ); 3170 return object; 3171} 3172 3173/* 3174 * Create a callback list using the following parameters: 3175 * 3176 * options: an optional list of space-separated options that will change how 3177 * the callback list behaves or a more traditional option object 3178 * 3179 * By default a callback list will act like an event callback list and can be 3180 * "fired" multiple times. 3181 * 3182 * Possible options: 3183 * 3184 * once: will ensure the callback list can only be fired once (like a Deferred) 3185 * 3186 * memory: will keep track of previous values and will call any callback added 3187 * after the list has been fired right away with the latest "memorized" 3188 * values (like a Deferred) 3189 * 3190 * unique: will ensure a callback can only be added once (no duplicate in the list) 3191 * 3192 * stopOnFalse: interrupt callings when a callback returns false 3193 * 3194 */ 3195jQuery.Callbacks = function( options ) { 3196 3197 // Convert options from String-formatted to Object-formatted if needed 3198 // (we check in cache first) 3199 options = typeof options === "string" ? 3200 createOptions( options ) : 3201 jQuery.extend( {}, options ); 3202 3203 var // Flag to know if list is currently firing 3204 firing, 3205 3206 // Last fire value for non-forgettable lists 3207 memory, 3208 3209 // Flag to know if list was already fired 3210 fired, 3211 3212 // Flag to prevent firing 3213 locked, 3214 3215 // Actual callback list 3216 list = [], 3217 3218 // Queue of execution data for repeatable lists 3219 queue = [], 3220 3221 // Index of currently firing callback (modified by add/remove as needed) 3222 firingIndex = -1, 3223 3224 // Fire callbacks 3225 fire = function() { 3226 3227 // Enforce single-firing 3228 locked = options.once; 3229 3230 // Execute callbacks for all pending executions, 3231 // respecting firingIndex overrides and runtime changes 3232 fired = firing = true; 3233 for ( ; queue.length; firingIndex = -1 ) { 3234 memory = queue.shift(); 3235 while ( ++firingIndex < list.length ) { 3236 3237 // Run callback and check for early termination 3238 if ( list[ firingIndex ].apply( memory[ 0 ], memory[ 1 ] ) === false && 3239 options.stopOnFalse ) { 3240 3241 // Jump to end and forget the data so .add doesn't re-fire 3242 firingIndex = list.length; 3243 memory = false; 3244 } 3245 } 3246 } 3247 3248 // Forget the data if we're done with it 3249 if ( !options.memory ) { 3250 memory = false; 3251 } 3252 3253 firing = false; 3254 3255 // Clean up if we're done firing for good 3256 if ( locked ) { 3257 3258 // Keep an empty list if we have data for future add calls 3259 if ( memory ) { 3260 list = []; 3261 3262 // Otherwise, this object is spent 3263 } else { 3264 list = ""; 3265 } 3266 } 3267 }, 3268 3269 // Actual Callbacks object 3270 self = { 3271 3272 // Add a callback or a collection of callbacks to the list 3273 add: function() { 3274 if ( list ) { 3275 3276 // If we have memory from a past run, we should fire after adding 3277 if ( memory && !firing ) { 3278 firingIndex = list.length - 1; 3279 queue.push( memory ); 3280 } 3281 3282 ( function add( args ) { 3283 jQuery.each( args, function( _, arg ) { 3284 if ( jQuery.isFunction( arg ) ) { 3285 if ( !options.unique || !self.has( arg ) ) { 3286 list.push( arg ); 3287 } 3288 } else if ( arg && arg.length && jQuery.type( arg ) !== "string" ) { 3289 3290 // Inspect recursively 3291 add( arg ); 3292 } 3293 } ); 3294 } )( arguments ); 3295 3296 if ( memory && !firing ) { 3297 fire(); 3298 } 3299 } 3300 return this; 3301 }, 3302 3303 // Remove a callback from the list 3304 remove: function() { 3305 jQuery.each( arguments, function( _, arg ) { 3306 var index; 3307 while ( ( index = jQuery.inArray( arg, list, index ) ) > -1 ) { 3308 list.splice( index, 1 ); 3309 3310 // Handle firing indexes 3311 if ( index <= firingIndex ) { 3312 firingIndex--; 3313 } 3314 } 3315 } ); 3316 return this; 3317 }, 3318 3319 // Check if a given callback is in the list. 3320 // If no argument is given, return whether or not list has callbacks attached. 3321 has: function( fn ) { 3322 return fn ? 3323 jQuery.inArray( fn, list ) > -1 : 3324 list.length > 0; 3325 }, 3326 3327 // Remove all callbacks from the list 3328 empty: function() { 3329 if ( list ) { 3330 list = []; 3331 } 3332 return this; 3333 }, 3334 3335 // Disable .fire and .add 3336 // Abort any current/pending executions 3337 // Clear all callbacks and values 3338 disable: function() { 3339 locked = queue = []; 3340 list = memory = ""; 3341 return this; 3342 }, 3343 disabled: function() { 3344 return !list; 3345 }, 3346 3347 // Disable .fire 3348 // Also disable .add unless we have memory (since it would have no effect) 3349 // Abort any pending executions 3350 lock: function() { 3351 locked = true; 3352 if ( !memory ) { 3353 self.disable(); 3354 } 3355 return this; 3356 }, 3357 locked: function() { 3358 return !!locked; 3359 }, 3360 3361 // Call all callbacks with the given context and arguments 3362 fireWith: function( context, args ) { 3363 if ( !locked ) { 3364 args = args || []; 3365 args = [ context, args.slice ? args.slice() : args ]; 3366 queue.push( args ); 3367 if ( !firing ) { 3368 fire(); 3369 } 3370 } 3371 return this; 3372 }, 3373 3374 // Call all the callbacks with the given arguments 3375 fire: function() { 3376 self.fireWith( this, arguments ); 3377 return this; 3378 }, 3379 3380 // To know if the callbacks have already been called at least once 3381 fired: function() { 3382 return !!fired; 3383 } 3384 }; 3385 3386 return self; 3387}; 3388 3389 3390jQuery.extend( { 3391 3392 Deferred: function( func ) { 3393 var tuples = [ 3394 3395 // action, add listener, listener list, final state 3396 [ "resolve", "done", jQuery.Callbacks( "once memory" ), "resolved" ], 3397 [ "reject", "fail", jQuery.Callbacks( "once memory" ), "rejected" ], 3398 [ "notify", "progress", jQuery.Callbacks( "memory" ) ] 3399 ], 3400 state = "pending", 3401 promise = { 3402 state: function() { 3403 return state; 3404 }, 3405 always: function() { 3406 deferred.done( arguments ).fail( arguments ); 3407 return this; 3408 }, 3409 then: function( /* fnDone, fnFail, fnProgress */ ) { 3410 var fns = arguments; 3411 return jQuery.Deferred( function( newDefer ) { 3412 jQuery.each( tuples, function( i, tuple ) { 3413 var fn = jQuery.isFunction( fns[ i ] ) && fns[ i ]; 3414 3415 // deferred[ done | fail | progress ] for forwarding actions to newDefer 3416 deferred[ tuple[ 1 ] ]( function() { 3417 var returned = fn && fn.apply( this, arguments ); 3418 if ( returned && jQuery.isFunction( returned.promise ) ) { 3419 returned.promise() 3420 .progress( newDefer.notify ) 3421 .done( newDefer.resolve ) 3422 .fail( newDefer.reject ); 3423 } else { 3424 newDefer[ tuple[ 0 ] + "With" ]( 3425 this === promise ? newDefer.promise() : this, 3426 fn ? [ returned ] : arguments 3427 ); 3428 } 3429 } ); 3430 } ); 3431 fns = null; 3432 } ).promise(); 3433 }, 3434 3435 // Get a promise for this deferred 3436 // If obj is provided, the promise aspect is added to the object 3437 promise: function( obj ) { 3438 return obj != null ? jQuery.extend( obj, promise ) : promise; 3439 } 3440 }, 3441 deferred = {}; 3442 3443 // Keep pipe for back-compat 3444 promise.pipe = promise.then; 3445 3446 // Add list-specific methods 3447 jQuery.each( tuples, function( i, tuple ) { 3448 var list = tuple[ 2 ], 3449 stateString = tuple[ 3 ]; 3450 3451 // promise[ done | fail | progress ] = list.add 3452 promise[ tuple[ 1 ] ] = list.add; 3453 3454 // Handle state 3455 if ( stateString ) { 3456 list.add( function() { 3457 3458 // state = [ resolved | rejected ] 3459 state = stateString; 3460 3461 // [ reject_list | resolve_list ].disable; progress_list.lock 3462 }, tuples[ i ^ 1 ][ 2 ].disable, tuples[ 2 ][ 2 ].lock ); 3463 } 3464 3465 // deferred[ resolve | reject | notify ] 3466 deferred[ tuple[ 0 ] ] = function() { 3467 deferred[ tuple[ 0 ] + "With" ]( this === deferred ? promise : this, arguments ); 3468 return this; 3469 }; 3470 deferred[ tuple[ 0 ] + "With" ] = list.fireWith; 3471 } ); 3472 3473 // Make the deferred a promise 3474 promise.promise( deferred ); 3475 3476 // Call given func if any 3477 if ( func ) { 3478 func.call( deferred, deferred ); 3479 } 3480 3481 // All done! 3482 return deferred; 3483 }, 3484 3485 // Deferred helper 3486 when: function( subordinate /* , ..., subordinateN */ ) { 3487 var i = 0, 3488 resolveValues = slice.call( arguments ), 3489 length = resolveValues.length, 3490 3491 // the count of uncompleted subordinates 3492 remaining = length !== 1 || 3493 ( subordinate && jQuery.isFunction( subordinate.promise ) ) ? length : 0, 3494 3495 // the master Deferred. 3496 // If resolveValues consist of only a single Deferred, just use that. 3497 deferred = remaining === 1 ? subordinate : jQuery.Deferred(), 3498 3499 // Update function for both resolve and progress values 3500 updateFunc = function( i, contexts, values ) { 3501 return function( value ) { 3502 contexts[ i ] = this; 3503 values[ i ] = arguments.length > 1 ? slice.call( arguments ) : value; 3504 if ( values === progressValues ) { 3505 deferred.notifyWith( contexts, values ); 3506 3507 } else if ( !( --remaining ) ) { 3508 deferred.resolveWith( contexts, values ); 3509 } 3510 }; 3511 }, 3512 3513 progressValues, progressContexts, resolveContexts; 3514 3515 // add listeners to Deferred subordinates; treat others as resolved 3516 if ( length > 1 ) { 3517 progressValues = new Array( length ); 3518 progressContexts = new Array( length ); 3519 resolveContexts = new Array( length ); 3520 for ( ; i < length; i++ ) { 3521 if ( resolveValues[ i ] && jQuery.isFunction( resolveValues[ i ].promise ) ) { 3522 resolveValues[ i ].promise() 3523 .progress( updateFunc( i, progressContexts, progressValues ) ) 3524 .done( updateFunc( i, resolveContexts, resolveValues ) ) 3525 .fail( deferred.reject ); 3526 } else { 3527 --remaining; 3528 } 3529 } 3530 } 3531 3532 // if we're not waiting on anything, resolve the master 3533 if ( !remaining ) {
vendor: 2,149 bytes, lines 3534-3633
3534 deferred.resolveWith( resolveContexts, resolveValues ); 3535 } 3536 3537 return deferred.promise(); 3538 } 3539} ); 3540 3541 3542// The deferred used on DOM ready 3543var readyList; 3544 3545jQuery.fn.ready = function( fn ) { 3546 3547 // Add the callback 3548 jQuery.ready.promise().done( fn ); 3549 3550 return this; 3551}; 3552 3553jQuery.extend( { 3554 3555 // Is the DOM ready to be used? Set to true once it occurs. 3556 isReady: false, 3557 3558 // A counter to track how many items to wait for before 3559 // the ready event fires. See #6781 3560 readyWait: 1, 3561 3562 // Hold (or release) the ready event 3563 holdReady: function( hold ) { 3564 if ( hold ) { 3565 jQuery.readyWait++; 3566 } else { 3567 jQuery.ready( true ); 3568 } 3569 }, 3570 3571 // Handle when the DOM is ready 3572 ready: function( wait ) { 3573 3574 // Abort if there are pending holds or we're already ready 3575 if ( wait === true ? --jQuery.readyWait : jQuery.isReady ) { 3576 return; 3577 } 3578 3579 // Remember that the DOM is ready 3580 jQuery.isReady = true; 3581 3582 // If a normal DOM Ready event fired, decrement, and wait if need be 3583 if ( wait !== true && --jQuery.readyWait > 0 ) { 3584 return; 3585 } 3586 3587 // If there are functions bound, to execute 3588 readyList.resolveWith( document, [ jQuery ] ); 3589 3590 // Trigger any bound ready events 3591 if ( jQuery.fn.triggerHandler ) { 3592 jQuery( document ).triggerHandler( "ready" ); 3593 jQuery( document ).off( "ready" ); 3594 } 3595 } 3596} ); 3597 3598/** 3599 * Clean-up method for dom ready events 3600 */ 3601function detach() { 3602 if ( document.addEventListener ) { 3603 document.removeEventListener( "DOMContentLoaded", completed ); 3604 window.removeEventListener( "load", completed ); 3605 3606 } else { 3607 document.detachEvent( "onreadystatechange", completed ); 3608 window.detachEvent( "onload", completed ); 3609 } 3610} 3611 3612/** 3613 * The ready event handler and self cleanup method 3614 */ 3615function completed() { 3616 3617 // readyState === "complete" is good enough for us to call the dom ready in oldIE 3618 if ( document.addEventListener || 3619 window.event.type === "load" || 3620 document.readyState === "complete" ) { 3621 3622 detach(); 3623 jQuery.ready(); 3624 } 3625} 3626 3627jQuery.ready.promise = function( obj ) { 3628 if ( !readyList ) { 3629 3630 readyList = jQuery.Deferred(); 3631 3632 // Catch cases where $(document).ready() is called 3633 // after the browser event has already occurred.
3634 // Support: IE6-10 3635 // Older IE sometimes signals "interactive" too soon 3636 if ( document.readyState === "complete" || 3637 ( document.readyState !== "loading" && !document.documentElement.doScroll ) ) { 3638 3639 // Handle it asynchronously to allow scripts the opportunity to delay ready 3640 window.setTimeout( jQuery.ready ); 3641 3642 // Standards-based browsers support DOMContentLoaded 3643 } else if ( document.addEventListener ) { 3644 3645 // Use the handy event callback 3646 document.addEventListener( "DOMContentLoaded", completed ); 3647 3648 // A fallback to window.onload, that will always work 3649 window.addEventListener( "load", completed ); 3650 3651 // If IE event model is used 3652 } else { 3653 3654 // Ensure firing before onload, maybe late but safe also for iframes 3655 document.attachEvent( "onreadystatechange", completed ); 3656 3657 // A fallback to window.onload, that will always work 3658 window.attachEvent( "onload", completed ); 3659 3660 // If IE and not a frame 3661 // continually check to see if the document is ready 3662 var top = false; 3663 3664 try { 3665 top = window.frameElement == null && document.documentElement; 3666 } catch ( e ) {} 3667 3668 if ( top && top.doScroll ) { 3669 ( function doScrollCheck() { 3670 if ( !jQuery.isReady ) { 3671 3672 try { 3673 3674 // Use the trick by Diego Perini 3675 // http://javascript.nwbox.com/IEContentLoaded/ 3676 top.doScroll( "left" ); 3677 } catch ( e ) { 3678 return window.setTimeout( doScrollCheck, 50 ); 3679 } 3680 3681 // detach all dom ready events 3682 detach(); 3683 3684 // and execute any waiting functions 3685 jQuery.ready(); 3686 } 3687 } )(); 3688 } 3689 } 3690 } 3691 return readyList.promise( obj ); 3692}; 3693 3694// Kick off the DOM ready check even if the user does not 3695jQuery.ready.promise(); 3696 3697 3698 3699 3700// Support: IE<9 3701// Iteration over object's inherited properties before its own 3702var i; 3703for ( i in jQuery( support ) ) { 3704 break; 3705} 3706support.ownFirst = i === "0"; 3707 3708// Note: most support tests are defined in their respective modules. 3709// false until the test is run 3710support.inlineBlockNeedsLayout = false; 3711 3712// Execute ASAP in case we need to set body.style.zoom 3713jQuery( function() { 3714 3715 // Minified: var a,b,c,d 3716 var val, div, body, container; 3717 3718 body = document.getElementsByTagName( "body" )[ 0 ]; 3719 if ( !body || !body.style ) { 3720 3721 // Return for frameset docs that don't have a body 3722 return; 3723 } 3724 3725 // Setup 3726 div = document.createElement( "div" ); 3727 container = document.createElement( "div" ); 3728 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 3729 body.appendChild( container ).appendChild( div ); 3730 3731 if ( typeof div.style.zoom !== "undefined" ) { 3732 3733 // Support: IE<8 3734 // Check if natively block-level elements act like inline-block 3735 // elements when setting their display to 'inline' and giving 3736 // them layout 3737 div.style.cssText = "display:inline;margin:0;border:0;padding:1px;width:1px;zoom:1"; 3738 3739 support.inlineBlockNeedsLayout = val = div.offsetWidth === 3; 3740 if ( val ) { 3741 3742 // Prevent IE 6 from affecting layout for positioned elements #11048 3743 // Prevent IE from shrinking the body in IE 7 mode #12869 3744 // Support: IE<8 3745 body.style.zoom = 1; 3746 } 3747 } 3748 3749 body.removeChild( container ); 3750} ); 3751 3752 3753( function() { 3754 var div = document.createElement( "div" ); 3755 3756 // Support: IE<9 3757 support.deleteExpando = true; 3758 try { 3759 delete div.test; 3760 } catch ( e ) { 3761 support.deleteExpando = false; 3762 } 3763 3764 // Null elements to avoid leaks in IE. 3765 div = null; 3766} )(); 3767var acceptData = function( elem ) { 3768 var noData = jQuery.noData[ ( elem.nodeName + " " ).toLowerCase() ], 3769 nodeType = +elem.nodeType || 1; 3770 3771 // Do not set data on non-element DOM nodes because it will not be cleared (#8335). 3772 return nodeType !== 1 && nodeType !== 9 ? 3773 false : 3774 3775 // Nodes accept data unless otherwise specified; rejection can be conditional 3776 !noData || noData !== true && elem.getAttribute( "classid" ) === noData; 3777}; 3778 3779 3780 3781 3782var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, 3783 rmultiDash = /([A-Z])/g; 3784 3785function dataAttr( elem, key, data ) { 3786 3787 // If nothing was found internally, try to fetch any 3788 // data from the HTML5 data-* attribute 3789 if ( data === undefined && elem.nodeType === 1 ) { 3790 3791 var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); 3792 3793 data = elem.getAttribute( name ); 3794 3795 if ( typeof data === "string" ) { 3796 try { 3797 data = data === "true" ? true :
vendor: 11,186 bytes, lines 3798-4262
3798 data === "false" ? false : 3799 data === "null" ? null : 3800 3801 // Only convert to a number if it doesn't change the string 3802 +data + "" === data ? +data : 3803 rbrace.test( data ) ? jQuery.parseJSON( data ) : 3804 data; 3805 } catch ( e ) {} 3806 3807 // Make sure we set the data so it isn't changed later 3808 jQuery.data( elem, key, data ); 3809 3810 } else { 3811 data = undefined; 3812 } 3813 } 3814 3815 return data; 3816} 3817 3818// checks a cache object for emptiness 3819function isEmptyDataObject( obj ) { 3820 var name; 3821 for ( name in obj ) { 3822 3823 // if the public data object is empty, the private is still empty 3824 if ( name === "data" && jQuery.isEmptyObject( obj[ name ] ) ) { 3825 continue; 3826 } 3827 if ( name !== "toJSON" ) { 3828 return false; 3829 } 3830 } 3831 3832 return true; 3833} 3834 3835function internalData( elem, name, data, pvt /* Internal Use Only */ ) { 3836 if ( !acceptData( elem ) ) { 3837 return; 3838 } 3839 3840 var ret, thisCache, 3841 internalKey = jQuery.expando, 3842 3843 // We have to handle DOM nodes and JS objects differently because IE6-7 3844 // can't GC object references properly across the DOM-JS boundary 3845 isNode = elem.nodeType, 3846 3847 // Only DOM nodes need the global jQuery cache; JS object data is 3848 // attached directly to the object so GC can occur automatically 3849 cache = isNode ? jQuery.cache : elem, 3850 3851 // Only defining an ID for JS objects if its cache already exists allows 3852 // the code to shortcut on the same path as a DOM node with no cache 3853 id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey; 3854 3855 // Avoid doing any more work than we need to when trying to get data on an 3856 // object that has no data at all 3857 if ( ( !id || !cache[ id ] || ( !pvt && !cache[ id ].data ) ) && 3858 data === undefined && typeof name === "string" ) { 3859 return; 3860 } 3861 3862 if ( !id ) { 3863 3864 // Only DOM nodes need a new unique ID for each element since their data 3865 // ends up in the global cache 3866 if ( isNode ) { 3867 id = elem[ internalKey ] = deletedIds.pop() || jQuery.guid++; 3868 } else { 3869 id = internalKey; 3870 } 3871 } 3872 3873 if ( !cache[ id ] ) { 3874 3875 // Avoid exposing jQuery metadata on plain JS objects when the object 3876 // is serialized using JSON.stringify 3877 cache[ id ] = isNode ? {} : { toJSON: jQuery.noop }; 3878 } 3879 3880 // An object can be passed to jQuery.data instead of a key/value pair; this gets 3881 // shallow copied over onto the existing cache 3882 if ( typeof name === "object" || typeof name === "function" ) { 3883 if ( pvt ) { 3884 cache[ id ] = jQuery.extend( cache[ id ], name ); 3885 } else { 3886 cache[ id ].data = jQuery.extend( cache[ id ].data, name ); 3887 } 3888 } 3889 3890 thisCache = cache[ id ]; 3891 3892 // jQuery data() is stored in a separate object inside the object's internal data 3893 // cache in order to avoid key collisions between internal data and user-defined 3894 // data. 3895 if ( !pvt ) { 3896 if ( !thisCache.data ) { 3897 thisCache.data = {}; 3898 } 3899 3900 thisCache = thisCache.data; 3901 } 3902 3903 if ( data !== undefined ) { 3904 thisCache[ jQuery.camelCase( name ) ] = data; 3905 } 3906 3907 // Check for both converted-to-camel and non-converted data property names 3908 // If a data property was specified 3909 if ( typeof name === "string" ) { 3910 3911 // First Try to find as-is property data 3912 ret = thisCache[ name ]; 3913 3914 // Test for null|undefined property data 3915 if ( ret == null ) { 3916 3917 // Try to find the camelCased property 3918 ret = thisCache[ jQuery.camelCase( name ) ]; 3919 } 3920 } else { 3921 ret = thisCache; 3922 } 3923 3924 return ret; 3925} 3926 3927function internalRemoveData( elem, name, pvt ) { 3928 if ( !acceptData( elem ) ) { 3929 return; 3930 } 3931 3932 var thisCache, i, 3933 isNode = elem.nodeType, 3934 3935 // See jQuery.data for more information 3936 cache = isNode ? jQuery.cache : elem, 3937 id = isNode ? elem[ jQuery.expando ] : jQuery.expando; 3938 3939 // If there is already no cache entry for this object, there is no 3940 // purpose in continuing 3941 if ( !cache[ id ] ) { 3942 return; 3943 } 3944 3945 if ( name ) { 3946 3947 thisCache = pvt ? cache[ id ] : cache[ id ].data; 3948 3949 if ( thisCache ) { 3950 3951 // Support array or space separated string names for data keys 3952 if ( !jQuery.isArray( name ) ) { 3953 3954 // try the string as a key before any manipulation 3955 if ( name in thisCache ) { 3956 name = [ name ]; 3957 } else { 3958 3959 // split the camel cased version by spaces unless a key with the spaces exists 3960 name = jQuery.camelCase( name ); 3961 if ( name in thisCache ) { 3962 name = [ name ]; 3963 } else { 3964 name = name.split( " " ); 3965 } 3966 } 3967 } else { 3968 3969 // If "name" is an array of keys... 3970 // When data is initially created, via ("key", "val") signature, 3971 // keys will be converted to camelCase. 3972 // Since there is no way to tell _how_ a key was added, remove 3973 // both plain key and camelCase key. #12786 3974 // This will only penalize the array argument path. 3975 name = name.concat( jQuery.map( name, jQuery.camelCase ) ); 3976 } 3977 3978 i = name.length; 3979 while ( i-- ) { 3980 delete thisCache[ name[ i ] ]; 3981 } 3982 3983 // If there is no data left in the cache, we want to continue 3984 // and let the cache object itself get destroyed 3985 if ( pvt ? !isEmptyDataObject( thisCache ) : !jQuery.isEmptyObject( thisCache ) ) { 3986 return; 3987 } 3988 } 3989 } 3990 3991 // See jQuery.data for more information 3992 if ( !pvt ) { 3993 delete cache[ id ].data; 3994 3995 // Don't destroy the parent cache unless the internal data object 3996 // had been the only thing left in it 3997 if ( !isEmptyDataObject( cache[ id ] ) ) { 3998 return; 3999 } 4000 } 4001 4002 // Destroy the cache 4003 if ( isNode ) { 4004 jQuery.cleanData( [ elem ], true ); 4005 4006 // Use delete when supported for expandos or `cache` is not a window per isWindow (#10080) 4007 /* jshint eqeqeq: false */ 4008 } else if ( support.deleteExpando || cache != cache.window ) { 4009 /* jshint eqeqeq: true */ 4010 delete cache[ id ]; 4011 4012 // When all else fails, undefined 4013 } else { 4014 cache[ id ] = undefined; 4015 } 4016} 4017 4018jQuery.extend( { 4019 cache: {}, 4020 4021 // The following elements (space-suffixed to avoid Object.prototype collisions) 4022 // throw uncatchable exceptions if you attempt to set expando properties 4023 noData: { 4024 "applet ": true, 4025 "embed ": true, 4026 4027 // ...but Flash objects (which have this classid) *can* handle expandos 4028 "object ": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" 4029 }, 4030 4031 hasData: function( elem ) { 4032 elem = elem.nodeType ? jQuery.cache[ elem[ jQuery.expando ] ] : elem[ jQuery.expando ]; 4033 return !!elem && !isEmptyDataObject( elem ); 4034 }, 4035 4036 data: function( elem, name, data ) { 4037 return internalData( elem, name, data ); 4038 }, 4039 4040 removeData: function( elem, name ) { 4041 return internalRemoveData( elem, name ); 4042 }, 4043 4044 // For internal use only. 4045 _data: function( elem, name, data ) { 4046 return internalData( elem, name, data, true ); 4047 }, 4048 4049 _removeData: function( elem, name ) { 4050 return internalRemoveData( elem, name, true ); 4051 } 4052} ); 4053 4054jQuery.fn.extend( { 4055 data: function( key, value ) { 4056 var i, name, data, 4057 elem = this[ 0 ], 4058 attrs = elem && elem.attributes; 4059 4060 // Special expections of .data basically thwart jQuery.access, 4061 // so implement the relevant behavior ourselves 4062 4063 // Gets all values 4064 if ( key === undefined ) { 4065 if ( this.length ) { 4066 data = jQuery.data( elem ); 4067 4068 if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) { 4069 i = attrs.length; 4070 while ( i-- ) { 4071 4072 // Support: IE11+ 4073 // The attrs elements can be null (#14894) 4074 if ( attrs[ i ] ) { 4075 name = attrs[ i ].name; 4076 if ( name.indexOf( "data-" ) === 0 ) { 4077 name = jQuery.camelCase( name.slice( 5 ) ); 4078 dataAttr( elem, name, data[ name ] ); 4079 } 4080 } 4081 } 4082 jQuery._data( elem, "parsedAttrs", true ); 4083 } 4084 } 4085 4086 return data; 4087 } 4088 4089 // Sets multiple values 4090 if ( typeof key === "object" ) { 4091 return this.each( function() { 4092 jQuery.data( this, key ); 4093 } ); 4094 } 4095 4096 return arguments.length > 1 ? 4097 4098 // Sets one value 4099 this.each( function() { 4100 jQuery.data( this, key, value ); 4101 } ) : 4102 4103 // Gets one value 4104 // Try to fetch any internally stored data first 4105 elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : undefined; 4106 }, 4107 4108 removeData: function( key ) { 4109 return this.each( function() { 4110 jQuery.removeData( this, key ); 4111 } ); 4112 } 4113} ); 4114 4115 4116jQuery.extend( { 4117 queue: function( elem, type, data ) { 4118 var queue; 4119 4120 if ( elem ) { 4121 type = ( type || "fx" ) + "queue"; 4122 queue = jQuery._data( elem, type ); 4123 4124 // Speed up dequeue by getting out quickly if this is just a lookup 4125 if ( data ) { 4126 if ( !queue || jQuery.isArray( data ) ) { 4127 queue = jQuery._data( elem, type, jQuery.makeArray( data ) ); 4128 } else { 4129 queue.push( data ); 4130 } 4131 } 4132 return queue || []; 4133 } 4134 }, 4135 4136 dequeue: function( elem, type ) { 4137 type = type || "fx"; 4138 4139 var queue = jQuery.queue( elem, type ), 4140 startLength = queue.length, 4141 fn = queue.shift(), 4142 hooks = jQuery._queueHooks( elem, type ), 4143 next = function() { 4144 jQuery.dequeue( elem, type ); 4145 }; 4146 4147 // If the fx queue is dequeued, always remove the progress sentinel 4148 if ( fn === "inprogress" ) { 4149 fn = queue.shift(); 4150 startLength--; 4151 } 4152 4153 if ( fn ) { 4154 4155 // Add a progress sentinel to prevent the fx queue from being 4156 // automatically dequeued 4157 if ( type === "fx" ) { 4158 queue.unshift( "inprogress" ); 4159 } 4160 4161 // clear up the last queue stop function 4162 delete hooks.stop; 4163 fn.call( elem, next, hooks ); 4164 } 4165 4166 if ( !startLength && hooks ) { 4167 hooks.empty.fire(); 4168 } 4169 }, 4170 4171 // not intended for public consumption - generates a queueHooks object, 4172 // or returns the current one 4173 _queueHooks: function( elem, type ) { 4174 var key = type + "queueHooks"; 4175 return jQuery._data( elem, key ) || jQuery._data( elem, key, { 4176 empty: jQuery.Callbacks( "once memory" ).add( function() { 4177 jQuery._removeData( elem, type + "queue" ); 4178 jQuery._removeData( elem, key ); 4179 } ) 4180 } ); 4181 } 4182} ); 4183 4184jQuery.fn.extend( { 4185 queue: function( type, data ) { 4186 var setter = 2; 4187 4188 if ( typeof type !== "string" ) { 4189 data = type; 4190 type = "fx"; 4191 setter--; 4192 } 4193 4194 if ( arguments.length < setter ) { 4195 return jQuery.queue( this[ 0 ], type ); 4196 } 4197 4198 return data === undefined ? 4199 this : 4200 this.each( function() { 4201 var queue = jQuery.queue( this, type, data ); 4202 4203 // ensure a hooks for this queue 4204 jQuery._queueHooks( this, type ); 4205 4206 if ( type === "fx" && queue[ 0 ] !== "inprogress" ) { 4207 jQuery.dequeue( this, type ); 4208 } 4209 } ); 4210 }, 4211 dequeue: function( type ) { 4212 return this.each( function() { 4213 jQuery.dequeue( this, type ); 4214 } ); 4215 }, 4216 clearQueue: function( type ) { 4217 return this.queue( type || "fx", [] ); 4218 }, 4219 4220 // Get a promise resolved when queues of a certain type 4221 // are emptied (fx is the type by default) 4222 promise: function( type, obj ) { 4223 var tmp, 4224 count = 1, 4225 defer = jQuery.Deferred(), 4226 elements = this, 4227 i = this.length, 4228 resolve = function() { 4229 if ( !( --count ) ) { 4230 defer.resolveWith( elements, [ elements ] ); 4231 } 4232 }; 4233 4234 if ( typeof type !== "string" ) { 4235 obj = type; 4236 type = undefined; 4237 } 4238 type = type || "fx"; 4239 4240 while ( i-- ) { 4241 tmp = jQuery._data( elements[ i ], type + "queueHooks" ); 4242 if ( tmp && tmp.empty ) { 4243 count++; 4244 tmp.empty.add( resolve ); 4245 } 4246 } 4247 resolve(); 4248 return defer.promise( obj ); 4249 } 4250} ); 4251 4252 4253( function() { 4254 var shrinkWrapBlocksVal; 4255 4256 support.shrinkWrapBlocks = function() { 4257 if ( shrinkWrapBlocksVal != null ) { 4258 return shrinkWrapBlocksVal; 4259 } 4260 4261 // Will be changed later if needed. 4262 shrinkWrapBlocksVal = false;
vendor: 4,171 bytes, lines 4263-4411
4263 4264 // Minified: var b,c,d 4265 var div, body, container; 4266 4267 body = document.getElementsByTagName( "body" )[ 0 ]; 4268 if ( !body || !body.style ) { 4269 4270 // Test fired too early or in an unsupported environment, exit. 4271 return; 4272 } 4273 4274 // Setup 4275 div = document.createElement( "div" ); 4276 container = document.createElement( "div" ); 4277 container.style.cssText = "position:absolute;border:0;width:0;height:0;top:0;left:-9999px"; 4278 body.appendChild( container ).appendChild( div ); 4279 4280 // Support: IE6 4281 // Check if elements with layout shrink-wrap their children 4282 if ( typeof div.style.zoom !== "undefined" ) { 4283 4284 // Reset CSS: box-sizing; display; margin; border 4285 div.style.cssText = 4286 4287 // Support: Firefox<29, Android 2.3 4288 // Vendor-prefix box-sizing 4289 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 4290 "box-sizing:content-box;display:block;margin:0;border:0;" + 4291 "padding:1px;width:1px;zoom:1"; 4292 div.appendChild( document.createElement( "div" ) ).style.width = "5px"; 4293 shrinkWrapBlocksVal = div.offsetWidth !== 3; 4294 } 4295 4296 body.removeChild( container ); 4297 4298 return shrinkWrapBlocksVal; 4299 }; 4300 4301} )(); 4302var pnum = ( /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/ ).source; 4303 4304var rcssNum = new RegExp( "^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i" ); 4305 4306 4307var cssExpand = [ "Top", "Right", "Bottom", "Left" ]; 4308 4309var isHidden = function( elem, el ) { 4310 4311 // isHidden might be called from jQuery#filter function; 4312 // in that case, element will be second argument 4313 elem = el || elem; 4314 return jQuery.css( elem, "display" ) === "none" || 4315 !jQuery.contains( elem.ownerDocument, elem ); 4316 }; 4317 4318 4319 4320function adjustCSS( elem, prop, valueParts, tween ) { 4321 var adjusted, 4322 scale = 1, 4323 maxIterations = 20, 4324 currentValue = tween ? 4325 function() { return tween.cur(); } : 4326 function() { return jQuery.css( elem, prop, "" ); }, 4327 initial = currentValue(), 4328 unit = valueParts && valueParts[ 3 ] || ( jQuery.cssNumber[ prop ] ? "" : "px" ), 4329 4330 // Starting value computation is required for potential unit mismatches 4331 initialInUnit = ( jQuery.cssNumber[ prop ] || unit !== "px" && +initial ) && 4332 rcssNum.exec( jQuery.css( elem, prop ) ); 4333 4334 if ( initialInUnit && initialInUnit[ 3 ] !== unit ) { 4335 4336 // Trust units reported by jQuery.css 4337 unit = unit || initialInUnit[ 3 ]; 4338 4339 // Make sure we update the tween properties later on 4340 valueParts = valueParts || []; 4341 4342 // Iteratively approximate from a nonzero starting point 4343 initialInUnit = +initial || 1; 4344 4345 do { 4346 4347 // If previous iteration zeroed out, double until we get *something*. 4348 // Use string for doubling so we don't accidentally see scale as unchanged below 4349 scale = scale || ".5"; 4350 4351 // Adjust and apply 4352 initialInUnit = initialInUnit / scale; 4353 jQuery.style( elem, prop, initialInUnit + unit ); 4354 4355 // Update scale, tolerating zero or NaN from tween.cur() 4356 // Break the loop if scale is unchanged or perfect, or if we've just had enough. 4357 } while ( 4358 scale !== ( scale = currentValue() / initial ) && scale !== 1 && --maxIterations 4359 ); 4360 } 4361 4362 if ( valueParts ) { 4363 initialInUnit = +initialInUnit || +initial || 0; 4364 4365 // Apply relative offset (+=/-=) if specified 4366 adjusted = valueParts[ 1 ] ? 4367 initialInUnit + ( valueParts[ 1 ] + 1 ) * valueParts[ 2 ] : 4368 +valueParts[ 2 ]; 4369 if ( tween ) { 4370 tween.unit = unit; 4371 tween.start = initialInUnit; 4372 tween.end = adjusted; 4373 } 4374 } 4375 return adjusted; 4376} 4377 4378 4379// Multifunctional method to get and set values of a collection 4380// The value/s can optionally be executed if it's a function 4381var access = function( elems, fn, key, value, chainable, emptyGet, raw ) { 4382 var i = 0, 4383 length = elems.length, 4384 bulk = key == null; 4385 4386 // Sets many values 4387 if ( jQuery.type( key ) === "object" ) { 4388 chainable = true; 4389 for ( i in key ) { 4390 access( elems, fn, i, key[ i ], true, emptyGet, raw ); 4391 } 4392 4393 // Sets one value 4394 } else if ( value !== undefined ) { 4395 chainable = true; 4396 4397 if ( !jQuery.isFunction( value ) ) { 4398 raw = true; 4399 } 4400 4401 if ( bulk ) { 4402 4403 // Bulk operations run against the entire set 4404 if ( raw ) { 4405 fn.call( elems, value ); 4406 fn = null; 4407 4408 // ...except when executing function values 4409 } else { 4410 bulk = fn; 4411 fn = function( elem, key, value ) {
4412 return bulk.call( jQuery( elem ), value ); 4413 }; 4414 } 4415 } 4416 4417 if ( fn ) { 4418 for ( ; i < length; i++ ) { 4419 fn( 4420 elems[ i ], 4421 key, 4422 raw ? value : value.call( elems[ i ], i, fn( elems[ i ], key ) ) 4423 ); 4424 } 4425 } 4426 } 4427 4428 return chainable ? 4429 elems : 4430 4431 // Gets 4432 bulk ? 4433 fn.call( elems ) : 4434 length ? fn( elems[ 0 ], key ) : emptyGet; 4435}; 4436var rcheckableType = ( /^(?:checkbox|radio)$/i ); 4437 4438var rtagName = ( /<([\w:-]+)/ ); 4439 4440var rscriptType = ( /^$|\/(?:java|ecma)script/i ); 4441 4442var rleadingWhitespace = ( /^\s+/ ); 4443 4444var nodeNames = "abbr|article|aside|audio|bdi|canvas|data|datalist|" + 4445 "details|dialog|figcaption|figure|footer|header|hgroup|main|" + 4446 "mark|meter|nav|output|picture|progress|section|summary|template|time|video"; 4447 4448 4449 4450function createSafeFragment( document ) { 4451 var list = nodeNames.split( "|" ), 4452 safeFrag = document.createDocumentFragment(); 4453 4454 if ( safeFrag.createElement ) { 4455 while ( list.length ) { 4456 safeFrag.createElement( 4457 list.pop() 4458 ); 4459 } 4460 } 4461 return safeFrag; 4462} 4463 4464 4465( function() { 4466 var div = document.createElement( "div" ), 4467 fragment = document.createDocumentFragment(), 4468 input = document.createElement( "input" ); 4469 4470 // Setup 4471 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 4472 4473 // IE strips leading whitespace when .innerHTML is used 4474 support.leadingWhitespace = div.firstChild.nodeType === 3; 4475 4476 // Make sure that tbody elements aren't automatically inserted 4477 // IE will insert them into empty tables 4478 support.tbody = !div.getElementsByTagName( "tbody" ).length; 4479 4480 // Make sure that link elements get serialized correctly by innerHTML 4481 // This requires a wrapper element in IE 4482 support.htmlSerialize = !!div.getElementsByTagName( "link" ).length; 4483 4484 // Makes sure cloning an html5 element does not cause problems 4485 // Where outerHTML is undefined, this still works 4486 support.html5Clone = 4487 document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>"; 4488 4489 // Check if a disconnected checkbox will retain its checked 4490 // value of true after appended to the DOM (IE6/7) 4491 input.type = "checkbox"; 4492 input.checked = true; 4493 fragment.appendChild( input ); 4494 support.appendChecked = input.checked; 4495 4496 // Make sure textarea (and checkbox) defaultValue is properly cloned 4497 // Support: IE6-IE11+ 4498 div.innerHTML = "<textarea>x</textarea>"; 4499 support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue; 4500 4501 // #11217 - WebKit loses check when the name is after the checked attribute 4502 fragment.appendChild( div ); 4503 4504 // Support: Windows Web Apps (WWA) 4505 // `name` and `type` must use .setAttribute for WWA (#14901) 4506 input = document.createElement( "input" ); 4507 input.setAttribute( "type", "radio" ); 4508 input.setAttribute( "checked", "checked" ); 4509 input.setAttribute( "name", "t" ); 4510 4511 div.appendChild( input ); 4512 4513 // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3 4514 // old WebKit doesn't clone checked state correctly in fragments 4515 support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked; 4516 4517 // Support: IE<9 4518 // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+ 4519 support.noCloneEvent = !!div.addEventListener; 4520 4521 // Support: IE<9 4522 // Since attributes and properties are the same in IE, 4523 // cleanData must set properties to undefined rather than use removeAttribute 4524 div[ jQuery.expando ] = 1; 4525 support.attributes = !div.getAttribute( jQuery.expando ); 4526} )(); 4527 4528 4529// We have to close these tags to support XHTML (#13200) 4530var wrapMap = { 4531 option: [ 1, "<select multiple='multiple'>", "</select>" ], 4532 legend: [ 1, "<fieldset>", "</fieldset>" ], 4533 area: [ 1, "<map>", "</map>" ], 4534 4535 // Support: IE8 4536 param: [ 1, "<object>", "</object>" ], 4537 thead: [ 1, "<table>", "</table>" ], 4538 tr: [ 2, "<table><tbody>", "</tbody></table>" ], 4539 col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ], 4540 td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ], 4541 4542 // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags, 4543 // unless wrapped in a div with non-breaking characters in front of it. 4544 _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ] 4545}; 4546 4547// Support: IE8-IE9 4548wrapMap.optgroup = wrapMap.option; 4549 4550wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; 4551wrapMap.th = wrapMap.td; 4552 4553 4554function getAll( context, tag ) { 4555 var elems, elem, 4556 i = 0, 4557 found = typeof context.getElementsByTagName !== "undefined" ? 4558 context.getElementsByTagName( tag || "*" ) : 4559 typeof context.querySelectorAll !== "undefined" ? 4560 context.querySelectorAll( tag || "*" ) : 4561 undefined; 4562 4563 if ( !found ) { 4564 for ( found = [], elems = context.childNodes || context; 4565 ( elem = elems[ i ] ) != null; 4566 i++ 4567 ) { 4568 if ( !tag || jQuery.nodeName( elem, tag ) ) { 4569 found.push( elem ); 4570 } else { 4571 jQuery.merge( found, getAll( elem, tag ) ); 4572 } 4573 } 4574 } 4575 4576 return tag === undefined || tag && jQuery.nodeName( context, tag ) ? 4577 jQuery.merge( [ context ], found ) : 4578 found; 4579} 4580 4581 4582// Mark scripts as having already been evaluated 4583function setGlobalEval( elems, refElements ) { 4584 var elem, 4585 i = 0; 4586 for ( ; ( elem = elems[ i ] ) != null; i++ ) { 4587 jQuery._data( 4588 elem, 4589 "globalEval", 4590 !refElements || jQuery._data( refElements[ i ], "globalEval" ) 4591 ); 4592 } 4593} 4594 4595
vendor: 45,546 bytes, lines 4596-6228
4596var rhtml = /<|&#?\w+;/, 4597 rtbody = /<tbody/i; 4598 4599function fixDefaultChecked( elem ) { 4600 if ( rcheckableType.test( elem.type ) ) { 4601 elem.defaultChecked = elem.checked; 4602 } 4603} 4604 4605function buildFragment( elems, context, scripts, selection, ignored ) { 4606 var j, elem, contains, 4607 tmp, tag, tbody, wrap, 4608 l = elems.length, 4609 4610 // Ensure a safe fragment 4611 safe = createSafeFragment( context ), 4612 4613 nodes = [], 4614 i = 0; 4615 4616 for ( ; i < l; i++ ) { 4617 elem = elems[ i ]; 4618 4619 if ( elem || elem === 0 ) { 4620 4621 // Add nodes directly 4622 if ( jQuery.type( elem ) === "object" ) { 4623 jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem ); 4624 4625 // Convert non-html into a text node 4626 } else if ( !rhtml.test( elem ) ) { 4627 nodes.push( context.createTextNode( elem ) ); 4628 4629 // Convert html into DOM nodes 4630 } else { 4631 tmp = tmp || safe.appendChild( context.createElement( "div" ) ); 4632 4633 // Deserialize a standard representation 4634 tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase(); 4635 wrap = wrapMap[ tag ] || wrapMap._default; 4636 4637 tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ]; 4638 4639 // Descend through wrappers to the right content 4640 j = wrap[ 0 ]; 4641 while ( j-- ) { 4642 tmp = tmp.lastChild; 4643 } 4644 4645 // Manually add leading whitespace removed by IE 4646 if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) { 4647 nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) ); 4648 } 4649 4650 // Remove IE's autoinserted <tbody> from table fragments 4651 if ( !support.tbody ) { 4652 4653 // String was a <table>, *may* have spurious <tbody> 4654 elem = tag === "table" && !rtbody.test( elem ) ? 4655 tmp.firstChild : 4656 4657 // String was a bare <thead> or <tfoot> 4658 wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ? 4659 tmp : 4660 0; 4661 4662 j = elem && elem.childNodes.length; 4663 while ( j-- ) { 4664 if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) && 4665 !tbody.childNodes.length ) { 4666 4667 elem.removeChild( tbody ); 4668 } 4669 } 4670 } 4671 4672 jQuery.merge( nodes, tmp.childNodes ); 4673 4674 // Fix #12392 for WebKit and IE > 9 4675 tmp.textContent = ""; 4676 4677 // Fix #12392 for oldIE 4678 while ( tmp.firstChild ) { 4679 tmp.removeChild( tmp.firstChild ); 4680 } 4681 4682 // Remember the top-level container for proper cleanup 4683 tmp = safe.lastChild; 4684 } 4685 } 4686 } 4687 4688 // Fix #11356: Clear elements from fragment 4689 if ( tmp ) { 4690 safe.removeChild( tmp ); 4691 } 4692 4693 // Reset defaultChecked for any radios and checkboxes 4694 // about to be appended to the DOM in IE 6/7 (#8060) 4695 if ( !support.appendChecked ) { 4696 jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked ); 4697 } 4698 4699 i = 0; 4700 while ( ( elem = nodes[ i++ ] ) ) { 4701 4702 // Skip elements already in the context collection (trac-4087) 4703 if ( selection && jQuery.inArray( elem, selection ) > -1 ) { 4704 if ( ignored ) { 4705 ignored.push( elem ); 4706 } 4707 4708 continue; 4709 } 4710 4711 contains = jQuery.contains( elem.ownerDocument, elem ); 4712 4713 // Append to fragment 4714 tmp = getAll( safe.appendChild( elem ), "script" ); 4715 4716 // Preserve script evaluation history 4717 if ( contains ) { 4718 setGlobalEval( tmp ); 4719 } 4720 4721 // Capture executables 4722 if ( scripts ) { 4723 j = 0; 4724 while ( ( elem = tmp[ j++ ] ) ) { 4725 if ( rscriptType.test( elem.type || "" ) ) { 4726 scripts.push( elem ); 4727 } 4728 } 4729 } 4730 } 4731 4732 tmp = null; 4733 4734 return safe; 4735} 4736 4737 4738( function() { 4739 var i, eventName, 4740 div = document.createElement( "div" ); 4741 4742 // Support: IE<9 (lack submit/change bubble), Firefox (lack focus(in | out) events) 4743 for ( i in { submit: true, change: true, focusin: true } ) { 4744 eventName = "on" + i; 4745 4746 if ( !( support[ i ] = eventName in window ) ) { 4747 4748 // Beware of CSP restrictions (https://developer.mozilla.org/en/Security/CSP) 4749 div.setAttribute( eventName, "t" ); 4750 support[ i ] = div.attributes[ eventName ].expando === false; 4751 } 4752 } 4753 4754 // Null elements to avoid leaks in IE. 4755 div = null; 4756} )(); 4757 4758 4759var rformElems = /^(?:input|select|textarea)$/i, 4760 rkeyEvent = /^key/, 4761 rmouseEvent = /^(?:mouse|pointer|contextmenu|drag|drop)|click/, 4762 rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, 4763 rtypenamespace = /^([^.]*)(?:\.(.+)|)/; 4764 4765function returnTrue() { 4766 return true; 4767} 4768 4769function returnFalse() { 4770 return false; 4771} 4772 4773// Support: IE9 4774// See #13393 for more info 4775function safeActiveElement() { 4776 try { 4777 return document.activeElement; 4778 } catch ( err ) { } 4779} 4780 4781function on( elem, types, selector, data, fn, one ) { 4782 var origFn, type; 4783 4784 // Types can be a map of types/handlers 4785 if ( typeof types === "object" ) { 4786 4787 // ( types-Object, selector, data ) 4788 if ( typeof selector !== "string" ) { 4789 4790 // ( types-Object, data ) 4791 data = data || selector; 4792 selector = undefined; 4793 } 4794 for ( type in types ) { 4795 on( elem, type, selector, data, types[ type ], one ); 4796 } 4797 return elem; 4798 } 4799 4800 if ( data == null && fn == null ) { 4801 4802 // ( types, fn ) 4803 fn = selector; 4804 data = selector = undefined; 4805 } else if ( fn == null ) { 4806 if ( typeof selector === "string" ) { 4807 4808 // ( types, selector, fn ) 4809 fn = data; 4810 data = undefined; 4811 } else { 4812 4813 // ( types, data, fn ) 4814 fn = data; 4815 data = selector; 4816 selector = undefined; 4817 } 4818 } 4819 if ( fn === false ) { 4820 fn = returnFalse; 4821 } else if ( !fn ) { 4822 return elem; 4823 } 4824 4825 if ( one === 1 ) { 4826 origFn = fn; 4827 fn = function( event ) { 4828 4829 // Can use an empty set, since event contains the info 4830 jQuery().off( event ); 4831 return origFn.apply( this, arguments ); 4832 }; 4833 4834 // Use same guid so caller can remove using origFn 4835 fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); 4836 } 4837 return elem.each( function() { 4838 jQuery.event.add( this, types, fn, data, selector ); 4839 } ); 4840} 4841 4842/* 4843 * Helper functions for managing events -- not part of the public interface. 4844 * Props to Dean Edwards' addEvent library for many of the ideas. 4845 */ 4846jQuery.event = { 4847 4848 global: {}, 4849 4850 add: function( elem, types, handler, data, selector ) { 4851 var tmp, events, t, handleObjIn, 4852 special, eventHandle, handleObj, 4853 handlers, type, namespaces, origType, 4854 elemData = jQuery._data( elem ); 4855 4856 // Don't attach events to noData or text/comment nodes (but allow plain objects) 4857 if ( !elemData ) { 4858 return; 4859 } 4860 4861 // Caller can pass in an object of custom data in lieu of the handler 4862 if ( handler.handler ) { 4863 handleObjIn = handler; 4864 handler = handleObjIn.handler; 4865 selector = handleObjIn.selector; 4866 } 4867 4868 // Make sure that the handler has a unique ID, used to find/remove it later 4869 if ( !handler.guid ) { 4870 handler.guid = jQuery.guid++; 4871 } 4872 4873 // Init the element's event structure and main handler, if this is the first 4874 if ( !( events = elemData.events ) ) { 4875 events = elemData.events = {}; 4876 } 4877 if ( !( eventHandle = elemData.handle ) ) { 4878 eventHandle = elemData.handle = function( e ) { 4879 4880 // Discard the second event of a jQuery.event.trigger() and 4881 // when an event is called after a page has unloaded 4882 return typeof jQuery !== "undefined" && 4883 ( !e || jQuery.event.triggered !== e.type ) ? 4884 jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : 4885 undefined; 4886 }; 4887 4888 // Add elem as a property of the handle fn to prevent a memory leak 4889 // with IE non-native events 4890 eventHandle.elem = elem; 4891 } 4892 4893 // Handle multiple events separated by a space 4894 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4895 t = types.length; 4896 while ( t-- ) { 4897 tmp = rtypenamespace.exec( types[ t ] ) || []; 4898 type = origType = tmp[ 1 ]; 4899 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4900 4901 // There *must* be a type, no attaching namespace-only handlers 4902 if ( !type ) { 4903 continue; 4904 } 4905 4906 // If event changes its type, use the special event handlers for the changed type 4907 special = jQuery.event.special[ type ] || {}; 4908 4909 // If selector defined, determine special event api type, otherwise given type 4910 type = ( selector ? special.delegateType : special.bindType ) || type; 4911 4912 // Update special based on newly reset type 4913 special = jQuery.event.special[ type ] || {}; 4914 4915 // handleObj is passed to all event handlers 4916 handleObj = jQuery.extend( { 4917 type: type, 4918 origType: origType, 4919 data: data, 4920 handler: handler, 4921 guid: handler.guid, 4922 selector: selector, 4923 needsContext: selector && jQuery.expr.match.needsContext.test( selector ), 4924 namespace: namespaces.join( "." ) 4925 }, handleObjIn ); 4926 4927 // Init the event handler queue if we're the first 4928 if ( !( handlers = events[ type ] ) ) { 4929 handlers = events[ type ] = []; 4930 handlers.delegateCount = 0; 4931 4932 // Only use addEventListener/attachEvent if the special events handler returns false 4933 if ( !special.setup || 4934 special.setup.call( elem, data, namespaces, eventHandle ) === false ) { 4935 4936 // Bind the global event handler to the element 4937 if ( elem.addEventListener ) { 4938 elem.addEventListener( type, eventHandle, false ); 4939 4940 } else if ( elem.attachEvent ) { 4941 elem.attachEvent( "on" + type, eventHandle ); 4942 } 4943 } 4944 } 4945 4946 if ( special.add ) { 4947 special.add.call( elem, handleObj ); 4948 4949 if ( !handleObj.handler.guid ) { 4950 handleObj.handler.guid = handler.guid; 4951 } 4952 } 4953 4954 // Add to the element's handler list, delegates in front 4955 if ( selector ) { 4956 handlers.splice( handlers.delegateCount++, 0, handleObj ); 4957 } else { 4958 handlers.push( handleObj ); 4959 } 4960 4961 // Keep track of which events have ever been used, for event optimization 4962 jQuery.event.global[ type ] = true; 4963 } 4964 4965 // Nullify elem to prevent memory leaks in IE 4966 elem = null; 4967 }, 4968 4969 // Detach an event or set of events from an element 4970 remove: function( elem, types, handler, selector, mappedTypes ) { 4971 var j, handleObj, tmp, 4972 origCount, t, events, 4973 special, handlers, type, 4974 namespaces, origType, 4975 elemData = jQuery.hasData( elem ) && jQuery._data( elem ); 4976 4977 if ( !elemData || !( events = elemData.events ) ) { 4978 return; 4979 } 4980 4981 // Once for each type.namespace in types; type may be omitted 4982 types = ( types || "" ).match( rnotwhite ) || [ "" ]; 4983 t = types.length; 4984 while ( t-- ) { 4985 tmp = rtypenamespace.exec( types[ t ] ) || []; 4986 type = origType = tmp[ 1 ]; 4987 namespaces = ( tmp[ 2 ] || "" ).split( "." ).sort(); 4988 4989 // Unbind all events (on this namespace, if provided) for the element 4990 if ( !type ) { 4991 for ( type in events ) { 4992 jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); 4993 } 4994 continue; 4995 } 4996 4997 special = jQuery.event.special[ type ] || {}; 4998 type = ( selector ? special.delegateType : special.bindType ) || type; 4999 handlers = events[ type ] || []; 5000 tmp = tmp[ 2 ] && 5001 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ); 5002 5003 // Remove matching events 5004 origCount = j = handlers.length; 5005 while ( j-- ) { 5006 handleObj = handlers[ j ]; 5007 5008 if ( ( mappedTypes || origType === handleObj.origType ) && 5009 ( !handler || handler.guid === handleObj.guid ) && 5010 ( !tmp || tmp.test( handleObj.namespace ) ) && 5011 ( !selector || selector === handleObj.selector || 5012 selector === "**" && handleObj.selector ) ) { 5013 handlers.splice( j, 1 ); 5014 5015 if ( handleObj.selector ) { 5016 handlers.delegateCount--; 5017 } 5018 if ( special.remove ) { 5019 special.remove.call( elem, handleObj ); 5020 } 5021 } 5022 } 5023 5024 // Remove generic event handler if we removed something and no more handlers exist 5025 // (avoids potential for endless recursion during removal of special event handlers) 5026 if ( origCount && !handlers.length ) { 5027 if ( !special.teardown || 5028 special.teardown.call( elem, namespaces, elemData.handle ) === false ) { 5029 5030 jQuery.removeEvent( elem, type, elemData.handle ); 5031 } 5032 5033 delete events[ type ]; 5034 } 5035 } 5036 5037 // Remove the expando if it's no longer used 5038 if ( jQuery.isEmptyObject( events ) ) { 5039 delete elemData.handle; 5040 5041 // removeData also checks for emptiness and clears the expando if empty 5042 // so use it instead of delete 5043 jQuery._removeData( elem, "events" ); 5044 } 5045 }, 5046 5047 trigger: function( event, data, elem, onlyHandlers ) { 5048 var handle, ontype, cur, 5049 bubbleType, special, tmp, i, 5050 eventPath = [ elem || document ], 5051 type = hasOwn.call( event, "type" ) ? event.type : event, 5052 namespaces = hasOwn.call( event, "namespace" ) ? event.namespace.split( "." ) : []; 5053 5054 cur = tmp = elem = elem || document; 5055 5056 // Don't do events on text and comment nodes 5057 if ( elem.nodeType === 3 || elem.nodeType === 8 ) { 5058 return; 5059 } 5060 5061 // focus/blur morphs to focusin/out; ensure we're not firing them right now 5062 if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { 5063 return; 5064 } 5065 5066 if ( type.indexOf( "." ) > -1 ) { 5067 5068 // Namespaced trigger; create a regexp to match event type in handle() 5069 namespaces = type.split( "." ); 5070 type = namespaces.shift(); 5071 namespaces.sort(); 5072 } 5073 ontype = type.indexOf( ":" ) < 0 && "on" + type; 5074 5075 // Caller can pass in a jQuery.Event object, Object, or just an event type string 5076 event = event[ jQuery.expando ] ? 5077 event : 5078 new jQuery.Event( type, typeof event === "object" && event ); 5079 5080 // Trigger bitmask: & 1 for native handlers; & 2 for jQuery (always true) 5081 event.isTrigger = onlyHandlers ? 2 : 3; 5082 event.namespace = namespaces.join( "." ); 5083 event.rnamespace = event.namespace ? 5084 new RegExp( "(^|\\.)" + namespaces.join( "\\.(?:.*\\.|)" ) + "(\\.|$)" ) : 5085 null; 5086 5087 // Clean up the event in case it is being reused 5088 event.result = undefined; 5089 if ( !event.target ) { 5090 event.target = elem; 5091 } 5092 5093 // Clone any incoming data and prepend the event, creating the handler arg list 5094 data = data == null ? 5095 [ event ] : 5096 jQuery.makeArray( data, [ event ] ); 5097 5098 // Allow special events to draw outside the lines 5099 special = jQuery.event.special[ type ] || {}; 5100 if ( !onlyHandlers && special.trigger && special.trigger.apply( elem, data ) === false ) { 5101 return; 5102 } 5103 5104 // Determine event propagation path in advance, per W3C events spec (#9951) 5105 // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) 5106 if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { 5107 5108 bubbleType = special.delegateType || type; 5109 if ( !rfocusMorph.test( bubbleType + type ) ) { 5110 cur = cur.parentNode; 5111 } 5112 for ( ; cur; cur = cur.parentNode ) { 5113 eventPath.push( cur ); 5114 tmp = cur; 5115 } 5116 5117 // Only add window if we got to document (e.g., not plain obj or detached DOM) 5118 if ( tmp === ( elem.ownerDocument || document ) ) { 5119 eventPath.push( tmp.defaultView || tmp.parentWindow || window ); 5120 } 5121 } 5122 5123 // Fire handlers on the event path 5124 i = 0; 5125 while ( ( cur = eventPath[ i++ ] ) && !event.isPropagationStopped() ) { 5126 5127 event.type = i > 1 ? 5128 bubbleType : 5129 special.bindType || type; 5130 5131 // jQuery handler 5132 handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && 5133 jQuery._data( cur, "handle" ); 5134 5135 if ( handle ) { 5136 handle.apply( cur, data ); 5137 } 5138 5139 // Native handler 5140 handle = ontype && cur[ ontype ]; 5141 if ( handle && handle.apply && acceptData( cur ) ) { 5142 event.result = handle.apply( cur, data ); 5143 if ( event.result === false ) { 5144 event.preventDefault(); 5145 } 5146 } 5147 } 5148 event.type = type; 5149 5150 // If nobody prevented the default action, do it now 5151 if ( !onlyHandlers && !event.isDefaultPrevented() ) { 5152 5153 if ( 5154 ( !special._default || 5155 special._default.apply( eventPath.pop(), data ) === false 5156 ) && acceptData( elem ) 5157 ) { 5158 5159 // Call a native DOM method on the target with the same name name as the event. 5160 // Can't use an .isFunction() check here because IE6/7 fails that test. 5161 // Don't do default actions on window, that's where global variables be (#6170) 5162 if ( ontype && elem[ type ] && !jQuery.isWindow( elem ) ) { 5163 5164 // Don't re-trigger an onFOO event when we call its FOO() method 5165 tmp = elem[ ontype ]; 5166 5167 if ( tmp ) { 5168 elem[ ontype ] = null; 5169 } 5170 5171 // Prevent re-triggering of the same event, since we already bubbled it above 5172 jQuery.event.triggered = type; 5173 try { 5174 elem[ type ](); 5175 } catch ( e ) { 5176 5177 // IE<9 dies on focus/blur to hidden element (#1486,#12518) 5178 // only reproducible on winXP IE8 native, not IE9 in IE8 mode 5179 } 5180 jQuery.event.triggered = undefined; 5181 5182 if ( tmp ) { 5183 elem[ ontype ] = tmp; 5184 } 5185 } 5186 } 5187 } 5188 5189 return event.result; 5190 }, 5191 5192 dispatch: function( event ) { 5193 5194 // Make a writable jQuery.Event from the native event object 5195 event = jQuery.event.fix( event ); 5196 5197 var i, j, ret, matched, handleObj, 5198 handlerQueue = [], 5199 args = slice.call( arguments ), 5200 handlers = ( jQuery._data( this, "events" ) || {} )[ event.type ] || [], 5201 special = jQuery.event.special[ event.type ] || {}; 5202 5203 // Use the fix-ed jQuery.Event rather than the (read-only) native event 5204 args[ 0 ] = event; 5205 event.delegateTarget = this; 5206 5207 // Call the preDispatch hook for the mapped type, and let it bail if desired 5208 if ( special.preDispatch && special.preDispatch.call( this, event ) === false ) { 5209 return; 5210 } 5211 5212 // Determine handlers 5213 handlerQueue = jQuery.event.handlers.call( this, event, handlers ); 5214 5215 // Run delegates first; they may want to stop propagation beneath us 5216 i = 0; 5217 while ( ( matched = handlerQueue[ i++ ] ) && !event.isPropagationStopped() ) { 5218 event.currentTarget = matched.elem; 5219 5220 j = 0; 5221 while ( ( handleObj = matched.handlers[ j++ ] ) && 5222 !event.isImmediatePropagationStopped() ) { 5223 5224 // Triggered event must either 1) have no namespace, or 2) have namespace(s) 5225 // a subset or equal to those in the bound event (both can have no namespace). 5226 if ( !event.rnamespace || event.rnamespace.test( handleObj.namespace ) ) { 5227 5228 event.handleObj = handleObj; 5229 event.data = handleObj.data; 5230 5231 ret = ( ( jQuery.event.special[ handleObj.origType ] || {} ).handle || 5232 handleObj.handler ).apply( matched.elem, args ); 5233 5234 if ( ret !== undefined ) { 5235 if ( ( event.result = ret ) === false ) { 5236 event.preventDefault(); 5237 event.stopPropagation(); 5238 } 5239 } 5240 } 5241 } 5242 } 5243 5244 // Call the postDispatch hook for the mapped type 5245 if ( special.postDispatch ) { 5246 special.postDispatch.call( this, event ); 5247 } 5248 5249 return event.result; 5250 }, 5251 5252 handlers: function( event, handlers ) { 5253 var i, matches, sel, handleObj, 5254 handlerQueue = [], 5255 delegateCount = handlers.delegateCount, 5256 cur = event.target; 5257 5258 // Support (at least): Chrome, IE9 5259 // Find delegate handlers 5260 // Black-hole SVG <use> instance trees (#13180) 5261 // 5262 // Support: Firefox<=42+ 5263 // Avoid non-left-click in FF but don't block IE radio events (#3861, gh-2343) 5264 if ( delegateCount && cur.nodeType && 5265 ( event.type !== "click" || isNaN( event.button ) || event.button < 1 ) ) { 5266 5267 /* jshint eqeqeq: false */ 5268 for ( ; cur != this; cur = cur.parentNode || this ) { 5269 /* jshint eqeqeq: true */ 5270 5271 // Don't check non-elements (#13208) 5272 // Don't process clicks on disabled elements (#6911, #8165, #11382, #11764) 5273 if ( cur.nodeType === 1 && ( cur.disabled !== true || event.type !== "click" ) ) { 5274 matches = []; 5275 for ( i = 0; i < delegateCount; i++ ) { 5276 handleObj = handlers[ i ]; 5277 5278 // Don't conflict with Object.prototype properties (#13203) 5279 sel = handleObj.selector + " "; 5280 5281 if ( matches[ sel ] === undefined ) { 5282 matches[ sel ] = handleObj.needsContext ? 5283 jQuery( sel, this ).index( cur ) > -1 : 5284 jQuery.find( sel, this, null, [ cur ] ).length; 5285 } 5286 if ( matches[ sel ] ) { 5287 matches.push( handleObj ); 5288 } 5289 } 5290 if ( matches.length ) { 5291 handlerQueue.push( { elem: cur, handlers: matches } ); 5292 } 5293 } 5294 } 5295 } 5296 5297 // Add the remaining (directly-bound) handlers 5298 if ( delegateCount < handlers.length ) { 5299 handlerQueue.push( { elem: this, handlers: handlers.slice( delegateCount ) } ); 5300 } 5301 5302 return handlerQueue; 5303 }, 5304 5305 fix: function( event ) { 5306 if ( event[ jQuery.expando ] ) { 5307 return event; 5308 } 5309 5310 // Create a writable copy of the event object and normalize some properties 5311 var i, prop, copy, 5312 type = event.type, 5313 originalEvent = event, 5314 fixHook = this.fixHooks[ type ]; 5315 5316 if ( !fixHook ) { 5317 this.fixHooks[ type ] = fixHook = 5318 rmouseEvent.test( type ) ? this.mouseHooks : 5319 rkeyEvent.test( type ) ? this.keyHooks : 5320 {}; 5321 } 5322 copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; 5323 5324 event = new jQuery.Event( originalEvent ); 5325 5326 i = copy.length; 5327 while ( i-- ) { 5328 prop = copy[ i ]; 5329 event[ prop ] = originalEvent[ prop ]; 5330 } 5331 5332 // Support: IE<9 5333 // Fix target property (#1925) 5334 if ( !event.target ) { 5335 event.target = originalEvent.srcElement || document; 5336 } 5337 5338 // Support: Safari 6-8+ 5339 // Target should not be a text node (#504, #13143) 5340 if ( event.target.nodeType === 3 ) { 5341 event.target = event.target.parentNode; 5342 } 5343 5344 // Support: IE<9 5345 // For mouse/key events, metaKey==false if it's undefined (#3368, #11328) 5346 event.metaKey = !!event.metaKey; 5347 5348 return fixHook.filter ? fixHook.filter( event, originalEvent ) : event; 5349 }, 5350 5351 // Includes some event props shared by KeyEvent and MouseEvent 5352 props: ( "altKey bubbles cancelable ctrlKey currentTarget detail eventPhase " + 5353 "metaKey relatedTarget shiftKey target timeStamp view which" ).split( " " ), 5354 5355 fixHooks: {}, 5356 5357 keyHooks: { 5358 props: "char charCode key keyCode".split( " " ), 5359 filter: function( event, original ) { 5360 5361 // Add which for key events 5362 if ( event.which == null ) { 5363 event.which = original.charCode != null ? original.charCode : original.keyCode; 5364 } 5365 5366 return event; 5367 } 5368 }, 5369 5370 mouseHooks: { 5371 props: ( "button buttons clientX clientY fromElement offsetX offsetY " + 5372 "pageX pageY screenX screenY toElement" ).split( " " ), 5373 filter: function( event, original ) { 5374 var body, eventDoc, doc, 5375 button = original.button, 5376 fromElement = original.fromElement; 5377 5378 // Calculate pageX/Y if missing and clientX/Y available 5379 if ( event.pageX == null && original.clientX != null ) { 5380 eventDoc = event.target.ownerDocument || document; 5381 doc = eventDoc.documentElement; 5382 body = eventDoc.body; 5383 5384 event.pageX = original.clientX + 5385 ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - 5386 ( doc && doc.clientLeft || body && body.clientLeft || 0 ); 5387 event.pageY = original.clientY + 5388 ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - 5389 ( doc && doc.clientTop || body && body.clientTop || 0 ); 5390 } 5391 5392 // Add relatedTarget, if necessary 5393 if ( !event.relatedTarget && fromElement ) { 5394 event.relatedTarget = fromElement === event.target ? 5395 original.toElement : 5396 fromElement; 5397 } 5398 5399 // Add which for click: 1 === left; 2 === middle; 3 === right 5400 // Note: button is not normalized, so don't use it 5401 if ( !event.which && button !== undefined ) { 5402 event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); 5403 } 5404 5405 return event; 5406 } 5407 }, 5408 5409 special: { 5410 load: { 5411 5412 // Prevent triggered image.load events from bubbling to window.load 5413 noBubble: true 5414 }, 5415 focus: { 5416 5417 // Fire native event if possible so blur/focus sequence is correct 5418 trigger: function() { 5419 if ( this !== safeActiveElement() && this.focus ) { 5420 try { 5421 this.focus(); 5422 return false; 5423 } catch ( e ) { 5424 5425 // Support: IE<9 5426 // If we error on focus to hidden element (#1486, #12518), 5427 // let .trigger() run the handlers 5428 } 5429 } 5430 }, 5431 delegateType: "focusin" 5432 }, 5433 blur: { 5434 trigger: function() { 5435 if ( this === safeActiveElement() && this.blur ) { 5436 this.blur(); 5437 return false; 5438 } 5439 }, 5440 delegateType: "focusout" 5441 }, 5442 click: { 5443 5444 // For checkbox, fire native event so checked state will be right 5445 trigger: function() { 5446 if ( jQuery.nodeName( this, "input" ) && this.type === "checkbox" && this.click ) { 5447 this.click(); 5448 return false; 5449 } 5450 }, 5451 5452 // For cross-browser consistency, don't fire native .click() on links 5453 _default: function( event ) { 5454 return jQuery.nodeName( event.target, "a" ); 5455 } 5456 }, 5457 5458 beforeunload: { 5459 postDispatch: function( event ) { 5460 5461 // Support: Firefox 20+ 5462 // Firefox doesn't alert if the returnValue field is not set. 5463 if ( event.result !== undefined && event.originalEvent ) { 5464 event.originalEvent.returnValue = event.result; 5465 } 5466 } 5467 } 5468 }, 5469 5470 // Piggyback on a donor event to simulate a different one 5471 simulate: function( type, elem, event ) { 5472 var e = jQuery.extend( 5473 new jQuery.Event(), 5474 event, 5475 { 5476 type: type, 5477 isSimulated: true 5478 5479 // Previously, `originalEvent: {}` was set here, so stopPropagation call 5480 // would not be triggered on donor event, since in our own 5481 // jQuery.event.stopPropagation function we had a check for existence of 5482 // originalEvent.stopPropagation method, so, consequently it would be a noop. 5483 // 5484 // Guard for simulated events was moved to jQuery.event.stopPropagation function 5485 // since `originalEvent` should point to the original event for the 5486 // constancy with other events and for more focused logic 5487 } 5488 ); 5489 5490 jQuery.event.trigger( e, null, elem ); 5491 5492 if ( e.isDefaultPrevented() ) { 5493 event.preventDefault(); 5494 } 5495 } 5496}; 5497 5498jQuery.removeEvent = document.removeEventListener ? 5499 function( elem, type, handle ) { 5500 5501 // This "if" is needed for plain objects 5502 if ( elem.removeEventListener ) { 5503 elem.removeEventListener( type, handle ); 5504 } 5505 } : 5506 function( elem, type, handle ) { 5507 var name = "on" + type; 5508 5509 if ( elem.detachEvent ) { 5510 5511 // #8545, #7054, preventing memory leaks for custom events in IE6-8 5512 // detachEvent needed property on element, by name of that event, 5513 // to properly expose it to GC 5514 if ( typeof elem[ name ] === "undefined" ) { 5515 elem[ name ] = null; 5516 } 5517 5518 elem.detachEvent( name, handle ); 5519 } 5520 }; 5521 5522jQuery.Event = function( src, props ) { 5523 5524 // Allow instantiation without the 'new' keyword 5525 if ( !( this instanceof jQuery.Event ) ) { 5526 return new jQuery.Event( src, props ); 5527 } 5528 5529 // Event object 5530 if ( src && src.type ) { 5531 this.originalEvent = src; 5532 this.type = src.type; 5533 5534 // Events bubbling up the document may have been marked as prevented 5535 // by a handler lower down the tree; reflect the correct value. 5536 this.isDefaultPrevented = src.defaultPrevented || 5537 src.defaultPrevented === undefined && 5538 5539 // Support: IE < 9, Android < 4.0 5540 src.returnValue === false ? 5541 returnTrue : 5542 returnFalse; 5543 5544 // Event type 5545 } else { 5546 this.type = src; 5547 } 5548 5549 // Put explicitly provided properties onto the event object 5550 if ( props ) { 5551 jQuery.extend( this, props ); 5552 } 5553 5554 // Create a timestamp if incoming event doesn't have one 5555 this.timeStamp = src && src.timeStamp || jQuery.now(); 5556 5557 // Mark it as fixed 5558 this[ jQuery.expando ] = true; 5559}; 5560 5561// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding 5562// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html 5563jQuery.Event.prototype = { 5564 constructor: jQuery.Event, 5565 isDefaultPrevented: returnFalse, 5566 isPropagationStopped: returnFalse, 5567 isImmediatePropagationStopped: returnFalse, 5568 5569 preventDefault: function() { 5570 var e = this.originalEvent; 5571 5572 this.isDefaultPrevented = returnTrue; 5573 if ( !e ) { 5574 return; 5575 } 5576 5577 // If preventDefault exists, run it on the original event 5578 if ( e.preventDefault ) { 5579 e.preventDefault(); 5580 5581 // Support: IE 5582 // Otherwise set the returnValue property of the original event to false 5583 } else { 5584 e.returnValue = false; 5585 } 5586 }, 5587 stopPropagation: function() { 5588 var e = this.originalEvent; 5589 5590 this.isPropagationStopped = returnTrue; 5591 5592 if ( !e || this.isSimulated ) { 5593 return; 5594 } 5595 5596 // If stopPropagation exists, run it on the original event 5597 if ( e.stopPropagation ) { 5598 e.stopPropagation(); 5599 } 5600 5601 // Support: IE 5602 // Set the cancelBubble property of the original event to true 5603 e.cancelBubble = true; 5604 }, 5605 stopImmediatePropagation: function() { 5606 var e = this.originalEvent; 5607 5608 this.isImmediatePropagationStopped = returnTrue; 5609 5610 if ( e && e.stopImmediatePropagation ) { 5611 e.stopImmediatePropagation(); 5612 } 5613 5614 this.stopPropagation(); 5615 } 5616}; 5617 5618// Create mouseenter/leave events using mouseover/out and event-time checks 5619// so that event delegation works in jQuery. 5620// Do the same for pointerenter/pointerleave and pointerover/pointerout 5621// 5622// Support: Safari 7 only 5623// Safari sends mouseenter too often; see: 5624// https://code.google.com/p/chromium/issues/detail?id=470258 5625// for the description of the bug (it existed in older Chrome versions as well). 5626jQuery.each( { 5627 mouseenter: "mouseover", 5628 mouseleave: "mouseout", 5629 pointerenter: "pointerover", 5630 pointerleave: "pointerout" 5631}, function( orig, fix ) { 5632 jQuery.event.special[ orig ] = { 5633 delegateType: fix, 5634 bindType: fix, 5635 5636 handle: function( event ) { 5637 var ret, 5638 target = this, 5639 related = event.relatedTarget, 5640 handleObj = event.handleObj; 5641 5642 // For mouseenter/leave call the handler if related is outside the target. 5643 // NB: No relatedTarget if the mouse left/entered the browser window 5644 if ( !related || ( related !== target && !jQuery.contains( target, related ) ) ) { 5645 event.type = handleObj.origType; 5646 ret = handleObj.handler.apply( this, arguments ); 5647 event.type = fix; 5648 } 5649 return ret; 5650 } 5651 }; 5652} ); 5653 5654// IE submit delegation 5655if ( !support.submit ) { 5656 5657 jQuery.event.special.submit = { 5658 setup: function() { 5659 5660 // Only need this for delegated form submit events 5661 if ( jQuery.nodeName( this, "form" ) ) { 5662 return false; 5663 } 5664 5665 // Lazy-add a submit handler when a descendant form may potentially be submitted 5666 jQuery.event.add( this, "click._submit keypress._submit", function( e ) { 5667 5668 // Node name check avoids a VML-related crash in IE (#9807) 5669 var elem = e.target, 5670 form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? 5671 5672 // Support: IE <=8 5673 // We use jQuery.prop instead of elem.form 5674 // to allow fixing the IE8 delegated submit issue (gh-2332) 5675 // by 3rd party polyfills/workarounds. 5676 jQuery.prop( elem, "form" ) : 5677 undefined; 5678 5679 if ( form && !jQuery._data( form, "submit" ) ) { 5680 jQuery.event.add( form, "submit._submit", function( event ) { 5681 event._submitBubble = true; 5682 } ); 5683 jQuery._data( form, "submit", true ); 5684 } 5685 } ); 5686 5687 // return undefined since we don't need an event listener 5688 }, 5689 5690 postDispatch: function( event ) { 5691 5692 // If form was submitted by the user, bubble the event up the tree 5693 if ( event._submitBubble ) { 5694 delete event._submitBubble; 5695 if ( this.parentNode && !event.isTrigger ) { 5696 jQuery.event.simulate( "submit", this.parentNode, event ); 5697 } 5698 } 5699 }, 5700 5701 teardown: function() { 5702 5703 // Only need this for delegated form submit events 5704 if ( jQuery.nodeName( this, "form" ) ) { 5705 return false; 5706 } 5707 5708 // Remove delegated handlers; cleanData eventually reaps submit handlers attached above 5709 jQuery.event.remove( this, "._submit" ); 5710 } 5711 }; 5712} 5713 5714// IE change delegation and checkbox/radio fix 5715if ( !support.change ) { 5716 5717 jQuery.event.special.change = { 5718 5719 setup: function() { 5720 5721 if ( rformElems.test( this.nodeName ) ) { 5722 5723 // IE doesn't fire change on a check/radio until blur; trigger it on click 5724 // after a propertychange. Eat the blur-change in special.change.handle. 5725 // This still fires onchange a second time for check/radio after blur. 5726 if ( this.type === "checkbox" || this.type === "radio" ) { 5727 jQuery.event.add( this, "propertychange._change", function( event ) { 5728 if ( event.originalEvent.propertyName === "checked" ) { 5729 this._justChanged = true; 5730 } 5731 } ); 5732 jQuery.event.add( this, "click._change", function( event ) { 5733 if ( this._justChanged && !event.isTrigger ) { 5734 this._justChanged = false; 5735 } 5736 5737 // Allow triggered, simulated change events (#11500) 5738 jQuery.event.simulate( "change", this, event ); 5739 } ); 5740 } 5741 return false; 5742 } 5743 5744 // Delegated event; lazy-add a change handler on descendant inputs 5745 jQuery.event.add( this, "beforeactivate._change", function( e ) { 5746 var elem = e.target; 5747 5748 if ( rformElems.test( elem.nodeName ) && !jQuery._data( elem, "change" ) ) { 5749 jQuery.event.add( elem, "change._change", function( event ) { 5750 if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { 5751 jQuery.event.simulate( "change", this.parentNode, event ); 5752 } 5753 } ); 5754 jQuery._data( elem, "change", true ); 5755 } 5756 } ); 5757 }, 5758 5759 handle: function( event ) { 5760 var elem = event.target; 5761 5762 // Swallow native change events from checkbox/radio, we already triggered them above 5763 if ( this !== elem || event.isSimulated || event.isTrigger || 5764 ( elem.type !== "radio" && elem.type !== "checkbox" ) ) { 5765 5766 return event.handleObj.handler.apply( this, arguments ); 5767 } 5768 }, 5769 5770 teardown: function() { 5771 jQuery.event.remove( this, "._change" ); 5772 5773 return !rformElems.test( this.nodeName ); 5774 } 5775 }; 5776} 5777 5778// Support: Firefox 5779// Firefox doesn't have focus(in | out) events 5780// Related ticket - https://bugzilla.mozilla.org/show_bug.cgi?id=687787 5781// 5782// Support: Chrome, Safari 5783// focus(in | out) events fire after focus & blur events, 5784// which is spec violation - http://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order 5785// Related ticket - https://code.google.com/p/chromium/issues/detail?id=449857 5786if ( !support.focusin ) { 5787 jQuery.each( { focus: "focusin", blur: "focusout" }, function( orig, fix ) { 5788 5789 // Attach a single capturing handler on the document while someone wants focusin/focusout 5790 var handler = function( event ) { 5791 jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ) ); 5792 }; 5793 5794 jQuery.event.special[ fix ] = { 5795 setup: function() { 5796 var doc = this.ownerDocument || this, 5797 attaches = jQuery._data( doc, fix ); 5798 5799 if ( !attaches ) { 5800 doc.addEventListener( orig, handler, true ); 5801 } 5802 jQuery._data( doc, fix, ( attaches || 0 ) + 1 ); 5803 }, 5804 teardown: function() { 5805 var doc = this.ownerDocument || this, 5806 attaches = jQuery._data( doc, fix ) - 1; 5807 5808 if ( !attaches ) { 5809 doc.removeEventListener( orig, handler, true ); 5810 jQuery._removeData( doc, fix ); 5811 } else { 5812 jQuery._data( doc, fix, attaches ); 5813 } 5814 } 5815 }; 5816 } ); 5817} 5818 5819jQuery.fn.extend( { 5820 5821 on: function( types, selector, data, fn ) { 5822 return on( this, types, selector, data, fn ); 5823 }, 5824 one: function( types, selector, data, fn ) { 5825 return on( this, types, selector, data, fn, 1 ); 5826 }, 5827 off: function( types, selector, fn ) { 5828 var handleObj, type; 5829 if ( types && types.preventDefault && types.handleObj ) { 5830 5831 // ( event ) dispatched jQuery.Event 5832 handleObj = types.handleObj; 5833 jQuery( types.delegateTarget ).off( 5834 handleObj.namespace ? 5835 handleObj.origType + "." + handleObj.namespace : 5836 handleObj.origType, 5837 handleObj.selector, 5838 handleObj.handler 5839 ); 5840 return this; 5841 } 5842 if ( typeof types === "object" ) { 5843 5844 // ( types-object [, selector] ) 5845 for ( type in types ) { 5846 this.off( type, selector, types[ type ] ); 5847 } 5848 return this; 5849 } 5850 if ( selector === false || typeof selector === "function" ) { 5851 5852 // ( types [, fn] ) 5853 fn = selector; 5854 selector = undefined; 5855 } 5856 if ( fn === false ) { 5857 fn = returnFalse; 5858 } 5859 return this.each( function() { 5860 jQuery.event.remove( this, types, fn, selector ); 5861 } ); 5862 }, 5863 5864 trigger: function( type, data ) { 5865 return this.each( function() { 5866 jQuery.event.trigger( type, data, this ); 5867 } ); 5868 }, 5869 triggerHandler: function( type, data ) { 5870 var elem = this[ 0 ]; 5871 if ( elem ) { 5872 return jQuery.event.trigger( type, data, elem, true ); 5873 } 5874 } 5875} ); 5876 5877 5878var rinlinejQuery = / jQuery\d+="(?:null|\d+)"/g, 5879 rnoshimcache = new RegExp( "<(?:" + nodeNames + ")[\\s/>]", "i" ), 5880 rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi, 5881 5882 // Support: IE 10-11, Edge 10240+ 5883 // In IE/Edge using regex groups here causes severe slowdowns. 5884 // See https://connect.microsoft.com/IE/feedback/details/1736512/ 5885 rnoInnerhtml = /<script|<style|<link/i, 5886 5887 // checked="checked" or checked 5888 rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, 5889 rscriptTypeMasked = /^true\/(.*)/, 5890 rcleanScript = /^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g, 5891 safeFragment = createSafeFragment( document ), 5892 fragmentDiv = safeFragment.appendChild( document.createElement( "div" ) ); 5893 5894// Support: IE<8 5895// Manipulating tables requires a tbody 5896function manipulationTarget( elem, content ) { 5897 return jQuery.nodeName( elem, "table" ) && 5898 jQuery.nodeName( content.nodeType !== 11 ? content : content.firstChild, "tr" ) ? 5899 5900 elem.getElementsByTagName( "tbody" )[ 0 ] || 5901 elem.appendChild( elem.ownerDocument.createElement( "tbody" ) ) : 5902 elem; 5903} 5904 5905// Replace/restore the type attribute of script elements for safe DOM manipulation 5906function disableScript( elem ) { 5907 elem.type = ( jQuery.find.attr( elem, "type" ) !== null ) + "/" + elem.type; 5908 return elem; 5909} 5910function restoreScript( elem ) { 5911 var match = rscriptTypeMasked.exec( elem.type ); 5912 if ( match ) { 5913 elem.type = match[ 1 ]; 5914 } else { 5915 elem.removeAttribute( "type" ); 5916 } 5917 return elem; 5918} 5919 5920function cloneCopyEvent( src, dest ) { 5921 if ( dest.nodeType !== 1 || !jQuery.hasData( src ) ) { 5922 return; 5923 } 5924 5925 var type, i, l, 5926 oldData = jQuery._data( src ), 5927 curData = jQuery._data( dest, oldData ), 5928 events = oldData.events; 5929 5930 if ( events ) { 5931 delete curData.handle; 5932 curData.events = {}; 5933 5934 for ( type in events ) { 5935 for ( i = 0, l = events[ type ].length; i < l; i++ ) { 5936 jQuery.event.add( dest, type, events[ type ][ i ] ); 5937 } 5938 } 5939 } 5940 5941 // make the cloned public data object a copy from the original 5942 if ( curData.data ) { 5943 curData.data = jQuery.extend( {}, curData.data ); 5944 } 5945} 5946 5947function fixCloneNodeIssues( src, dest ) { 5948 var nodeName, e, data; 5949 5950 // We do not need to do anything for non-Elements 5951 if ( dest.nodeType !== 1 ) { 5952 return; 5953 } 5954 5955 nodeName = dest.nodeName.toLowerCase(); 5956 5957 // IE6-8 copies events bound via attachEvent when using cloneNode. 5958 if ( !support.noCloneEvent && dest[ jQuery.expando ] ) { 5959 data = jQuery._data( dest ); 5960 5961 for ( e in data.events ) { 5962 jQuery.removeEvent( dest, e, data.handle ); 5963 } 5964 5965 // Event data gets referenced instead of copied if the expando gets copied too 5966 dest.removeAttribute( jQuery.expando ); 5967 } 5968 5969 // IE blanks contents when cloning scripts, and tries to evaluate newly-set text 5970 if ( nodeName === "script" && dest.text !== src.text ) { 5971 disableScript( dest ).text = src.text; 5972 restoreScript( dest ); 5973 5974 // IE6-10 improperly clones children of object elements using classid. 5975 // IE10 throws NoModificationAllowedError if parent is null, #12132. 5976 } else if ( nodeName === "object" ) { 5977 if ( dest.parentNode ) { 5978 dest.outerHTML = src.outerHTML; 5979 } 5980 5981 // This path appears unavoidable for IE9. When cloning an object 5982 // element in IE9, the outerHTML strategy above is not sufficient. 5983 // If the src has innerHTML and the destination does not, 5984 // copy the src.innerHTML into the dest.innerHTML. #10324 5985 if ( support.html5Clone && ( src.innerHTML && !jQuery.trim( dest.innerHTML ) ) ) { 5986 dest.innerHTML = src.innerHTML; 5987 } 5988 5989 } else if ( nodeName === "input" && rcheckableType.test( src.type ) ) { 5990 5991 // IE6-8 fails to persist the checked state of a cloned checkbox 5992 // or radio button. Worse, IE6-7 fail to give the cloned element 5993 // a checked appearance if the defaultChecked value isn't also set 5994 5995 dest.defaultChecked = dest.checked = src.checked; 5996 5997 // IE6-7 get confused and end up setting the value of a cloned 5998 // checkbox/radio button to an empty string instead of "on" 5999 if ( dest.value !== src.value ) { 6000 dest.value = src.value; 6001 } 6002 6003 // IE6-8 fails to return the selected option to the default selected 6004 // state when cloning options 6005 } else if ( nodeName === "option" ) { 6006 dest.defaultSelected = dest.selected = src.defaultSelected; 6007 6008 // IE6-8 fails to set the defaultValue to the correct value when 6009 // cloning other types of input fields 6010 } else if ( nodeName === "input" || nodeName === "textarea" ) { 6011 dest.defaultValue = src.defaultValue; 6012 } 6013} 6014 6015function domManip( collection, args, callback, ignored ) { 6016 6017 // Flatten any nested arrays 6018 args = concat.apply( [], args ); 6019 6020 var first, node, hasScripts, 6021 scripts, doc, fragment, 6022 i = 0, 6023 l = collection.length, 6024 iNoClone = l - 1, 6025 value = args[ 0 ], 6026 isFunction = jQuery.isFunction( value ); 6027 6028 // We can't cloneNode fragments that contain checked, in WebKit 6029 if ( isFunction || 6030 ( l > 1 && typeof value === "string" && 6031 !support.checkClone && rchecked.test( value ) ) ) { 6032 return collection.each( function( index ) { 6033 var self = collection.eq( index ); 6034 if ( isFunction ) { 6035 args[ 0 ] = value.call( this, index, self.html() ); 6036 } 6037 domManip( self, args, callback, ignored ); 6038 } ); 6039 } 6040 6041 if ( l ) { 6042 fragment = buildFragment( args, collection[ 0 ].ownerDocument, false, collection, ignored ); 6043 first = fragment.firstChild; 6044 6045 if ( fragment.childNodes.length === 1 ) { 6046 fragment = first; 6047 } 6048 6049 // Require either new content or an interest in ignored elements to invoke the callback 6050 if ( first || ignored ) { 6051 scripts = jQuery.map( getAll( fragment, "script" ), disableScript ); 6052 hasScripts = scripts.length; 6053 6054 // Use the original fragment for the last item 6055 // instead of the first because it can end up 6056 // being emptied incorrectly in certain situations (#8070). 6057 for ( ; i < l; i++ ) { 6058 node = fragment; 6059 6060 if ( i !== iNoClone ) { 6061 node = jQuery.clone( node, true, true ); 6062 6063 // Keep references to cloned scripts for later restoration 6064 if ( hasScripts ) { 6065 6066 // Support: Android<4.1, PhantomJS<2 6067 // push.apply(_, arraylike) throws on ancient WebKit 6068 jQuery.merge( scripts, getAll( node, "script" ) ); 6069 } 6070 } 6071 6072 callback.call( collection[ i ], node, i ); 6073 } 6074 6075 if ( hasScripts ) { 6076 doc = scripts[ scripts.length - 1 ].ownerDocument; 6077 6078 // Reenable scripts 6079 jQuery.map( scripts, restoreScript ); 6080 6081 // Evaluate executable scripts on first document insertion 6082 for ( i = 0; i < hasScripts; i++ ) { 6083 node = scripts[ i ]; 6084 if ( rscriptType.test( node.type || "" ) && 6085 !jQuery._data( node, "globalEval" ) && 6086 jQuery.contains( doc, node ) ) { 6087 6088 if ( node.src ) { 6089 6090 // Optional AJAX dependency, but won't run scripts if not present 6091 if ( jQuery._evalUrl ) { 6092 jQuery._evalUrl( node.src ); 6093 } 6094 } else { 6095 jQuery.globalEval( 6096 ( node.text || node.textContent || node.innerHTML || "" ) 6097 .replace( rcleanScript, "" ) 6098 ); 6099 } 6100 } 6101 } 6102 } 6103 6104 // Fix #11809: Avoid leaking memory 6105 fragment = first = null; 6106 } 6107 } 6108 6109 return collection; 6110} 6111 6112function remove( elem, selector, keepData ) { 6113 var node, 6114 elems = selector ? jQuery.filter( selector, elem ) : elem, 6115 i = 0; 6116 6117 for ( ; ( node = elems[ i ] ) != null; i++ ) { 6118 6119 if ( !keepData && node.nodeType === 1 ) { 6120 jQuery.cleanData( getAll( node ) ); 6121 } 6122 6123 if ( node.parentNode ) { 6124 if ( keepData && jQuery.contains( node.ownerDocument, node ) ) { 6125 setGlobalEval( getAll( node, "script" ) ); 6126 } 6127 node.parentNode.removeChild( node ); 6128 } 6129 } 6130 6131 return elem; 6132} 6133 6134jQuery.extend( { 6135 htmlPrefilter: function( html ) { 6136 return html.replace( rxhtmlTag, "<$1></$2>" ); 6137 }, 6138 6139 clone: function( elem, dataAndEvents, deepDataAndEvents ) { 6140 var destElements, node, clone, i, srcElements, 6141 inPage = jQuery.contains( elem.ownerDocument, elem ); 6142 6143 if ( support.html5Clone || jQuery.isXMLDoc( elem ) || 6144 !rnoshimcache.test( "<" + elem.nodeName + ">" ) ) { 6145 6146 clone = elem.cloneNode( true ); 6147 6148 // IE<=8 does not properly clone detached, unknown element nodes 6149 } else { 6150 fragmentDiv.innerHTML = elem.outerHTML; 6151 fragmentDiv.removeChild( clone = fragmentDiv.firstChild ); 6152 } 6153 6154 if ( ( !support.noCloneEvent || !support.noCloneChecked ) && 6155 ( elem.nodeType === 1 || elem.nodeType === 11 ) && !jQuery.isXMLDoc( elem ) ) { 6156 6157 // We eschew Sizzle here for performance reasons: http://jsperf.com/getall-vs-sizzle/2 6158 destElements = getAll( clone ); 6159 srcElements = getAll( elem ); 6160 6161 // Fix all IE cloning issues 6162 for ( i = 0; ( node = srcElements[ i ] ) != null; ++i ) { 6163 6164 // Ensure that the destination node is not null; Fixes #9587 6165 if ( destElements[ i ] ) { 6166 fixCloneNodeIssues( node, destElements[ i ] ); 6167 } 6168 } 6169 } 6170 6171 // Copy the events from the original to the clone 6172 if ( dataAndEvents ) { 6173 if ( deepDataAndEvents ) { 6174 srcElements = srcElements || getAll( elem ); 6175 destElements = destElements || getAll( clone ); 6176 6177 for ( i = 0; ( node = srcElements[ i ] ) != null; i++ ) { 6178 cloneCopyEvent( node, destElements[ i ] ); 6179 } 6180 } else { 6181 cloneCopyEvent( elem, clone ); 6182 } 6183 } 6184 6185 // Preserve script evaluation history 6186 destElements = getAll( clone, "script" ); 6187 if ( destElements.length > 0 ) { 6188 setGlobalEval( destElements, !inPage && getAll( elem, "script" ) ); 6189 } 6190 6191 destElements = srcElements = node = null; 6192 6193 // Return the cloned set 6194 return clone; 6195 }, 6196 6197 cleanData: function( elems, /* internal */ forceAcceptData ) { 6198 var elem, type, id, data, 6199 i = 0, 6200 internalKey = jQuery.expando, 6201 cache = jQuery.cache, 6202 attributes = support.attributes, 6203 special = jQuery.event.special; 6204 6205 for ( ; ( elem = elems[ i ] ) != null; i++ ) { 6206 if ( forceAcceptData || acceptData( elem ) ) { 6207 6208 id = elem[ internalKey ]; 6209 data = id && cache[ id ]; 6210 6211 if ( data ) { 6212 if ( data.events ) { 6213 for ( type in data.events ) { 6214 if ( special[ type ] ) { 6215 jQuery.event.remove( elem, type ); 6216 6217 // This is a shortcut to avoid jQuery.event.remove's overhead 6218 } else { 6219 jQuery.removeEvent( elem, type, data.handle ); 6220 } 6221 } 6222 } 6223 6224 // Remove cache only if it was not already removed by jQuery.event.remove 6225 if ( cache[ id ] ) { 6226 6227 delete cache[ id ]; 6228
6229 // Support: IE<9 6230 // IE does not allow us to delete expando properties from nodes 6231 // IE creates expando attributes along with the property 6232 // IE does not have a removeAttribute function on Document nodes 6233 if ( !attributes && typeof elem.removeAttribute !== "undefined" ) { 6234 elem.removeAttribute( internalKey ); 6235 6236 // Webkit & Blink performance suffers when deleting properties 6237 // from DOM nodes, so set to undefined instead 6238 // https://code.google.com/p/chromium/issues/detail?id=378607 6239 } else { 6240 elem[ internalKey ] = undefined; 6241 } 6242 6243 deletedIds.push( id ); 6244 } 6245 } 6246 } 6247 } 6248 } 6249} ); 6250 6251jQuery.fn.extend( { 6252 6253 // Keep domManip exposed until 3.0 (gh-2225) 6254 domManip: domManip, 6255 6256 detach: function( selector ) { 6257 return remove( this, selector, true ); 6258 }, 6259 6260 remove: function( selector ) { 6261 return remove( this, selector ); 6262 }, 6263 6264 text: function( value ) { 6265 return access( this, function( value ) { 6266 return value === undefined ? 6267 jQuery.text( this ) : 6268 this.empty().append( 6269 ( this[ 0 ] && this[ 0 ].ownerDocument || document ).createTextNode( value ) 6270 ); 6271 }, null, value, arguments.length ); 6272 }, 6273 6274 append: function() { 6275 return domManip( this, arguments, function( elem ) { 6276 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6277 var target = manipulationTarget( this, elem ); 6278 target.appendChild( elem ); 6279 } 6280 } ); 6281 }, 6282
vendor: 4,288 bytes, lines 6283-6456
6283 prepend: function() { 6284 return domManip( this, arguments, function( elem ) { 6285 if ( this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9 ) { 6286 var target = manipulationTarget( this, elem ); 6287 target.insertBefore( elem, target.firstChild ); 6288 } 6289 } ); 6290 }, 6291 6292 before: function() { 6293 return domManip( this, arguments, function( elem ) { 6294 if ( this.parentNode ) { 6295 this.parentNode.insertBefore( elem, this ); 6296 } 6297 } ); 6298 }, 6299 6300 after: function() { 6301 return domManip( this, arguments, function( elem ) { 6302 if ( this.parentNode ) { 6303 this.parentNode.insertBefore( elem, this.nextSibling ); 6304 } 6305 } ); 6306 }, 6307 6308 empty: function() { 6309 var elem, 6310 i = 0; 6311 6312 for ( ; ( elem = this[ i ] ) != null; i++ ) { 6313 6314 // Remove element nodes and prevent memory leaks 6315 if ( elem.nodeType === 1 ) { 6316 jQuery.cleanData( getAll( elem, false ) ); 6317 } 6318 6319 // Remove any remaining nodes 6320 while ( elem.firstChild ) { 6321 elem.removeChild( elem.firstChild ); 6322 } 6323 6324 // If this is a select, ensure that it displays empty (#12336) 6325 // Support: IE<9 6326 if ( elem.options && jQuery.nodeName( elem, "select" ) ) { 6327 elem.options.length = 0; 6328 } 6329 } 6330 6331 return this; 6332 }, 6333 6334 clone: function( dataAndEvents, deepDataAndEvents ) { 6335 dataAndEvents = dataAndEvents == null ? false : dataAndEvents; 6336 deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents; 6337 6338 return this.map( function() { 6339 return jQuery.clone( this, dataAndEvents, deepDataAndEvents ); 6340 } ); 6341 }, 6342 6343 html: function( value ) { 6344 return access( this, function( value ) { 6345 var elem = this[ 0 ] || {}, 6346 i = 0, 6347 l = this.length; 6348 6349 if ( value === undefined ) { 6350 return elem.nodeType === 1 ? 6351 elem.innerHTML.replace( rinlinejQuery, "" ) : 6352 undefined; 6353 } 6354 6355 // See if we can take a shortcut and just use innerHTML 6356 if ( typeof value === "string" && !rnoInnerhtml.test( value ) && 6357 ( support.htmlSerialize || !rnoshimcache.test( value ) ) && 6358 ( support.leadingWhitespace || !rleadingWhitespace.test( value ) ) && 6359 !wrapMap[ ( rtagName.exec( value ) || [ "", "" ] )[ 1 ].toLowerCase() ] ) { 6360 6361 value = jQuery.htmlPrefilter( value ); 6362 6363 try { 6364 for ( ; i < l; i++ ) { 6365 6366 // Remove element nodes and prevent memory leaks 6367 elem = this[ i ] || {}; 6368 if ( elem.nodeType === 1 ) { 6369 jQuery.cleanData( getAll( elem, false ) ); 6370 elem.innerHTML = value; 6371 } 6372 } 6373 6374 elem = 0; 6375 6376 // If using innerHTML throws an exception, use the fallback method 6377 } catch ( e ) {} 6378 } 6379 6380 if ( elem ) { 6381 this.empty().append( value ); 6382 } 6383 }, null, value, arguments.length ); 6384 }, 6385 6386 replaceWith: function() { 6387 var ignored = []; 6388 6389 // Make the changes, replacing each non-ignored context element with the new content 6390 return domManip( this, arguments, function( elem ) { 6391 var parent = this.parentNode; 6392 6393 if ( jQuery.inArray( this, ignored ) < 0 ) { 6394 jQuery.cleanData( getAll( this ) ); 6395 if ( parent ) { 6396 parent.replaceChild( elem, this ); 6397 } 6398 } 6399 6400 // Force callback invocation 6401 }, ignored ); 6402 } 6403} ); 6404 6405jQuery.each( { 6406 appendTo: "append", 6407 prependTo: "prepend", 6408 insertBefore: "before", 6409 insertAfter: "after", 6410 replaceAll: "replaceWith" 6411}, function( name, original ) { 6412 jQuery.fn[ name ] = function( selector ) { 6413 var elems, 6414 i = 0, 6415 ret = [], 6416 insert = jQuery( selector ), 6417 last = insert.length - 1; 6418 6419 for ( ; i <= last; i++ ) { 6420 elems = i === last ? this : this.clone( true ); 6421 jQuery( insert[ i ] )[ original ]( elems ); 6422 6423 // Modern browsers can apply jQuery collections as arrays, but oldIE needs a .get() 6424 push.apply( ret, elems.get() ); 6425 } 6426 6427 return this.pushStack( ret ); 6428 }; 6429} ); 6430 6431 6432var iframe, 6433 elemdisplay = { 6434 6435 // Support: Firefox 6436 // We have to pre-define these values for FF (#10227) 6437 HTML: "block", 6438 BODY: "block" 6439 }; 6440 6441/** 6442 * Retrieve the actual display of a element 6443 * @param {String} name nodeName of the element 6444 * @param {Object} doc Document object 6445 */ 6446 6447// Called only from within defaultDisplay 6448function actualDisplay( name, doc ) { 6449 var elem = jQuery( doc.createElement( name ) ).appendTo( doc.body ), 6450 6451 display = jQuery.css( elem[ 0 ], "display" ); 6452 6453 // We don't have any data stored on the element, 6454 // so use "detach" method as fast way to get rid of the element 6455 elem.detach(); 6456
6457 return display; 6458} 6459 6460/** 6461 * Try to determine the default display value of an element 6462 * @param {String} nodeName 6463 */ 6464function defaultDisplay( nodeName ) { 6465 var doc = document, 6466 display = elemdisplay[ nodeName ]; 6467 6468 if ( !display ) { 6469 display = actualDisplay( nodeName, doc ); 6470 6471 // If the simple way fails, read from inside an iframe 6472 if ( display === "none" || !display ) { 6473 6474 // Use the already-created iframe if possible 6475 iframe = ( iframe || jQuery( "<iframe frameborder='0' width='0' height='0'/>" ) ) 6476 .appendTo( doc.documentElement ); 6477 6478 // Always write a new HTML skeleton so Webkit and Firefox don't choke on reuse 6479 doc = ( iframe[ 0 ].contentWindow || iframe[ 0 ].contentDocument ).document; 6480 6481 // Support: IE 6482 doc.write(); 6483 doc.close(); 6484 6485 display = actualDisplay( nodeName, doc ); 6486 iframe.detach(); 6487 } 6488 6489 // Store the correct default display 6490 elemdisplay[ nodeName ] = display; 6491 } 6492 6493 return display; 6494} 6495var rmargin = ( /^margin/ ); 6496 6497var rnumnonpx = new RegExp( "^(" + pnum + ")(?!px)[a-z%]+$", "i" ); 6498 6499var swap = function( elem, options, callback, args ) { 6500 var ret, name, 6501 old = {}; 6502 6503 // Remember the old values, and insert the new ones 6504 for ( name in options ) { 6505 old[ name ] = elem.style[ name ]; 6506 elem.style[ name ] = options[ name ]; 6507 } 6508 6509 ret = callback.apply( elem, args || [] ); 6510 6511 // Revert the old values 6512 for ( name in options ) { 6513 elem.style[ name ] = old[ name ]; 6514 } 6515 6516 return ret; 6517}; 6518 6519 6520var documentElement = document.documentElement; 6521 6522 6523 6524( function() { 6525 var pixelPositionVal, pixelMarginRightVal, boxSizingReliableVal, 6526 reliableHiddenOffsetsVal, reliableMarginRightVal, reliableMarginLeftVal, 6527 container = document.createElement( "div" ), 6528 div = document.createElement( "div" ); 6529 6530 // Finish early in limited (non-browser) environments 6531 if ( !div.style ) { 6532 return; 6533 } 6534 6535 div.style.cssText = "float:left;opacity:.5"; 6536 6537 // Support: IE<9 6538 // Make sure that element opacity exists (as opposed to filter) 6539 support.opacity = div.style.opacity === "0.5"; 6540 6541 // Verify style float existence 6542 // (IE uses styleFloat instead of cssFloat) 6543 support.cssFloat = !!div.style.cssFloat; 6544 6545 div.style.backgroundClip = "content-box"; 6546 div.cloneNode( true ).style.backgroundClip = ""; 6547 support.clearCloneStyle = div.style.backgroundClip === "content-box"; 6548 6549 container = document.createElement( "div" ); 6550 container.style.cssText = "border:0;width:8px;height:0;top:0;left:-9999px;" + 6551 "padding:0;margin-top:1px;position:absolute"; 6552 div.innerHTML = ""; 6553 container.appendChild( div ); 6554 6555 // Support: Firefox<29, Android 2.3 6556 // Vendor-prefix box-sizing 6557 support.boxSizing = div.style.boxSizing === "" || div.style.MozBoxSizing === "" || 6558 div.style.WebkitBoxSizing === ""; 6559 6560 jQuery.extend( support, { 6561 reliableHiddenOffsets: function() { 6562 if ( pixelPositionVal == null ) { 6563 computeStyleTests(); 6564 } 6565 return reliableHiddenOffsetsVal; 6566 }, 6567 6568 boxSizingReliable: function() { 6569 6570 // We're checking for pixelPositionVal here instead of boxSizingReliableVal 6571 // since that compresses better and they're computed together anyway. 6572 if ( pixelPositionVal == null ) { 6573 computeStyleTests(); 6574 } 6575 return boxSizingReliableVal; 6576 }, 6577 6578 pixelMarginRight: function() { 6579 6580 // Support: Android 4.0-4.3 6581 if ( pixelPositionVal == null ) { 6582 computeStyleTests(); 6583 } 6584 return pixelMarginRightVal; 6585 }, 6586 6587 pixelPosition: function() { 6588 if ( pixelPositionVal == null ) { 6589 computeStyleTests(); 6590 } 6591 return pixelPositionVal; 6592 }, 6593 6594 reliableMarginRight: function() { 6595 6596 // Support: Android 2.3 6597 if ( pixelPositionVal == null ) { 6598 computeStyleTests(); 6599 } 6600 return reliableMarginRightVal; 6601 }, 6602 6603 reliableMarginLeft: function() { 6604 6605 // Support: IE <=8 only, Android 4.0 - 4.3 only, Firefox <=3 - 37 6606 if ( pixelPositionVal == null ) { 6607 computeStyleTests(); 6608 } 6609 return reliableMarginLeftVal; 6610 } 6611 } ); 6612 6613 function computeStyleTests() { 6614 var contents, divStyle, 6615 documentElement = document.documentElement; 6616 6617 // Setup 6618 documentElement.appendChild( container ); 6619 6620 div.style.cssText = 6621 6622 // Support: Android 2.3 6623 // Vendor-prefix box-sizing 6624 "-webkit-box-sizing:border-box;box-sizing:border-box;" + 6625 "position:relative;display:block;" + 6626 "margin:auto;border:1px;padding:1px;" + 6627 "top:1%;width:50%"; 6628
6629 // Support: IE<9 6630 // Assume reasonable values in the absence of getComputedStyle 6631 pixelPositionVal = boxSizingReliableVal = reliableMarginLeftVal = false; 6632 pixelMarginRightVal = reliableMarginRightVal = true; 6633 6634 // Check for getComputedStyle so that this code is not run in IE<9. 6635 if ( window.getComputedStyle ) { 6636 divStyle = window.getComputedStyle( div ); 6637 pixelPositionVal = ( divStyle || {} ).top !== "1%"; 6638 reliableMarginLeftVal = ( divStyle || {} ).marginLeft === "2px"; 6639 boxSizingReliableVal = ( divStyle || { width: "4px" } ).width === "4px"; 6640 6641 // Support: Android 4.0 - 4.3 only 6642 // Some styles come back with percentage values, even though they shouldn't 6643 div.style.marginRight = "50%"; 6644 pixelMarginRightVal = ( divStyle || { marginRight: "4px" } ).marginRight === "4px"; 6645 6646 // Support: Android 2.3 only 6647 // Div with explicit width and no margin-right incorrectly 6648 // gets computed margin-right based on width of container (#3333) 6649 // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right 6650 contents = div.appendChild( document.createElement( "div" ) ); 6651 6652 // Reset CSS: box-sizing; display; margin; border; padding 6653 contents.style.cssText = div.style.cssText = 6654 6655 // Support: Android 2.3 6656 // Vendor-prefix box-sizing 6657 "-webkit-box-sizing:content-box;-moz-box-sizing:content-box;" + 6658 "box-sizing:content-box;display:block;margin:0;border:0;padding:0"; 6659 contents.style.marginRight = contents.style.width = "0"; 6660 div.style.width = "1px"; 6661 6662 reliableMarginRightVal = 6663 !parseFloat( ( window.getComputedStyle( contents ) || {} ).marginRight ); 6664 6665 div.removeChild( contents ); 6666 } 6667 6668 // Support: IE6-8 6669 // First check that getClientRects works as expected 6670 // Check if table cells still have offsetWidth/Height when they are set 6671 // to display:none and there are still other visible table cells in a 6672 // table row; if so, offsetWidth/Height are not reliable for use when 6673 // determining if an element has been hidden directly using 6674 // display:none (it is still safe to use offsets if a parent element is 6675 // hidden; don safety goggles and see bug #4512 for more information). 6676 div.style.display = "none"; 6677 reliableHiddenOffsetsVal = div.getClientRects().length === 0; 6678 if ( reliableHiddenOffsetsVal ) { 6679 div.style.display = ""; 6680 div.innerHTML = "<table><tr><td></td><td>t</td></tr></table>"; 6681 div.childNodes[ 0 ].style.borderCollapse = "separate"; 6682 contents = div.getElementsByTagName( "td" ); 6683 contents[ 0 ].style.cssText = "margin:0;border:0;padding:0;display:none"; 6684 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6685 if ( reliableHiddenOffsetsVal ) { 6686 contents[ 0 ].style.display = ""; 6687 contents[ 1 ].style.display = "none"; 6688 reliableHiddenOffsetsVal = contents[ 0 ].offsetHeight === 0; 6689 } 6690 } 6691 6692 // Teardown 6693 documentElement.removeChild( container ); 6694 } 6695 6696} )(); 6697 6698 6699var getStyles, curCSS, 6700 rposition = /^(top|right|bottom|left)$/; 6701 6702if ( window.getComputedStyle ) { 6703 getStyles = function( elem ) { 6704 6705 // Support: IE<=11+, Firefox<=30+ (#15098, #14150) 6706 // IE throws on elements created in popups 6707 // FF meanwhile throws on frame elements through "defaultView.getComputedStyle" 6708 var view = elem.ownerDocument.defaultView; 6709 6710 if ( !view || !view.opener ) { 6711 view = window; 6712 } 6713 6714 return view.getComputedStyle( elem ); 6715 }; 6716 6717 curCSS = function( elem, name, computed ) { 6718 var width, minWidth, maxWidth, ret, 6719 style = elem.style; 6720 6721 computed = computed || getStyles( elem ); 6722 6723 // getPropertyValue is only needed for .css('filter') in IE9, see #12537 6724 ret = computed ? computed.getPropertyValue( name ) || computed[ name ] : undefined; 6725 6726 // Support: Opera 12.1x only 6727 // Fall back to style even without computed 6728 // computed is undefined for elems on document fragments 6729 if ( ( ret === "" || ret === undefined ) && !jQuery.contains( elem.ownerDocument, elem ) ) { 6730 ret = jQuery.style( elem, name ); 6731 } 6732 6733 if ( computed ) { 6734 6735 // A tribute to the "awesome hack by Dean Edwards" 6736 // Chrome < 17 and Safari 5.0 uses "computed value" 6737 // instead of "used value" for margin-right 6738 // Safari 5.1.7 (at least) returns percentage for a larger set of values, 6739 // but width seems to be reliably pixels 6740 // this is against the CSSOM draft spec: 6741 // http://dev.w3.org/csswg/cssom/#resolved-values 6742 if ( !support.pixelMarginRight() && rnumnonpx.test( ret ) && rmargin.test( name ) ) { 6743 6744 // Remember the original values 6745 width = style.width; 6746 minWidth = style.minWidth; 6747 maxWidth = style.maxWidth; 6748 6749 // Put in the new values to get a computed value out 6750 style.minWidth = style.maxWidth = style.width = ret; 6751 ret = computed.width; 6752 6753 // Revert the changed values 6754 style.width = width; 6755 style.minWidth = minWidth; 6756 style.maxWidth = maxWidth; 6757 } 6758 } 6759
vendor: 4,152 bytes, lines 6760-6922
6760 // Support: IE 6761 // IE returns zIndex value as an integer. 6762 return ret === undefined ? 6763 ret : 6764 ret + ""; 6765 }; 6766} else if ( documentElement.currentStyle ) { 6767 getStyles = function( elem ) { 6768 return elem.currentStyle; 6769 }; 6770 6771 curCSS = function( elem, name, computed ) { 6772 var left, rs, rsLeft, ret, 6773 style = elem.style; 6774 6775 computed = computed || getStyles( elem ); 6776 ret = computed ? computed[ name ] : undefined; 6777 6778 // Avoid setting ret to empty string here 6779 // so we don't default to auto 6780 if ( ret == null && style && style[ name ] ) { 6781 ret = style[ name ]; 6782 } 6783 6784 // From the awesome hack by Dean Edwards 6785 // http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291 6786 6787 // If we're not dealing with a regular pixel number 6788 // but a number that has a weird ending, we need to convert it to pixels 6789 // but not position css attributes, as those are 6790 // proportional to the parent element instead 6791 // and we can't measure the parent instead because it 6792 // might trigger a "stacking dolls" problem 6793 if ( rnumnonpx.test( ret ) && !rposition.test( name ) ) { 6794 6795 // Remember the original values 6796 left = style.left; 6797 rs = elem.runtimeStyle; 6798 rsLeft = rs && rs.left; 6799 6800 // Put in the new values to get a computed value out 6801 if ( rsLeft ) { 6802 rs.left = elem.currentStyle.left; 6803 } 6804 style.left = name === "fontSize" ? "1em" : ret; 6805 ret = style.pixelLeft + "px"; 6806 6807 // Revert the changed values 6808 style.left = left; 6809 if ( rsLeft ) { 6810 rs.left = rsLeft; 6811 } 6812 } 6813 6814 // Support: IE 6815 // IE returns zIndex value as an integer. 6816 return ret === undefined ? 6817 ret : 6818 ret + "" || "auto"; 6819 }; 6820} 6821 6822 6823 6824 6825function addGetHookIf( conditionFn, hookFn ) { 6826 6827 // Define the hook, we'll check on the first run if it's really needed. 6828 return { 6829 get: function() { 6830 if ( conditionFn() ) { 6831 6832 // Hook not needed (or it's not possible to use it due 6833 // to missing dependency), remove it. 6834 delete this.get; 6835 return; 6836 } 6837 6838 // Hook needed; redefine it so that the support test is not executed again. 6839 return ( this.get = hookFn ).apply( this, arguments ); 6840 } 6841 }; 6842} 6843 6844 6845var 6846 6847 ralpha = /alpha\([^)]*\)/i, 6848 ropacity = /opacity\s*=\s*([^)]*)/i, 6849 6850 // swappable if display is none or starts with table except 6851 // "table", "table-cell", or "table-caption" 6852 // see here for display values: 6853 // https://developer.mozilla.org/en-US/docs/CSS/display 6854 rdisplayswap = /^(none|table(?!-c[ea]).+)/, 6855 rnumsplit = new RegExp( "^(" + pnum + ")(.*)$", "i" ), 6856 6857 cssShow = { position: "absolute", visibility: "hidden", display: "block" }, 6858 cssNormalTransform = { 6859 letterSpacing: "0", 6860 fontWeight: "400" 6861 }, 6862 6863 cssPrefixes = [ "Webkit", "O", "Moz", "ms" ], 6864 emptyStyle = document.createElement( "div" ).style; 6865 6866 6867// return a css property mapped to a potentially vendor prefixed property 6868function vendorPropName( name ) { 6869 6870 // shortcut for names that are not vendor prefixed 6871 if ( name in emptyStyle ) { 6872 return name; 6873 } 6874 6875 // check for vendor prefixed names 6876 var capName = name.charAt( 0 ).toUpperCase() + name.slice( 1 ), 6877 i = cssPrefixes.length; 6878 6879 while ( i-- ) { 6880 name = cssPrefixes[ i ] + capName; 6881 if ( name in emptyStyle ) { 6882 return name; 6883 } 6884 } 6885} 6886 6887function showHide( elements, show ) { 6888 var display, elem, hidden, 6889 values = [], 6890 index = 0, 6891 length = elements.length; 6892 6893 for ( ; index < length; index++ ) { 6894 elem = elements[ index ]; 6895 if ( !elem.style ) { 6896 continue; 6897 } 6898 6899 values[ index ] = jQuery._data( elem, "olddisplay" ); 6900 display = elem.style.display; 6901 if ( show ) { 6902 6903 // Reset the inline display of this element to learn if it is 6904 // being hidden by cascaded rules or not 6905 if ( !values[ index ] && display === "none" ) { 6906 elem.style.display = ""; 6907 } 6908 6909 // Set elements which have been overridden with display: none 6910 // in a stylesheet to whatever the default browser style is 6911 // for such an element 6912 if ( elem.style.display === "" && isHidden( elem ) ) { 6913 values[ index ] = 6914 jQuery._data( elem, "olddisplay", defaultDisplay( elem.nodeName ) ); 6915 } 6916 } else { 6917 hidden = isHidden( elem ); 6918 6919 if ( display && display !== "none" || !hidden ) { 6920 jQuery._data( 6921 elem, 6922 "olddisplay",
vendor: 6,043 bytes, lines 6923-7134
6923 hidden ? display : jQuery.css( elem, "display" ) 6924 ); 6925 } 6926 } 6927 } 6928 6929 // Set the display of most of the elements in a second loop 6930 // to avoid the constant reflow 6931 for ( index = 0; index < length; index++ ) { 6932 elem = elements[ index ]; 6933 if ( !elem.style ) { 6934 continue; 6935 } 6936 if ( !show || elem.style.display === "none" || elem.style.display === "" ) { 6937 elem.style.display = show ? values[ index ] || "" : "none"; 6938 } 6939 } 6940 6941 return elements; 6942} 6943 6944function setPositiveNumber( elem, value, subtract ) { 6945 var matches = rnumsplit.exec( value ); 6946 return matches ? 6947 6948 // Guard against undefined "subtract", e.g., when used as in cssHooks 6949 Math.max( 0, matches[ 1 ] - ( subtract || 0 ) ) + ( matches[ 2 ] || "px" ) : 6950 value; 6951} 6952 6953function augmentWidthOrHeight( elem, name, extra, isBorderBox, styles ) { 6954 var i = extra === ( isBorderBox ? "border" : "content" ) ? 6955 6956 // If we already have the right measurement, avoid augmentation 6957 4 : 6958 6959 // Otherwise initialize for horizontal or vertical properties 6960 name === "width" ? 1 : 0, 6961 6962 val = 0; 6963 6964 for ( ; i < 4; i += 2 ) { 6965 6966 // both box models exclude margin, so add it if we want it 6967 if ( extra === "margin" ) { 6968 val += jQuery.css( elem, extra + cssExpand[ i ], true, styles ); 6969 } 6970 6971 if ( isBorderBox ) { 6972 6973 // border-box includes padding, so remove it if we want content 6974 if ( extra === "content" ) { 6975 val -= jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6976 } 6977 6978 // at this point, extra isn't border nor margin, so remove border 6979 if ( extra !== "margin" ) { 6980 val -= jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6981 } 6982 } else { 6983 6984 // at this point, extra isn't content, so add padding 6985 val += jQuery.css( elem, "padding" + cssExpand[ i ], true, styles ); 6986 6987 // at this point, extra isn't content nor padding, so add border 6988 if ( extra !== "padding" ) { 6989 val += jQuery.css( elem, "border" + cssExpand[ i ] + "Width", true, styles ); 6990 } 6991 } 6992 } 6993 6994 return val; 6995} 6996 6997function getWidthOrHeight( elem, name, extra ) { 6998 6999 // Start with offset property, which is equivalent to the border-box value 7000 var valueIsBorderBox = true, 7001 val = name === "width" ? elem.offsetWidth : elem.offsetHeight, 7002 styles = getStyles( elem ), 7003 isBorderBox = support.boxSizing && 7004 jQuery.css( elem, "boxSizing", false, styles ) === "border-box"; 7005 7006 // some non-html elements return undefined for offsetWidth, so check for null/undefined 7007 // svg - https://bugzilla.mozilla.org/show_bug.cgi?id=649285 7008 // MathML - https://bugzilla.mozilla.org/show_bug.cgi?id=491668 7009 if ( val <= 0 || val == null ) { 7010 7011 // Fall back to computed then uncomputed css if necessary 7012 val = curCSS( elem, name, styles ); 7013 if ( val < 0 || val == null ) { 7014 val = elem.style[ name ]; 7015 } 7016 7017 // Computed unit is not pixels. Stop here and return. 7018 if ( rnumnonpx.test( val ) ) { 7019 return val; 7020 } 7021 7022 // we need the check for style in case a browser which returns unreliable values 7023 // for getComputedStyle silently falls back to the reliable elem.style 7024 valueIsBorderBox = isBorderBox && 7025 ( support.boxSizingReliable() || val === elem.style[ name ] ); 7026 7027 // Normalize "", auto, and prepare for extra 7028 val = parseFloat( val ) || 0; 7029 } 7030 7031 // use the active box-sizing model to add/subtract irrelevant styles 7032 return ( val + 7033 augmentWidthOrHeight( 7034 elem, 7035 name, 7036 extra || ( isBorderBox ? "border" : "content" ), 7037 valueIsBorderBox, 7038 styles 7039 ) 7040 ) + "px"; 7041} 7042 7043jQuery.extend( { 7044 7045 // Add in style property hooks for overriding the default 7046 // behavior of getting and setting a style property 7047 cssHooks: { 7048 opacity: { 7049 get: function( elem, computed ) { 7050 if ( computed ) { 7051 7052 // We should always get a number back from opacity 7053 var ret = curCSS( elem, "opacity" ); 7054 return ret === "" ? "1" : ret; 7055 } 7056 } 7057 } 7058 }, 7059 7060 // Don't automatically add "px" to these possibly-unitless properties 7061 cssNumber: { 7062 "animationIterationCount": true, 7063 "columnCount": true, 7064 "fillOpacity": true, 7065 "flexGrow": true, 7066 "flexShrink": true, 7067 "fontWeight": true, 7068 "lineHeight": true, 7069 "opacity": true, 7070 "order": true, 7071 "orphans": true, 7072 "widows": true, 7073 "zIndex": true, 7074 "zoom": true 7075 }, 7076 7077 // Add in properties whose names you wish to fix before 7078 // setting or getting the value 7079 cssProps: { 7080 7081 // normalize float css property 7082 "float": support.cssFloat ? "cssFloat" : "styleFloat" 7083 }, 7084 7085 // Get and set the style property on a DOM Node 7086 style: function( elem, name, value, extra ) { 7087 7088 // Don't set styles on text and comment nodes 7089 if ( !elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style ) { 7090 return; 7091 } 7092 7093 // Make sure that we're working with the right name 7094 var ret, type, hooks, 7095 origName = jQuery.camelCase( name ), 7096 style = elem.style; 7097 7098 name = jQuery.cssProps[ origName ] || 7099 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 7100 7101 // gets hook for the prefixed version 7102 // followed by the unprefixed version 7103 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7104 7105 // Check if we're setting a value 7106 if ( value !== undefined ) { 7107 type = typeof value; 7108 7109 // Convert "+=" or "-=" to relative numbers (#7345) 7110 if ( type === "string" && ( ret = rcssNum.exec( value ) ) && ret[ 1 ] ) { 7111 value = adjustCSS( elem, name, ret ); 7112 7113 // Fixes bug #9237 7114 type = "number"; 7115 } 7116 7117 // Make sure that null and NaN values aren't set. See: #7116 7118 if ( value == null || value !== value ) { 7119 return; 7120 } 7121 7122 // If a number was passed in, add the unit (except for certain CSS properties) 7123 if ( type === "number" ) { 7124 value += ret && ret[ 3 ] || ( jQuery.cssNumber[ origName ] ? "" : "px" ); 7125 } 7126 7127 // Fixes #8908, it can be done more correctly by specifing setters in cssHooks, 7128 // but it would mean to define eight 7129 // (for every problematic property) identical functions 7130 if ( !support.clearCloneStyle && value === "" && name.indexOf( "background" ) === 0 ) { 7131 style[ name ] = "inherit"; 7132 } 7133 7134 // If a hook was provided, use that value, otherwise just set the specified value
vendor: 4,586 bytes, lines 7135-7290
7135 if ( !hooks || !( "set" in hooks ) || 7136 ( value = hooks.set( elem, value, extra ) ) !== undefined ) { 7137 7138 // Support: IE 7139 // Swallow errors from 'invalid' CSS values (#5509) 7140 try { 7141 style[ name ] = value; 7142 } catch ( e ) {} 7143 } 7144 7145 } else { 7146 7147 // If a hook was provided get the non-computed value from there 7148 if ( hooks && "get" in hooks && 7149 ( ret = hooks.get( elem, false, extra ) ) !== undefined ) { 7150 7151 return ret; 7152 } 7153 7154 // Otherwise just get the value from the style object 7155 return style[ name ]; 7156 } 7157 }, 7158 7159 css: function( elem, name, extra, styles ) { 7160 var num, val, hooks, 7161 origName = jQuery.camelCase( name ); 7162 7163 // Make sure that we're working with the right name 7164 name = jQuery.cssProps[ origName ] || 7165 ( jQuery.cssProps[ origName ] = vendorPropName( origName ) || origName ); 7166 7167 // gets hook for the prefixed version 7168 // followed by the unprefixed version 7169 hooks = jQuery.cssHooks[ name ] || jQuery.cssHooks[ origName ]; 7170 7171 // If a hook was provided get the computed value from there 7172 if ( hooks && "get" in hooks ) { 7173 val = hooks.get( elem, true, extra ); 7174 } 7175 7176 // Otherwise, if a way to get the computed value exists, use that 7177 if ( val === undefined ) { 7178 val = curCSS( elem, name, styles ); 7179 } 7180 7181 //convert "normal" to computed value 7182 if ( val === "normal" && name in cssNormalTransform ) { 7183 val = cssNormalTransform[ name ]; 7184 } 7185 7186 // Return, converting to number if forced or a qualifier was provided and val looks numeric 7187 if ( extra === "" || extra ) { 7188 num = parseFloat( val ); 7189 return extra === true || isFinite( num ) ? num || 0 : val; 7190 } 7191 return val; 7192 } 7193} ); 7194 7195jQuery.each( [ "height", "width" ], function( i, name ) { 7196 jQuery.cssHooks[ name ] = { 7197 get: function( elem, computed, extra ) { 7198 if ( computed ) { 7199 7200 // certain elements can have dimension info if we invisibly show them 7201 // however, it must have a current display style that would benefit from this 7202 return rdisplayswap.test( jQuery.css( elem, "display" ) ) && 7203 elem.offsetWidth === 0 ? 7204 swap( elem, cssShow, function() { 7205 return getWidthOrHeight( elem, name, extra ); 7206 } ) : 7207 getWidthOrHeight( elem, name, extra ); 7208 } 7209 }, 7210 7211 set: function( elem, value, extra ) { 7212 var styles = extra && getStyles( elem ); 7213 return setPositiveNumber( elem, value, extra ? 7214 augmentWidthOrHeight( 7215 elem, 7216 name, 7217 extra, 7218 support.boxSizing && 7219 jQuery.css( elem, "boxSizing", false, styles ) === "border-box", 7220 styles 7221 ) : 0 7222 ); 7223 } 7224 }; 7225} ); 7226 7227if ( !support.opacity ) { 7228 jQuery.cssHooks.opacity = { 7229 get: function( elem, computed ) { 7230 7231 // IE uses filters for opacity 7232 return ropacity.test( ( computed && elem.currentStyle ? 7233 elem.currentStyle.filter : 7234 elem.style.filter ) || "" ) ? 7235 ( 0.01 * parseFloat( RegExp.$1 ) ) + "" : 7236 computed ? "1" : ""; 7237 }, 7238 7239 set: function( elem, value ) { 7240 var style = elem.style, 7241 currentStyle = elem.currentStyle, 7242 opacity = jQuery.isNumeric( value ) ? "alpha(opacity=" + value * 100 + ")" : "", 7243 filter = currentStyle && currentStyle.filter || style.filter || ""; 7244 7245 // IE has trouble with opacity if it does not have layout 7246 // Force it by setting the zoom level 7247 style.zoom = 1; 7248 7249 // if setting opacity to 1, and no other filters exist - 7250 // attempt to remove filter attribute #6652 7251 // if value === "", then remove inline opacity #12685 7252 if ( ( value >= 1 || value === "" ) && 7253 jQuery.trim( filter.replace( ralpha, "" ) ) === "" && 7254 style.removeAttribute ) { 7255 7256 // Setting style.filter to null, "" & " " still leave "filter:" in the cssText 7257 // if "filter:" is present at all, clearType is disabled, we want to avoid this 7258 // style.removeAttribute is IE Only, but so apparently is this code path... 7259 style.removeAttribute( "filter" ); 7260 7261 // if there is no filter style applied in a css rule 7262 // or unset inline opacity, we are done 7263 if ( value === "" || currentStyle && !currentStyle.filter ) { 7264 return; 7265 } 7266 } 7267 7268 // otherwise, set new filter values 7269 style.filter = ralpha.test( filter ) ? 7270 filter.replace( ralpha, opacity ) : 7271 filter + " " + opacity; 7272 } 7273 }; 7274} 7275 7276jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight, 7277 function( elem, computed ) { 7278 if ( computed ) { 7279 return swap( elem, { "display": "inline-block" }, 7280 curCSS, [ elem, "marginRight" ] ); 7281 } 7282 } 7283); 7284 7285jQuery.cssHooks.marginLeft = addGetHookIf( support.reliableMarginLeft, 7286 function( elem, computed ) { 7287 if ( computed ) { 7288 return ( 7289 parseFloat( curCSS( elem, "marginLeft" ) ) || 7290
vendor: 4,625 bytes, lines 7291-7469
7291 // Support: IE<=11+ 7292 // Running getBoundingClientRect on a disconnected node in IE throws an error 7293 // Support: IE8 only 7294 // getClientRects() errors on disconnected elems 7295 ( jQuery.contains( elem.ownerDocument, elem ) ? 7296 elem.getBoundingClientRect().left - 7297 swap( elem, { marginLeft: 0 }, function() { 7298 return elem.getBoundingClientRect().left; 7299 } ) : 7300 0 7301 ) 7302 ) + "px"; 7303 } 7304 } 7305); 7306 7307// These hooks are used by animate to expand properties 7308jQuery.each( { 7309 margin: "", 7310 padding: "", 7311 border: "Width" 7312}, function( prefix, suffix ) { 7313 jQuery.cssHooks[ prefix + suffix ] = { 7314 expand: function( value ) { 7315 var i = 0, 7316 expanded = {}, 7317 7318 // assumes a single number if not a string 7319 parts = typeof value === "string" ? value.split( " " ) : [ value ]; 7320 7321 for ( ; i < 4; i++ ) { 7322 expanded[ prefix + cssExpand[ i ] + suffix ] = 7323 parts[ i ] || parts[ i - 2 ] || parts[ 0 ]; 7324 } 7325 7326 return expanded; 7327 } 7328 }; 7329 7330 if ( !rmargin.test( prefix ) ) { 7331 jQuery.cssHooks[ prefix + suffix ].set = setPositiveNumber; 7332 } 7333} ); 7334 7335jQuery.fn.extend( { 7336 css: function( name, value ) { 7337 return access( this, function( elem, name, value ) { 7338 var styles, len, 7339 map = {}, 7340 i = 0; 7341 7342 if ( jQuery.isArray( name ) ) { 7343 styles = getStyles( elem ); 7344 len = name.length; 7345 7346 for ( ; i < len; i++ ) { 7347 map[ name[ i ] ] = jQuery.css( elem, name[ i ], false, styles ); 7348 } 7349 7350 return map; 7351 } 7352 7353 return value !== undefined ? 7354 jQuery.style( elem, name, value ) : 7355 jQuery.css( elem, name ); 7356 }, name, value, arguments.length > 1 ); 7357 }, 7358 show: function() { 7359 return showHide( this, true ); 7360 }, 7361 hide: function() { 7362 return showHide( this ); 7363 }, 7364 toggle: function( state ) { 7365 if ( typeof state === "boolean" ) { 7366 return state ? this.show() : this.hide(); 7367 } 7368 7369 return this.each( function() { 7370 if ( isHidden( this ) ) { 7371 jQuery( this ).show(); 7372 } else { 7373 jQuery( this ).hide(); 7374 } 7375 } ); 7376 } 7377} ); 7378 7379 7380function Tween( elem, options, prop, end, easing ) { 7381 return new Tween.prototype.init( elem, options, prop, end, easing ); 7382} 7383jQuery.Tween = Tween; 7384 7385Tween.prototype = { 7386 constructor: Tween, 7387 init: function( elem, options, prop, end, easing, unit ) { 7388 this.elem = elem; 7389 this.prop = prop; 7390 this.easing = easing || jQuery.easing._default; 7391 this.options = options; 7392 this.start = this.now = this.cur(); 7393 this.end = end; 7394 this.unit = unit || ( jQuery.cssNumber[ prop ] ? "" : "px" ); 7395 }, 7396 cur: function() { 7397 var hooks = Tween.propHooks[ this.prop ]; 7398 7399 return hooks && hooks.get ? 7400 hooks.get( this ) : 7401 Tween.propHooks._default.get( this ); 7402 }, 7403 run: function( percent ) { 7404 var eased, 7405 hooks = Tween.propHooks[ this.prop ]; 7406 7407 if ( this.options.duration ) { 7408 this.pos = eased = jQuery.easing[ this.easing ]( 7409 percent, this.options.duration * percent, 0, 1, this.options.duration 7410 ); 7411 } else { 7412 this.pos = eased = percent; 7413 } 7414 this.now = ( this.end - this.start ) * eased + this.start; 7415 7416 if ( this.options.step ) { 7417 this.options.step.call( this.elem, this.now, this ); 7418 } 7419 7420 if ( hooks && hooks.set ) { 7421 hooks.set( this ); 7422 } else { 7423 Tween.propHooks._default.set( this ); 7424 } 7425 return this; 7426 } 7427}; 7428 7429Tween.prototype.init.prototype = Tween.prototype; 7430 7431Tween.propHooks = { 7432 _default: { 7433 get: function( tween ) { 7434 var result; 7435 7436 // Use a property on the element directly when it is not a DOM element, 7437 // or when there is no matching style property that exists. 7438 if ( tween.elem.nodeType !== 1 || 7439 tween.elem[ tween.prop ] != null && tween.elem.style[ tween.prop ] == null ) { 7440 return tween.elem[ tween.prop ]; 7441 } 7442 7443 // passing an empty string as a 3rd parameter to .css will automatically 7444 // attempt a parseFloat and fallback to a string if the parse fails 7445 // so, simple values such as "10px" are parsed to Float. 7446 // complex values such as "rotate(1rad)" are returned as is. 7447 result = jQuery.css( tween.elem, tween.prop, "" ); 7448 7449 // Empty strings, null, undefined and "auto" are converted to 0. 7450 return !result || result === "auto" ? 0 : result; 7451 }, 7452 set: function( tween ) { 7453 7454 // use step hook for back compat - use cssHook if its there - use .style if its 7455 // available and use plain properties where available 7456 if ( jQuery.fx.step[ tween.prop ] ) { 7457 jQuery.fx.step[ tween.prop ]( tween ); 7458 } else if ( tween.elem.nodeType === 1 && 7459 ( tween.elem.style[ jQuery.cssProps[ tween.prop ] ] != null || 7460 jQuery.cssHooks[ tween.prop ] ) ) { 7461 jQuery.style( tween.elem, tween.prop, tween.now + tween.unit ); 7462 } else { 7463 tween.elem[ tween.prop ] = tween.now; 7464 } 7465 } 7466 } 7467}; 7468 7469// Support: IE <=9
vendor: 5,654 bytes, lines 7470-7686
7470// Panic based approach to setting things on disconnected nodes 7471 7472Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = { 7473 set: function( tween ) { 7474 if ( tween.elem.nodeType && tween.elem.parentNode ) { 7475 tween.elem[ tween.prop ] = tween.now; 7476 } 7477 } 7478}; 7479 7480jQuery.easing = { 7481 linear: function( p ) { 7482 return p; 7483 }, 7484 swing: function( p ) { 7485 return 0.5 - Math.cos( p * Math.PI ) / 2; 7486 }, 7487 _default: "swing" 7488}; 7489 7490jQuery.fx = Tween.prototype.init; 7491 7492// Back Compat <1.8 extension point 7493jQuery.fx.step = {}; 7494 7495 7496 7497 7498var 7499 fxNow, timerId, 7500 rfxtypes = /^(?:toggle|show|hide)$/, 7501 rrun = /queueHooks$/; 7502 7503// Animations created synchronously will run synchronously 7504function createFxNow() { 7505 window.setTimeout( function() { 7506 fxNow = undefined; 7507 } ); 7508 return ( fxNow = jQuery.now() ); 7509} 7510 7511// Generate parameters to create a standard animation 7512function genFx( type, includeWidth ) { 7513 var which, 7514 attrs = { height: type }, 7515 i = 0; 7516 7517 // if we include width, step value is 1 to do all cssExpand values, 7518 // if we don't include width, step value is 2 to skip over Left and Right 7519 includeWidth = includeWidth ? 1 : 0; 7520 for ( ; i < 4 ; i += 2 - includeWidth ) { 7521 which = cssExpand[ i ]; 7522 attrs[ "margin" + which ] = attrs[ "padding" + which ] = type; 7523 } 7524 7525 if ( includeWidth ) { 7526 attrs.opacity = attrs.width = type; 7527 } 7528 7529 return attrs; 7530} 7531 7532function createTween( value, prop, animation ) { 7533 var tween, 7534 collection = ( Animation.tweeners[ prop ] || [] ).concat( Animation.tweeners[ "*" ] ), 7535 index = 0, 7536 length = collection.length; 7537 for ( ; index < length; index++ ) { 7538 if ( ( tween = collection[ index ].call( animation, prop, value ) ) ) { 7539 7540 // we're done with this property 7541 return tween; 7542 } 7543 } 7544} 7545 7546function defaultPrefilter( elem, props, opts ) { 7547 /* jshint validthis: true */ 7548 var prop, value, toggle, tween, hooks, oldfire, display, checkDisplay, 7549 anim = this, 7550 orig = {}, 7551 style = elem.style, 7552 hidden = elem.nodeType && isHidden( elem ), 7553 dataShow = jQuery._data( elem, "fxshow" ); 7554 7555 // handle queue: false promises 7556 if ( !opts.queue ) { 7557 hooks = jQuery._queueHooks( elem, "fx" ); 7558 if ( hooks.unqueued == null ) { 7559 hooks.unqueued = 0; 7560 oldfire = hooks.empty.fire; 7561 hooks.empty.fire = function() { 7562 if ( !hooks.unqueued ) { 7563 oldfire(); 7564 } 7565 }; 7566 } 7567 hooks.unqueued++; 7568 7569 anim.always( function() { 7570 7571 // doing this makes sure that the complete handler will be called 7572 // before this completes 7573 anim.always( function() { 7574 hooks.unqueued--; 7575 if ( !jQuery.queue( elem, "fx" ).length ) { 7576 hooks.empty.fire(); 7577 } 7578 } ); 7579 } ); 7580 } 7581 7582 // height/width overflow pass 7583 if ( elem.nodeType === 1 && ( "height" in props || "width" in props ) ) { 7584 7585 // Make sure that nothing sneaks out 7586 // Record all 3 overflow attributes because IE does not 7587 // change the overflow attribute when overflowX and 7588 // overflowY are set to the same value 7589 opts.overflow = [ style.overflow, style.overflowX, style.overflowY ]; 7590 7591 // Set display property to inline-block for height/width 7592 // animations on inline elements that are having width/height animated 7593 display = jQuery.css( elem, "display" ); 7594 7595 // Test default display if display is currently "none" 7596 checkDisplay = display === "none" ? 7597 jQuery._data( elem, "olddisplay" ) || defaultDisplay( elem.nodeName ) : display; 7598 7599 if ( checkDisplay === "inline" && jQuery.css( elem, "float" ) === "none" ) { 7600 7601 // inline-level elements accept inline-block; 7602 // block-level elements need to be inline with layout 7603 if ( !support.inlineBlockNeedsLayout || defaultDisplay( elem.nodeName ) === "inline" ) { 7604 style.display = "inline-block"; 7605 } else { 7606 style.zoom = 1; 7607 } 7608 } 7609 } 7610 7611 if ( opts.overflow ) { 7612 style.overflow = "hidden"; 7613 if ( !support.shrinkWrapBlocks() ) { 7614 anim.always( function() { 7615 style.overflow = opts.overflow[ 0 ]; 7616 style.overflowX = opts.overflow[ 1 ]; 7617 style.overflowY = opts.overflow[ 2 ]; 7618 } ); 7619 } 7620 } 7621 7622 // show/hide pass 7623 for ( prop in props ) { 7624 value = props[ prop ]; 7625 if ( rfxtypes.exec( value ) ) { 7626 delete props[ prop ]; 7627 toggle = toggle || value === "toggle"; 7628 if ( value === ( hidden ? "hide" : "show" ) ) { 7629 7630 // If there is dataShow left over from a stopped hide or show 7631 // and we are going to proceed with show, we should pretend to be hidden 7632 if ( value === "show" && dataShow && dataShow[ prop ] !== undefined ) { 7633 hidden = true; 7634 } else { 7635 continue; 7636 } 7637 } 7638 orig[ prop ] = dataShow && dataShow[ prop ] || jQuery.style( elem, prop ); 7639 7640 // Any non-fx value stops us from restoring the original display value 7641 } else { 7642 display = undefined; 7643 } 7644 } 7645 7646 if ( !jQuery.isEmptyObject( orig ) ) { 7647 if ( dataShow ) { 7648 if ( "hidden" in dataShow ) { 7649 hidden = dataShow.hidden; 7650 } 7651 } else { 7652 dataShow = jQuery._data( elem, "fxshow", {} ); 7653 } 7654 7655 // store state if its toggle - enables .stop().toggle() to "reverse" 7656 if ( toggle ) { 7657 dataShow.hidden = !hidden; 7658 } 7659 if ( hidden ) { 7660 jQuery( elem ).show(); 7661 } else { 7662 anim.done( function() { 7663 jQuery( elem ).hide(); 7664 } ); 7665 } 7666 anim.done( function() { 7667 var prop; 7668 jQuery._removeData( elem, "fxshow" ); 7669 for ( prop in orig ) { 7670 jQuery.style( elem, prop, orig[ prop ] ); 7671 } 7672 } ); 7673 for ( prop in orig ) { 7674 tween = createTween( hidden ? dataShow[ prop ] : 0, prop, anim ); 7675 7676 if ( !( prop in dataShow ) ) { 7677 dataShow[ prop ] = tween.start; 7678 if ( hidden ) { 7679 tween.end = tween.start; 7680 tween.start = prop === "width" || prop === "height" ? 1 : 0; 7681 } 7682 } 7683 } 7684 7685 // If this is a noop like .hide().hide(), restore an overwritten display value 7686 } else if ( ( display === "none" ? defaultDisplay( elem.nodeName ) : dis
vendor: 10,851 bytes, lines 7686-8118
7686play ) === "inline" ) { 7687 style.display = display; 7688 } 7689} 7690 7691function propFilter( props, specialEasing ) { 7692 var index, name, easing, value, hooks; 7693 7694 // camelCase, specialEasing and expand cssHook pass 7695 for ( index in props ) { 7696 name = jQuery.camelCase( index ); 7697 easing = specialEasing[ name ]; 7698 value = props[ index ]; 7699 if ( jQuery.isArray( value ) ) { 7700 easing = value[ 1 ]; 7701 value = props[ index ] = value[ 0 ]; 7702 } 7703 7704 if ( index !== name ) { 7705 props[ name ] = value; 7706 delete props[ index ]; 7707 } 7708 7709 hooks = jQuery.cssHooks[ name ]; 7710 if ( hooks && "expand" in hooks ) { 7711 value = hooks.expand( value ); 7712 delete props[ name ]; 7713 7714 // not quite $.extend, this wont overwrite keys already present. 7715 // also - reusing 'index' from above because we have the correct "name" 7716 for ( index in value ) { 7717 if ( !( index in props ) ) { 7718 props[ index ] = value[ index ]; 7719 specialEasing[ index ] = easing; 7720 } 7721 } 7722 } else { 7723 specialEasing[ name ] = easing; 7724 } 7725 } 7726} 7727 7728function Animation( elem, properties, options ) { 7729 var result, 7730 stopped, 7731 index = 0, 7732 length = Animation.prefilters.length, 7733 deferred = jQuery.Deferred().always( function() { 7734 7735 // don't match elem in the :animated selector 7736 delete tick.elem; 7737 } ), 7738 tick = function() { 7739 if ( stopped ) { 7740 return false; 7741 } 7742 var currentTime = fxNow || createFxNow(), 7743 remaining = Math.max( 0, animation.startTime + animation.duration - currentTime ), 7744 7745 // Support: Android 2.3 7746 // Archaic crash bug won't allow us to use `1 - ( 0.5 || 0 )` (#12497) 7747 temp = remaining / animation.duration || 0, 7748 percent = 1 - temp, 7749 index = 0, 7750 length = animation.tweens.length; 7751 7752 for ( ; index < length ; index++ ) { 7753 animation.tweens[ index ].run( percent ); 7754 } 7755 7756 deferred.notifyWith( elem, [ animation, percent, remaining ] ); 7757 7758 if ( percent < 1 && length ) { 7759 return remaining; 7760 } else { 7761 deferred.resolveWith( elem, [ animation ] ); 7762 return false; 7763 } 7764 }, 7765 animation = deferred.promise( { 7766 elem: elem, 7767 props: jQuery.extend( {}, properties ), 7768 opts: jQuery.extend( true, { 7769 specialEasing: {}, 7770 easing: jQuery.easing._default 7771 }, options ), 7772 originalProperties: properties, 7773 originalOptions: options, 7774 startTime: fxNow || createFxNow(), 7775 duration: options.duration, 7776 tweens: [], 7777 createTween: function( prop, end ) { 7778 var tween = jQuery.Tween( elem, animation.opts, prop, end, 7779 animation.opts.specialEasing[ prop ] || animation.opts.easing ); 7780 animation.tweens.push( tween ); 7781 return tween; 7782 }, 7783 stop: function( gotoEnd ) { 7784 var index = 0, 7785 7786 // if we are going to the end, we want to run all the tweens 7787 // otherwise we skip this part 7788 length = gotoEnd ? animation.tweens.length : 0; 7789 if ( stopped ) { 7790 return this; 7791 } 7792 stopped = true; 7793 for ( ; index < length ; index++ ) { 7794 animation.tweens[ index ].run( 1 ); 7795 } 7796 7797 // resolve when we played the last frame 7798 // otherwise, reject 7799 if ( gotoEnd ) { 7800 deferred.notifyWith( elem, [ animation, 1, 0 ] ); 7801 deferred.resolveWith( elem, [ animation, gotoEnd ] ); 7802 } else { 7803 deferred.rejectWith( elem, [ animation, gotoEnd ] ); 7804 } 7805 return this; 7806 } 7807 } ), 7808 props = animation.props; 7809 7810 propFilter( props, animation.opts.specialEasing ); 7811 7812 for ( ; index < length ; index++ ) { 7813 result = Animation.prefilters[ index ].call( animation, elem, props, animation.opts ); 7814 if ( result ) { 7815 if ( jQuery.isFunction( result.stop ) ) { 7816 jQuery._queueHooks( animation.elem, animation.opts.queue ).stop = 7817 jQuery.proxy( result.stop, result ); 7818 } 7819 return result; 7820 } 7821 } 7822 7823 jQuery.map( props, createTween, animation ); 7824 7825 if ( jQuery.isFunction( animation.opts.start ) ) { 7826 animation.opts.start.call( elem, animation ); 7827 } 7828 7829 jQuery.fx.timer( 7830 jQuery.extend( tick, { 7831 elem: elem, 7832 anim: animation, 7833 queue: animation.opts.queue 7834 } ) 7835 ); 7836 7837 // attach callbacks from options 7838 return animation.progress( animation.opts.progress ) 7839 .done( animation.opts.done, animation.opts.complete ) 7840 .fail( animation.opts.fail ) 7841 .always( animation.opts.always ); 7842} 7843 7844jQuery.Animation = jQuery.extend( Animation, { 7845 7846 tweeners: { 7847 "*": [ function( prop, value ) { 7848 var tween = this.createTween( prop, value ); 7849 adjustCSS( tween.elem, prop, rcssNum.exec( value ), tween ); 7850 return tween; 7851 } ] 7852 }, 7853 7854 tweener: function( props, callback ) { 7855 if ( jQuery.isFunction( props ) ) { 7856 callback = props; 7857 props = [ "*" ]; 7858 } else { 7859 props = props.match( rnotwhite ); 7860 } 7861 7862 var prop, 7863 index = 0, 7864 length = props.length; 7865 7866 for ( ; index < length ; index++ ) { 7867 prop = props[ index ]; 7868 Animation.tweeners[ prop ] = Animation.tweeners[ prop ] || []; 7869 Animation.tweeners[ prop ].unshift( callback ); 7870 } 7871 }, 7872 7873 prefilters: [ defaultPrefilter ], 7874 7875 prefilter: function( callback, prepend ) { 7876 if ( prepend ) { 7877 Animation.prefilters.unshift( callback ); 7878 } else { 7879 Animation.prefilters.push( callback ); 7880 } 7881 } 7882} ); 7883 7884jQuery.speed = function( speed, easing, fn ) { 7885 var opt = speed && typeof speed === "object" ? jQuery.extend( {}, speed ) : { 7886 complete: fn || !fn && easing || 7887 jQuery.isFunction( speed ) && speed, 7888 duration: speed, 7889 easing: fn && easing || easing && !jQuery.isFunction( easing ) && easing 7890 }; 7891 7892 opt.duration = jQuery.fx.off ? 0 : typeof opt.duration === "number" ? opt.duration : 7893 opt.duration in jQuery.fx.speeds ? 7894 jQuery.fx.speeds[ opt.duration ] : jQuery.fx.speeds._default; 7895 7896 // normalize opt.queue - true/undefined/null -> "fx" 7897 if ( opt.queue == null || opt.queue === true ) { 7898 opt.queue = "fx"; 7899 } 7900 7901 // Queueing 7902 opt.old = opt.complete; 7903 7904 opt.complete = function() { 7905 if ( jQuery.isFunction( opt.old ) ) { 7906 opt.old.call( this ); 7907 } 7908 7909 if ( opt.queue ) { 7910 jQuery.dequeue( this, opt.queue ); 7911 } 7912 }; 7913 7914 return opt; 7915}; 7916 7917jQuery.fn.extend( { 7918 fadeTo: function( speed, to, easing, callback ) { 7919 7920 // show any hidden elements after setting opacity to 0 7921 return this.filter( isHidden ).css( "opacity", 0 ).show() 7922 7923 // animate to the value specified 7924 .end().animate( { opacity: to }, speed, easing, callback ); 7925 }, 7926 animate: function( prop, speed, easing, callback ) { 7927 var empty = jQuery.isEmptyObject( prop ), 7928 optall = jQuery.speed( speed, easing, callback ), 7929 doAnimation = function() { 7930 7931 // Operate on a copy of prop so per-property easing won't be lost 7932 var anim = Animation( this, jQuery.extend( {}, prop ), optall ); 7933 7934 // Empty animations, or finishing resolves immediately 7935 if ( empty || jQuery._data( this, "finish" ) ) { 7936 anim.stop( true ); 7937 } 7938 }; 7939 doAnimation.finish = doAnimation; 7940 7941 return empty || optall.queue === false ? 7942 this.each( doAnimation ) : 7943 this.queue( optall.queue, doAnimation ); 7944 }, 7945 stop: function( type, clearQueue, gotoEnd ) { 7946 var stopQueue = function( hooks ) { 7947 var stop = hooks.stop; 7948 delete hooks.stop; 7949 stop( gotoEnd ); 7950 }; 7951 7952 if ( typeof type !== "string" ) { 7953 gotoEnd = clearQueue; 7954 clearQueue = type; 7955 type = undefined; 7956 } 7957 if ( clearQueue && type !== false ) { 7958 this.queue( type || "fx", [] ); 7959 } 7960 7961 return this.each( function() { 7962 var dequeue = true, 7963 index = type != null && type + "queueHooks", 7964 timers = jQuery.timers, 7965 data = jQuery._data( this ); 7966 7967 if ( index ) { 7968 if ( data[ index ] && data[ index ].stop ) { 7969 stopQueue( data[ index ] ); 7970 } 7971 } else { 7972 for ( index in data ) { 7973 if ( data[ index ] && data[ index ].stop && rrun.test( index ) ) { 7974 stopQueue( data[ index ] ); 7975 } 7976 } 7977 } 7978 7979 for ( index = timers.length; index--; ) { 7980 if ( timers[ index ].elem === this && 7981 ( type == null || timers[ index ].queue === type ) ) { 7982 7983 timers[ index ].anim.stop( gotoEnd ); 7984 dequeue = false; 7985 timers.splice( index, 1 ); 7986 } 7987 } 7988 7989 // start the next in the queue if the last step wasn't forced 7990 // timers currently will call their complete callbacks, which will dequeue 7991 // but only if they were gotoEnd 7992 if ( dequeue || !gotoEnd ) { 7993 jQuery.dequeue( this, type ); 7994 } 7995 } ); 7996 }, 7997 finish: function( type ) { 7998 if ( type !== false ) { 7999 type = type || "fx"; 8000 } 8001 return this.each( function() { 8002 var index, 8003 data = jQuery._data( this ), 8004 queue = data[ type + "queue" ], 8005 hooks = data[ type + "queueHooks" ], 8006 timers = jQuery.timers, 8007 length = queue ? queue.length : 0; 8008 8009 // enable finishing flag on private data 8010 data.finish = true; 8011 8012 // empty the queue first 8013 jQuery.queue( this, type, [] ); 8014 8015 if ( hooks && hooks.stop ) { 8016 hooks.stop.call( this, true ); 8017 } 8018 8019 // look for any active animations, and finish them 8020 for ( index = timers.length; index--; ) { 8021 if ( timers[ index ].elem === this && timers[ index ].queue === type ) { 8022 timers[ index ].anim.stop( true ); 8023 timers.splice( index, 1 ); 8024 } 8025 } 8026 8027 // look for any animations in the old queue and finish them 8028 for ( index = 0; index < length; index++ ) { 8029 if ( queue[ index ] && queue[ index ].finish ) { 8030 queue[ index ].finish.call( this ); 8031 } 8032 } 8033 8034 // turn off finishing flag 8035 delete data.finish; 8036 } ); 8037 } 8038} ); 8039 8040jQuery.each( [ "toggle", "show", "hide" ], function( i, name ) { 8041 var cssFn = jQuery.fn[ name ]; 8042 jQuery.fn[ name ] = function( speed, easing, callback ) { 8043 return speed == null || typeof speed === "boolean" ? 8044 cssFn.apply( this, arguments ) : 8045 this.animate( genFx( name, true ), speed, easing, callback ); 8046 }; 8047} ); 8048 8049// Generate shortcuts for custom animations 8050jQuery.each( { 8051 slideDown: genFx( "show" ), 8052 slideUp: genFx( "hide" ), 8053 slideToggle: genFx( "toggle" ), 8054 fadeIn: { opacity: "show" }, 8055 fadeOut: { opacity: "hide" }, 8056 fadeToggle: { opacity: "toggle" } 8057}, function( name, props ) { 8058 jQuery.fn[ name ] = function( speed, easing, callback ) { 8059 return this.animate( props, speed, easing, callback ); 8060 }; 8061} ); 8062 8063jQuery.timers = []; 8064jQuery.fx.tick = function() { 8065 var timer, 8066 timers = jQuery.timers, 8067 i = 0; 8068 8069 fxNow = jQuery.now(); 8070 8071 for ( ; i < timers.length; i++ ) { 8072 timer = timers[ i ]; 8073 8074 // Checks the timer has not already been removed 8075 if ( !timer() && timers[ i ] === timer ) { 8076 timers.splice( i--, 1 ); 8077 } 8078 } 8079 8080 if ( !timers.length ) { 8081 jQuery.fx.stop(); 8082 } 8083 fxNow = undefined; 8084}; 8085 8086jQuery.fx.timer = function( timer ) { 8087 jQuery.timers.push( timer ); 8088 if ( timer() ) { 8089 jQuery.fx.start(); 8090 } else { 8091 jQuery.timers.pop(); 8092 } 8093}; 8094 8095jQuery.fx.interval = 13; 8096 8097jQuery.fx.start = function() { 8098 if ( !timerId ) { 8099 timerId = window.setInterval( jQuery.fx.tick, jQuery.fx.interval ); 8100 } 8101}; 8102 8103jQuery.fx.stop = function() { 8104 window.clearInterval( timerId ); 8105 timerId = null; 8106}; 8107 8108jQuery.fx.speeds = { 8109 slow: 600, 8110 fast: 200, 8111 8112 // Default speed 8113 _default: 400 8114}; 8115 8116 8117// Based off of the plugin by Clint Helfers, with permission. 8118// http://web.archive.org/web/20100324014747/http://blindsignals.com/index.php/2009/07/jquery-delay/
8119jQuery.fn.delay = function( time, type ) { 8120 time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; 8121 type = type || "fx"; 8122 8123 return this.queue( type, function( next, hooks ) { 8124 var timeout = window.setTimeout( next, time ); 8125 hooks.stop = function() { 8126 window.clearTimeout( timeout ); 8127 }; 8128 } ); 8129}; 8130 8131 8132( function() { 8133 var a, 8134 input = document.createElement( "input" ), 8135 div = document.createElement( "div" ), 8136 select = document.createElement( "select" ), 8137 opt = select.appendChild( document.createElement( "option" ) ); 8138 8139 // Setup 8140 div = document.createElement( "div" ); 8141 div.setAttribute( "className", "t" ); 8142 div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>"; 8143 a = div.getElementsByTagName( "a" )[ 0 ]; 8144 8145 // Support: Windows Web Apps (WWA) 8146 // `type` must use .setAttribute for WWA (#14901) 8147 input.setAttribute( "type", "checkbox" ); 8148 div.appendChild( input ); 8149 8150 a = div.getElementsByTagName( "a" )[ 0 ]; 8151 8152 // First batch of tests. 8153 a.style.cssText = "top:1px"; 8154 8155 // Test setAttribute on camelCase class. 8156 // If it works, we need attrFixes when doing get/setAttribute (ie6/7)
vendor: 2,696 bytes, lines 8157-8258
8157 support.getSetAttribute = div.className !== "t"; 8158 8159 // Get the style information from getAttribute 8160 // (IE uses .cssText instead) 8161 support.style = /top/.test( a.getAttribute( "style" ) ); 8162 8163 // Make sure that URLs aren't manipulated 8164 // (IE normalizes it by default) 8165 support.hrefNormalized = a.getAttribute( "href" ) === "/a"; 8166 8167 // Check the default checkbox/radio value ("" on WebKit; "on" elsewhere) 8168 support.checkOn = !!input.value; 8169 8170 // Make sure that a selected-by-default option has a working selected property. 8171 // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) 8172 support.optSelected = opt.selected; 8173 8174 // Tests for enctype support on a form (#6743) 8175 support.enctype = !!document.createElement( "form" ).enctype; 8176 8177 // Make sure that the options inside disabled selects aren't marked as disabled 8178 // (WebKit marks them as disabled) 8179 select.disabled = true; 8180 support.optDisabled = !opt.disabled; 8181 8182 // Support: IE8 only 8183 // Check if we can trust getAttribute("value") 8184 input = document.createElement( "input" ); 8185 input.setAttribute( "value", "" ); 8186 support.input = input.getAttribute( "value" ) === ""; 8187 8188 // Check if an input maintains its value after becoming a radio 8189 input.value = "t"; 8190 input.setAttribute( "type", "radio" ); 8191 support.radioValue = input.value === "t"; 8192} )(); 8193 8194 8195var rreturn = /\r/g, 8196 rspaces = /[\x20\t\r\n\f]+/g; 8197 8198jQuery.fn.extend( { 8199 val: function( value ) { 8200 var hooks, ret, isFunction, 8201 elem = this[ 0 ]; 8202 8203 if ( !arguments.length ) { 8204 if ( elem ) { 8205 hooks = jQuery.valHooks[ elem.type ] || 8206 jQuery.valHooks[ elem.nodeName.toLowerCase() ]; 8207 8208 if ( 8209 hooks && 8210 "get" in hooks && 8211 ( ret = hooks.get( elem, "value" ) ) !== undefined 8212 ) { 8213 return ret; 8214 } 8215 8216 ret = elem.value; 8217 8218 return typeof ret === "string" ? 8219 8220 // handle most common string cases 8221 ret.replace( rreturn, "" ) : 8222 8223 // handle cases where value is null/undef or number 8224 ret == null ? "" : ret; 8225 } 8226 8227 return; 8228 } 8229 8230 isFunction = jQuery.isFunction( value ); 8231 8232 return this.each( function( i ) { 8233 var val; 8234 8235 if ( this.nodeType !== 1 ) { 8236 return; 8237 } 8238 8239 if ( isFunction ) { 8240 val = value.call( this, i, jQuery( this ).val() ); 8241 } else { 8242 val = value; 8243 } 8244 8245 // Treat null/undefined as ""; convert numbers to string 8246 if ( val == null ) { 8247 val = ""; 8248 } else if ( typeof val === "number" ) { 8249 val += ""; 8250 } else if ( jQuery.isArray( val ) ) { 8251 val = jQuery.map( val, function( value ) { 8252 return value == null ? "" : value + ""; 8253 } ); 8254 } 8255 8256 hooks = jQuery.valHooks[ this.type ] || jQuery.valHooks[ this.nodeName.toLowerCase() ]; 8257 8258 // If set returns undefined, fall back to normal setting
vendor: 4,648 bytes, lines 8259-8449
8259 if ( !hooks || !( "set" in hooks ) || hooks.set( this, val, "value" ) === undefined ) { 8260 this.value = val; 8261 } 8262 } ); 8263 } 8264} ); 8265 8266jQuery.extend( { 8267 valHooks: { 8268 option: { 8269 get: function( elem ) { 8270 var val = jQuery.find.attr( elem, "value" ); 8271 return val != null ? 8272 val : 8273 8274 // Support: IE10-11+ 8275 // option.text throws exceptions (#14686, #14858) 8276 // Strip and collapse whitespace 8277 // https://html.spec.whatwg.org/#strip-and-collapse-whitespace 8278 jQuery.trim( jQuery.text( elem ) ).replace( rspaces, " " ); 8279 } 8280 }, 8281 select: { 8282 get: function( elem ) { 8283 var value, option, 8284 options = elem.options, 8285 index = elem.selectedIndex, 8286 one = elem.type === "select-one" || index < 0, 8287 values = one ? null : [], 8288 max = one ? index + 1 : options.length, 8289 i = index < 0 ? 8290 max : 8291 one ? index : 0; 8292 8293 // Loop through all the selected options 8294 for ( ; i < max; i++ ) { 8295 option = options[ i ]; 8296 8297 // oldIE doesn't update selected after form reset (#2551) 8298 if ( ( option.selected || i === index ) && 8299 8300 // Don't return options that are disabled or in a disabled optgroup 8301 ( support.optDisabled ? 8302 !option.disabled : 8303 option.getAttribute( "disabled" ) === null ) && 8304 ( !option.parentNode.disabled || 8305 !jQuery.nodeName( option.parentNode, "optgroup" ) ) ) { 8306 8307 // Get the specific value for the option 8308 value = jQuery( option ).val(); 8309 8310 // We don't need an array for one selects 8311 if ( one ) { 8312 return value; 8313 } 8314 8315 // Multi-Selects return an array 8316 values.push( value ); 8317 } 8318 } 8319 8320 return values; 8321 }, 8322 8323 set: function( elem, value ) { 8324 var optionSet, option, 8325 options = elem.options, 8326 values = jQuery.makeArray( value ), 8327 i = options.length; 8328 8329 while ( i-- ) { 8330 option = options[ i ]; 8331 8332 if ( jQuery.inArray( jQuery.valHooks.option.get( option ), values ) > -1 ) { 8333 8334 // Support: IE6 8335 // When new option element is added to select box we need to 8336 // force reflow of newly added node in order to workaround delay 8337 // of initialization properties 8338 try { 8339 option.selected = optionSet = true; 8340 8341 } catch ( _ ) { 8342 8343 // Will be executed only in IE6 8344 option.scrollHeight; 8345 } 8346 8347 } else { 8348 option.selected = false; 8349 } 8350 } 8351 8352 // Force browsers to behave consistently when non-matching value is set 8353 if ( !optionSet ) { 8354 elem.selectedIndex = -1; 8355 } 8356 8357 return options; 8358 } 8359 } 8360 } 8361} ); 8362 8363// Radios and checkboxes getter/setter 8364jQuery.each( [ "radio", "checkbox" ], function() { 8365 jQuery.valHooks[ this ] = { 8366 set: function( elem, value ) { 8367 if ( jQuery.isArray( value ) ) { 8368 return ( elem.checked = jQuery.inArray( jQuery( elem ).val(), value ) > -1 ); 8369 } 8370 } 8371 }; 8372 if ( !support.checkOn ) { 8373 jQuery.valHooks[ this ].get = function( elem ) { 8374 return elem.getAttribute( "value" ) === null ? "on" : elem.value; 8375 }; 8376 } 8377} ); 8378 8379 8380 8381 8382var nodeHook, boolHook, 8383 attrHandle = jQuery.expr.attrHandle, 8384 ruseDefault = /^(?:checked|selected)$/i, 8385 getSetAttribute = support.getSetAttribute, 8386 getSetInput = support.input; 8387 8388jQuery.fn.extend( { 8389 attr: function( name, value ) { 8390 return access( this, jQuery.attr, name, value, arguments.length > 1 ); 8391 }, 8392 8393 removeAttr: function( name ) { 8394 return this.each( function() { 8395 jQuery.removeAttr( this, name ); 8396 } ); 8397 } 8398} ); 8399 8400jQuery.extend( { 8401 attr: function( elem, name, value ) { 8402 var ret, hooks, 8403 nType = elem.nodeType; 8404 8405 // Don't get/set attributes on text, comment and attribute nodes 8406 if ( nType === 3 || nType === 8 || nType === 2 ) { 8407 return; 8408 } 8409 8410 // Fallback to prop when attributes are not supported 8411 if ( typeof elem.getAttribute === "undefined" ) { 8412 return jQuery.prop( elem, name, value ); 8413 } 8414 8415 // All attributes are lowercase 8416 // Grab necessary hook if one is defined 8417 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8418 name = name.toLowerCase(); 8419 hooks = jQuery.attrHooks[ name ] || 8420 ( jQuery.expr.match.bool.test( name ) ? boolHook : nodeHook ); 8421 } 8422 8423 if ( value !== undefined ) { 8424 if ( value === null ) { 8425 jQuery.removeAttr( elem, name ); 8426 return; 8427 } 8428 8429 if ( hooks && "set" in hooks && 8430 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8431 return ret; 8432 } 8433 8434 elem.setAttribute( name, value + "" ); 8435 return value; 8436 } 8437 8438 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8439 return ret; 8440 } 8441 8442 ret = jQuery.find.attr( elem, name ); 8443 8444 // Non-existent attributes return null, we normalize to undefined 8445 return ret == null ? undefined : ret; 8446 }, 8447 8448 attrHooks: { 8449 type: {
vendor: 4,457 bytes, lines 8450-8616
8450 set: function( elem, value ) { 8451 if ( !support.radioValue && value === "radio" && 8452 jQuery.nodeName( elem, "input" ) ) { 8453 8454 // Setting the type on a radio button after the value resets the value in IE8-9 8455 // Reset value to default in case type is set after value during creation 8456 var val = elem.value; 8457 elem.setAttribute( "type", value ); 8458 if ( val ) { 8459 elem.value = val; 8460 } 8461 return value; 8462 } 8463 } 8464 } 8465 }, 8466 8467 removeAttr: function( elem, value ) { 8468 var name, propName, 8469 i = 0, 8470 attrNames = value && value.match( rnotwhite ); 8471 8472 if ( attrNames && elem.nodeType === 1 ) { 8473 while ( ( name = attrNames[ i++ ] ) ) { 8474 propName = jQuery.propFix[ name ] || name; 8475 8476 // Boolean attributes get special treatment (#10870) 8477 if ( jQuery.expr.match.bool.test( name ) ) { 8478 8479 // Set corresponding property to false 8480 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8481 elem[ propName ] = false; 8482 8483 // Support: IE<9 8484 // Also clear defaultChecked/defaultSelected (if appropriate) 8485 } else { 8486 elem[ jQuery.camelCase( "default-" + name ) ] = 8487 elem[ propName ] = false; 8488 } 8489 8490 // See #9699 for explanation of this approach (setting first, then removal) 8491 } else { 8492 jQuery.attr( elem, name, "" ); 8493 } 8494 8495 elem.removeAttribute( getSetAttribute ? name : propName ); 8496 } 8497 } 8498 } 8499} ); 8500 8501// Hooks for boolean attributes 8502boolHook = { 8503 set: function( elem, value, name ) { 8504 if ( value === false ) { 8505 8506 // Remove boolean attributes when set to false 8507 jQuery.removeAttr( elem, name ); 8508 } else if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8509 8510 // IE<8 needs the *property* name 8511 elem.setAttribute( !getSetAttribute && jQuery.propFix[ name ] || name, name ); 8512 8513 } else { 8514 8515 // Support: IE<9 8516 // Use defaultChecked and defaultSelected for oldIE 8517 elem[ jQuery.camelCase( "default-" + name ) ] = elem[ name ] = true; 8518 } 8519 return name; 8520 } 8521}; 8522 8523jQuery.each( jQuery.expr.match.bool.source.match( /\w+/g ), function( i, name ) { 8524 var getter = attrHandle[ name ] || jQuery.find.attr; 8525 8526 if ( getSetInput && getSetAttribute || !ruseDefault.test( name ) ) { 8527 attrHandle[ name ] = function( elem, name, isXML ) { 8528 var ret, handle; 8529 if ( !isXML ) { 8530 8531 // Avoid an infinite loop by temporarily removing this function from the getter 8532 handle = attrHandle[ name ]; 8533 attrHandle[ name ] = ret; 8534 ret = getter( elem, name, isXML ) != null ? 8535 name.toLowerCase() : 8536 null; 8537 attrHandle[ name ] = handle; 8538 } 8539 return ret; 8540 }; 8541 } else { 8542 attrHandle[ name ] = function( elem, name, isXML ) { 8543 if ( !isXML ) { 8544 return elem[ jQuery.camelCase( "default-" + name ) ] ? 8545 name.toLowerCase() : 8546 null; 8547 } 8548 }; 8549 } 8550} ); 8551 8552// fix oldIE attroperties 8553if ( !getSetInput || !getSetAttribute ) { 8554 jQuery.attrHooks.value = { 8555 set: function( elem, value, name ) { 8556 if ( jQuery.nodeName( elem, "input" ) ) { 8557 8558 // Does not return so that setAttribute is also used 8559 elem.defaultValue = value; 8560 } else { 8561 8562 // Use nodeHook if defined (#1954); otherwise setAttribute is fine 8563 return nodeHook && nodeHook.set( elem, value, name ); 8564 } 8565 } 8566 }; 8567} 8568 8569// IE6/7 do not support getting/setting some attributes with get/setAttribute 8570if ( !getSetAttribute ) { 8571 8572 // Use this for any attribute in IE6/7 8573 // This fixes almost every IE6/7 issue 8574 nodeHook = { 8575 set: function( elem, value, name ) { 8576 8577 // Set the existing or create a new attribute node 8578 var ret = elem.getAttributeNode( name ); 8579 if ( !ret ) { 8580 elem.setAttributeNode( 8581 ( ret = elem.ownerDocument.createAttribute( name ) ) 8582 ); 8583 } 8584 8585 ret.value = value += ""; 8586 8587 // Break association with cloned elements by also using setAttribute (#9646) 8588 if ( name === "value" || value === elem.getAttribute( name ) ) { 8589 return value; 8590 } 8591 } 8592 }; 8593 8594 // Some attributes are constructed with empty-string values when not defined 8595 attrHandle.id = attrHandle.name = attrHandle.coords = 8596 function( elem, name, isXML ) { 8597 var ret; 8598 if ( !isXML ) { 8599 return ( ret = elem.getAttributeNode( name ) ) && ret.value !== "" ? 8600 ret.value : 8601 null; 8602 } 8603 }; 8604 8605 // Fixing value retrieval on a button requires this module 8606 jQuery.valHooks.button = { 8607 get: function( elem, name ) { 8608 var ret = elem.getAttributeNode( name ); 8609 if ( ret && ret.specified ) { 8610 return ret.value; 8611 } 8612 }, 8613 set: nodeHook.set 8614 }; 8615 8616 // Set contenteditable to false on removals(#10429)
8617 // Setting to empty string throws an error as an invalid value 8618 jQuery.attrHooks.contenteditable = { 8619 set: function( elem, value, name ) { 8620 nodeHook.set( elem, value === "" ? false : value, name ); 8621 } 8622 }; 8623 8624 // Set width and height to auto instead of 0 on empty string( Bug #8150 ) 8625 // This is for removals 8626 jQuery.each( [ "width", "height" ], function( i, name ) { 8627 jQuery.attrHooks[ name ] = { 8628 set: function( elem, value ) { 8629 if ( value === "" ) { 8630 elem.setAttribute( name, "auto" ); 8631 return value; 8632 } 8633 } 8634 }; 8635 } ); 8636} 8637 8638if ( !support.style ) { 8639 jQuery.attrHooks.style = { 8640 get: function( elem ) { 8641 8642 // Return undefined in the case of empty string 8643 // Note: IE uppercases css property names, but if we were to .toLowerCase() 8644 // .cssText, that would destroy case sensitivity in URL's, like in "background" 8645 return elem.style.cssText || undefined; 8646 }, 8647 set: function( elem, value ) { 8648 return ( elem.style.cssText = value + "" ); 8649 } 8650 }; 8651} 8652 8653 8654 8655 8656var rfocusable = /^(?:input|select|textarea|button|object)$/i, 8657 rclickable = /^(?:a|area)$/i; 8658 8659jQuery.fn.extend( { 8660 prop: function( name, value ) { 8661 return access( this, jQuery.prop, name, value, arguments.length > 1 ); 8662 }, 8663 8664 removeProp: function( name ) { 8665 name = jQuery.propFix[ name ] || name; 8666 return this.each( function() { 8667 8668 // try/catch handles cases where IE balks (such as removing a property on window) 8669 try { 8670 this[ name ] = undefined; 8671 delete this[ name ]; 8672 } catch ( e ) {} 8673 } ); 8674 } 8675} ); 8676 8677jQuery.extend( { 8678 prop: function( elem, name, value ) { 8679 var ret, hooks, 8680 nType = elem.nodeType; 8681 8682 // Don't get/set properties on text, comment and attribute nodes 8683 if ( nType === 3 || nType === 8 || nType === 2 ) { 8684 return; 8685 } 8686 8687 if ( nType !== 1 || !jQuery.isXMLDoc( elem ) ) { 8688 8689 // Fix name and attach hooks 8690 name = jQuery.propFix[ name ] || name; 8691 hooks = jQuery.propHooks[ name ]; 8692 } 8693 8694 if ( value !== undefined ) { 8695 if ( hooks && "set" in hooks && 8696 ( ret = hooks.set( elem, value, name ) ) !== undefined ) { 8697 return ret; 8698 } 8699 8700 return ( elem[ name ] = value ); 8701 } 8702 8703 if ( hooks && "get" in hooks && ( ret = hooks.get( elem, name ) ) !== null ) { 8704 return ret; 8705 } 8706 8707 return elem[ name ]; 8708 }, 8709 8710 propHooks: { 8711 tabIndex: { 8712 get: function( elem ) { 8713 8714 // elem.tabIndex doesn't always return the 8715 // correct value when it hasn't been explicitly set 8716 // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ 8717 // Use proper attribute retrieval(#12072) 8718 var tabindex = jQuery.find.attr( elem, "tabindex" ); 8719 8720 return tabindex ? 8721 parseInt( tabindex, 10 ) : 8722 rfocusable.test( elem.nodeName ) || 8723 rclickable.test( elem.nodeName ) && elem.href ? 8724 0 : 8725 -1; 8726 } 8727 } 8728 }, 8729 8730 propFix: { 8731 "for": "htmlFor", 8732 "class": "className" 8733 } 8734} ); 8735 8736// Some attributes require a special call on IE 8737// http://msdn.microsoft.com/en-us/library/ms536429%28VS.85%29.aspx 8738if ( !support.hrefNormalized ) { 8739 8740 // href/src property should get the full normalized URL (#10299/#12915) 8741 jQuery.each( [ "href", "src" ], function( i, name ) { 8742 jQuery.propHooks[ name ] = { 8743 get: function( elem ) { 8744 return elem.getAttribute( name, 4 ); 8745 } 8746 }; 8747 } ); 8748} 8749 8750// Support: Safari, IE9+ 8751// Accessing the selectedIndex property 8752// forces the browser to respect setting selected 8753// on the option 8754// The getter ensures a default option is selected 8755// when in an optgroup 8756if ( !support.optSelected ) { 8757 jQuery.propHooks.selected = { 8758 get: function( elem ) { 8759 var parent = elem.parentNode; 8760 8761 if ( parent ) { 8762 parent.selectedIndex; 8763 8764 // Make sure that it also works with optgroups, see #5701 8765 if ( parent.parentNode ) { 8766 parent.parentNode.selectedIndex; 8767 } 8768 } 8769 return null; 8770 }, 8771 set: function( elem ) { 8772 var parent = elem.parentNode; 8773 if ( parent ) { 8774 parent.selectedIndex; 8775 8776 if ( parent.parentNode ) { 8777 parent.parentNode.selectedIndex; 8778 } 8779 } 8780 } 8781 }; 8782} 8783 8784jQuery.each( [ 8785 "tabIndex", 8786 "readOnly", 8787 "maxLength", 8788 "cellSpacing", 8789 "cellPadding", 8790 "rowSpan", 8791 "colSpan", 8792 "useMap", 8793 "frameBorder", 8794 "contentEditable" 8795], function() { 8796 jQuery.propFix[ this.toLowerCase() ] = this; 8797} ); 8798 8799// IE6/7 call enctype encoding 8800if ( !support.enctype ) { 8801 jQuery.propFix.enctype = "encoding"; 8802} 8803 8804 8805 8806 8807var rclass = /[\t\r\n\f]/g; 8808 8809function getClass( elem ) { 8810 return jQuery.attr( elem, "class" ) || ""; 8811} 8812 8813jQuery.fn.extend( { 8814 addClass: function( value ) { 8815 var classes, elem, cur, curValue, clazz, j, finalValue, 8816 i = 0; 8817 8818 if ( jQuery.isFunction( value ) ) { 8819 return this.each( function( j ) { 8820 jQuery( this ).addClass( value.call( this, j, getClass( this ) ) ); 8821 } ); 8822 } 8823 8824 if ( typeof value === "string" && value ) { 8825 classes = value.match( rnotwhite ) || []; 8826 8827 while ( ( elem = this[ i++ ] ) ) { 8828 curValue = getClass( elem ); 8829 cur = elem.nodeType === 1 && 8830 ( " " + curValue + " " ).replace( rclass, " " ); 8831 8832 if ( cur ) { 8833 j = 0; 8834 while ( ( clazz = classes[ j++ ] ) ) { 8835 if ( cur.indexOf( " " + clazz + " " ) < 0 ) { 8836 cur += clazz + " "; 8837 } 8838 } 8839 8840 // only assign if different to avoid unneeded rendering. 8841 finalValue = jQuery.trim( cur ); 8842 if ( curValue !== finalValue ) { 8843 jQuery.attr( elem, "class", finalValue ); 8844 } 8845 } 8846 } 8847 } 8848 8849 return this; 8850 }, 8851 8852 removeClass: function( value ) { 8853 var classes, elem, cur, curValue, clazz, j, finalValue, 8854 i = 0; 8855 8856 if ( jQuery.isFunction( value ) ) { 8857 return this.each( function( j ) { 8858 jQuery( this ).removeClass( value.call( this, j, getClass( this ) ) ); 8859 } ); 8860 } 8861 8862 if ( !arguments.length ) { 8863 return this.attr( "class", "" ); 8864 } 8865 8866 if ( typeof value === "string" && value ) { 8867 classes = value.match( rnotwhite ) || []; 8868 8869 while ( ( elem = this[ i++ ] ) ) { 8870 curValue = getClass( elem ); 8871 8872 // This expression is here for better compressibility (see addClass) 8873 cur = elem.nodeType === 1 && 8874 ( " " + curValue + " " ).replace( rclass, " " ); 8875 8876 if ( cur ) { 8877 j = 0; 8878 while ( ( clazz = classes[ j++ ] ) ) { 8879
8880 // Remove *all* instances 8881 while ( cur.indexOf( " " + clazz + " " ) > -1 ) { 8882 cur = cur.replace( " " + clazz + " ", " " ); 8883 } 8884 } 8885 8886 // Only assign if different to avoid unneeded rendering. 8887 finalValue = jQuery.trim( cur ); 8888 if ( curValue !== finalValue ) { 8889 jQuery.attr( elem, "class", finalValue ); 8890 } 8891 } 8892 } 8893 } 8894 8895 return this; 8896 }, 8897 8898 toggleClass: function( value, stateVal ) { 8899 var type = typeof value; 8900 8901 if ( typeof stateVal === "boolean" && type === "string" ) { 8902 return stateVal ? this.addClass( value ) : this.removeClass( value ); 8903 } 8904 8905 if ( jQuery.isFunction( value ) ) { 8906 return this.each( function( i ) { 8907 jQuery( this ).toggleClass( 8908 value.call( this, i, getClass( this ), stateVal ), 8909 stateVal 8910 ); 8911 } ); 8912 } 8913 8914 return this.each( function() { 8915 var className, i, self, classNames; 8916 8917 if ( type === "string" ) { 8918 8919 // Toggle individual class names 8920 i = 0; 8921 self = jQuery( this ); 8922 classNames = value.match( rnotwhite ) || []; 8923 8924 while ( ( className = classNames[ i++ ] ) ) { 8925 8926 // Check each className given, space separated list 8927 if ( self.hasClass( className ) ) { 8928 self.removeClass( className ); 8929 } else { 8930 self.addClass( className ); 8931 } 8932 } 8933 8934 // Toggle whole class name 8935 } else if ( value === undefined || type === "boolean" ) { 8936 className = getClass( this ); 8937 if ( className ) { 8938 8939 // store className if set 8940 jQuery._data( this, "__className__", className ); 8941 } 8942 8943 // If the element has a class name or if we're passed "false", 8944 // then remove the whole classname (if there was one, the above saved it). 8945 // Otherwise bring back whatever was previously saved (if anything), 8946 // falling back to the empty string if nothing was stored. 8947 jQuery.attr( this, "class", 8948 className || value === false ? 8949 "" : 8950 jQuery._data( this, "__className__" ) || "" 8951 ); 8952 } 8953 } ); 8954 }, 8955 8956 hasClass: function( selector ) { 8957 var className, elem, 8958 i = 0; 8959 8960 className = " " + selector + " "; 8961 while ( ( elem = this[ i++ ] ) ) { 8962 if ( elem.nodeType === 1 && 8963 ( " " + getClass( elem ) + " " ).replace( rclass, " " ) 8964 .indexOf( className ) > -1 8965 ) { 8966 return true; 8967 } 8968 } 8969 8970 return false; 8971 } 8972} ); 8973 8974 8975 8976 8977// Return jQuery for attributes-only inclusion 8978 8979 8980jQuery.each( ( "blur focus focusin focusout load resize scroll unload click dblclick " + 8981 "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + 8982 "change select submit keydown keypress keyup error contextmenu" ).split( " " ), 8983 function( i, name ) { 8984 8985 // Handle event binding 8986 jQuery.fn[ name ] = function( data, fn ) { 8987 return arguments.length > 0 ? 8988 this.on( name, null, data, fn ) : 8989 this.trigger( name ); 8990 }; 8991} ); 8992 8993jQuery.fn.extend( { 8994 hover: function( fnOver, fnOut ) { 8995 return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); 8996 } 8997} ); 8998 8999 9000var location = window.location; 9001 9002var nonce = jQuery.now(); 9003 9004var rquery = ( /\?/ ); 9005 9006 9007 9008var rvalidtokens = /(,)|(\[|{)|(}|])|"(?:[^"\\\r\n]|\\["\\\/bfnrt]|\\u[\da-fA-F]{4})*"\s*:?|true|false|null|-?(?!0\d)\d+(?:\.\d+|)(?:[eE][+-]?\d+|)/g; 9009 9010jQuery.parseJSON = function( data ) { 9011 9012 // Attempt to parse using the native JSON parser first 9013 if ( window.JSON && window.JSON.parse ) { 9014 9015 // Support: Android 2.3 9016 // Workaround failure to string-cast null input 9017 return window.JSON.parse( data + "" ); 9018 } 9019 9020 var requireNonComma, 9021 depth = null, 9022 str = jQuery.trim( data + "" ); 9023 9024 // Guard against invalid (and possibly dangerous) input by ensuring that nothing remains 9025 // after removing valid tokens 9026 return str && !jQuery.trim( str.replace( rvalidtokens, function( token, comma, open, close ) { 9027 9028 // Force termination if we see a misplaced comma 9029 if ( requireNonComma && comma ) { 9030 depth = 0; 9031 } 9032 9033 // Perform no more replacements after returning to outermost depth 9034 if ( depth === 0 ) { 9035 return token; 9036 } 9037 9038 // Commas must not follow "[", "{", or "," 9039 requireNonComma = open || comma; 9040 9041 // Determine new depth 9042 // array/object open ("[" or "{"): depth += true - false (increment) 9043 // array/object close ("]" or "}"): depth += false - true (decrement) 9044 // other cases ("," or primitive): depth += true - true (numeric cast) 9045 depth += !close - !open; 9046 9047 // Remove this token 9048 return ""; 9049 } ) ) ? 9050 ( Function( "return " + str ) )() : 9051 jQuery.error( "Invalid JSON: " + data ); 9052}; 9053 9054 9055// Cross-browser xml parsing
vendor: 10,393 bytes, lines 9056-9461
9056jQuery.parseXML = function( data ) { 9057 var xml, tmp; 9058 if ( !data || typeof data !== "string" ) { 9059 return null; 9060 } 9061 try { 9062 if ( window.DOMParser ) { // Standard 9063 tmp = new window.DOMParser(); 9064 xml = tmp.parseFromString( data, "text/xml" ); 9065 } else { // IE 9066 xml = new window.ActiveXObject( "Microsoft.XMLDOM" ); 9067 xml.async = "false"; 9068 xml.loadXML( data ); 9069 } 9070 } catch ( e ) { 9071 xml = undefined; 9072 } 9073 if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { 9074 jQuery.error( "Invalid XML: " + data ); 9075 } 9076 return xml; 9077}; 9078 9079 9080var 9081 rhash = /#.*$/, 9082 rts = /([?&])_=[^&]*/, 9083 9084 // IE leaves an \r character at EOL 9085 rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, 9086 9087 // #7653, #8125, #8152: local protocol detection 9088 rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, 9089 rnoContent = /^(?:GET|HEAD)$/, 9090 rprotocol = /^\/\//, 9091 rurl = /^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/, 9092 9093 /* Prefilters 9094 * 1) They are useful to introduce custom dataTypes (see ajax/jsonp.js for an example) 9095 * 2) These are called: 9096 * - BEFORE asking for a transport 9097 * - AFTER param serialization (s.data is a string if s.processData is true) 9098 * 3) key is the dataType 9099 * 4) the catchall symbol "*" can be used 9100 * 5) execution will start with transport dataType and THEN continue down to "*" if needed 9101 */ 9102 prefilters = {}, 9103 9104 /* Transports bindings 9105 * 1) key is the dataType 9106 * 2) the catchall symbol "*" can be used 9107 * 3) selection will start with transport dataType and THEN go to "*" if needed 9108 */ 9109 transports = {}, 9110 9111 // Avoid comment-prolog char sequence (#10098); must appease lint and evade compression 9112 allTypes = "*/".concat( "*" ), 9113 9114 // Document location 9115 ajaxLocation = location.href, 9116 9117 // Segment location into parts 9118 ajaxLocParts = rurl.exec( ajaxLocation.toLowerCase() ) || []; 9119 9120// Base "constructor" for jQuery.ajaxPrefilter and jQuery.ajaxTransport 9121function addToPrefiltersOrTransports( structure ) { 9122 9123 // dataTypeExpression is optional and defaults to "*" 9124 return function( dataTypeExpression, func ) { 9125 9126 if ( typeof dataTypeExpression !== "string" ) { 9127 func = dataTypeExpression; 9128 dataTypeExpression = "*"; 9129 } 9130 9131 var dataType, 9132 i = 0, 9133 dataTypes = dataTypeExpression.toLowerCase().match( rnotwhite ) || []; 9134 9135 if ( jQuery.isFunction( func ) ) { 9136 9137 // For each dataType in the dataTypeExpression 9138 while ( ( dataType = dataTypes[ i++ ] ) ) { 9139 9140 // Prepend if requested 9141 if ( dataType.charAt( 0 ) === "+" ) { 9142 dataType = dataType.slice( 1 ) || "*"; 9143 ( structure[ dataType ] = structure[ dataType ] || [] ).unshift( func ); 9144 9145 // Otherwise append 9146 } else { 9147 ( structure[ dataType ] = structure[ dataType ] || [] ).push( func ); 9148 } 9149 } 9150 } 9151 }; 9152} 9153 9154// Base inspection function for prefilters and transports 9155function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR ) { 9156 9157 var inspected = {}, 9158 seekingTransport = ( structure === transports ); 9159 9160 function inspect( dataType ) { 9161 var selected; 9162 inspected[ dataType ] = true; 9163 jQuery.each( structure[ dataType ] || [], function( _, prefilterOrFactory ) { 9164 var dataTypeOrTransport = prefilterOrFactory( options, originalOptions, jqXHR ); 9165 if ( typeof dataTypeOrTransport === "string" && 9166 !seekingTransport && !inspected[ dataTypeOrTransport ] ) { 9167 9168 options.dataTypes.unshift( dataTypeOrTransport ); 9169 inspect( dataTypeOrTransport ); 9170 return false; 9171 } else if ( seekingTransport ) { 9172 return !( selected = dataTypeOrTransport ); 9173 } 9174 } ); 9175 return selected; 9176 } 9177 9178 return inspect( options.dataTypes[ 0 ] ) || !inspected[ "*" ] && inspect( "*" ); 9179} 9180 9181// A special extend for ajax options 9182// that takes "flat" options (not to be deep extended) 9183// Fixes #9887 9184function ajaxExtend( target, src ) { 9185 var deep, key, 9186 flatOptions = jQuery.ajaxSettings.flatOptions || {}; 9187 9188 for ( key in src ) { 9189 if ( src[ key ] !== undefined ) { 9190 ( flatOptions[ key ] ? target : ( deep || ( deep = {} ) ) )[ key ] = src[ key ]; 9191 } 9192 } 9193 if ( deep ) { 9194 jQuery.extend( true, target, deep ); 9195 } 9196 9197 return target; 9198} 9199 9200/* Handles responses to an ajax request: 9201 * - finds the right dataType (mediates between content-type and expected dataType) 9202 * - returns the corresponding response 9203 */ 9204function ajaxHandleResponses( s, jqXHR, responses ) { 9205 var firstDataType, ct, finalDataType, type, 9206 contents = s.contents, 9207 dataTypes = s.dataTypes; 9208 9209 // Remove auto dataType and get content-type in the process 9210 while ( dataTypes[ 0 ] === "*" ) { 9211 dataTypes.shift(); 9212 if ( ct === undefined ) { 9213 ct = s.mimeType || jqXHR.getResponseHeader( "Content-Type" ); 9214 } 9215 } 9216 9217 // Check if we're dealing with a known content-type 9218 if ( ct ) { 9219 for ( type in contents ) { 9220 if ( contents[ type ] && contents[ type ].test( ct ) ) { 9221 dataTypes.unshift( type ); 9222 break; 9223 } 9224 } 9225 } 9226 9227 // Check to see if we have a response for the expected dataType 9228 if ( dataTypes[ 0 ] in responses ) { 9229 finalDataType = dataTypes[ 0 ]; 9230 } else { 9231 9232 // Try convertible dataTypes 9233 for ( type in responses ) { 9234 if ( !dataTypes[ 0 ] || s.converters[ type + " " + dataTypes[ 0 ] ] ) { 9235 finalDataType = type; 9236 break; 9237 } 9238 if ( !firstDataType ) { 9239 firstDataType = type; 9240 } 9241 } 9242 9243 // Or just use first one 9244 finalDataType = finalDataType || firstDataType; 9245 } 9246 9247 // If we found a dataType 9248 // We add the dataType to the list if needed 9249 // and return the corresponding response 9250 if ( finalDataType ) { 9251 if ( finalDataType !== dataTypes[ 0 ] ) { 9252 dataTypes.unshift( finalDataType ); 9253 } 9254 return responses[ finalDataType ]; 9255 } 9256} 9257 9258/* Chain conversions given the request and the original response 9259 * Also sets the responseXXX fields on the jqXHR instance 9260 */ 9261function ajaxConvert( s, response, jqXHR, isSuccess ) { 9262 var conv2, current, conv, tmp, prev, 9263 converters = {}, 9264 9265 // Work with a copy of dataTypes in case we need to modify it for conversion 9266 dataTypes = s.dataTypes.slice(); 9267 9268 // Create converters map with lowercased keys 9269 if ( dataTypes[ 1 ] ) { 9270 for ( conv in s.converters ) { 9271 converters[ conv.toLowerCase() ] = s.converters[ conv ]; 9272 } 9273 } 9274 9275 current = dataTypes.shift(); 9276 9277 // Convert to each sequential dataType 9278 while ( current ) { 9279 9280 if ( s.responseFields[ current ] ) { 9281 jqXHR[ s.responseFields[ current ] ] = response; 9282 } 9283 9284 // Apply the dataFilter if provided 9285 if ( !prev && isSuccess && s.dataFilter ) { 9286 response = s.dataFilter( response, s.dataType ); 9287 } 9288 9289 prev = current; 9290 current = dataTypes.shift(); 9291 9292 if ( current ) { 9293 9294 // There's only work to do if current dataType is non-auto 9295 if ( current === "*" ) { 9296 9297 current = prev; 9298 9299 // Convert response if prev dataType is non-auto and differs from current 9300 } else if ( prev !== "*" && prev !== current ) { 9301 9302 // Seek a direct converter 9303 conv = converters[ prev + " " + current ] || converters[ "* " + current ]; 9304 9305 // If none found, seek a pair 9306 if ( !conv ) { 9307 for ( conv2 in converters ) { 9308 9309 // If conv2 outputs current 9310 tmp = conv2.split( " " ); 9311 if ( tmp[ 1 ] === current ) { 9312 9313 // If prev can be converted to accepted input 9314 conv = converters[ prev + " " + tmp[ 0 ] ] || 9315 converters[ "* " + tmp[ 0 ] ]; 9316 if ( conv ) { 9317 9318 // Condense equivalence converters 9319 if ( conv === true ) { 9320 conv = converters[ conv2 ]; 9321 9322 // Otherwise, insert the intermediate dataType 9323 } else if ( converters[ conv2 ] !== true ) { 9324 current = tmp[ 0 ]; 9325 dataTypes.unshift( tmp[ 1 ] ); 9326 } 9327 break; 9328 } 9329 } 9330 } 9331 } 9332 9333 // Apply converter (if not an equivalence) 9334 if ( conv !== true ) { 9335 9336 // Unless errors are allowed to bubble, catch and return them 9337 if ( conv && s[ "throws" ] ) { // jscs:ignore requireDotNotation 9338 response = conv( response ); 9339 } else { 9340 try { 9341 response = conv( response ); 9342 } catch ( e ) { 9343 return { 9344 state: "parsererror", 9345 error: conv ? e : "No conversion from " + prev + " to " + current 9346 }; 9347 } 9348 } 9349 } 9350 } 9351 } 9352 } 9353 9354 return { state: "success", data: response }; 9355} 9356 9357jQuery.extend( { 9358 9359 // Counter for holding the number of active queries 9360 active: 0, 9361 9362 // Last-Modified header cache for next request 9363 lastModified: {}, 9364 etag: {}, 9365 9366 ajaxSettings: { 9367 url: ajaxLocation, 9368 type: "GET", 9369 isLocal: rlocalProtocol.test( ajaxLocParts[ 1 ] ), 9370 global: true, 9371 processData: true, 9372 async: true, 9373 contentType: "application/x-www-form-urlencoded; charset=UTF-8", 9374 /* 9375 timeout: 0, 9376 data: null, 9377 dataType: null, 9378 username: null, 9379 password: null, 9380 cache: null, 9381 throws: false, 9382 traditional: false, 9383 headers: {}, 9384 */ 9385 9386 accepts: { 9387 "*": allTypes, 9388 text: "text/plain", 9389 html: "text/html", 9390 xml: "application/xml, text/xml", 9391 json: "application/json, text/javascript" 9392 }, 9393 9394 contents: { 9395 xml: /\bxml\b/, 9396 html: /\bhtml/, 9397 json: /\bjson\b/ 9398 }, 9399 9400 responseFields: { 9401 xml: "responseXML", 9402 text: "responseText", 9403 json: "responseJSON" 9404 }, 9405 9406 // Data converters 9407 // Keys separate source (or catchall "*") and destination types with a single space 9408 converters: { 9409 9410 // Convert anything to text 9411 "* text": String, 9412 9413 // Text to html (true = no transformation) 9414 "text html": true, 9415 9416 // Evaluate text as a json expression 9417 "text json": jQuery.parseJSON, 9418 9419 // Parse text as xml 9420 "text xml": jQuery.parseXML 9421 }, 9422 9423 // For options that shouldn't be deep extended: 9424 // you can add your own custom options here if 9425 // and when you create one that shouldn't be 9426 // deep extended (see ajaxExtend) 9427 flatOptions: { 9428 url: true, 9429 context: true 9430 } 9431 }, 9432 9433 // Creates a full fledged settings object into target 9434 // with both ajaxSettings and settings fields. 9435 // If target is omitted, writes into ajaxSettings. 9436 ajaxSetup: function( target, settings ) { 9437 return settings ? 9438 9439 // Building a settings object 9440 ajaxExtend( ajaxExtend( target, jQuery.ajaxSettings ), settings ) : 9441 9442 // Extending ajaxSettings 9443 ajaxExtend( jQuery.ajaxSettings, target ); 9444 }, 9445 9446 ajaxPrefilter: addToPrefiltersOrTransports( prefilters ), 9447 ajaxTransport: addToPrefiltersOrTransports( transports ), 9448 9449 // Main method 9450 ajax: function( url, options ) { 9451 9452 // If url is an object, simulate pre-1.5 signature 9453 if ( typeof url === "object" ) { 9454 options = url; 9455 url = undefined; 9456 } 9457 9458 // Force options to be an object 9459 options = options || {}; 9460 9461 var
vendor: 5,146 bytes, lines 9462-9652
9462 9463 // Cross-domain detection vars 9464 parts, 9465 9466 // Loop variable 9467 i, 9468 9469 // URL without anti-cache param 9470 cacheURL, 9471 9472 // Response headers as string 9473 responseHeadersString, 9474 9475 // timeout handle 9476 timeoutTimer, 9477 9478 // To know if global events are to be dispatched 9479 fireGlobals, 9480 9481 transport, 9482 9483 // Response headers 9484 responseHeaders, 9485 9486 // Create the final options object 9487 s = jQuery.ajaxSetup( {}, options ), 9488 9489 // Callbacks context 9490 callbackContext = s.context || s, 9491 9492 // Context for global events is callbackContext if it is a DOM node or jQuery collection 9493 globalEventContext = s.context && 9494 ( callbackContext.nodeType || callbackContext.jquery ) ? 9495 jQuery( callbackContext ) : 9496 jQuery.event, 9497 9498 // Deferreds 9499 deferred = jQuery.Deferred(), 9500 completeDeferred = jQuery.Callbacks( "once memory" ), 9501 9502 // Status-dependent callbacks 9503 statusCode = s.statusCode || {}, 9504 9505 // Headers (they are sent all at once) 9506 requestHeaders = {}, 9507 requestHeadersNames = {}, 9508 9509 // The jqXHR state 9510 state = 0, 9511 9512 // Default abort message 9513 strAbort = "canceled", 9514 9515 // Fake xhr 9516 jqXHR = { 9517 readyState: 0, 9518 9519 // Builds headers hashtable if needed 9520 getResponseHeader: function( key ) { 9521 var match; 9522 if ( state === 2 ) { 9523 if ( !responseHeaders ) { 9524 responseHeaders = {}; 9525 while ( ( match = rheaders.exec( responseHeadersString ) ) ) { 9526 responseHeaders[ match[ 1 ].toLowerCase() ] = match[ 2 ]; 9527 } 9528 } 9529 match = responseHeaders[ key.toLowerCase() ]; 9530 } 9531 return match == null ? null : match; 9532 }, 9533 9534 // Raw string 9535 getAllResponseHeaders: function() { 9536 return state === 2 ? responseHeadersString : null; 9537 }, 9538 9539 // Caches the header 9540 setRequestHeader: function( name, value ) { 9541 var lname = name.toLowerCase(); 9542 if ( !state ) { 9543 name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name; 9544 requestHeaders[ name ] = value; 9545 } 9546 return this; 9547 }, 9548 9549 // Overrides response content-type header 9550 overrideMimeType: function( type ) { 9551 if ( !state ) { 9552 s.mimeType = type; 9553 } 9554 return this; 9555 }, 9556 9557 // Status-dependent callbacks 9558 statusCode: function( map ) { 9559 var code; 9560 if ( map ) { 9561 if ( state < 2 ) { 9562 for ( code in map ) { 9563 9564 // Lazy-add the new callback in a way that preserves old ones 9565 statusCode[ code ] = [ statusCode[ code ], map[ code ] ]; 9566 } 9567 } else { 9568 9569 // Execute the appropriate callbacks 9570 jqXHR.always( map[ jqXHR.status ] ); 9571 } 9572 } 9573 return this; 9574 }, 9575 9576 // Cancel the request 9577 abort: function( statusText ) { 9578 var finalText = statusText || strAbort; 9579 if ( transport ) { 9580 transport.abort( finalText ); 9581 } 9582 done( 0, finalText ); 9583 return this; 9584 } 9585 }; 9586 9587 // Attach deferreds 9588 deferred.promise( jqXHR ).complete = completeDeferred.add; 9589 jqXHR.success = jqXHR.done; 9590 jqXHR.error = jqXHR.fail; 9591 9592 // Remove hash character (#7531: and string promotion) 9593 // Add protocol if not provided (#5866: IE7 issue with protocol-less urls) 9594 // Handle falsy url in the settings object (#10093: consistency with old signature) 9595 // We also use the url parameter if available 9596 s.url = ( ( url || s.url || ajaxLocation ) + "" ) 9597 .replace( rhash, "" ) 9598 .replace( rprotocol, ajaxLocParts[ 1 ] + "//" ); 9599 9600 // Alias method option to type as per ticket #12004 9601 s.type = options.method || options.type || s.method || s.type; 9602 9603 // Extract dataTypes list 9604 s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().match( rnotwhite ) || [ "" ]; 9605 9606 // A cross-domain request is in order when we have a protocol:host:port mismatch 9607 if ( s.crossDomain == null ) { 9608 parts = rurl.exec( s.url.toLowerCase() ); 9609 s.crossDomain = !!( parts && 9610 ( parts[ 1 ] !== ajaxLocParts[ 1 ] || parts[ 2 ] !== ajaxLocParts[ 2 ] || 9611 ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? "80" : "443" ) ) !== 9612 ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? "80" : "443" ) ) ) 9613 ); 9614 } 9615 9616 // Convert data if not already a string 9617 if ( s.data && s.processData && typeof s.data !== "string" ) { 9618 s.data = jQuery.param( s.data, s.traditional ); 9619 } 9620 9621 // Apply prefilters 9622 inspectPrefiltersOrTransports( prefilters, s, options, jqXHR ); 9623 9624 // If request was aborted inside a prefilter, stop there 9625 if ( state === 2 ) { 9626 return jqXHR; 9627 } 9628 9629 // We can fire global events as of now if asked to 9630 // Don't fire events if jQuery.event is undefined in an AMD-usage scenario (#15118) 9631 fireGlobals = jQuery.event && s.global; 9632 9633 // Watch for a new set of requests 9634 if ( fireGlobals && jQuery.active++ === 0 ) { 9635 jQuery.event.trigger( "ajaxStart" ); 9636 } 9637 9638 // Uppercase the type 9639 s.type = s.type.toUpperCase(); 9640 9641 // Determine if request has content 9642 s.hasContent = !rnoContent.test( s.type ); 9643 9644 // Save the URL in case we're toying with the If-Modified-Since 9645 // and/or If-None-Match header later on 9646 cacheURL = s.url; 9647 9648 // More options handling for requests with no content 9649 if ( !s.hasContent ) { 9650 9651 // If data is available, append data to url 9652 if ( s.data ) {
vendor: 8,244 bytes, lines 9653-9992
9653 cacheURL = ( s.url += ( rquery.test( cacheURL ) ? "&" : "?" ) + s.data ); 9654 9655 // #9682: remove data so that it's not used in an eventual retry 9656 delete s.data; 9657 } 9658 9659 // Add anti-cache in url if needed 9660 if ( s.cache === false ) { 9661 s.url = rts.test( cacheURL ) ? 9662 9663 // If there is already a '_' parameter, set its value 9664 cacheURL.replace( rts, "$1_=" + nonce++ ) : 9665 9666 // Otherwise add one to the end 9667 cacheURL + ( rquery.test( cacheURL ) ? "&" : "?" ) + "_=" + nonce++; 9668 } 9669 } 9670 9671 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9672 if ( s.ifModified ) { 9673 if ( jQuery.lastModified[ cacheURL ] ) { 9674 jqXHR.setRequestHeader( "If-Modified-Since", jQuery.lastModified[ cacheURL ] ); 9675 } 9676 if ( jQuery.etag[ cacheURL ] ) { 9677 jqXHR.setRequestHeader( "If-None-Match", jQuery.etag[ cacheURL ] ); 9678 } 9679 } 9680 9681 // Set the correct header, if data is being sent 9682 if ( s.data && s.hasContent && s.contentType !== false || options.contentType ) { 9683 jqXHR.setRequestHeader( "Content-Type", s.contentType ); 9684 } 9685 9686 // Set the Accepts header for the server, depending on the dataType 9687 jqXHR.setRequestHeader( 9688 "Accept", 9689 s.dataTypes[ 0 ] && s.accepts[ s.dataTypes[ 0 ] ] ? 9690 s.accepts[ s.dataTypes[ 0 ] ] + 9691 ( s.dataTypes[ 0 ] !== "*" ? ", " + allTypes + "; q=0.01" : "" ) : 9692 s.accepts[ "*" ] 9693 ); 9694 9695 // Check for headers option 9696 for ( i in s.headers ) { 9697 jqXHR.setRequestHeader( i, s.headers[ i ] ); 9698 } 9699 9700 // Allow custom headers/mimetypes and early abort 9701 if ( s.beforeSend && 9702 ( s.beforeSend.call( callbackContext, jqXHR, s ) === false || state === 2 ) ) { 9703 9704 // Abort if not done already and return 9705 return jqXHR.abort(); 9706 } 9707 9708 // aborting is no longer a cancellation 9709 strAbort = "abort"; 9710 9711 // Install callbacks on deferreds 9712 for ( i in { success: 1, error: 1, complete: 1 } ) { 9713 jqXHR[ i ]( s[ i ] ); 9714 } 9715 9716 // Get transport 9717 transport = inspectPrefiltersOrTransports( transports, s, options, jqXHR ); 9718 9719 // If no transport, we auto-abort 9720 if ( !transport ) { 9721 done( -1, "No Transport" ); 9722 } else { 9723 jqXHR.readyState = 1; 9724 9725 // Send global event 9726 if ( fireGlobals ) { 9727 globalEventContext.trigger( "ajaxSend", [ jqXHR, s ] ); 9728 } 9729 9730 // If request was aborted inside ajaxSend, stop there 9731 if ( state === 2 ) { 9732 return jqXHR; 9733 } 9734 9735 // Timeout 9736 if ( s.async && s.timeout > 0 ) { 9737 timeoutTimer = window.setTimeout( function() { 9738 jqXHR.abort( "timeout" ); 9739 }, s.timeout ); 9740 } 9741 9742 try { 9743 state = 1; 9744 transport.send( requestHeaders, done ); 9745 } catch ( e ) { 9746 9747 // Propagate exception as error if not done 9748 if ( state < 2 ) { 9749 done( -1, e ); 9750 9751 // Simply rethrow otherwise 9752 } else { 9753 throw e; 9754 } 9755 } 9756 } 9757 9758 // Callback for when everything is done 9759 function done( status, nativeStatusText, responses, headers ) { 9760 var isSuccess, success, error, response, modified, 9761 statusText = nativeStatusText; 9762 9763 // Called once 9764 if ( state === 2 ) { 9765 return; 9766 } 9767 9768 // State is "done" now 9769 state = 2; 9770 9771 // Clear timeout if it exists 9772 if ( timeoutTimer ) { 9773 window.clearTimeout( timeoutTimer ); 9774 } 9775 9776 // Dereference transport for early garbage collection 9777 // (no matter how long the jqXHR object will be used) 9778 transport = undefined; 9779 9780 // Cache response headers 9781 responseHeadersString = headers || ""; 9782 9783 // Set readyState 9784 jqXHR.readyState = status > 0 ? 4 : 0; 9785 9786 // Determine if successful 9787 isSuccess = status >= 200 && status < 300 || status === 304; 9788 9789 // Get response data 9790 if ( responses ) { 9791 response = ajaxHandleResponses( s, jqXHR, responses ); 9792 } 9793 9794 // Convert no matter what (that way responseXXX fields are always set) 9795 response = ajaxConvert( s, response, jqXHR, isSuccess ); 9796 9797 // If successful, handle type chaining 9798 if ( isSuccess ) { 9799 9800 // Set the If-Modified-Since and/or If-None-Match header, if in ifModified mode. 9801 if ( s.ifModified ) { 9802 modified = jqXHR.getResponseHeader( "Last-Modified" ); 9803 if ( modified ) { 9804 jQuery.lastModified[ cacheURL ] = modified; 9805 } 9806 modified = jqXHR.getResponseHeader( "etag" ); 9807 if ( modified ) { 9808 jQuery.etag[ cacheURL ] = modified; 9809 } 9810 } 9811 9812 // if no content 9813 if ( status === 204 || s.type === "HEAD" ) { 9814 statusText = "nocontent"; 9815 9816 // if not modified 9817 } else if ( status === 304 ) { 9818 statusText = "notmodified"; 9819 9820 // If we have data, let's convert it 9821 } else { 9822 statusText = response.state; 9823 success = response.data; 9824 error = response.error; 9825 isSuccess = !error; 9826 } 9827 } else { 9828 9829 // We extract error from statusText 9830 // then normalize statusText and status for non-aborts 9831 error = statusText; 9832 if ( status || !statusText ) { 9833 statusText = "error"; 9834 if ( status < 0 ) { 9835 status = 0; 9836 } 9837 } 9838 } 9839 9840 // Set data for the fake xhr object 9841 jqXHR.status = status; 9842 jqXHR.statusText = ( nativeStatusText || statusText ) + ""; 9843 9844 // Success/Error 9845 if ( isSuccess ) { 9846 deferred.resolveWith( callbackContext, [ success, statusText, jqXHR ] ); 9847 } else { 9848 deferred.rejectWith( callbackContext, [ jqXHR, statusText, error ] ); 9849 } 9850 9851 // Status-dependent callbacks 9852 jqXHR.statusCode( statusCode ); 9853 statusCode = undefined; 9854 9855 if ( fireGlobals ) { 9856 globalEventContext.trigger( isSuccess ? "ajaxSuccess" : "ajaxError", 9857 [ jqXHR, s, isSuccess ? success : error ] ); 9858 } 9859 9860 // Complete 9861 completeDeferred.fireWith( callbackContext, [ jqXHR, statusText ] ); 9862 9863 if ( fireGlobals ) { 9864 globalEventContext.trigger( "ajaxComplete", [ jqXHR, s ] ); 9865 9866 // Handle the global AJAX counter 9867 if ( !( --jQuery.active ) ) { 9868 jQuery.event.trigger( "ajaxStop" ); 9869 } 9870 } 9871 } 9872 9873 return jqXHR; 9874 }, 9875 9876 getJSON: function( url, data, callback ) { 9877 return jQuery.get( url, data, callback, "json" ); 9878 }, 9879 9880 getScript: function( url, callback ) { 9881 return jQuery.get( url, undefined, callback, "script" ); 9882 } 9883} ); 9884 9885jQuery.each( [ "get", "post" ], function( i, method ) { 9886 jQuery[ method ] = function( url, data, callback, type ) { 9887 9888 // shift arguments if data argument was omitted 9889 if ( jQuery.isFunction( data ) ) { 9890 type = type || callback; 9891 callback = data; 9892 data = undefined; 9893 } 9894 9895 // The url can be an options object (which then must have .url) 9896 return jQuery.ajax( jQuery.extend( { 9897 url: url, 9898 type: method, 9899 dataType: type, 9900 data: data, 9901 success: callback 9902 }, jQuery.isPlainObject( url ) && url ) ); 9903 }; 9904} ); 9905 9906 9907jQuery._evalUrl = function( url ) { 9908 return jQuery.ajax( { 9909 url: url, 9910 9911 // Make this explicit, since user can override this through ajaxSetup (#11264) 9912 type: "GET", 9913 dataType: "script", 9914 cache: true, 9915 async: false, 9916 global: false, 9917 "throws": true 9918 } ); 9919}; 9920 9921 9922jQuery.fn.extend( { 9923 wrapAll: function( html ) { 9924 if ( jQuery.isFunction( html ) ) { 9925 return this.each( function( i ) { 9926 jQuery( this ).wrapAll( html.call( this, i ) ); 9927 } ); 9928 } 9929 9930 if ( this[ 0 ] ) { 9931 9932 // The elements to wrap the target around 9933 var wrap = jQuery( html, this[ 0 ].ownerDocument ).eq( 0 ).clone( true ); 9934 9935 if ( this[ 0 ].parentNode ) { 9936 wrap.insertBefore( this[ 0 ] ); 9937 } 9938 9939 wrap.map( function() { 9940 var elem = this; 9941 9942 while ( elem.firstChild && elem.firstChild.nodeType === 1 ) { 9943 elem = elem.firstChild; 9944 } 9945 9946 return elem; 9947 } ).append( this ); 9948 } 9949 9950 return this; 9951 }, 9952 9953 wrapInner: function( html ) { 9954 if ( jQuery.isFunction( html ) ) { 9955 return this.each( function( i ) { 9956 jQuery( this ).wrapInner( html.call( this, i ) ); 9957 } ); 9958 } 9959 9960 return this.each( function() { 9961 var self = jQuery( this ), 9962 contents = self.contents(); 9963 9964 if ( contents.length ) { 9965 contents.wrapAll( html ); 9966 9967 } else { 9968 self.append( html ); 9969 } 9970 } ); 9971 }, 9972 9973 wrap: function( html ) { 9974 var isFunction = jQuery.isFunction( html ); 9975 9976 return this.each( function( i ) { 9977 jQuery( this ).wrapAll( isFunction ? html.call( this, i ) : html ); 9978 } ); 9979 }, 9980 9981 unwrap: function() { 9982 return this.parent().each( function() { 9983 if ( !jQuery.nodeName( this, "body" ) ) { 9984 jQuery( this ).replaceWith( this.childNodes ); 9985 } 9986 } ).end(); 9987 } 9988} ); 9989 9990 9991function getDisplay( elem ) { 9992 return elem.style && elem.style.display || jQuery.css( elem, "dis
9992play" ); 9993} 9994 9995function filterHidden( elem ) { 9996 9997 // Disconnected elements are considered hidden 9998 if ( !jQuery.contains( elem.ownerDocument || document, elem ) ) { 9999 return true; 10000 } 10001 while ( elem && elem.nodeType === 1 ) { 10002 if ( getDisplay( elem ) === "none" || elem.type === "hidden" ) { 10003 return true; 10004 } 10005 elem = elem.parentNode; 10006 } 10007 return false; 10008} 10009 10010jQuery.expr.filters.hidden = function( elem ) { 10011 10012 // Support: Opera <= 12.12 10013 // Opera reports offsetWidths and offsetHeights less than zero on some elements 10014 return support.reliableHiddenOffsets() ? 10015 ( elem.offsetWidth <= 0 && elem.offsetHeight <= 0 && 10016 !elem.getClientRects().length ) : 10017 filterHidden( elem ); 10018}; 10019 10020jQuery.expr.filters.visible = function( elem ) { 10021 return !jQuery.expr.filters.hidden( elem ); 10022}; 10023 10024 10025 10026 10027var r20 = /%20/g, 10028 rbracket = /\[\]$/, 10029 rCRLF = /\r?\n/g, 10030 rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, 10031 rsubmittable = /^(?:input|select|textarea|keygen)/i; 10032 10033function buildParams( prefix, obj, traditional, add ) { 10034 var name; 10035 10036 if ( jQuery.isArray( obj ) ) { 10037 10038 // Serialize array item. 10039 jQuery.each( obj, function( i, v ) { 10040 if ( traditional || rbracket.test( prefix ) ) { 10041 10042 // Treat each array item as a scalar. 10043 add( prefix, v ); 10044 10045 } else { 10046 10047 // Item is non-scalar (array or object), encode its numeric index. 10048 buildParams( 10049 prefix + "[" + ( typeof v === "object" && v != null ? i : "" ) + "]", 10050 v, 10051 traditional, 10052 add 10053 ); 10054 } 10055 } ); 10056 10057 } else if ( !traditional && jQuery.type( obj ) === "object" ) { 10058 10059 // Serialize object item. 10060 for ( name in obj ) { 10061 buildParams( prefix + "[" + name + "]", obj[ name ], traditional, add ); 10062 } 10063 10064 } else { 10065 10066 // Serialize scalar item. 10067 add( prefix, obj ); 10068 } 10069} 10070 10071// Serialize an array of form elements or a set of 10072// key/values into a query string 10073jQuery.param = function( a, traditional ) { 10074 var prefix, 10075 s = [], 10076 add = function( key, value ) { 10077 10078 // If value is a function, invoke it and return its value 10079 value = jQuery.isFunction( value ) ? value() : ( value == null ? "" : value ); 10080 s[ s.length ] = encodeURIComponent( key ) + "=" + encodeURIComponent( value ); 10081 }; 10082 10083 // Set traditional to true for jQuery <= 1.3.2 behavior. 10084 if ( traditional === undefined ) { 10085 traditional = jQuery.ajaxSettings && jQuery.ajaxSettings.traditional; 10086 } 10087 10088 // If an array was passed in, assume that it is an array of form elements. 10089 if ( jQuery.isArray( a ) || ( a.jquery && !jQuery.isPlainObject( a ) ) ) { 10090 10091 // Serialize the form elements 10092 jQuery.each( a, function() { 10093 add( this.name, this.value ); 10094 } ); 10095 10096 } else { 10097 10098 // If traditional, encode the "old" way (the way 1.3.2 or older 10099 // did it), otherwise encode params recursively. 10100 for ( prefix in a ) { 10101 buildParams( prefix, a[ prefix ], traditional, add ); 10102 } 10103 } 10104 10105 // Return the resulting serialization 10106 return s.join( "&" ).replace( r20, "+" ); 10107}; 10108 10109jQuery.fn.extend( { 10110 serialize: function() { 10111 return jQuery.param( this.serializeArray() ); 10112 }, 10113 serializeArray: function() { 10114 return this.map( function() { 10115 10116 // Can add propHook for "elements" to filter or add form elements 10117 var elements = jQuery.prop( this, "elements" ); 10118 return elements ? jQuery.makeArray( elements ) : this; 10119 } ) 10120 .filter( function() { 10121 var type = this.type; 10122 10123 // Use .is(":disabled") so that fieldset[disabled] works 10124 return this.name && !jQuery( this ).is( ":disabled" ) && 10125 rsubmittable.test( this.nodeName ) && !rsubmitterTypes.test( type ) && 10126 ( this.checked || !rcheckableType.test( type ) ); 10127 } ) 10128 .map( function( i, elem ) { 10129 var val = jQuery( this ).val(); 10130 10131 return val == null ? 10132 null : 10133 jQuery.isArray( val ) ? 10134 jQuery.map( val, function( val ) { 10135 return { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10136 } ) : 10137 { name: elem.name, value: val.replace( rCRLF, "\r\n" ) }; 10138 } ).get(); 10139 } 10140} ); 10141 10142 10143// Create the request object 10144// (This is still attached to ajaxSettings for backward compatibility) 10145jQuery.ajaxSettings.xhr = window.ActiveXObject !== undefined ? 10146 10147 // Support: IE6-IE8 10148 function() { 10149 10150 // XHR cannot access local files, always use ActiveX for that case 10151 if ( this.isLocal ) { 10152 return createActiveXHR(); 10153 } 10154
vendor: 22,565 bytes, lines 10155-10975
10155 // Support: IE 9-11 10156 // IE seems to error on cross-domain PATCH requests when ActiveX XHR 10157 // is used. In IE 9+ always use the native XHR. 10158 // Note: this condition won't catch Edge as it doesn't define 10159 // document.documentMode but it also doesn't support ActiveX so it won't 10160 // reach this code. 10161 if ( document.documentMode > 8 ) { 10162 return createStandardXHR(); 10163 } 10164 10165 // Support: IE<9 10166 // oldIE XHR does not support non-RFC2616 methods (#13240) 10167 // See http://msdn.microsoft.com/en-us/library/ie/ms536648(v=vs.85).aspx 10168 // and http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9 10169 // Although this check for six methods instead of eight 10170 // since IE also does not support "trace" and "connect" 10171 return /^(get|post|head|put|delete|options)$/i.test( this.type ) && 10172 createStandardXHR() || createActiveXHR(); 10173 } : 10174 10175 // For all other browsers, use the standard XMLHttpRequest object 10176 createStandardXHR; 10177 10178var xhrId = 0, 10179 xhrCallbacks = {}, 10180 xhrSupported = jQuery.ajaxSettings.xhr(); 10181 10182// Support: IE<10 10183// Open requests must be manually aborted on unload (#5280) 10184// See https://support.microsoft.com/kb/2856746 for more info 10185if ( window.attachEvent ) { 10186 window.attachEvent( "onunload", function() { 10187 for ( var key in xhrCallbacks ) { 10188 xhrCallbacks[ key ]( undefined, true ); 10189 } 10190 } ); 10191} 10192 10193// Determine support properties 10194support.cors = !!xhrSupported && ( "withCredentials" in xhrSupported ); 10195xhrSupported = support.ajax = !!xhrSupported; 10196 10197// Create transport if the browser can provide an xhr 10198if ( xhrSupported ) { 10199 10200 jQuery.ajaxTransport( function( options ) { 10201 10202 // Cross domain only allowed if supported through XMLHttpRequest 10203 if ( !options.crossDomain || support.cors ) { 10204 10205 var callback; 10206 10207 return { 10208 send: function( headers, complete ) { 10209 var i, 10210 xhr = options.xhr(), 10211 id = ++xhrId; 10212 10213 // Open the socket 10214 xhr.open( 10215 options.type, 10216 options.url, 10217 options.async, 10218 options.username, 10219 options.password 10220 ); 10221 10222 // Apply custom fields if provided 10223 if ( options.xhrFields ) { 10224 for ( i in options.xhrFields ) { 10225 xhr[ i ] = options.xhrFields[ i ]; 10226 } 10227 } 10228 10229 // Override mime type if needed 10230 if ( options.mimeType && xhr.overrideMimeType ) { 10231 xhr.overrideMimeType( options.mimeType ); 10232 } 10233 10234 // X-Requested-With header 10235 // For cross-domain requests, seeing as conditions for a preflight are 10236 // akin to a jigsaw puzzle, we simply never set it to be sure. 10237 // (it can always be set on a per-request basis or even using ajaxSetup) 10238 // For same-domain requests, won't change header if already provided. 10239 if ( !options.crossDomain && !headers[ "X-Requested-With" ] ) { 10240 headers[ "X-Requested-With" ] = "XMLHttpRequest"; 10241 } 10242 10243 // Set headers 10244 for ( i in headers ) { 10245 10246 // Support: IE<9 10247 // IE's ActiveXObject throws a 'Type Mismatch' exception when setting 10248 // request header to a null-value. 10249 // 10250 // To keep consistent with other XHR implementations, cast the value 10251 // to string and ignore `undefined`. 10252 if ( headers[ i ] !== undefined ) { 10253 xhr.setRequestHeader( i, headers[ i ] + "" ); 10254 } 10255 } 10256 10257 // Do send the request 10258 // This may raise an exception which is actually 10259 // handled in jQuery.ajax (so no try/catch here) 10260 xhr.send( ( options.hasContent && options.data ) || null ); 10261 10262 // Listener 10263 callback = function( _, isAbort ) { 10264 var status, statusText, responses; 10265 10266 // Was never called and is aborted or complete 10267 if ( callback && ( isAbort || xhr.readyState === 4 ) ) { 10268 10269 // Clean up 10270 delete xhrCallbacks[ id ]; 10271 callback = undefined; 10272 xhr.onreadystatechange = jQuery.noop; 10273 10274 // Abort manually if needed 10275 if ( isAbort ) { 10276 if ( xhr.readyState !== 4 ) { 10277 xhr.abort(); 10278 } 10279 } else { 10280 responses = {}; 10281 status = xhr.status; 10282 10283 // Support: IE<10 10284 // Accessing binary-data responseText throws an exception 10285 // (#11426) 10286 if ( typeof xhr.responseText === "string" ) { 10287 responses.text = xhr.responseText; 10288 } 10289 10290 // Firefox throws an exception when accessing 10291 // statusText for faulty cross-domain requests 10292 try { 10293 statusText = xhr.statusText; 10294 } catch ( e ) { 10295 10296 // We normalize with Webkit giving an empty statusText 10297 statusText = ""; 10298 } 10299 10300 // Filter status for non standard behaviors 10301 10302 // If the request is local and we have data: assume a success 10303 // (success with no data won't get notified, that's the best we 10304 // can do given current implementations) 10305 if ( !status && options.isLocal && !options.crossDomain ) { 10306 status = responses.text ? 200 : 404; 10307 10308 // IE - #1450: sometimes returns 1223 when it should be 204 10309 } else if ( status === 1223 ) { 10310 status = 204; 10311 } 10312 } 10313 } 10314 10315 // Call complete if needed 10316 if ( responses ) { 10317 complete( status, statusText, responses, xhr.getAllResponseHeaders() ); 10318 } 10319 }; 10320 10321 // Do send the request 10322 // `xhr.send` may raise an exception, but it will be 10323 // handled in jQuery.ajax (so no try/catch here) 10324 if ( !options.async ) { 10325 10326 // If we're in sync mode we fire the callback 10327 callback(); 10328 } else if ( xhr.readyState === 4 ) { 10329 10330 // (IE6 & IE7) if it's in cache and has been 10331 // retrieved directly we need to fire the callback 10332 window.setTimeout( callback ); 10333 } else { 10334 10335 // Register the callback, but delay it in case `xhr.send` throws 10336 // Add to the list of active xhr callbacks 10337 xhr.onreadystatechange = xhrCallbacks[ id ] = callback; 10338 } 10339 }, 10340 10341 abort: function() { 10342 if ( callback ) { 10343 callback( undefined, true ); 10344 } 10345 } 10346 }; 10347 } 10348 } ); 10349} 10350 10351// Functions to create xhrs 10352function createStandardXHR() { 10353 try { 10354 return new window.XMLHttpRequest(); 10355 } catch ( e ) {} 10356} 10357 10358function createActiveXHR() { 10359 try { 10360 return new window.ActiveXObject( "Microsoft.XMLHTTP" ); 10361 } catch ( e ) {} 10362} 10363 10364 10365 10366 10367// Install script dataType 10368jQuery.ajaxSetup( { 10369 accepts: { 10370 script: "text/javascript, application/javascript, " + 10371 "application/ecmascript, application/x-ecmascript" 10372 }, 10373 contents: { 10374 script: /\b(?:java|ecma)script\b/ 10375 }, 10376 converters: { 10377 "text script": function( text ) { 10378 jQuery.globalEval( text ); 10379 return text; 10380 } 10381 } 10382} ); 10383 10384// Handle cache's special case and global 10385jQuery.ajaxPrefilter( "script", function( s ) { 10386 if ( s.cache === undefined ) { 10387 s.cache = false; 10388 } 10389 if ( s.crossDomain ) { 10390 s.type = "GET"; 10391 s.global = false; 10392 } 10393} ); 10394 10395// Bind script tag hack transport 10396jQuery.ajaxTransport( "script", function( s ) { 10397 10398 // This transport only deals with cross domain requests 10399 if ( s.crossDomain ) { 10400 10401 var script, 10402 head = document.head || jQuery( "head" )[ 0 ] || document.documentElement; 10403 10404 return { 10405 10406 send: function( _, callback ) { 10407 10408 script = document.createElement( "script" ); 10409 10410 script.async = true; 10411 10412 if ( s.scriptCharset ) { 10413 script.charset = s.scriptCharset; 10414 } 10415 10416 script.src = s.url; 10417 10418 // Attach handlers for all browsers 10419 script.onload = script.onreadystatechange = function( _, isAbort ) { 10420 10421 if ( isAbort || !script.readyState || /loaded|complete/.test( script.readyState ) ) { 10422 10423 // Handle memory leak in IE 10424 script.onload = script.onreadystatechange = null; 10425 10426 // Remove the script 10427 if ( script.parentNode ) { 10428 script.parentNode.removeChild( script ); 10429 } 10430 10431 // Dereference the script 10432 script = null; 10433 10434 // Callback if not abort 10435 if ( !isAbort ) { 10436 callback( 200, "success" ); 10437 } 10438 } 10439 }; 10440 10441 // Circumvent IE6 bugs with base elements (#2709 and #4378) by prepending 10442 // Use native DOM manipulation to avoid our domManip AJAX trickery 10443 head.insertBefore( script, head.firstChild ); 10444 }, 10445 10446 abort: function() { 10447 if ( script ) { 10448 script.onload( undefined, true ); 10449 } 10450 } 10451 }; 10452 } 10453} ); 10454 10455 10456 10457 10458var oldCallbacks = [], 10459 rjsonp = /(=)\?(?=&|$)|\?\?/; 10460 10461// Default jsonp settings 10462jQuery.ajaxSetup( { 10463 jsonp: "callback", 10464 jsonpCallback: function() { 10465 var callback = oldCallbacks.pop() || ( jQuery.expando + "_" + ( nonce++ ) ); 10466 this[ callback ] = true; 10467 return callback; 10468 } 10469} ); 10470 10471// Detect, normalize options and install callbacks for jsonp requests 10472jQuery.ajaxPrefilter( "json jsonp", function( s, originalSettings, jqXHR ) { 10473 10474 var callbackName, overwritten, responseContainer, 10475 jsonProp = s.jsonp !== false && ( rjsonp.test( s.url ) ? 10476 "url" : 10477 typeof s.data === "string" && 10478 ( s.contentType || "" ) 10479 .indexOf( "application/x-www-form-urlencoded" ) === 0 && 10480 rjsonp.test( s.data ) && "data" 10481 ); 10482 10483 // Handle iff the expected data type is "jsonp" or we have a parameter to set 10484 if ( jsonProp || s.dataTypes[ 0 ] === "jsonp" ) { 10485 10486 // Get callback name, remembering preexisting value associated with it 10487 callbackName = s.jsonpCallback = jQuery.isFunction( s.jsonpCallback ) ? 10488 s.jsonpCallback() : 10489 s.jsonpCallback; 10490 10491 // Insert callback into url or form data 10492 if ( jsonProp ) { 10493 s[ jsonProp ] = s[ jsonProp ].replace( rjsonp, "$1" + callbackName ); 10494 } else if ( s.jsonp !== false ) { 10495 s.url += ( rquery.test( s.url ) ? "&" : "?" ) + s.jsonp + "=" + callbackName; 10496 } 10497 10498 // Use data converter to retrieve json after script execution 10499 s.converters[ "script json" ] = function() { 10500 if ( !responseContainer ) { 10501 jQuery.error( callbackName + " was not called" ); 10502 } 10503 return responseContainer[ 0 ]; 10504 }; 10505 10506 // force json dataType 10507 s.dataTypes[ 0 ] = "json"; 10508 10509 // Install callback 10510 overwritten = window[ callbackName ]; 10511 window[ callbackName ] = function() { 10512 responseContainer = arguments; 10513 }; 10514 10515 // Clean-up function (fires after converters) 10516 jqXHR.always( function() { 10517 10518 // If previous value didn't exist - remove it 10519 if ( overwritten === undefined ) { 10520 jQuery( window ).removeProp( callbackName ); 10521 10522 // Otherwise restore preexisting value 10523 } else { 10524 window[ callbackName ] = overwritten; 10525 } 10526 10527 // Save back as free 10528 if ( s[ callbackName ] ) { 10529 10530 // make sure that re-using the options doesn't screw things around 10531 s.jsonpCallback = originalSettings.jsonpCallback; 10532 10533 // save the callback name for future use 10534 oldCallbacks.push( callbackName ); 10535 } 10536 10537 // Call if it was a function and we have a response 10538 if ( responseContainer && jQuery.isFunction( overwritten ) ) { 10539 overwritten( responseContainer[ 0 ] ); 10540 } 10541 10542 responseContainer = overwritten = undefined; 10543 } ); 10544 10545 // Delegate to script 10546 return "script"; 10547 } 10548} ); 10549 10550 10551 10552 10553// data: string of html 10554// context (optional): If specified, the fragment will be created in this context, 10555// defaults to document 10556// keepScripts (optional): If true, will include scripts passed in the html string 10557jQuery.parseHTML = function( data, context, keepScripts ) { 10558 if ( !data || typeof data !== "string" ) { 10559 return null; 10560 } 10561 if ( typeof context === "boolean" ) { 10562 keepScripts = context; 10563 context = false; 10564 } 10565 context = context || document; 10566 10567 var parsed = rsingleTag.exec( data ), 10568 scripts = !keepScripts && []; 10569 10570 // Single tag 10571 if ( parsed ) { 10572 return [ context.createElement( parsed[ 1 ] ) ]; 10573 } 10574 10575 parsed = buildFragment( [ data ], context, scripts ); 10576 10577 if ( scripts && scripts.length ) { 10578 jQuery( scripts ).remove(); 10579 } 10580 10581 return jQuery.merge( [], parsed.childNodes ); 10582}; 10583 10584 10585// Keep a copy of the old load method 10586var _load = jQuery.fn.load; 10587 10588/** 10589 * Load a url into a page 10590 */ 10591jQuery.fn.load = function( url, params, callback ) { 10592 if ( typeof url !== "string" && _load ) { 10593 return _load.apply( this, arguments ); 10594 } 10595 10596 var selector, type, response, 10597 self = this, 10598 off = url.indexOf( " " ); 10599 10600 if ( off > -1 ) { 10601 selector = jQuery.trim( url.slice( off, url.length ) ); 10602 url = url.slice( 0, off ); 10603 } 10604 10605 // If it's a function 10606 if ( jQuery.isFunction( params ) ) { 10607 10608 // We assume that it's the callback 10609 callback = params; 10610 params = undefined; 10611 10612 // Otherwise, build a param string 10613 } else if ( params && typeof params === "object" ) { 10614 type = "POST"; 10615 } 10616 10617 // If we have elements to modify, make the request 10618 if ( self.length > 0 ) { 10619 jQuery.ajax( { 10620 url: url, 10621 10622 // If "type" variable is undefined, then "GET" method will be used. 10623 // Make value of this field explicit since 10624 // user can override it through ajaxSetup method 10625 type: type || "GET", 10626 dataType: "html", 10627 data: params 10628 } ).done( function( responseText ) { 10629 10630 // Save response for use in complete callback 10631 response = arguments; 10632 10633 self.html( selector ? 10634 10635 // If a selector was specified, locate the right elements in a dummy div 10636 // Exclude scripts to avoid IE 'Permission Denied' errors 10637 jQuery( "<div>" ).append( jQuery.parseHTML( responseText ) ).find( selector ) : 10638 10639 // Otherwise use the full result 10640 responseText ); 10641 10642 // If the request succeeds, this function gets "data", "status", "jqXHR" 10643 // but they are ignored because response was set above. 10644 // If it fails, this function gets "jqXHR", "status", "error" 10645 } ).always( callback && function( jqXHR, status ) { 10646 self.each( function() { 10647 callback.apply( this, response || [ jqXHR.responseText, status, jqXHR ] ); 10648 } ); 10649 } ); 10650 } 10651 10652 return this; 10653}; 10654 10655 10656 10657 10658// Attach a bunch of functions for handling common AJAX events 10659jQuery.each( [ 10660 "ajaxStart", 10661 "ajaxStop", 10662 "ajaxComplete", 10663 "ajaxError", 10664 "ajaxSuccess", 10665 "ajaxSend" 10666], function( i, type ) { 10667 jQuery.fn[ type ] = function( fn ) { 10668 return this.on( type, fn ); 10669 }; 10670} ); 10671 10672 10673 10674 10675jQuery.expr.filters.animated = function( elem ) { 10676 return jQuery.grep( jQuery.timers, function( fn ) { 10677 return elem === fn.elem; 10678 } ).length; 10679}; 10680 10681 10682 10683 10684 10685/** 10686 * Gets a window from an element 10687 */ 10688function getWindow( elem ) { 10689 return jQuery.isWindow( elem ) ? 10690 elem : 10691 elem.nodeType === 9 ? 10692 elem.defaultView || elem.parentWindow : 10693 false; 10694} 10695 10696jQuery.offset = { 10697 setOffset: function( elem, options, i ) { 10698 var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, 10699 position = jQuery.css( elem, "position" ), 10700 curElem = jQuery( elem ), 10701 props = {}; 10702 10703 // set position first, in-case top/left are set even on static elem 10704 if ( position === "static" ) { 10705 elem.style.position = "relative"; 10706 } 10707 10708 curOffset = curElem.offset(); 10709 curCSSTop = jQuery.css( elem, "top" ); 10710 curCSSLeft = jQuery.css( elem, "left" ); 10711 calculatePosition = ( position === "absolute" || position === "fixed" ) && 10712 jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1; 10713 10714 // need to be able to calculate position if either top or left 10715 // is auto and position is either absolute or fixed 10716 if ( calculatePosition ) { 10717 curPosition = curElem.position(); 10718 curTop = curPosition.top; 10719 curLeft = curPosition.left; 10720 } else { 10721 curTop = parseFloat( curCSSTop ) || 0; 10722 curLeft = parseFloat( curCSSLeft ) || 0; 10723 } 10724 10725 if ( jQuery.isFunction( options ) ) { 10726 10727 // Use jQuery.extend here to allow modification of coordinates argument (gh-1848) 10728 options = options.call( elem, i, jQuery.extend( {}, curOffset ) ); 10729 } 10730 10731 if ( options.top != null ) { 10732 props.top = ( options.top - curOffset.top ) + curTop; 10733 } 10734 if ( options.left != null ) { 10735 props.left = ( options.left - curOffset.left ) + curLeft; 10736 } 10737 10738 if ( "using" in options ) { 10739 options.using.call( elem, props ); 10740 } else { 10741 curElem.css( props ); 10742 } 10743 } 10744}; 10745 10746jQuery.fn.extend( { 10747 offset: function( options ) { 10748 if ( arguments.length ) { 10749 return options === undefined ? 10750 this : 10751 this.each( function( i ) { 10752 jQuery.offset.setOffset( this, options, i ); 10753 } ); 10754 } 10755 10756 var docElem, win, 10757 box = { top: 0, left: 0 }, 10758 elem = this[ 0 ], 10759 doc = elem && elem.ownerDocument; 10760 10761 if ( !doc ) { 10762 return; 10763 } 10764 10765 docElem = doc.documentElement; 10766 10767 // Make sure it's not a disconnected DOM node 10768 if ( !jQuery.contains( docElem, elem ) ) { 10769 return box; 10770 } 10771 10772 // If we don't have gBCR, just use 0,0 rather than error 10773 // BlackBerry 5, iOS 3 (original iPhone) 10774 if ( typeof elem.getBoundingClientRect !== "undefined" ) { 10775 box = elem.getBoundingClientRect(); 10776 } 10777 win = getWindow( doc ); 10778 return { 10779 top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ), 10780 left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 ) 10781 }; 10782 }, 10783 10784 position: function() { 10785 if ( !this[ 0 ] ) { 10786 return; 10787 } 10788 10789 var offsetParent, offset, 10790 parentOffset = { top: 0, left: 0 }, 10791 elem = this[ 0 ]; 10792 10793 // Fixed elements are offset from window (parentOffset = {top:0, left: 0}, 10794 // because it is its only offset parent 10795 if ( jQuery.css( elem, "position" ) === "fixed" ) { 10796 10797 // we assume that getBoundingClientRect is available when computed position is fixed 10798 offset = elem.getBoundingClientRect(); 10799 } else { 10800 10801 // Get *real* offsetParent 10802 offsetParent = this.offsetParent(); 10803 10804 // Get correct offsets 10805 offset = this.offset(); 10806 if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) { 10807 parentOffset = offsetParent.offset(); 10808 } 10809 10810 // Add offsetParent borders 10811 parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true ); 10812 parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true ); 10813 } 10814 10815 // Subtract parent offsets and element margins 10816 // note: when an element has margin: auto the offsetLeft and marginLeft 10817 // are the same in Safari causing offset.left to incorrectly be 0 10818 return { 10819 top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ), 10820 left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true ) 10821 }; 10822 }, 10823 10824 offsetParent: function() { 10825 return this.map( function() { 10826 var offsetParent = this.offsetParent; 10827 10828 while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) && 10829 jQuery.css( offsetParent, "position" ) === "static" ) ) { 10830 offsetParent = offsetParent.offsetParent; 10831 } 10832 return offsetParent || documentElement; 10833 } ); 10834 } 10835} ); 10836 10837// Create scrollLeft and scrollTop methods 10838jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) { 10839 var top = /Y/.test( prop ); 10840 10841 jQuery.fn[ method ] = function( val ) { 10842 return access( this, function( elem, method, val ) { 10843 var win = getWindow( elem ); 10844 10845 if ( val === undefined ) { 10846 return win ? ( prop in win ) ? win[ prop ] : 10847 win.document.documentElement[ method ] : 10848 elem[ method ]; 10849 } 10850 10851 if ( win ) { 10852 win.scrollTo( 10853 !top ? val : jQuery( win ).scrollLeft(), 10854 top ? val : jQuery( win ).scrollTop() 10855 ); 10856 10857 } else { 10858 elem[ method ] = val; 10859 } 10860 }, method, val, arguments.length, null ); 10861 }; 10862} ); 10863 10864// Support: Safari<7-8+, Chrome<37-44+ 10865// Add the top/left cssHooks using jQuery.fn.position 10866// Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084 10867// getComputedStyle returns percent when specified for top/left/bottom/right 10868// rather than make the css module depend on the offset module, we just check for it here 10869jQuery.each( [ "top", "left" ], function( i, prop ) { 10870 jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition, 10871 function( elem, computed ) { 10872 if ( computed ) { 10873 computed = curCSS( elem, prop ); 10874 10875 // if curCSS returns percentage, fallback to offset 10876 return rnumnonpx.test( computed ) ? 10877 jQuery( elem ).position()[ prop ] + "px" : 10878 computed; 10879 } 10880 } 10881 ); 10882} ); 10883 10884 10885// Create innerHeight, innerWidth, height, width, outerHeight and outerWidth methods 10886jQuery.each( { Height: "height", Width: "width" }, function( name, type ) { 10887 jQuery.each( { padding: "inner" + name, content: type, "": "outer" + name }, 10888 function( defaultExtra, funcName ) { 10889 10890 // margin is only for outerHeight, outerWidth 10891 jQuery.fn[ funcName ] = function( margin, value ) { 10892 var chainable = arguments.length && ( defaultExtra || typeof margin !== "boolean" ), 10893 extra = defaultExtra || ( margin === true || value === true ? "margin" : "border" ); 10894 10895 return access( this, function( elem, type, value ) { 10896 var doc; 10897 10898 if ( jQuery.isWindow( elem ) ) { 10899 10900 // As of 5/8/2012 this will yield incorrect results for Mobile Safari, but there 10901 // isn't a whole lot we can do. See pull request at this URL for discussion: 10902 // https://github.com/jquery/jquery/pull/764 10903 return elem.document.documentElement[ "client" + name ]; 10904 } 10905 10906 // Get document width or height 10907 if ( elem.nodeType === 9 ) { 10908 doc = elem.documentElement; 10909 10910 // Either scroll[Width/Height] or offset[Width/Height] or client[Width/Height], 10911 // whichever is greatest 10912 // unfortunately, this causes bug #3838 in IE6/8 only, 10913 // but there is currently no good, small way to fix it. 10914 return Math.max( 10915 elem.body[ "scroll" + name ], doc[ "scroll" + name ], 10916 elem.body[ "offset" + name ], doc[ "offset" + name ], 10917 doc[ "client" + name ] 10918 ); 10919 } 10920 10921 return value === undefined ? 10922 10923 // Get width or height on the element, requesting but not forcing parseFloat 10924 jQuery.css( elem, type, extra ) : 10925 10926 // Set width or height on the element 10927 jQuery.style( elem, type, value, extra ); 10928 }, type, chainable ? margin : undefined, chainable, null ); 10929 }; 10930 } ); 10931} ); 10932 10933 10934jQuery.fn.extend( { 10935 10936 bind: function( types, data, fn ) { 10937 return this.on( types, null, data, fn ); 10938 }, 10939 unbind: function( types, fn ) { 10940 return this.off( types, null, fn ); 10941 }, 10942 10943 delegate: function( selector, types, data, fn ) { 10944 return this.on( types, selector, data, fn ); 10945 }, 10946 undelegate: function( selector, types, fn ) { 10947 10948 // ( namespace ) or ( selector, types [, fn] ) 10949 return arguments.length === 1 ? 10950 this.off( selector, "**" ) : 10951 this.off( types, selector || "**", fn ); 10952 } 10953} ); 10954 10955// The number of elements contained in the matched element set 10956jQuery.fn.size = function() { 10957 return this.length; 10958}; 10959 10960jQuery.fn.andSelf = jQuery.fn.addBack; 10961 10962 10963 10964 10965// Register as a named AMD module, since jQuery can be concatenated with other 10966// files that may use define, but not via a proper concatenation script that 10967// understands anonymous AMD modules. A named AMD is safest and most robust 10968// way to register. Lowercase jquery is used because AMD module names are 10969// derived from file names, and jQuery is normally delivered in a lowercase 10970// file name. Do this after creating the global so that if an AMD module wants 10971// to call noConflict to hide this version of jQuery, it will work. 10972 10973// Note that for maximum portability, libraries that are not jQuery should 10974// declare themselves as anonymous modules, and avoid setting a global if an 10975// AMD loader is present. jQuery is a special case. For more information, see
10976// https://github.com/jrburke/requirejs/wiki/Updating-existing-libraries#wiki-anon 10977 10978if ( typeof define === "function" && define.amd ) { 10979 define( "jquery", [], function() { 10980 return jQuery; 10981 } ); 10982} 10983 10984 10985 10986var 10987 10988 // Map over jQuery in case of overwrite 10989 _jQuery = window.jQuery, 10990 10991 // Map over the $ in case of overwrite 10992 _$ = window.$; 10993 10994jQuery.noConflict = function( deep ) { 10995 if ( window.$ === jQuery ) { 10996 window.$ = _$; 10997 } 10998 10999 if ( deep && window.jQuery === jQuery ) { 11000 window.jQuery = _jQuery; 11001 } 11002 11003 return jQuery; 11004}; 11005 11006// Expose jQuery and $ identifiers, even in 11007// AMD (#7102#comment:10, https://github.com/jquery/jquery/pull/557) 11008// and CommonJS for browser emulators (#13566) 11009if ( !noGlobal ) { 11010 window.jQuery = window.$ = jQuery; 11011} 11012 11013return jQuery; 11014})); 11015/* jshint node: true */ 11016 11017/** 11018 * Unobtrusive scripting adapter for jQuery 11019 * https://github.com/rails/jquery-ujs 11020 * 11021 * Requires jQuery 1.8.0 or later. 11022 * 11023 * Released under the MIT license 11024 * 11025 */ 11026 11027(function() { 11028 'use strict'; 11029 11030 var jqueryUjsInit = function($, undefined) { 11031 11032 // Cut down on the number of issues from people inadvertently including jquery_ujs twice 11033 // by detecting and raising an error when it happens. 11034 if ( $.rails !== undefined ) { 11035 $.error('jquery-ujs has already been loaded!'); 11036 } 11037 11038 // Shorthand to make it a little easier to call public rails functions from within rails.js 11039 var rails; 11040 var $document = $(document); 11041 11042 $.rails = rails = { 11043 // Link elements bound by jquery-ujs 11044 linkClickSelector: 'a[data-confirm], a[data-method], a[data-remote]:not([disabled]), a[data-disable-with], a[data-disable]', 11045 11046 // Button elements bound by jquery-ujs 11047 buttonClickSelector: 'button[data-remote]:not([form]):not(form button), button[data-confirm]:not([form]):not(form button)', 11048 11049 // Select elements bound by jquery-ujs 11050 inputChangeSelector: 'select[data-remote], input[data-remote], textarea[data-remote]', 11051 11052 // Form elements bound by jquery-ujs 11053 formSubmitSelector: 'form:not([data-turbo=true])', 11054 11055 // Form input elements bound by jquery-ujs 11056 formInputClickSelector: 'form:not([data-turbo=true]) input[type=submit], form:not([data-turbo=true]) input[type=image], form:not([data-turbo=true]) button[type=submit], form:not([data-turbo=true]) button:not([type]), input[type=submit][form], input[type=image][form], button[type=submit][form], button[form]:not([type])', 11057 11058 // Form input elements disabled during form submission 11059 disableSelector: 'input[data-disable-with]:enabled, button[data-disable-with]:enabled, textarea[data-disable-with]:enabled, input[data-disable]:enabled, button[data-disable]:enabled, textarea[data-disable]:enabled', 11060 11061 // Form input elements re-enabled after form submission 11062 enableSelector: 'input[data-disable-with]:disabled, button[data-disable-with]:disabled, textarea[data-disable-with]:disabled, input[data-disable]:disabled, button[data-disable]:disabled, textarea[data-disable]:disabled', 11063 11064 // Form required input elements 11065 requiredInputSelector: 'input[name][required]:not([disabled]), textarea[name][required]:not([disabled])', 11066 11067 // Form file input elements 11068 fileInputSelector: 'input[name][type=file]:not([disabled])', 11069 11070 // Link onClick disable selector with possible reenable after remote submission 11071 linkDisableSelector: 'a[data-disable-with], a[data-disable]', 11072 11073 // Button onClick disable selector with possible reenable after remote submission 11074 buttonDisableSelector: 'button[data-remote][data-disable-with], button[data-remote][data-disable]', 11075 11076 // Up-to-date Cross-Site Request Forgery token 11077 csrfToken: function() { 11078 return $('meta[name=csrf-token]').attr('content'); 11079 }, 11080 11081 // URL param that must contain the CSRF token 11082 csrfParam: function() { 11083 return $('meta[name=csrf-param]').attr('content'); 11084 }, 11085 11086 // Make sure that every Ajax request sends the CSRF token 11087 CSRFProtection: function(xhr) { 11088 var token = rails.csrfToken(); 11089 if (token) xhr.setRequestHeader('X-CSRF-Token', token); 11090 }, 11091 11092 // Make sure that all forms have actual up-to-date tokens (cached forms contain old ones) 11093 refreshCSRFTokens: function(){ 11094 $('form input[name="' + rails.csrfParam() + '"]').val(rails.csrfToken()); 11095 }, 11096 11097 // Triggers an event on an element and returns false if the event result is false 11098 fire: function(obj, name, data) { 11099 var event = $.Event(name); 11100 obj.trigger(event, data); 11101 return event.result !== false; 11102 }, 11103 11104 // Default confirm dialog, may be overridden with custom confirm dialog in $.rails.confirm 11105 confirm: function(message) { 11106 return confirm(message); 11107 }, 11108 11109 // Default ajax function, may be overridden with custom function in $.rails.ajax 11110 ajax: function(options) { 11111 return $.ajax(options); 11112 }, 11113 11114 // Default way to get an element's href. May be overridden at $.rails.href. 11115 href: function(element) { 11116 return element[0].href; 11117 }, 11118 11119 // Checks "data-remote" if true to handle the request through a XHR request. 11120 isRemote: function(element) { 11121 return element.data('remote') !== undefined && element.data('remote') !== false; 11122 }, 11123 11124 // Submits "remote" forms and links with ajax 11125 handleRemote: function(element) { 11126 var method, url, data, withCredentials, dataType, options; 11127 11128 if (rails.fire(element, 'ajax:before')) { 11129 withCredentials = element.data('with-credentials') || null; 11130 dataType = element.data('type') || ($.ajaxSettings && $.ajaxSettings.dataType); 11131 11132 if (element.is('form')) { 11133 method = element.data('ujs:submit-button-formmethod') || element.attr('method'); 11134 url = element.data('ujs:submit-button-formaction') || element.attr('action'); 11135 data = $(element[0]).serializeArray(); 11136 // memoized value from clicked submit button 11137 var button = element.data('ujs:submit-button'); 11138 if (button) { 11139 data.push(button); 11140 element.data('ujs:submit-button', null); 11141 } 11142 element.data('ujs:submit-button-formmethod', null); 11143 element.data('ujs:submit-button-formaction', null); 11144 } else if (element.is(rails.inputChangeSelector)) { 11145 method = element.data('method'); 11146 url = element.data('url'); 11147 data = element.serialize(); 11148 if (element.data('params')) data = data + '&' + element.data('params'); 11149 } else if (element.is(rails.buttonClickSelector)) { 11150 method = element.data('method') || 'get'; 11151 url = element.data('url'); 11152 data = element.serialize(); 11153 if (element.data('params')) data = data + '&' + element.data('params'); 11154 } else { 11155 method = element.data('method'); 11156 url = rails.href(element); 11157 data = element.data('params') || null; 11158 } 11159 11160 options = { 11161 type: method || 'GET', data: data, dataType: dataType, 11162 // stopping the "ajax:beforeSend" event will cancel the ajax request 11163 beforeSend: function(xhr, settings) { 11164 if (settings.dataType === undefined) { 11165 xhr.setRequestHeader('accept', '*/*;q=0.5, ' + settings.accepts.script); 11166 } 11167 if (rails.fire(element, 'ajax:beforeSend', [xhr, settings])) {
11168 element.trigger('ajax:send', xhr); 11169 } else { 11170 return false; 11171 } 11172 }, 11173 success: function(data, status, xhr) { 11174 element.trigger('ajax:success', [data, status, xhr]); 11175 }, 11176 complete: function(xhr, status) { 11177 element.trigger('ajax:complete', [xhr, status]); 11178 }, 11179 error: function(xhr, status, error) { 11180 element.trigger('ajax:error', [xhr, status, error]); 11181 }, 11182 crossDomain: rails.isCrossDomain(url) 11183 }; 11184 11185 // There is no withCredentials for IE6-8 when 11186 // "Enable native XMLHTTP support" is disabled 11187 if (withCredentials) { 11188 options.xhrFields = { 11189 withCredentials: withCredentials 11190 }; 11191 } 11192 11193 // Only pass url to `ajax` options if not blank 11194 if (url) { options.url = url; } 11195 11196 return rails.ajax(options); 11197 } else { 11198 return false; 11199 } 11200 }, 11201 11202 // Determines if the request is a cross domain request. 11203 isCrossDomain: function(url) { 11204 var originAnchor = document.createElement('a'); 11205 originAnchor.href = location.href; 11206 var urlAnchor = document.createElement('a'); 11207 11208 try { 11209 urlAnchor.href = url; 11210 // This is a workaround to a IE bug. 11211 urlAnchor.href = urlAnchor.href; 11212 11213 // If URL protocol is false or is a string containing a single colon 11214 // *and* host are false, assume it is not a cross-domain request 11215 // (should only be the case for IE7 and IE compatibility mode). 11216 // Otherwise, evaluate protocol and host of the URL against the origin 11217 // protocol and host. 11218 return !(((!urlAnchor.protocol || urlAnchor.protocol === ':') && !urlAnchor.host) || 11219 (originAnchor.protocol + '//' + originAnchor.host === 11220 urlAnchor.protocol + '//' + urlAnchor.host)); 11221 } catch (e) { 11222 // If there is an error parsing the URL, assume it is crossDomain. 11223 return true; 11224 } 11225 }, 11226 11227 // Handles "data-method" on links such as: 11228 // <a href="/users/5" data-method="delete" rel="nofollow" data-confirm="Are you sure?">Delete</a> 11229 handleMethod: function(link) { 11230 var href = rails.href(link), 11231 method = link.data('method'), 11232 target = link.attr('target'), 11233 csrfToken = rails.csrfToken(), 11234 csrfParam = rails.csrfParam(), 11235 form = $('<form method="post" action="' + href + '"></form>'), 11236 metadataInput = '<input name="_method" value="' + method + '" type="hidden" />'; 11237 11238 if (csrfParam !== undefined && csrfToken !== undefined && !rails.isCrossDomain(href)) { 11239 metadataInput += '<input name="' + csrfParam + '" value="' + csrfToken + '" type="hidden" />'; 11240 } 11241 11242 if (target) { form.attr('target', target); } 11243 11244 form.hide().append(metadataInput).appendTo('body'); 11245 form.submit(); 11246 }, 11247 11248 // Helper function that returns form elements that match the specified CSS selector 11249 // If form is actually a "form" element this will return associated elements outside the from that have 11250 // the html form attribute set 11251 formElements: function(form, selector) { 11252 return form.is('form') ? $(form[0].elements).filter(selector) : form.find(selector); 11253 }, 11254 11255 /* Disables form elements: 11256 - Caches element value in 'ujs:enable-with' data store 11257 - Replaces element text with value of 'data-disable-with' attribute 11258 - Sets disabled property to true 11259 */ 11260 disableFormElements: function(form) { 11261 rails.formElements(form, rails.disableSelector).each(function() { 11262 rails.disableFormElement($(this)); 11263 }); 11264 }, 11265 11266 disableFormElement: function(element) { 11267 var method, replacement; 11268 11269 method = element.is('button') ? 'html' : 'val'; 11270 replacement = element.data('disable-with'); 11271 11272 if (replacement !== undefined) { 11273 element.data('ujs:enable-with', element[method]()); 11274 element[method](replacement); 11275 } 11276 11277 element.prop('disabled', true); 11278 element.data('ujs:disabled', true); 11279 }, 11280 11281 /* Re-enables disabled form elements: 11282 - Replaces element text with cached value from 'ujs:enable-with' data store (created in `disableFormElements`) 11283 - Sets disabled property to false 11284 */ 11285 enableFormElements: function(form) { 11286 rails.formElements(form, rails.enableSelector).each(function() { 11287 rails.enableFormElement($(this)); 11288 }); 11289 }, 11290 11291 enableFormElement: function(element) { 11292 var method = element.is('button') ? 'html' : 'val'; 11293 if (element.data('ujs:enable-with') !== undefined) { 11294 element[method](element.data('ujs:enable-with')); 11295 element.removeData('ujs:enable-with'); // clean up cache 11296 } 11297 element.prop('disabled', false); 11298 element.removeData('ujs:disabled'); 11299 }, 11300 11301 /* For 'data-confirm' attribute: 11302 - Fires `confirm` event 11303 - Shows the confirmation dialog 11304 - Fires the `confirm:complete` event 11305 11306 Returns `true` if no function stops the chain and user chose yes; `false` otherwise. 11307 Attaching a handler to the element's `confirm` event that returns a `falsy` value cancels the confirmation dialog. 11308 Attaching a handler to the element's `confirm:complete` event that returns a `falsy` value makes this function
11309 return false. The `confirm:complete` event is fired whether or not the user answered true or false to the dialog. 11310 */ 11311 allowAction: function(element) { 11312 var message = element.data('confirm'), 11313 answer = false, callback; 11314 if (!message) { return true; } 11315 11316 if (rails.fire(element, 'confirm')) { 11317 try { 11318 answer = rails.confirm(message); 11319 } catch (e) { 11320 (console.error || console.log).call(console, e.stack || e); 11321 } 11322 callback = rails.fire(element, 'confirm:complete', [answer]); 11323 } 11324 return answer && callback; 11325 }, 11326 11327 // Helper function which checks for blank inputs in a form that match the specified CSS selector 11328 blankInputs: function(form, specifiedSelector, nonBlank) { 11329 var foundInputs = $(), 11330 input, 11331 valueToCheck, 11332 radiosForNameWithNoneSelected, 11333 radioName, 11334 selector = specifiedSelector || 'input,textarea', 11335 requiredInputs = form.find(selector), 11336 checkedRadioButtonNames = {}; 11337 11338 requiredInputs.each(function() { 11339 input = $(this); 11340 if (input.is('input[type=radio]')) { 11341 11342 // Don't count unchecked required radio as blank if other radio with same name is checked, 11343 // regardless of whether same-name radio input has required attribute or not. The spec 11344 // states https://www.w3.org/TR/html5/forms.html#the-required-attribute 11345 radioName = input.attr('name'); 11346 11347 // Skip if we've already seen the radio with this name. 11348 if (!checkedRadioButtonNames[radioName]) { 11349 11350 // If none checked 11351 if (form.find('input[type=radio]:checked[name="' + radioName + '"]').length === 0) { 11352 radiosForNameWithNoneSelected = form.find( 11353 'input[type=radio][name="' + radioName + '"]'); 11354 foundInputs = foundInputs.add(radiosForNameWithNoneSelected); 11355 } 11356 11357 // We only need to check each name once. 11358 checkedRadioButtonNames[radioName] = radioName; 11359 } 11360 } else { 11361 valueToCheck = input.is('input[type=checkbox],input[type=radio]') ? input.is(':checked') : !!input.val(); 11362 if (valueToCheck === nonBlank) { 11363 foundInputs = foundInputs.add(input); 11364 } 11365 } 11366 }); 11367 return foundInputs.length ? foundInputs : false; 11368 }, 11369 11370 // Helper function which checks for non-blank inputs in a form that match the specified CSS selector 11371 nonBlankInputs: function(form, specifiedSelector) { 11372 return rails.blankInputs(form, specifiedSelector, true); // true specifies nonBlank 11373 }, 11374 11375 // Helper function, needed to provide consistent behavior in IE 11376 stopEverything: function(e) { 11377 $(e.target).trigger('ujs:everythingStopped'); 11378 e.stopImmediatePropagation(); 11379 return false; 11380 }, 11381 11382 // Replace element's html with the 'data-disable-with' after storing original html 11383 // and prevent clicking on it 11384 disableElement: function(element) { 11385 var replacement = element.data('disable-with'); 11386 11387 if (replacement !== undefined) { 11388 element.data('ujs:enable-with', element.html()); // store enabled state 11389 element.html(replacement); 11390 } 11391 11392 element.on('click.railsDisable', function(e) { // prevent further clicking 11393 return rails.stopEverything(e); 11394 }); 11395 element.data('ujs:disabled', true); 11396 }, 11397 11398 // Restore element to its original state which was disabled by 'disableElement' above 11399 enableElement: function(element) { 11400 if (element.data('ujs:enable-with') !== undefined) { 11401 element.html(element.data('ujs:enable-with')); // set to old enabled state 11402 element.removeData('ujs:enable-with'); // clean up cache 11403 } 11404 element.off('click.railsDisable'); // enable element 11405 element.removeData('ujs:disabled'); 11406 } 11407 }; 11408 11409 if (rails.fire($document, 'rails:attachBindings')) { 11410 11411 $.ajaxPrefilter(function(options, originalOptions, xhr){ if ( !options.crossDomain ) { rails.CSRFProtection(xhr); }}); 11412 11413 // This event works the same as the load event, except that it fires every 11414 // time the page is loaded. 11415 // 11416 // See https://github.com/rails/jquery-ujs/issues/357 11417 // See https://developer.mozilla.org/en-US/docs/Using_Firefox_1.5_caching 11418 $(window).on('pageshow.rails', function () { 11419 $($.rails.enableSelector).each(function () { 11420 var element = $(this); 11421 11422 if (element.data('ujs:disabled')) { 11423 $.rails.enableFormElement(element); 11424 } 11425 }); 11426 11427 $($.rails.linkDisableSelector).each(function () { 11428 var element = $(this); 11429 11430 if (element.data('ujs:disabled')) { 11431 $.rails.enableElement(element); 11432 } 11433 }); 11434 }); 11435 11436 $document.on('ajax:complete', rails.linkDisableSelector, function() { 11437 rails.enableElement($(this)); 11438 }); 11439 11440 $document.on('ajax:complete', rails.buttonDisableSelector, function() { 11441 rails.enableFormElement($(this)); 11442 }); 11443 11444 $document.on('click.rails', rails.linkClickSelector, function(e) { 11445 var link = $(this), method = link.data('method'), data = link.data('params'), metaClick = e.metaKey || e.ctrlKey; 11446 if (!rails.allowAction(link)) return rails.stopEverything(e); 11447 11448 if (!metaClick && link.is(rails.linkDisableSelector)) rails.disableElement(link); 11449 11450 if (rails.isRemote(link)) { 11451 if (metaClick && (!method || method === 'GET') && !data) { return true; } 11452 11453 var handleRemote = rails.handleRemote(link); 11454 // Response from rails.handleRemote() will either be false or a deferred object promise. 11455 if (handleRemote === false) { 11456 rails.enableElement(link); 11457 } else { 11458 handleRemote.fail( function() { rails.enableElement(link); } ); 11459 } 11460 return false;
11461 11462 } else if (method) { 11463 rails.handleMethod(link); 11464 return false; 11465 } 11466 }); 11467 11468 $document.on('click.rails', rails.buttonClickSelector, function(e) { 11469 var button = $(this); 11470 11471 if (!rails.allowAction(button) || !rails.isRemote(button)) return rails.stopEverything(e); 11472 11473 if (button.is(rails.buttonDisableSelector)) rails.disableFormElement(button); 11474 11475 var handleRemote = rails.handleRemote(button); 11476 // Response from rails.handleRemote() will either be false or a deferred object promise. 11477 if (handleRemote === false) { 11478 rails.enableFormElement(button); 11479 } else { 11480 handleRemote.fail( function() { rails.enableFormElement(button); } ); 11481 } 11482 return false; 11483 }); 11484 11485 $document.on('change.rails', rails.inputChangeSelector, function(e) { 11486 var link = $(this); 11487 if (!rails.allowAction(link) || !rails.isRemote(link)) return rails.stopEverything(e); 11488 11489 rails.handleRemote(link); 11490 return false; 11491 }); 11492 11493 $document.on('submit.rails', rails.formSubmitSelector, function(e) { 11494 var form = $(this), 11495 remote = rails.isRemote(form), 11496 blankRequiredInputs, 11497 nonBlankFileInputs; 11498 11499 if (!rails.allowAction(form)) return rails.stopEverything(e); 11500 11501 // Skip other logic when required values are missing or file upload is present 11502 if (form.attr('novalidate') === undefined) { 11503 if (form.data('ujs:formnovalidate-button') === undefined) { 11504 blankRequiredInputs = rails.blankInputs(form, rails.requiredInputSelector, false); 11505 if (blankRequiredInputs && rails.fire(form, 'ajax:aborted:required', [blankRequiredInputs])) { 11506 return rails.stopEverything(e); 11507 } 11508 } else { 11509 // Clear the formnovalidate in case the next button click is not on a formnovalidate button 11510 // Not strictly necessary to do here, since it is also reset on each button click, but just to be certain 11511 form.data('ujs:formnovalidate-button', undefined); 11512 } 11513 } 11514 11515 if (remote) { 11516 nonBlankFileInputs = rails.nonBlankInputs(form, rails.fileInputSelector); 11517 if (nonBlankFileInputs) { 11518 // Slight timeout so that the submit button gets properly serialized 11519 // (make it easy for event handler to serialize form without disabled values) 11520 setTimeout(function(){ rails.disableFormElements(form); }, 13); 11521 var aborted = rails.fire(form, 'ajax:aborted:file', [nonBlankFileInputs]); 11522 11523 // Re-enable form elements if event bindings return false (canceling normal form submission) 11524 if (!aborted) { setTimeout(function(){ rails.enableFormElements(form); }, 13); } 11525 11526 return aborted; 11527 } 11528 11529 rails.handleRemote(form); 11530 return false; 11531 11532 } else { 11533 // Slight timeout so that the submit button gets properly serialized 11534 setTimeout(function(){ rails.disableFormElements(form); }, 13); 11535 } 11536 }); 11537 11538 $document.on('click.rails', rails.formInputClickSelector, function(event) { 11539 var button = $(this); 11540 11541 if (!rails.allowAction(button)) return rails.stopEverything(event); 11542 11543 // Register the pressed submit button 11544 var name = button.attr('name'), 11545 data = name ? {name:name, value:button.val()} : null; 11546 11547 var form = button.closest('form'); 11548 if (form.length === 0) { 11549 form = $('#' + button.attr('form')); 11550 } 11551 form.data('ujs:submit-button', data); 11552 11553 // Save attributes from button 11554 form.data('ujs:formnovalidate-button', button.attr('formnovalidate')); 11555 form.data('ujs:submit-button-formaction', button.attr('formaction')); 11556 form.data('ujs:submit-button-formmethod', button.attr('formmethod')); 11557 }); 11558 11559 $document.on('ajax:send.rails', rails.formSubmitSelector, function(event) { 11560 if (this === event.target) rails.disableFormElements($(this)); 11561 }); 11562 11563 $document.on('ajax:complete.rails', rails.formSubmitSelector, function(event) { 11564 if (this === event.target) rails.enableFormElements($(this)); 11565 }); 11566 11567 $(function(){ 11568 rails.refreshCSRFTokens(); 11569 }); 11570 } 11571 11572 }; 11573 11574 if (window.jQuery) { 11575 jqueryUjsInit(jQuery); 11576 } else if (typeof exports === 'object' && typeof module === 'object') { 11577 module.exports = jqueryUjsInit; 11578 } 11579})(); 11580document.addEventListener('turbolinks:load', function () { 11581 if (typeof gtag === 'function') { 11582 gtag('event', 'page_view', {'page_path': window.location.pathname}); 11583 } 11584}); 11585 11586 11587 11588 11589
11590// TODO: rails-ujs doesn't seem to support the `$('#search').trigger('submit.rails');` behaviour for the search key-up event;
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.