1(()=>{(function(){var Scroller,stats,type,text,totop,loading_text,isIE=-1!==navigator.userAgent.search("MSIE");if(isIE){var IEVersion=navigator.userAgent.match(/MSIE\s?(\d+)\.?\d*;/);IEVersion=parseInt(IEVersion[1])}function fullscreenState(){return document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement?1:0}"https:"===document.location.protocol&&(infiniteScroll.settings.ajaxurl=infiniteScroll.settings.ajaxurl.replace("http://","https://")),Scroller=function(e){var t=this;this.id=e.id,this.body=document.body,this.window=window,this.element=document.getElementById(e.id),this.wrapperClass=e.wrapper_class,this.ready=!0,this.disabled=!1,this.page=1,this.offset=e.offset,this.currentday=e.currentday,this.order=e.order,this.throttle=!1,this.click_handle=e.click_handle,this.google_analytics=e.google_analytics,this.history=e.history,this.origURL=window.location.href,this.handle=document.createElement("div"),this.handle.setAttribute("id","infinite-handle");var n=document.createElement("span"),i=document.createElement("button");i.textContent=text,n.appendChild(i),this.handle.appendChild(n),this.footer={el:document.getElementById("infinite-footer"),wrap:e.footer},this.checkViewportOnLoadBound=t.checkViewportOnLoad.bind(this),this.wpMediaelement=null,"scroll"===type?(this.window.addEventListener("scroll",function(){t.throttle=!0}),t.gotop(),setInterval(function(){t.throttle&&(t.throttle=!1,t.thefooter(),t.refresh(),t.determineURL())},250),t.ensureFilledViewport(),this.body.addEventListener("is.post-load",t.checkViewportOnLoadBound)):"click"===type&&(this.click_handle&&this.element.appendChild(this.handle),this.handle.addEventListener("click",function(){t.click_handle&&t.handle.parentNode.removeChild(t.handle),t.refresh()})),this.body.addEventListener("is.post-load",t.initializeMejs)},Scroller.prototype.getScrollTop=function(){return window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0},Scroller.prototype.extend=function(e){e=e||{};for(var t=1;t<arguments.length;t++)if(arguments[t])for(var n in arguments[t])Object.hasOwn(arguments[t],n)&&(e[n]=arguments[t][n]);return e},Scroller.prototype.check=function(){return this.measure(this.element,[this.wrapperClass]).bottom<2*this.window.innerHeight},Scroller.prototype.render=function(e){var t=Array.prototype.slice.call(e.fragment.childNodes);for(this.body.classList.add("infinity-success");t.length>0;){var n=t.shift();this.element.appendChild(n)}this.trigger(this.body,"is.post-load",{jqueryEventName:"post-load",data:e}),this.ready=!0},Scroller.prototype.query=function(){return{page:this.page+this.offset,currentday:this.currentday,order:this.order,scripts:window.infiniteScroll.settings.scripts,styles:window.infiniteScroll.settings.styles,query_args:window.infiniteScroll.settings.query_args,query_before:window.infiniteScroll.settings.query_before,last_post_date:window.infiniteScroll.settings.last_post_date}},Scroller.prototype.animate=function(e,t){var n=performance.now();requestAnimationFrame(function i(o){var r=Math.min(1,(o-n)/t);e(r),r<1&&requestAnimationFrame(i)})},Scroller.prototype.gotop=function(){var e=document.getElementById("infinity-blog-title"),t=this;e&&(e.setAttribute("title",totop),e.addEventListener("click",function(e){var n=t.window.pageYOffset;e.preventDefault(),t.animate(function(e){var t=n-n*e;document.documentElement.scrollTop=document.body.scrollTop=t},200)}))},Scroller.prototype.thefooter=function(){var e,t,n,i,o=this;if(this.footer&&this.footer.el){if("string"==typeof this.footer.wrap){try{t=(t=document.getElementById(this.footer.wrap).getBoundingClientRect()).width}catch{t=0}t>479&&(e=this.footer.el.querySelector(".container"))&&(e.style.width=t+"px")}n=parseInt(o.footer.el.style.bottom||-50,10),i=this.window.pageYOffset>=350?0:-50,n!==i&&o.animate(function(e){var t=n+(i-n)*e;o.footer.el.style.bottom=t+"px",1===e&&(n=i)},200)}},Scroller.prototype.urlEncodeJSON=function(e,t){var n,i,o=[];for(var r in e)n=encodeURIComponent(r),i=t?t+"["+n+"]":n,"object"==typeof e[r]?!Array.isArray(e[r])||e[r].length>0?o.push(this.urlEncodeJSON(e[r],i)):o.push(i+"[]="):o.push(i+"="+encodeURIComponent(e[r]));return o.join("&")},Scroller.prototype.refresh=function(){var self=this,query,xhr,loader,customized;if(!this.disabled&&this.ready&&this.check())return this.ready=!1,this.click_handle&&(loader||(document.getElementById("infinite-aria").textContent=loading_text,loader=document.createElement("div"),loader.classList.add("infinite-loader"),loader.setAttribute("role","progress"),loader.innerHTML='<svg class="jetpack-spinner infinite-loader-spinner spinner" width="28" height="28" viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><circle cx="50" cy="50" r="46" fill="none" stroke="#ddd" stroke-width="8"/><path d="M 50 4 A 46 46 0 0 1 96 50" fill="none" stroke="currentColor" stroke-width="8" stroke-linecap="round"><animateTransform attributeName="transform" type="rotate" dur="1.4s" from="0 50 50" to="360 50 50" repeatCount="indef
1inite"/></path></svg>'),this.element.appendChild(loader)),query=self.extend({action:"infinite_scroll"},this.query()),"undefined"!=typeof wp&&wp.customize&&wp.customize.settings.theme&&(customized={},query.wp_customize="on",query.theme=wp.customize.settings.theme.stylesheet,wp.customize.each(function(e){e._dirty&&(customized[e.id]=e())}),query.customized=JSON.stringify(customized),query.nonce=wp.customize.settings.nonce.preview),xhr=new XMLHttpRequest,xhr.open("POST",infiniteScroll.settings.ajaxurl,!0),xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8"),xhr.send(self.urlEncodeJSON(query)),xhr.onerror=function(){self.click_handle&&loader.parentNode&&loader.parentNode.removeChild(loader),self.ready=!0},xhr.onload=function(){var response=JSON.parse(xhr.responseText),httpCheck=xhr.status>=200&&xhr.status<300,responseCheck=void 0!==response.html;if(response&&httpCheck&&responseCheck){if(self.click_handle&&loader.parentNode&&loader.parentNode.removeChild(loader),response.scripts&&Array.isArray(response.scripts)&&response.scripts.forEach(function(e){var t=e.footer?"body":"head";window.infiniteScroll.settings.scripts.push(e.handle),e.extra_data&&self.appendInlineScript(e.extra_data,t),e.before_handle&&self.appendInlineScript(e.before_handle,t);var n=document.createElement("script");n.type="text/javascript",n.src=e.src,n.id=e.handle,n.async=!1,e.after_handle&&(n.onload=function(){self.appendInlineScript(e.after_handle,t)}),"wp-mediaelement"===e.handle&&self.body.removeEventListener("is.post-load",self.initializeMejs),"wp-mediaelement"===e.handle&&"undefined"==typeof mejs?(self.wpMediaelement={},self.wpMediaelement.tag=n,self.wpMediaelement.element=t,setTimeout(self.maybeLoadMejs.bind(self),250)):document.getElementsByTagName(t)[0].appendChild(n)}),response.styles&&Array.isArray(response.styles)&&response.styles.forEach(function(item){window.infiniteScroll.settings.styles.push(item.handle);var style=document.createElement("link");style.rel="stylesheet",style.href=item.src,style.id=item.handle+"-css",!item.conditional||isIE&&eval(item.conditional.replace(/%ver/g,IEVersion))||(style=!1),style&&document.getElementsByTagName("head")[0].appendChild(style)}),response.fragment=document.createElement("div"),response.fragment.innerHTML=response.html,self.page++,stats&&((new Image).src=document.location.protocol+"//pixel.wp.com/g.gif?"+stats+"&post=0&baba="+Math.random()),"object"==typeof response.postflair&&"object"==typeof WPCOM_sharing_counts&&(WPCOM_sharing_counts=self.extend(WPCOM_sharing_counts,response.postflair)),self.render.call(self,response),"click"===type?(infiniteScroll.settings.wrapper&&document.querySelector("#infinite-view-"+(self.page+self.offset-1)+" a:first-of-type").focus({preventScroll:!0}),response.lastbatch?self.click_handle?(self.body.classList.add("infinity-end"),self.body.classList.remove("infinity-success")):self.trigger(this.body,"infinite-scroll-posts-end"):self.click_handle?self.element.appendChild(self.handle):self.trigger(this.body,"infinite-scroll-posts-more")):response.lastbatch&&(self.disabled=!0,self.body.classList.add("infinity-end"),self.body.classList.remove("infinity-success")),response.currentday&&(self.currentday=response.currentday),self.google_analytics){var ga_url=self.history.path.replace(/%d/,self.page);"object"==typeof _gaq&&_gaq.push(["_trackPageview",ga_url]),"function"==typeof ga&&ga("send","pageview",ga_url)}}else self.click_handle&&loader.parentNode&&loader.parentNode.removeChild(loader)},xhr},Scroller.prototype.appendInlineScript=function(e,t){var n=document.createElement("script"),i=document.createTextNode("//<![CDATA[ \n"+e+"\n//]]>");n.type="text/javascript",n.appendChild(i),document.getElementsByTagName(t)[0].appendChild(n)},Scroller.prototype.maybeLoadMejs=function(){null!==this.wpMediaelement&&("undefined"==typeof mejs?setTimeout(this.maybeLoadMejs.bind(this),250):(document.getElementsByTagName(this.wpMediaelement.element)[0].appendChild(this.wpMediaelement.tag),this.wpMediaelement=null,this.body.addEventListener("is.post-load",this.initializeMejs)))},Scroller.prototype.initializeMejs=function(e){if(e.detail&&e.detail.html&&(-1!==e.detail.html.indexOf("wp-audio-shortcode")||-1!==e.detail.html.indexOf("wp-video-shortcode"))&&"undefined"!=typeof mejs){var t,n={};"undefined"!=typeof _wpmejsSettings&&(n.pluginPath=_wpmejsSettings.pluginPath),n.success=function(e){var t=e.attributes.autoplay&&"false"!==e.attributes.autoplay;"flash"===e.pluginType&&t&&e.addEventListener("canplay",function(){e.play()},!1)},t=document.querySelectorAll(".wp-audio-shortcode, .wp-video-shortcode"),t=(t=Array.prototype.slice.call(t)).filter(function(e){for(;e.parentNode;){if(e.classList.contains("mejs-container"))return!1;e=e.parentNode}return!0});for(var i=0;i<t.length;i++)new MediaElementPlayer(t[i],n)}},Scroller.prototype.measure=function(e,t){t=t||[];for(var n,i,o,r=Array.prototype.slice.call(e.children),s=Number.MAX_VALUE,l=0;r.length>0;){for(n=r.shift(),o=0;o<t.length;o++)if(n.classList.contains(t[o])){r=r.concat(Array.prototype.slice.call(n.children));break}i=n.getBoundingClientRect(),s=Math.min(s,i.top),l=Math.max(l,i.bottom)}var a=Math.round(window.innerHeight/2),d=s<=a&&l>=a;return{top:s,bottom:l,height:l-s,factor:(Math.min(l,a)-Math.max(s,0))/a,isActive:d}},Scroller.prototype.ensureFilledViewport=function(){var e=this,t=e.window.innerHeight,n=e.measure(e.element,[e.wrapperClass]);e.body.removeEventListener("is.post-load",e.checkViewportOnLoadBound),0!==n.bottom&&n.bottom<t&&(e.ready=!0,e.refresh())},Scroller.prototype.checkViewportOnLoad=function(){this.ensureFilledViewport()};var previousFullScrenState=fullscreenState();Scroller.prototype.determineURL=function(){var e,t=this,n=-1,i=fullscreenState(),o=0;if(previousFullScrenState^i)previousFullScrenState=i;else{previousFullScrenState=i,e=document.querySelectorAll("."+t.wrapperClass);for(var r=0;r<e.length;r++){var s=t.measure(e[r]);if(s.isActive){n=parseInt(e[r].dataset.pageNum,10);break}s.factor>o&&(n=parseInt(e[r].dataset.pageNum,10),o=s.factor)}t.updateURL(n)}},Scroller.prototype.updateURL=function(e){if(window.history.pushState){var t=this,n=t.origURL;-1!==e&&(n=window.location.protocol+"//"+t.history.host+t.history.path.replace(/%d/,e)+t.history.parameters),window.location.href!==n&&history.pushState(null,null,n)}},Scroller.prototype.pause=function(){this.disabled=!0},Scroller.prototype.resume=function(){this.disabled=!1},Scroller.prototype.trigger=function(e,t,n){var i;(n=n||{}).jqueryEventName&&"undefined"!=typeof jQuery&&jQuery(e).trigger(n.jqueryEventName,n.data||null);try{i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n.data||null})}catch{(i=document.createEvent("CustomEvent")).initCustomEvent(t,!0,!0,n.data||null)}e.dispatchEvent(i)};var jetpackInfinityModule=function(){if("object"==typeof infiniteScroll&&(infiniteScroll.
vendor: 6,225 bytes, lines 1-15
1settings.body_class.split(" ").forEach(function(e){e&&document.body.classList.add(e)}),stats=infiniteScroll.settings.stats,type=infiniteScroll.settings.type,text=infiniteScroll.settings.text,totop=infiniteScroll.settings.totop,loading_text=infiniteScroll.settings.loading_text,infiniteScroll.scroller=new Scroller(infiniteScroll.settings),"click"===type)){var e=null;window.addEventListener("scroll",function(){e||(e=setTimeout(function(){infiniteScroll.scroller.determineURL(),e=null},250))})}};"interactive"===document.readyState||"complete"===document.readyState?jetpackInfinityModule():document.addEventListener("DOMContentLoaded",jetpackInfinityModule)})()})();; 2/*! This file is auto-generated */ 3/*! 4 * imagesLoaded PACKAGED v5.0.0 5 * JavaScript is all like "You images are done yet or what?" 6 * MIT License 7 */ 8!function(t,e){"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,(function(){function t(){}let e=t.prototype;return e.on=function(t,e){if(!t||!e)return this;let i=this._events=this._events||{},s=i[t]=i[t]||[];return s.includes(e)||s.push(e),this},e.once=function(t,e){if(!t||!e)return this;this.on(t,e);let i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this},e.off=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;let s=i.indexOf(e);return-1!=s&&i.splice(s,1),this},e.emitEvent=function(t,e){let i=this._events&&this._events[t];if(!i||!i.length)return this;i=i.slice(0),e=e||[];let s=this._onceEvents&&this._onceEvents[t];for(let n of i){s&&s[n]&&(this.off(t,n),delete s[n]),n.apply(this,e)}return this},e.allOff=function(){return delete this._events,delete this._onceEvents,this},t})), 9/*! 10 * imagesLoaded v5.0.0 11 * JavaScript is all like "You images are done yet or what?" 12 * MIT License 13 */ 14function(t,e){"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter")):t.imagesLoaded=e(t,t.EvEmitter)}("undefined"!=typeof window?window:this,(function(t,e){let i=t.jQuery,s=t.console;function n(t,e,o){if(!(this instanceof n))return new n(t,e,o);let r=t;var h;("string"==typeof t&&(r=document.querySelectorAll(t)),r)?(this.elements=(h=r,Array.isArray(h)?h:"object"==typeof h&&"number"==typeof h.length?[...h]:[h]),this.options={},"function"==typeof e?o=e:Object.assign(this.options,e),o&&this.on("always",o),this.getImages(),i&&(this.jqDeferred=new i.Deferred),setTimeout(this.check.bind(this))):s.error(`Bad element for imagesLoaded ${r||t}`)}n.prototype=Object.create(e.prototype),n.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)};const o=[1,9,11];n.prototype.addElementImages=function(t){"IMG"===t.nodeName&&this.addImage(t),!0===this.options.background&&this.addElementBackgroundImages(t);let{nodeType:e}=t;if(!e||!o.includes(e))return;let i=t.querySelectorAll("img");for(let t of i)this.addImage(t);if("string"==typeof this.options.background){let e=t.querySelectorAll(this.options.background);for(let t of e)this.addElementBackgroundImages(t)}};const r=/url\((['"])?(.*?)\1\)/gi;function h(t){this.img=t}function d(t,e){this.url=t,this.element=e,this.img=new Image}return n.prototype.addElementBackgroundImages=function(t){let e=getComputedStyle(t);if(!e)return;let i=r.exec(e.backgroundImage);for(;null!==i;){let s=i&&i[2];s&&this.addBackground(s,t),i=r.exec(e.backgroundImage)}},n.prototype.addImage=function(t){let e=new h(t);this.images.push(e)},n.prototype.addBackground=function(t,e){let i=new d(t,e);this.images.push(i)},n.prototype.check=function(){if(this.progressedCount=0,this.hasAnyBroken=!1,!this.images.length)return void this.complete();let t=(t,e,i)=>{setTimeout((()=>{this.progress(t,e,i)}))};this.images.forEach((function(e){e.once("progress",t),e.check()}))},n.prototype.progress=function(t,e,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!t.isLoaded,this.emitEvent("progress",[this,t,e]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,t),this.progressedCount===this.images.length&&this.complete(),this.options.debug&&s&&s.log(`progress: ${i}`,t,e)},n.prototype.complete=function(){let t=this.hasAnyBroken?"fail":"done";if(this.isComplete=!0,this.emitEvent(t,[this]),this.emitEvent("always",[this]),this.jqDeferred){let t=this.hasAnyBroken?"reject":"resolve";this.jqDeferred[t](this)}},h.prototype=Object.create(e.prototype),h.prototype.check=function(){this.getIsImageComplete()?this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.img.crossOrigin&&(this.proxyImage.crossOrigin=this.img.crossOrigin),this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.proxyImage.src=this.img.currentSrc||this.img.src)},h.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},h.prototype.confirm=function(t,e){this.isLoaded=t;let{parentNode:i}=this.img,s="PICTURE"===i.nodeName?i:this.img;this.emitEvent("progress",[this,s,e])},h.prototype.handleEvent=function(t){let e="on"+t.type;this[e]&&this[e](t)},h.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},h.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},h.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype=Object.create(h.prototype),d.prototype.check=function(){this.img.addEventListener("load",this),this.img.addEventListener("error",this),this.img.src=this.url,this.getIsImageComplete()&&(this.confirm(0!==this.img.naturalWidth,"naturalWidth"),this.unbindEvents())},d.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},d.prototype.confirm=function(t,e){this.isLoaded=t,this.emitEvent("progress",[this,this.element,e])},n.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&(i=e,i.fn.imagesLoaded=function(t,e){return new n(this,t,e).jqDeferred.promise(i(this))})},n.makeJQueryPlugin(),n}));; 15/*! This file is auto-generated */
vendor: 24,103 bytes, lines 16-24
16/*! 17 * Masonry PACKAGED v4.2.2 18 * Cascading grid layout library 19 * https://masonry.desandro.com 20 * MIT License 21 * by David DeSandro 22 */ 23 24!function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,r,a){function h(t,e,n){var o,r="$()."+i+'("'+e+'")';return t.each(function(t,h){var u=a.data(h,i);if(!u)return void s(i+" not initialized. Cannot call methods, i.e. "+r);var d=u[e];if(!d||"_"==e.charAt(0))return void s(r+" is not a valid method");var l=d.apply(u,n);o=void 0===o?l:o}),void 0!==o?o:t}function u(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new r(n,e),a.data(n,i,o))})}a=a||e||t.jQuery,a&&(r.prototype.option||(r.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){if("string"==typeof t){var e=o.call(arguments,1);return h(this,t,e)}return u(this,t),this},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,r=t.console,s="undefined"==typeof r?function(){}:function(t){r.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{},n=i[t]=i[t]||{};return n[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){i=i.slice(0),e=e||[];for(var n=this._onceEvents&&this._onceEvents[t],o=0;o<i.length;o++){var r=i[o],s=n&&n[r];s&&(this.off(t,r),delete n[r]),r.apply(this,e)}return this}},e.allOff=function(){delete this._events,delete this._onceEvents},t}),function(t,e){"function"==typeof define&&define.amd?define("get-size/get-size",e):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t),i=-1==t.indexOf("%")&&!isNaN(e);return i&&e}function e(){}function i(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;u>e;e++){var i=h[e];t[i]=0}return t}function n(t){var e=getComputedStyle(t);return e||a("Style returned "+e+". Are you running this code in a hidden iframe on Firefox? See https://bit.ly/getsizebug1"),e}function o(){if(!d){d=!0;var e=document.createElement("div");e.style.width="200px",e.style.padding="1px 2px 3px 4px",e.style.borderStyle="solid",e.style.borderWidth="1px 2px 3px 4px",e.style.boxSizing="border-box";var i=document.body||document.documentElement;i.appendChild(e);var o=n(e);s=200==Math.round(t(o.width)),r.isBoxSizeOuter=s,i.removeChild(e)}}function r(e){if(o(),"string"==typeof e&&(e=document.querySelector(e)),e&&"object"==typeof e&&e.nodeType){var r=n(e);if("none"==r.display)return i();var a={};a.width=e.offsetWidth,a.height=e.offsetHeight;for(var d=a.isBorderBox="border-box"==r.boxSizing,l=0;u>l;l++){var c=h[l],f=r[c],m=parseFloat(f);a[c]=isNaN(m)?0:m}var p=a.paddingLeft+a.paddingRight,g=a.paddingTop+a.paddingBottom,y=a.marginLeft+a.marginRight,v=a.marginTop+a.marginBottom,_=a.borderLeftWidth+a.borderRightWidth,z=a.borderTopWidth+a.borderBottomWidth,E=d&&s,b=t(r.width);b!==!1&&(a.width=b+(E?0:p+_));var x=t(r.height);return x!==!1&&(a.height=x+(E?0:g+z)),a.innerWidth=a.width-(p+_),a.innerHeight=a.height-(g+z),a.outerWidth=a.width+y,a.outerHeight=a.height+v,a}}var s,a="undefined"==typeof console?e:function(t){console.error(t)},h=["paddingLeft","paddingRight","paddingTop","paddingBottom","marginLeft","marginRight","marginTop","marginBottom","borderLeftWidth","borderRightWidth","borderTopWidth","borderBottomWidth"],u=h.length,d=!1;return r}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("desandro-matches-selector/matches-selector",e):"object"==typeof module&&module.exports?module.exports=e():t.matchesSelector=e()}(window,function(){"use strict";var t=function(){var t=window.Element.prototype;if(t.matches)return"matches";if(t.matchesSelector)return"matchesSelector";for(var e=["webkit","moz","ms","o"],i=0;i<e.length;i++){var n=e[i],o=n+"MatchesSelector";if(t[o])return o}}();return function(e,i){return e[t](i)}}),function(t,e){"function"==typeof define&&define.amd?define("fizzy-ui-utils/utils",["desandro-matches-selector/matches-selector"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("desandro-matches-selector")):t.fizzyUIUtils=e(t,t.matchesSelector)}(window,function(t,e){var i={};i.extend=function(t,e){for(var i in e)t[i]=e[i];return t},i.modulo=function(t,e){return(t%e+e)%e};var n=Array.prototype.slice;i.makeArray=function(t){if(Array.isArray(t))return t;if(null===t||void 0===t)return[];var e="object"==typeof t&&"number"==typeof t.length;return e?n.call(t):[t]},i.removeFrom=function(t,e){var i=t.indexOf(e);-1!=i&&t.splice(i,1)},i.getParent=function(t,i){for(;t.parentNode&&t!=document.body;)if(t=t.parentNode,e(t,i))return t},i.getQueryElement=function(t){return"string"==typeof t?document.querySelector(t):t},i.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},i.filterFindElements=function(t,n){t=i.makeArray(t);var o=[];return t.forEach(function(t){if(t instanceof HTMLElement){if(!n)return void o.push(t);e(t,n)&&o.push(t);for(var i=t.querySelectorAll(n),r=0;r<i.length;r++)o.push(i[r])}}),o},i.debounceMethod=function(t,e,i){i=i||100;var n=t.prototype[e],o=e+"Timeout";t.prototype[e]=function(){var t=this[o];clearTimeout(t);var e=arguments,r=this;this[o]=setTimeout(function(){n.apply(r,e),delete r[o]},i)}},i.docReady=function(t){var e=document.readyState;"complete"==e||"interactive"==e?setTimeout(t):document.addEventListener("DOMContentLoaded",t)},i.toDashed=function(t){return t.replace(/(.)([A-Z])/g,function(t,e,i){return e+"-"+i}).toLowerCase()};var o=t.console;return i.htmlInit=function(e,n){i.docReady(function(){var r=i.toDashed(n),s="data-"+r,a=document.querySelectorAll("["+s+"]"),h=document.querySelectorAll(".js-"+r),u=i.makeArray(a).concat(i.makeArray(h)),d=s+"-options",l=t.jQuery;u.forEach(function(t){var i,r=t.getAttribute(s)||t.getAttribute(d);try{i=r&&JSON.parse(r)}catch(a){return void(o&&o.error("Error parsing "+s+" on "+t.className+": "+a))}var h=new e(t,i);l&&l.data(t,n,h)})})},i}),function(t,e){"function"==typeof define&&define.amd?define("outlayer/item",["ev-emitter/ev-emitter","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("ev-emitter"),require("get-size")):(t.Outlayer={},t.Outlayer.Item=e(t.EvEmitter,t.getSize))}(window,function(t,e){"use strict";function i(t){for(var e in t)return!1;return e=null,!0}function n(t,e){t&&(this.element=t,this.layout=e,this.position={x:0,y:0},this._create())}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}var r=document.documentElement.style,s="string"==typeof r.transition?"transition":"WebkitTransition",a="string"==typeof r.transform?"transform":"WebkitTransform",h={WebkitTransition:"webkitTransitionEnd",transition:"transitionend"}[s],u={transform:a,transition:s,transitionDuration:s+"Duration",transitionProperty:s+"Property",transitionDelay:s+"Delay"},d=n.prototype=Object.create(t.prototype);d.constructor=n,d._create=function(){this._transn={ingProperties:{},clean:{},onEnd:{}},this.css({position:"absolute"})},d.handleEvent=function(t){var e="on"+t.type;this[e]&&this[e](t)},d.getSize=function(){this.size=e(this.element)},d.css=function(t){var e=this.element.style;for(var i in t){var n=u[i]||i;e[n]=t[i]}},d.getPosition=function(){var t=getComputedStyle(this.element),e=this.layout._getOption("originLeft"),i=this.layout._getOption("originTop"),n=t[e?"left":"right"],o=t[i?"top":"bottom"],r=parseFloat(n),s=parseFloat(o),a=this.layout.size;-1!=n.indexOf("%")&&(r=r/100*a.width),-1!=o.indexOf("%")&&(s=s/100*a.height),r=isNaN(r)?0:r,s=isNaN(s)?0:s,r-=e?a.paddingLeft:a.paddingRight,s-=i?a.paddingTop:a.paddingBottom,this.position.x=r,this.position.y=s},d.layoutPosition=function(){var t=this.layout.size,e={},i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop"),o=i?"paddingLeft":"paddingRight",r=i?"left":"right",s=i?"right":"left",a=this.position.x+t[o];e[r]=this.getXValue(a),e[s]="";var h=n?"paddingTop":"paddingBottom",u=n?"top":"bottom",d=n?"bottom":"top",l=this.position.y+t[h];e[u]=this.getYValue(l),e[d]="",this.css(e),this.emitEvent("layout",[this])},d.getXValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&!e?t/this.layout.size.width*100+"%":t+"px"},d.getYValue=function(t){var e=this.layout._getOption("horizontal");return this.layout.options.percentPosition&&e?t/this.layout.size.height*100+"%":t+"px"},d._transitionTo=function(t,e){this.getPosition();var i=this.position.x,n=this.position.y,o=t==this.position.x&&e==this.position.y;if(this.setPosition(t,e),o&&!this.isTransitioning)return void this.layoutPosition();var r=t-i,s=e-n,a={};a.transform=this.getTranslate(r,s),this.transition({to:a,onTransitionEnd:{transform:this.layoutPosition},isCleaning:!0})},d.getTranslate=function(t,e){var i=this.layout._getOption("originLeft"),n=this.layout._getOption("originTop");return t=i?t:-t,e=n?e:-e,"translate3d("+t+"px, "+e+"px, 0)"},d.goTo=function(t,e){this.setPosition(t,e),this.layoutPosition()},d.moveTo=d._transitionTo,d.setPosition=function(t,e){this.position.x=parseFloat(t),this.position.y=parseFloat(e)},d._nonTransition=function(t){this.css(t.to),t.isCleaning&&this._removeStyles(t.to);for(var e in t.onTransitionEnd)t.onTransitionEnd[e].call(this)},d.transition=function(t){if(!parseFloat(this.layout.options.transitionDuration))return void this._nonTransition(t);var e=this._transn;for(var i in t.onTransitionEnd)e.onEnd[i]=t.onTransitionEnd[i];for(i in t.to)e.ingProperties[i]=!0,t.isCleaning&&(e.clean[i]=!0);if(t.from){this.css(t.from);var n=this.element.offsetHeight;n=null}this.enableTransition(t.to),this.css(t.to),this.isTransitioning=!0};var l="opacity,"+o(a);d.enableTransition=function(){if(!this.isTransitioning){var t=this.layout.options.transitionDuration;t="number"==typeof t?t+"ms":t,this.css({transitionProperty:l,transitionDuration:t,transitionDelay:this.staggerDelay||0}),this.element.addEventListener(h,this,!1)}},d.onwebkitTransitionEnd=function(t){this.ontransitionend(t)},d.onotransitionend=function(t){this.ontransitionend(t)};var c={"-webkit-transform":"transform"};d.ontransitionend=function(t){if(t.target===this.element){var e=this._transn,n=c[t.propertyName]||t.propertyName;if(delete e.ingProperties[n],i(e.ingProperties)&&this.disableTransition(),n in e.clean&&(this.element.style[t.propertyName]="",delete e.clean[n]),n in e.onEnd){var o=e.onEnd[n];o.call(this),delete e.onEnd[n]}this.emitEvent("transitionEnd",[this])}},d.disableTransition=function(){this.removeTransitionStyles(),this.element.removeEventListener(h,this,!1),this.isTransitioning=!1},d._removeStyles=function(t){var e={};for(var i in t)e[i]="";this.css(e)};var f={transitionProperty:"",transitionDuration:"",transitionDelay:""};return d.removeTransitionStyles=function(){this.css(f)},d.stagger=function(t){t=isNaN(t)?0:t,this.staggerDelay=t+"ms"},d.removeElem=function(){this.element.parentNode.removeChild(this.element),this.css({display:""}),this.emitEvent("remove",[this])},d.remove=function(){return s&&parseFloat(this.layout.options.transitionDuration)?(this.once("transitionEnd",function(){this.removeElem()}),void this.hide()):void this.removeElem()},d.reveal=function(){delete this.isHidden,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("visibleStyle");e[i]=this.onRevealTransitionEnd,this.transition({from:t.hiddenStyle,to:t.visibleStyle,isCleaning:!0,onTransitionEnd:e})},d.onRevealTransitionEnd=function(){this.isHidden||this.emitEvent("reveal")},d.getHideRevealTransitionEndProperty=function(t){var e=this.layout.options[t];if(e.opacity)return"opacity";for(var i in e)return i},d.hide=function(){this.isHidden=!0,this.css({display:""});var t=this.layout.options,e={},i=this.getHideRevealTransitionEndProperty("hiddenStyle");e[i]=this.onHideTransitionEnd,this.transition({from:t.visibleStyle,to:t.hiddenStyle,isCleaning:!0,onTransitionEnd:e})},d.onHideTransitionEnd=function(){this.isHidden&&(this.css({display:"none"}),this.emitEvent("hide"))},d.destroy=function(){this.css({position:"",left:"",right:"",top:"",bottom:"",transition:"",transform:""})},n}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("outlayer/outlayer",["ev-emitter/ev-emitter","get-size/get-size","fizzy-ui-utils/utils","./item"],function(i,n,o,r){return e(t,i,n,o,r)}):"object"==typeof module&&module.exports?module.exports=e(t,require("ev-emitter"),require("get-size"),require("fizzy-ui-utils"),require("./item")):t.Outlayer=e(t,t.EvEmitter,t.getSize,t.fizzyUIUtils,t.Outlayer.Item)}(window,function(t,e,i,n,o){"use strict";function r(t,e){var i=n.getQueryElement(t);if(!i)return void(h&&h.error("Bad element for "+this.constructor.namespace+": "+(i||t)));this.element=i,u&&(this.$element=u(this.element)),this.options=n.extend({},this.constructor.defaults),this.option(e);var o=++l;this.element.outlayerGUID=o,c[o]=this,this._create();var r=this._getOption("initLayout");r&&this.layout()}function s(t){function e(){t.apply(this,arguments)}return e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e}function a(t){if("number"==typeof t)return t;var e=t.match(/(^\d*\.?\d*)(\w*)/),i=e&&e[1],n=e&&e[2];if(!i.length)return 0;i=parseFloat(i);var o=m[n]||1;return i*o}var h=t.console,u=t.jQuery,d=function(){},l=0,c={};r.namespace="outlayer",r.Item=o,r.defaults={containerStyle:{position:"relative"},initLayout:!0,originLeft:!0,originTop:!0,resize:!0,resizeContainer:!0,transitionDuration:"0.4s",hiddenStyle:{opacity:0,transform:"scale(0.001)"},visibleStyle:{opacity:1,transform:"scale(1)"}};var f=r.prototype;n.extend(f,e.prototype),f.option=function(t){n.extend(this.options,t)},f._getOption=function(t){var e=this.constructor.compatOptions[t];return e&&void 0!==this.options[e]?this.options[e]:this.options[t]},r.compatOptions={initLayout:"isInitLayout",horizontal:"isHorizontal",layoutInstant:"isLayoutInstant",originLeft:"isOriginLeft",originTop:"isOriginTop",resize:"isResizeBound",resizeContainer:"isResizingContainer"},f._create=function(){this.reloadItems(),this.stamps=[],this.stamp(this.options.stamp),n.extend(this.element.style,this.options.containerStyle);var t=this._getOption("resize");t&&this.bindResize()},f.reloadItems=function(){this.items=this._itemize(this.element.children)},f._itemize=function(t){for(var e=this._filterFindItemElements(t),i=this.constructor.Item,n=[],o=0;o<e.length;o++){var r=e[o],s=new i(r,this);n.push(s)}return n},f._filterFindItemElements=function(t){return n.filterFindElements(t,this.options.itemSelector)},f.getItemElements=function(){return this.items.map(function(t){return t.element})},f.layout=function(){this._resetLayout(),this._manageStamps();var t=this._getOption("layoutInstant"),e=void 0!==t?t:!this._isLayoutInited;this.layoutItems(this.items,e),this._isLayoutInited=!0},f._init=f.layout,f._resetLayout=function(){this.getSize()},f.getSize=function(){this.size=i(this.element)},f._getMeasurement=function(t,e){var n,o=this.options[t];o?("string"==typeof o?n=this.element.querySelector(o):o instanceof HTMLElement&&(n=o),this[t]=n?i(n)[e]:o):this[t]=0},f.layoutItems=function(t,e){t=this._getItemsForLayout(t),this._layoutItems(t,e),this._postLayout()},f._getItemsForLayout=function(t){return t.filter(function(t){return!t.isIgnored})},f._layoutItems=function(t,e){if(this._emitCompleteOnItems("layout",t),t&&t.length){var i=[];t.forEach(function(t){var n=this._getItemLayoutPosition(t);n.item=t,n.isInstant=e||t.isLayoutInstant,i.push(n)},this),this._processLayoutQueue(i)}},f._getItemLayoutPosition=function(){return{x:0,y:0}},f._processLayoutQueue=function(t){this.updateStagger(),t.forEach(function(t,e){this._positionItem(t.item,t.x,t.y,t.isInstant,e)},this)},f.updateStagger=function(){var t=this.options.stagger;return null===t||void 0===t?void(this.stagger=0):(this.stagger=a(t),this.stagger)},f._positionItem=function(t,e,i,n,o){n?t.goTo(e,i):(t.stagger(o*this.stagger),t.moveTo(e,i))},f._postLayout=function(){this.resizeContainer()},f.resizeContainer=function(){var t=this._getOption("resizeContainer");if(t){var e=this._getContainerSize();e&&(this._setContainerMeasure(e.width,!0),this._setContainerMeasure(e.height,!1))}},f._getContainerSize=d,f._setContainerMeasure=function(t,e){if(void 0!==t){var i=this.size;i.isBorderBox&&(t+=e?i.paddingLeft+i.paddingRight+i.borderLeftWidth+i.borderRightWidth:i.paddingBottom+i.paddingTop+i.borderTopWidth+i.borderBottomWidth),t=Math.max(t,0),this.element.style[e?"width":"height"]=t+"px"}},f._emitCompleteOnItems=function(t,e){function i(){o.dispatchEvent(t+"Complete",null,[e])}function n(){s++,s==r&&i()}var o=this,r=e.length;if(!e||!r)return void i();var s=0;e.forEach(function(e){e.once(t,n)})},f.dispatchEvent=function(t,e,i){var n=e?[e].concat(i):i;if(this.emitEvent(t,n),u)if(this.$element=this.$element||u(this.element),e){var o=u.Event(e);o.type=t,this.$element.trigger(o,i)}else this.$element.trigger(t,i)},f.ignore=function(t){var e=this.getItem(t);e&&(e.isIgnored=!0)},f.unignore=function(t){var e=this.getItem(t);e&&delete e.isIgnored},f.stamp=function(t){t=this._find(t),t&&(this.stamps=this.stamps.concat(t),t.forEach(this.ignore,this))},f.unstamp=function(t){t=this._find(t),t&&t.forEach(function(t){n.removeFrom(this.stamps,t),this.unignore(t)},this)},f._find=function(t){return t?("string"==typeof t&&(t=this.element.querySelectorAll(t)),t=n.makeArray(t)):void 0},f._manageStamps=function(){this.stamps&&this.stamps.length&&(this._getBoundingRect(),this.stamps.forEach(this._manageStamp,this))},f._getBoundingRect=function(){var t=this.element.getBoundingClientRect(),e=this.size;this._boundingRect={left:t.left+e.paddingLeft+e.borderLeftWidth,top:t.top+e.paddingTop+e.borderTopWidth,right:t.right-(e.paddingRight+e.borderRightWidth),bottom:t.bottom-(e.paddingBottom+e.borderBottomWidth)}},f._manageStamp=d,f._getElementOffset=function(t){var e=t.getBoundingClientRect(),n=this._boundingRect,o=i(t),r={left:e.left-n.left-o.marginLeft,top:e.top-n.top-o.marginTop,right:n.right-e.right-o.marginRight,bottom:n.bottom-e.bottom-o.marginBottom};return r},f.handleEvent=n.handleEvent,f.bindResize=function(){t.addEventListener("resize",this),this.isResizeBound=!0},f.unbindResize=function(){t.removeEventListener("resize",this),this.isResizeBound=!1},f.onresize=function(){this.resize()},n.debounceMethod(r,"onresize",100),f.resize=function(){this.isResizeBound&&this.needsResizeLayout()&&this.layout()},f.needsResizeLayout=function(){var t=i(this.element),e=this.size&&t;return e&&t.innerWidth!==this.size.innerWidth},f.addItems=function(t){var e=this._itemize(t);return e.length&&(this.items=this.items.concat(e)),e},f.appended=function(t){var e=this.addItems(t);e.length&&(this.layoutItems(e,!0),this.reveal(e))},f.prepended=function(t){var e=this._itemize(t);if(e.length){var i=this.items.slice(0);this.items=e.concat(i),this._resetLayout(),this._manageStamps(),this.layoutItems(e,!0),this.reveal(e),this.layoutItems(i)}},f.reveal=function(t){if(this._emitCompleteOnItems("reveal",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.reveal()})}},f.hide=function(t){if(this._emitCompleteOnItems("hide",t),t&&t.length){var e=this.updateStagger();t.forEach(function(t,i){t.stagger(i*e),t.hide()})}},f.revealItemElements=function(t){var e=this.getItems(t);this.reveal(e)},f.hideItemElements=function(t){var e=this.getItems(t);this.hide(e)},f.getItem=function(t){for(var e=0;e<this.items.length;e++){var i=this.items[e];if(i.element==t)return i}},f.getItems=function(t){t=n.makeArray(t);var e=[];return t.forEach(function(t){var i=this.getItem(t);i&&e.push(i)},this),e},f.remove=function(t){var e=this.getItems(t);this._emitCompleteOnItems("remove",e),e&&e.length&&e.forEach(function(t){t.remove(),n.removeFrom(this.items,t)},this)},f.destroy=function(){var t=this.element.style;t.height="",t.position="",t.width="",this.items.forEach(function(t){t.destroy()}),this.unbindResize();var e=this.element.outlayerGUID;delete c[e],delete this.element.outlayerGUID,u&&u.removeData(this.element,this.constructor.namespace)},r.data=function(t){t=n.getQueryElement(t);var e=t&&t.outlayerGUID;return e&&c[e]},r.create=function(t,e){var i=s(r);return i.defaults=n.extend({},r.defaults),n.extend(i.defaults,e),i.compatOptions=n.extend({},r.compatOptions),i.namespace=t,i.data=r.data,i.Item=s(o),n.htmlInit(i,t),u&&u.bridget&&u.bridget(t,i),i};var m={ms:1,s:1e3};return r.Item=o,r}),function(t,e){"function"==typeof define&&define.amd?define(["outlayer/outlayer","get-size/get-size"],e):"object"==typeof module&&module.exports?module.exports=e(require("outlayer"),require("get-size")):t.Masonry=e(t.Outlayer,t.getSize)}(window,function(t,e){var i=t.create("masonry");i.compatOptions.fitWidth="isFitWidth";var n=i.prototype;return n._resetLayout=function(){this.getSize(),this._getMeasurement("columnWidth","outerWidth"),this._getMeasurement("gutter","outerWidth"),this.measureColumns(),this.colYs=[];for(var t=0;t<this.cols;t++)this.colYs.push(0);this.maxY=0,this.horizontalColIndex=0},n.measureColumns=function(){if(this.getContainerWidth(),!this.columnWidth){var t=this.items[0],i=t&&t.element;this.columnWidth=i&&e(i).outerWidth||this.containerWidth}var n=this.columnWidth+=this.gutter,o=this.containerWidth+this.gutter,r=o/n,s=n-o%n,a=s&&1>s?"round":"floor";r=Math[a](r),this.cols=Math.max(r,1)},n.getContainerWidth=function(){var t=this._getOption("fitWidth"),i=t?this.element.parentNode:this.element,n=e(i);this.containerWidth=n&&n.innerWidth},n._getItemLayoutPosition=function(t){t.getSize();var e=t.size.outerWidth%this.columnWidth,i=e&&1>e?"round":"ceil",n=Math[i](t.size.outerWidth/this.columnWidth);n=Math.min(n,this.cols);for(var o=this.options.horizontalOrder?"_getHorizontalColPosition":"_getTopColPosition",r=this[o](n,t),s={x:this.columnWidth*r.col,y:r.y},a=r.y+t.size.outerHeight,h=n+r.col,u=r.col;h>u;u++)this.colYs[u]=a;return s},n._getTopColPosition=function(t){var e=this._getTopColGroup(t),i=Math.min.apply(Math,e);return{col:e.indexOf(i),y:i}},n._getTopColGroup=function(t){if(2>t)return this.colYs;for(var e=[],i=this.cols+1-t,n=0;i>n;n++)e[n]=this._getColGroupY(n,t);return e},n._getColGroupY=function(t,e){if(2>e)return this.colYs[t];var i=this.colYs.slice(t,t+e);return Math.max.apply(Math,i)},n._getHorizontalColPosition=function(t,e){var i=this.horizontalColIndex%this.cols,n=t>1&&i+t>this.cols;i=n?0:i;var o=e.size.outerWidth&&e.size.outerHeight;return this.horizontalColIndex=o?i+t:this.horizontalColIndex,{col:i,y:this._getColGroupY(i,t)}},n._manageStamp=function(t){var i=e(t),n=this._getElementOffset(t),o=this._getOption("originLeft"),r=o?n.left:n.right,s=r+i.outerWidth,a=Math.floor(r/this.columnWidth);a=Math.max(0,a);var h=Math.floor(s/this.columnWidth);h-=s%this.columnWidth?0:1,h=Math.min(this.cols-1,h);for(var u=this._getOption("originTop"),d=(u?n.top:n.bottom)+i.outerHeight,l=a;h>=l;l++)this.colYs[l]=Math.max(d,this.colYs[l])},n._getContainerSize=function(){this.maxY=Math.max.apply(Math,this.colYs);var t={height:this.maxY};return this._getOption("fitWidth")&&(t.width=this._getContainerFitWidth()),t},n._getContainerFitWidth=function(){for(var t=0,e=this.cols;--e&&0===this.colYs[e];)t++;return(this.cols-t)*this.columnWidth-this.gutter},n.needsResizeLayout=function(){var t=this.containerWidth;return this.getContainerWidth(),t!=this.containerWidth},i});
24; 25/*! 26 * imagesLoaded PACKAGED v3.1.8 27 * JavaScript is all like "You images are done yet or what?" 28 * MIT License 29 */ 30 31 32/*! 33 * EventEmitter v4.2.6 - git.io/ee 34 * Oliver Caldwell 35 * MIT license 36 * @preserve 37 */ 38 39(function () { 40 41 42 /** 43 * Class for managing events. 44 * Can be extended to provide event functionality in other classes. 45 * 46 * @class EventEmitter Manages event registering and emitting. 47 */ 48 function EventEmitter() {} 49 50 // Shortcuts to improve speed and size 51 var proto = EventEmitter.prototype; 52 var exports = this; 53 var originalGlobalValue = exports.EventEmitter; 54 55 /** 56 * Finds the index of the listener for the event in it's storage array. 57 * 58 * @param {Function[]} listeners Array of listeners to search through. 59 * @param {Function} listener Method to look for. 60 * @return {Number} Index of the specified listener, -1 if not found 61 * @api private 62 */ 63 function indexOfListener(listeners, listener) { 64 var i = listeners.length; 65 while (i--) { 66 if (listeners[i].listener === listener) { 67 return i; 68 } 69 } 70 71 return -1; 72 } 73 74 /** 75 * Alias a method while keeping the context correct, to allow for over
vendor: 11,346 bytes, lines 75-383
75writing of target method. 76 * 77 * @param {String} name The name of the target method. 78 * @return {Function} The aliased method 79 * @api private 80 */ 81 function alias(name) { 82 return function aliasClosure() { 83 return this[name].apply(this, arguments); 84 }; 85 } 86 87 /** 88 * Returns the listener array for the specified event. 89 * Will initialise the event object and listener arrays if required. 90 * Will return an object if you use a regex search. The object contains keys for each matched event. So /ba[rz]/ might return an object containing bar and baz. But only if you have either defined them with defineEvent or added some listeners to them. 91 * Each property in the object response is an array of listener functions. 92 * 93 * @param {String|RegExp} evt Name of the event to return the listeners from. 94 * @return {Function[]|Object} All listener functions for the event. 95 */ 96 proto.getListeners = function getListeners(evt) { 97 var events = this._getEvents(); 98 var response; 99 var key; 100 101 // Return a concatenated array of all matching events if 102 // the selector is a regular expression. 103 if (typeof evt === 'object') { 104 response = {}; 105 for (key in events) { 106 if (events.hasOwnProperty(key) && evt.test(key)) { 107 response[key] = events[key]; 108 } 109 } 110 } 111 else { 112 response = events[evt] || (events[evt] = []); 113 } 114 115 return response; 116 }; 117 118 /** 119 * Takes a list of listener objects and flattens it into a list of listener functions. 120 * 121 * @param {Object[]} listeners Raw listener objects. 122 * @return {Function[]} Just the listener functions. 123 */ 124 proto.flattenListeners = function flattenListeners(listeners) { 125 var flatListeners = []; 126 var i; 127 128 for (i = 0; i < listeners.length; i += 1) { 129 flatListeners.push(listeners[i].listener); 130 } 131 132 return flatListeners; 133 }; 134 135 /** 136 * Fetches the requested listeners via getListeners but will always return the results inside an object. This is mainly for internal use but others may find it useful. 137 * 138 * @param {String|RegExp} evt Name of the event to return the listeners from. 139 * @return {Object} All listener functions for an event in an object. 140 */ 141 proto.getListenersAsObject = function getListenersAsObject(evt) { 142 var listeners = this.getListeners(evt); 143 var response; 144 145 if (listeners instanceof Array) { 146 response = {}; 147 response[evt] = listeners; 148 } 149 150 return response || listeners; 151 }; 152 153 /** 154 * Adds a listener function to the specified event. 155 * The listener will not be added if it is a duplicate. 156 * If the listener returns true then it will be removed after it is called. 157 * If you pass a regular expression as the event name then the listener will be added to all events that match it. 158 * 159 * @param {String|RegExp} evt Name of the event to attach the listener to. 160 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 161 * @return {Object} Current instance of EventEmitter for chaining. 162 */ 163 proto.addListener = function addListener(evt, listener) { 164 var listeners = this.getListenersAsObject(evt); 165 var listenerIsWrapped = typeof listener === 'object'; 166 var key; 167 168 for (key in listeners) { 169 if (listeners.hasOwnProperty(key) && indexOfListener(listeners[key], listener) === -1) { 170 listeners[key].push(listenerIsWrapped ? listener : { 171 listener: listener, 172 once: false 173 }); 174 } 175 } 176 177 return this; 178 }; 179 180 /** 181 * Alias of addListener 182 */ 183 proto.on = alias('addListener'); 184 185 /** 186 * Semi-alias of addListener. It will add a listener that will be 187 * automatically removed after it's first execution. 188 * 189 * @param {String|RegExp} evt Name of the event to attach the listener to. 190 * @param {Function} listener Method to be called when the event is emitted. If the function returns true then it will be removed after calling. 191 * @return {Object} Current instance of EventEmitter for chaining. 192 */ 193 proto.addOnceListener = function addOnceListener(evt, listener) { 194 return this.addListener(evt, { 195 listener: listener, 196 once: true 197 }); 198 }; 199 200 /** 201 * Alias of addOnceListener. 202 */ 203 proto.once = alias('addOnceListener'); 204 205 /** 206 * Defines an event name. This is required if you want to use a regex to add a listener to multiple events at once. If you don't do this then how do you expect it to know what event to add to? Should it just add to every possible match for a regex? No. That is scary and bad. 207 * You need to tell it what event names should be matched by a regex. 208 * 209 * @param {String} evt Name of the event to create. 210 * @return {Object} Current instance of EventEmitter for chaining. 211 */ 212 proto.defineEvent = function defineEvent(evt) { 213 this.getListeners(evt); 214 return this; 215 }; 216 217 /** 218 * Uses defineEvent to define multiple events. 219 * 220 * @param {String[]} evts An array of event names to define. 221 * @return {Object} Current instance of EventEmitter for chaining. 222 */ 223 proto.defineEvents = function defineEvents(evts) { 224 for (var i = 0; i < evts.length; i += 1) { 225 this.defineEvent(evts[i]); 226 } 227 return this; 228 }; 229 230 /** 231 * Removes a listener function from the specified event. 232 * When passed a regular expression as the event name, it will remove the listener from all events that match it. 233 * 234 * @param {String|RegExp} evt Name of the event to remove the listener from. 235 * @param {Function} listener Method to remove from the event. 236 * @return {Object} Current instance of EventEmitter for chaining. 237 */ 238 proto.removeListener = function removeListener(evt, listener) { 239 var listeners = this.getListenersAsObject(evt); 240 var index; 241 var key; 242 243 for (key in listeners) { 244 if (listeners.hasOwnProperty(key)) { 245 index = indexOfListener(listeners[key], listener); 246 247 if (index !== -1) { 248 listeners[key].splice(index, 1); 249 } 250 } 251 } 252 253 return this; 254 }; 255 256 /** 257 * Alias of removeListener 258 */ 259 proto.off = alias('removeListener'); 260 261 /** 262 * Adds listeners in bulk using the manipulateListeners method. 263 * If you pass an object as the second argument you can add to multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. You can also pass it an event name and an array of listeners to be added. 264 * You can also pass it a regular expression to add the array of listeners to all events that match it. 265 * Yeah, this function does quite a bit. That's probably a bad thing. 266 * 267 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add to multiple events at once. 268 * @param {Function[]} [listeners] An optional array of listener functions to add. 269 * @return {Object} Current instance of EventEmitter for chaining. 270 */ 271 proto.addListeners = function addListeners(evt, listeners) { 272 // Pass through to manipulateListeners 273 return this.manipulateListeners(false, evt, listeners); 274 }; 275 276 /** 277 * Removes listeners in bulk using the manipulateListeners method. 278 * If you pass an object as the second argument you can remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 279 * You can also pass it an event name and an array of listeners to be removed. 280 * You can also pass it a regular expression to remove the listeners from all events that match it. 281 * 282 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to remove from multiple events at once. 283 * @param {Function[]} [listeners] An optional array of listener functions to remove. 284 * @return {Object} Current instance of EventEmitter for chaining. 285 */ 286 proto.removeListeners = function removeListeners(evt, listeners) { 287 // Pass through to manipulateListeners 288 return this.manipulateListeners(true, evt, listeners); 289 }; 290 291 /** 292 * Edits listeners in bulk. The addListeners and removeListeners methods both use this to do their job. You should really use those instead, this is a little lower level. 293 * The first argument will determine if the listeners are removed (true) or added (false). 294 * If you pass an object as the second argument you can add/remove from multiple events at once. The object should contain key value pairs of events and listeners or listener arrays. 295 * You can also pass it an event name and an array of listeners to be added/removed. 296 * You can also pass it a regular expression to manipulate the listeners of all events that match it. 297 * 298 * @param {Boolean} remove True if you want to remove listeners, false if you want to add. 299 * @param {String|Object|RegExp} evt An event name if you will pass an array of listeners next. An object if you wish to add/remove from multiple events at once. 300 * @param {Function[]} [listeners] An optional array of listener functions to add/remove. 301 * @return {Object} Current instance of EventEmitter for chaining. 302 */ 303 proto.manipulateListeners = function manipulateListeners(remove, evt, listeners) { 304 var i; 305 var value; 306 var single = remove ? this.removeListener : this.addListener; 307 var multiple = remove ? this.removeListeners : this.addListeners; 308 309 // If evt is an object then pass each of it's properties to this method 310 if (typeof evt === 'object' && !(evt instanceof RegExp)) { 311 for (i in evt) { 312 if (evt.hasOwnProperty(i) && (value = evt[i])) { 313 // Pass the single listener straight through to the singular method 314 if (typeof value === 'function') { 315 single.call(this, i, value); 316 } 317 else { 318 // Otherwise pass back to the multiple function 319 multiple.call(this, i, value); 320 } 321 } 322 } 323 } 324 else { 325 // So evt must be a string 326 // And listeners must be an array of listeners 327 // Loop over it and pass each one to the multiple method 328 i = listeners.length; 329 while (i--) { 330 single.call(this, evt, listeners[i]); 331 } 332 } 333 334 return this; 335 }; 336 337 /** 338 * Removes all listeners from a specified event. 339 * If you do not specify an event then all listeners will be removed. 340 * That means every event will be emptied. 341 * You can also pass a regex to remove all events that match it. 342 * 343 * @param {String|RegExp} [evt] Optional name of the event to remove all listeners for. Will remove from every event if not passed. 344 * @return {Object} Current instance of EventEmitter for chaining. 345 */ 346 proto.removeEvent = function removeEvent(evt) { 347 var type = typeof evt; 348 var events = this._getEvents(); 349 var key; 350 351 // Remove different things depending on the state of evt 352 if (type === 'string') { 353 // Remove all listeners for the specified event 354 delete events[evt]; 355 } 356 else if (type === 'object') { 357 // Remove all events matching the regex. 358 for (key in events) { 359 if (events.hasOwnProperty(key) && evt.test(key)) { 360 delete events[key]; 361 } 362 } 363 } 364 else { 365 // Remove all listeners in all events 366 delete this._events; 367 } 368 369 return this; 370 }; 371 372 /** 373 * Alias of removeEvent. 374 * 375 * Added to mirror the node API. 376 */ 377 proto.removeAllListeners = alias('removeEvent'); 378 379 /** 380 * Emits an event of your choice. 381 * When emitted, every listener attached to that event will be executed. 382 * If you pass the optional argument array then those arguments will be passed to every listener upon execution. 383 * Because it uses `apply`, your array of arguments will be passed as if you wrote them out separately.
384 * So they will not arrive within the array on the other side, they will be separate. 385 * You can also pass a regular expression to emit to all events that match it. 386 * 387 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 388 * @param {Array} [args] Optional array of arguments to be passed to each listener. 389 * @return {Object} Current instance of EventEmitter for chaining. 390 */ 391 proto.emitEvent = function emitEvent(evt, args) { 392 var listeners = this.getListenersAsObject(evt); 393 var listener; 394 var i; 395 var key; 396 var response; 397 398 for (key in listeners) { 399 if (listeners.hasOwnProperty(key)) { 400 i = listeners[key].length; 401 402 while (i--) { 403 // If the listener returns true then it shall be removed from the event 404 // The function is executed either with a basic call or an apply if there is an args array 405 listener = listeners[key][i]; 406 407 if (listener.once === true) { 408 this.removeListener(evt, listener.listener); 409 } 410 411 response = listener.listener.apply(this, args || []); 412 413 if (response === this._getOnceReturnValue()) { 414 this.removeListener(evt, listener.listener); 415 } 416 } 417 } 418 } 419 420 return this; 421 }; 422 423 /** 424 * Alias of emitEvent 425 */ 426 proto.trigger = alias('emitEvent'); 427 428 /** 429 * Subtly different from emitEvent in that it will pass its arguments on to the listeners, as opposed to taking a single array of arguments to pass on. 430 * As with emitEvent, you can pass a regex in place of the event name to emit to all events that match it. 431 * 432 * @param {String|RegExp} evt Name of the event to emit and execute listeners for. 433 * @param {...*} Optional additional arguments to be passed to each listener. 434 * @return {Object} Current instance of EventEmitter for chaining. 435 */ 436 proto.emit = function emit(evt) { 437 var args = Array.prototype.slice.call(arguments, 1); 438 return this.emitEvent(evt, args); 439 }; 440 441 /** 442 * Sets the current value to check against when executing listeners. If a 443 * listeners return value matches the one set here then it will be removed 444 * after execution. This value defaults to true. 445 * 446 * @param {*} value The new value to check for when executing listeners. 447 * @return {Object} Current instance of EventEmitter for chaining. 448 */ 449 proto.setOnceReturnValue = function setOnceReturnValue(value) { 450 this._onceReturnValue = value; 451 return this; 452 }; 453 454 /** 455 * Fetches the current value to check against when executing listeners. If 456 * the listeners return value matches this one then it should be removed 457 * automatically. It will return true by default. 458 * 459 * @return {*|Boolean} The current value to check for or the default, true. 460 * @api private 461 */ 462 proto._getOnceReturnValue = function _getOnceReturnValue() { 463 if (this.hasOwnProperty('_onceReturnValue')) { 464 return this._onceReturnValue; 465 } 466 else { 467 return true; 468 } 469 }; 470 471 /** 472 * Fetches the events object and creates one if required. 473 * 474 * @return {Object} The events storage object. 475 * @api private 476 */ 477 proto._getEvents = function _getEvents() { 478 return this._events || (this._events = {}); 479 }; 480 481 /** 482 * Reverts the global {@link EventEmitter} to its previous value and returns a reference to this version. 483 * 484 * @return {Function} Non conflicting EventEmitter class. 485 */ 486 EventEmitter.noConflict = function noConflict() { 487 exports.EventEmitter = originalGlobalValue; 488 return EventEmitter; 489 }; 490 491 // Expose the class either via AMD, CommonJS or the global object 492 if (typeof define === 'function' && define.amd) { 493 define('eventEmitter/EventEmitter',[],function () { 494 return EventEmitter; 495 }); 496 } 497 else if (typeof module === 'object' && module.exports){ 498 module.exports = EventEmitter; 499 } 500 else { 501 this.EventEmitter = EventEmitter; 502 } 503}.call(this)); 504 505/*! 506 * eventie v1.0.4 507 * event binding helper 508 * eventie.bind( elem, 'click', myFn ) 509 * eventie.unbind( elem, 'click', myFn ) 510 */ 511 512/*jshint browser: true, undef: true, unused: true */ 513/*global define: false */ 514 515( function( window ) { 516 517 518 519var docElem = document.documentElement; 520 521var bind = function() {}; 522 523function getIEEvent( obj ) { 524 var event = window.event; 525 // add event.target 526 event.target = event.target || event.srcElement || obj; 527 return event; 528} 529 530if ( docElem.addEventListener ) { 531 bind = function( obj, type, fn ) { 532 obj.addEventListener( type, fn, false ); 533 }; 534} else if ( docElem.attachEvent ) { 535 bind = function( obj, type, fn ) { 536 obj[ type + fn ] = fn.handleEvent ? 537 function() { 538 var event = getIEEvent( obj ); 539 fn.handleEvent.call( fn, event ); 540 } : 541 function() { 542 var event = getIEEvent( obj ); 543 fn.call( obj, event ); 544 }; 545 obj.attachEvent( "on" + type, obj[ type + fn ] ); 546 }; 547} 548 549var unbind = function() {}; 550 551if ( docElem.removeEventListener ) { 552 unbind = function( obj, type, fn ) { 553 obj.removeEventListener( type, fn, false ); 554 }; 555} else if ( docElem.detachEvent ) { 556 unbind = function( obj, type, fn ) { 557 obj.detachEvent( "on" + type, obj[ type + fn ] ); 558 try { 559 delete obj[ type + fn ]; 560 } catch ( err ) { 561 // can't delete window object properties 562 obj[ type + fn ] = undefined; 563 } 564 }; 565} 566 567var eventie = { 568 bind: bind, 569 unbind: unbind 570}; 571 572// transport 573if ( typeof define === 'function' && define.amd ) { 574 // AMD 575 define( 'eventie/eventie',eventie ); 576} else { 577 // browser global 578 window.eventie = eventie; 579} 580 581})( this ); 582 583/*! 584 * imagesLoaded v3.1.8 585 * JavaScript is all like "You images are done yet or what?" 586 * MIT License 587 */ 588 589( function( window, factory ) { 590 // universal module definition 591 592 /*global define: false, module: false, require: false */ 593 594 if ( typeof define === 'function' && define.amd ) { 595 // AMD 596 define( [ 597 'eventEmitter/EventEmitter', 598 'eventie/eventie' 599 ], function( EventEmitter, eventie ) { 600 return factory( window, EventEmitter, eventie ); 601 }); 602 } else if ( typeof exports === 'object' ) { 603 // CommonJS 604 module.exports = factory( 605 window, 606 require('wolfy87-eventemitter'), 607 require('eventie') 608 ); 609 } else { 610 // browser global 611 window.imagesLoaded = factory( 612 window, 613 window.EventEmitter, 614 window.eventie 615 ); 616 } 617 618})( window, 619 620// -------------------------- factory -------------------------- // 621 622function factory( window, EventEmitter, eventie ) { 623 624 625 626var $ = window.jQuery; 627var console = window.console; 628var hasConsole = typeof console !== 'undefined'; 629 630// -------------------------- helpers -------------------------- // 631 632// extend objects 633function extend( a, b ) { 634 for ( var prop in b ) { 635 a[ prop ] = b[ prop ]; 636 } 637 return a; 638} 639 640var objToString = Object.prototype.toString; 641function isArray( obj ) { 642 return objToString.call( obj ) === '[object Array]'; 643} 644 645// turn element or nodeList into an array 646function makeArray( obj ) { 647 var ary = []; 648 if ( isArray( obj ) ) { 649 // use object if already an array 650 ary = obj; 651 } else if ( typeof obj.length === 'number' ) { 652 // convert nodeList to array 653 for ( var i=0, len = obj.length; i < len; i++ ) { 654 ary.push( obj[i] ); 655 } 656 } else { 657 // array of single index 658 ary.push( obj ); 659 } 660 return ary; 661} 662 663 // -------------------------- imagesLoaded -------------------------- // 664 665 /** 666 * @param {Array, Element, NodeList, String} elem 667 * @param {Object or Function} options - if function, use as callback 668 * @param {Function} onAlways - callback function 669 */ 670 function ImagesLoaded( elem, options, onAlways ) { 671 // coerce ImagesLoaded() without new, to be new ImagesLoaded() 672 if ( !( this instanceof ImagesLoaded ) ) { 673 return new ImagesLoaded( elem, options ); 674 } 675 // use elem as selector string 676 if ( typeof elem === 'string' ) { 677 elem = document.querySelectorAll( elem ); 678 } 679 680 this.elements = makeArray( elem ); 681 this.options = extend( {}, this.options ); 682 683 if ( typeof options === 'function' ) { 684 onAlways = options; 685 } else { 686 extend( this.options, options ); 687 } 688 689 if ( onAlways ) { 690 this.on( 'always', onAlways ); 691 } 692 693 this.getImages(); 694 695 if ( $ ) { 696 // add jQuery Deferred object 697 this.jqDeferred = new $.Deferred(); 698 } 699 700 // HACK check async to allow time to bind listeners 701 var _this = this; 702 setTimeout( function() { 703 _this.check(); 704 }); 705 } 706 707 ImagesLoaded.prototype = new EventEmitter(); 708 709 ImagesLoaded.prototype.options = {}; 710 711 ImagesLoaded.prototype.getImages = function() { 712 this.images = []; 713 714 // filter & find items if we have an item selector 715 for ( var i=0, len = this.elements.length; i < len; i++ ) { 716 var elem = this.elements[i]; 717 // filter siblings 718 if ( elem.nodeName === 'IMG' ) { 719 this.addImage( elem ); 720 } 721 // find children 722 // no non-element nodes, #143 723 var nodeType = elem.nodeType; 724 if ( !nodeType || !( nodeType === 1 || nodeType === 9 || nodeType === 11 ) ) { 725 continue; 726 } 727 var childElems = elem.querySelectorAll('img'); 728 // concat childElems to filterFound array 729 for ( var j=0, jLen = childElems.length; j < jLen; j++ ) { 730 var img = childElems[j]; 731 this.addImage( img ); 732 } 733 } 734 }; 735 736 /** 737 * @param {Image} img 738 */ 739 ImagesLoaded.prototype.addImage = function( img ) { 740 var loadingImage = new LoadingImage( img ); 741 this.images.push( loadingImage ); 742 }; 743
744 ImagesLoaded.prototype.check = function() { 745 var _this = this; 746 var checkedCount = 0; 747 var length = this.images.length; 748 this.hasAnyBroken = false; 749 // complete if no images 750 if ( !length ) { 751 this.complete(); 752 return; 753 } 754 755 function onConfirm( image, message ) { 756 if ( _this.options.debug && hasConsole ) { 757 console.log( 'confirm', image, message ); 758 } 759 760 _this.progress( image ); 761 checkedCount++; 762 if ( checkedCount === length ) { 763 _this.complete(); 764 } 765 return true; // bind once 766 } 767 768 for ( var i=0; i < length; i++ ) { 769 var loadingImage = this.images[i]; 770 loadingImage.on( 'confirm', onConfirm ); 771 loadingImage.check(); 772 } 773 }; 774 775 ImagesLoaded.prototype.progress = function( image ) { 776 this.hasAnyBroken = this.hasAnyBroken || !image.isLoaded; 777 // HACK - Chrome triggers event before object properties have changed. #83 778 var _this = this; 779 setTimeout( function() { 780 _this.emit( 'progress', _this, image ); 781 if ( _this.jqDeferred && _this.jqDeferred.notify ) { 782 _this.jqDeferred.notify( _this, image ); 783 } 784 }); 785 }; 786 787 ImagesLoaded.prototype.complete = function() { 788 var eventName = this.hasAnyBroken ? 'fail' : 'done'; 789 this.isComplete = true; 790 var _this = this; 791 // HACK - another setTimeout so that confirm happens after progress 792 setTimeout( function() { 793 _this.emit( eventName, _this ); 794 _this.emit( 'always', _this ); 795 if ( _this.jqDeferred ) { 796 var jqMethod = _this.hasAnyBroken ? 'reject' : 'resolve'; 797 _this.jqDeferred[ jqMethod ]( _this ); 798 } 799 }); 800 }; 801 802 // -------------------------- jquery -------------------------- // 803 804 if ( $ ) { 805 $.fn.imagesLoaded = function( options, callback ) { 806 var instance = new ImagesLoaded( this, options, callback ); 807 return instance.jqDeferred.promise( $(this) ); 808 }; 809 } 810 811 812 // -------------------------- -------------------------- // 813 814 function LoadingImage( img ) { 815 this.img = img; 816 } 817 818 LoadingImage.prototype = new EventEmitter(); 819 820 LoadingImage.prototype.check = function() { 821 // first check cached any previous images that have same src 822 var resource = cache[ this.img.src ] || new Resource( this.img.src ); 823 if ( resource.isConfirmed ) { 824 this.confirm( resource.isLoaded, 'cached was confirmed' ); 825 return; 826 } 827 828 // If complete is true and browser supports natural sizes, 829 // try to check for image status manually. 830 if ( this.img.complete && this.img.naturalWidth !== undefined ) { 831 // report based on naturalWidth 832 this.confirm( this.img.naturalWidth !== 0, 'naturalWidth' ); 833 return; 834 } 835 836 // If none of the checks above matched, simulate loading on detached element. 837 var _this = this; 838 resource.on( 'confirm', function( resrc, message ) { 839 _this.confirm( resrc.isLoaded, message ); 840 return true; 841 }); 842 843 resource.check(); 844 }; 845 846 LoadingImage.prototype.confirm = function( isLoaded, message ) { 847 this.isLoaded = isLoaded; 848 this.emit( 'confirm', this, message ); 849 }; 850 851 // -------------------------- Resource -------------------------- // 852 853 // Resource checks each src, only once 854 // separate class from LoadingImage to prevent memory leaks. See #115 855 856 var cache = {}; 857 858 function Resource( src ) { 859 this.src = src; 860 // add to cache 861 cache[ src ] = this; 862 } 863 864 Resource.prototype = new EventEmitter(); 865 866 Resource.prototype.check = function() { 867 // only trigger checking once 868 if ( this.isChecked ) { 869 return; 870 } 871 // simulate loading on detached element 872 var proxyImage = new Image(); 873 eventie.bind( proxyImage, 'load', this ); 874 eventie.bind( proxyImage, 'error', this ); 875 proxyImage.src = this.src; 876 // set flag 877 this.isChecked = true; 878 }; 879 880 // ----- events ----- // 881 882 // trigger specified handler for event type 883 Resource.prototype.handleEvent = function( event ) { 884 var method = 'on' + event.type; 885 if ( this[ method ] ) { 886 this[ method ]( event ); 887 } 888 }; 889 890 Resource.prototype.onload = function( event ) { 891 this.confirm( true, 'onload' ); 892 this.unbindProxyEvents( event ); 893 }; 894 895 Resource.prototype.onerror = function( event ) { 896 this.confirm( false, 'onerror' ); 897 this.unbindProxyEvents( event ); 898 }; 899 900 // ----- confirm ----- // 901 902 Resource.prototype.confirm = function( isLoaded, message ) { 903 this.isConfirmed = true; 904 this.isLoaded = isLoaded;
905 this.emit( 'confirm', this, message ); 906 }; 907 908 Resource.prototype.unbindProxyEvents = function( event ) { 909 eventie.unbind( event.target, 'load', this ); 910 eventie.unbind( event.target, 'error', this ); 911 }; 912 913 // ----- ----- // 914 915 return ImagesLoaded; 916 917});; 918/*! 919 * hoverIntent v1.8.0 // 2014.06.29 // jQuery v1.9.1+ 920 * http://cherne.net/brian/resources/jquery.hoverIntent.html 921 * 922 * You may use hoverIntent under the terms of the MIT license. Basically that 923 * means you are free to use hoverIntent as long as this header is left intact. 924 * Copyright 2007, 2014 Brian Cherne 925 */ 926 927/* hoverIntent is similar to jQuery's built-in "hover" method except that 928 * instead of firing the handlerIn function immediately, hoverIntent checks 929 * to see if the user's mouse has slowed down (beneath the sensitivity 930 * threshold) before firing the event. The handlerOut function is only 931 * called after a matching handlerIn. 932 * 933 * // basic usage ... just like .hover() 934 * .hoverIntent( handlerIn, handlerOut ) 935 * .hoverIntent( handlerInOut ) 936 * 937 * // basic usage ... with event delegation! 938 * .hoverIntent( handlerIn, handlerOut, selector ) 939 * .hoverIntent( handlerInOut, selector ) 940 * 941 * // using a basic configuration object 942 * .hoverIntent( config ) 943 * 944 * @param handlerIn function OR configuration object 945 * @param handlerOut function OR selector for delegation OR undefined 946 * @param selector selector OR undefined 947 * @author Brian Cherne <brian(at)cherne(dot)net> 948 */ 949(function($) { 950 $.fn.hoverIntent = function(handlerIn,handlerOut,selector) { 951 952 // default configuration values 953 var cfg = { 954 interval: 100, 955 sensitivity: 6, 956 timeout: 0 957 }; 958 959 if ( typeof handlerIn === "object" ) { 960 cfg = $.extend(cfg, handlerIn ); 961 } else if ($.isFunction(handlerOut)) { 962 cfg = $.extend(cfg, { over: handlerIn, out: handlerOut, selector: selector } ); 963 } else { 964 cfg = $.extend(cfg, { over: handlerIn, out: handlerIn, selector: handlerOut } ); 965 } 966 967 // instantiate variables 968 // cX, cY = current X and Y position of mouse, updated by mousemove event 969 // pX, pY = previous X and Y position of mouse, set by mouseover and polling interval 970 var cX, cY, pX, pY; 971 972 // A private function for getting mouse position 973 var track = function(ev) { 974 cX = ev.pageX; 975 cY = ev.pageY; 976 }; 977 978 // A private function for comparing current and previous mouse position 979 var compare = function(ev,ob) { 980 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 981 // compare mouse positions to see if they've crossed the threshold 982 if ( Math.sqrt( (pX-cX)*(pX-cX) + (pY-cY)*(pY-cY) ) < cfg.sensitivity ) { 983 $(ob).off("mousemove.hoverIntent",track); 984 // set hoverIntent state to true (so mouseOut can be called) 985 ob.hoverIntent_s = true; 986 return cfg.over.apply(ob,[ev]); 987 } else { 988 // set previous coordinates for next time 989 pX = cX; pY = cY; 990 // use self-calling timeout, guarantees intervals are spaced out properly (avoids JavaScript timer bugs) 991 ob.hoverIntent_t = setTimeout( function(){compare(ev, ob);} , cfg.interval ); 992 } 993 }; 994 995 // A private function for delaying the mouseOut function 996 var delay = function(ev,ob) { 997 ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); 998 ob.hoverIntent_s = false; 999 return cfg.out.apply(ob,[ev]); 1000 }; 1001 1002 // A private function for handling mouse 'hovering' 1003 var handleHover = function(e) { 1004 // copy objects to be passed into t (required for event object to be passed in IE) 1005 var ev = $.extend({},e); 1006 var ob = this; 1007 1008 // cancel hoverIntent timer if it exists 1009 if (ob.hoverIntent_t) { ob.hoverIntent_t = clearTimeout(ob.hoverIntent_t); } 1010 1011 // if e.type === "mouseenter" 1012 if (e.type === "mouseenter") { 1013 // set "previous" X and Y position based on initial entry point 1014 pX = ev.pageX; pY = ev.pageY; 1015 // update "current" X and Y position based on mousemove 1016 $(ob).on("mousemove.hoverIntent",track); 1017 // start polling interval (self-calling timeout) to compare mouse coordinates over time 1018 if (!ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){compare(ev,ob);} , cfg.interval );} 1019 1020 // else e.type == "mouseleave" 1021 } else { 1022 // unbind expensive mousemove event 1023 $(ob).off("mousemove.hoverIntent",track); 1024 // if hoverIntent state is true, then call the mouseOut function after the specified delay 1025 if (ob.hoverIntent_s) { ob.hoverIntent_t = setTimeout( function(){delay(ev,ob);} , cfg.timeout );} 1026 } 1027 }; 1028 1029 // listen for mouseenter and mouseleave 1030 return this.on({'mouseenter.hoverIntent':handleHover,'mouseleave.hoverIntent':handleHover}, cfg.selector); 1031 }; 1032})(jQuery);; 1033/*! VelocityJS.org (1.1.0). (C) 2014 Julian Shapiro. MIT @license: en.wikipedia.org/wiki/MIT_License */ 1034 1035/************************* 1036 Velocity jQuery Shim 1037*************************/ 1038
vendor: 9,456 bytes, lines 1039-1382
1039/*! VelocityJS.org jQuery Shim (1.0.1). (C) 2014 The jQuery Foundation. MIT @license: en.wikipedia.org/wiki/MIT_License. */ 1040 1041/* This file contains the jQuery functions that Velocity relies on, thereby removing Velocity's dependency on a full copy of jQuery, and allowing it to work in any environment. */ 1042/* These shimmed functions are only used if jQuery isn't present. If both this shim and jQuery are loaded, Velocity defaults to jQuery proper. */ 1043/* Browser support: Using this shim instead of jQuery proper removes support for IE8. */ 1044 1045;(function (window) { 1046 /*************** 1047 Setup 1048 ***************/ 1049 1050 /* If jQuery is already loaded, there's no point in loading this shim. */ 1051 if (window.jQuery) { 1052 return; 1053 } 1054 1055 /* jQuery base. */ 1056 var $ = function (selector, context) { 1057 return new $.fn.init(selector, context); 1058 }; 1059 1060 /******************** 1061 Private Methods 1062 ********************/ 1063 1064 /* jQuery */ 1065 $.isWindow = function (obj) { 1066 /* jshint eqeqeq: false */ 1067 return obj != null && obj == obj.window; 1068 }; 1069 1070 /* jQuery */ 1071 $.type = function (obj) { 1072 if (obj == null) { 1073 return obj + ""; 1074 } 1075 1076 return typeof obj === "object" || typeof obj === "function" ? 1077 class2type[toString.call(obj)] || "object" : 1078 typeof obj; 1079 }; 1080 1081 /* jQuery */ 1082 $.isArray = Array.isArray || function (obj) { 1083 return $.type(obj) === "array"; 1084 }; 1085 1086 /* jQuery */ 1087 function isArraylike (obj) { 1088 var length = obj.length, 1089 type = $.type(obj); 1090 1091 if (type === "function" || $.isWindow(obj)) { 1092 return false; 1093 } 1094 1095 if (obj.nodeType === 1 && length) { 1096 return true; 1097 } 1098 1099 return type === "array" || length === 0 || typeof length === "number" && length > 0 && (length - 1) in obj; 1100 } 1101 1102 /*************** 1103 $ Methods 1104 ***************/ 1105 1106 /* jQuery: Support removed for IE<9. */ 1107 $.isPlainObject = function (obj) { 1108 var key; 1109 1110 if (!obj || $.type(obj) !== "object" || obj.nodeType || $.isWindow(obj)) { 1111 return false; 1112 } 1113 1114 try { 1115 if (obj.constructor && 1116 !hasOwn.call(obj, "constructor") && 1117 !hasOwn.call(obj.constructor.prototype, "isPrototypeOf")) { 1118 return false; 1119 } 1120 } catch (e) { 1121 return false; 1122 } 1123 1124 for (key in obj) {} 1125 1126 return key === undefined || hasOwn.call(obj, key); 1127 }; 1128 1129 /* jQuery */ 1130 $.each = function(obj, callback, args) { 1131 var value, 1132 i = 0, 1133 length = obj.length, 1134 isArray = isArraylike(obj); 1135 1136 if (args) { 1137 if (isArray) { 1138 for (; i < length; i++) { 1139 value = callback.apply(obj[i], args); 1140 1141 if (value === false) { 1142 break; 1143 } 1144 } 1145 } else { 1146 for (i in obj) { 1147 value = callback.apply(obj[i], args); 1148 1149 if (value === false) { 1150 break; 1151 } 1152 } 1153 } 1154 1155 } else { 1156 if (isArray) { 1157 for (; i < length; i++) { 1158 value = callback.call(obj[i], i, obj[i]); 1159 1160 if (value === false) { 1161 break; 1162 } 1163 } 1164 } else { 1165 for (i in obj) { 1166 value = callback.call(obj[i], i, obj[i]); 1167 1168 if (value === false) { 1169 break; 1170 } 1171 } 1172 } 1173 } 1174 1175 return obj; 1176 }; 1177 1178 /* Custom */ 1179 $.data = function (node, key, value) { 1180 /* $.getData() */ 1181 if (value === undefined) { 1182 var id = node[$.expando], 1183 store = id && cache[id]; 1184 1185 if (key === undefined) { 1186 return store; 1187 } else if (store) { 1188 if (key in store) { 1189 return store[key]; 1190 } 1191 } 1192 /* $.setData() */ 1193 } else if (key !== undefined) { 1194 var id = node[$.expando] || (node[$.expando] = ++$.uuid); 1195 1196 cache[id] = cache[id] || {}; 1197 cache[id][key] = value; 1198 1199 return value; 1200 } 1201 }; 1202 1203 /* Custom */ 1204 $.removeData = function (node, keys) { 1205 var id = node[$.expando], 1206 store = id && cache[id]; 1207 1208 if (store) { 1209 $.each(keys, function(_, key) { 1210 delete store[key]; 1211 }); 1212 } 1213 }; 1214 1215 /* jQuery */ 1216 $.extend = function () { 1217 var src, copyIsArray, copy, name, options, clone, 1218 target = arguments[0] || {}, 1219 i = 1, 1220 length = arguments.length, 1221 deep = false; 1222 1223 if (typeof target === "boolean") { 1224 deep = target; 1225 1226 target = arguments[i] || {}; 1227 i++; 1228 } 1229 1230 if (typeof target !== "object" && $.type(target) !== "function") { 1231 target = {}; 1232 } 1233 1234 if (i === length) { 1235 target = this; 1236 i--; 1237 } 1238 1239 for (; i < length; i++) { 1240 if ((options = arguments[i]) != null) { 1241 for (name in options) { 1242 src = target[name]; 1243 copy = options[name]; 1244 1245 if (target === copy) { 1246 continue; 1247 } 1248 1249 if (deep && copy && ($.isPlainObject(copy) || (copyIsArray = $.isArray(copy)))) { 1250 if (copyIsArray) { 1251 copyIsArray = false; 1252 clone = src && $.isArray(src) ? src : []; 1253 1254 } else { 1255 clone = src && $.isPlainObject(src) ? src : {}; 1256 } 1257 1258 target[name] = $.extend(deep, clone, copy); 1259 1260 } else if (copy !== undefined) { 1261 target[name] = copy; 1262 } 1263 } 1264 } 1265 } 1266 1267 return target; 1268 }; 1269 1270 /* jQuery 1.4.3 */ 1271 $.queue = function (elem, type, data) { 1272 function $makeArray (arr, results) { 1273 var ret = results || []; 1274 1275 if (arr != null) { 1276 if (isArraylike(Object(arr))) { 1277 /* $.merge */ 1278 (function(first, second) { 1279 var len = +second.length, 1280 j = 0, 1281 i = first.length; 1282 1283 while (j < len) { 1284 first[i++] = second[j++]; 1285 } 1286 1287 if (len !== len) { 1288 while (second[j] !== undefined) { 1289 first[i++] = second[j++]; 1290 } 1291 } 1292 1293 first.length = i; 1294 1295 return first; 1296 })(ret, typeof arr === "string" ? [arr] : arr); 1297 } else { 1298 [].push.call(ret, arr); 1299 } 1300 } 1301 1302 return ret; 1303 } 1304 1305 if (!elem) { 1306 return; 1307 } 1308 1309 type = (type || "fx") + "queue"; 1310 1311 var q = $.data(elem, type); 1312 1313 if (!data) { 1314 return q || []; 1315 } 1316 1317 if (!q || $.isArray(data)) { 1318 q = $.data(elem, type, $makeArray(data)); 1319 } else { 1320 q.push(data); 1321 } 1322 1323 return q; 1324 }; 1325 1326 /* jQuery 1.4.3 */ 1327 $.dequeue = function (elems, type) { 1328 /* Custom: Embed element iteration. */ 1329 $.each(elems.nodeType ? [ elems ] : elems, function(i, elem) { 1330 type = type || "fx"; 1331 1332 var queue = $.queue(elem, type), 1333 fn = queue.shift(); 1334 1335 if (fn === "inprogress") { 1336 fn = queue.shift(); 1337 } 1338 1339 if (fn) { 1340 if (type === "fx") { 1341 queue.unshift("inprogress"); 1342 } 1343 1344 fn.call(elem, function() { 1345 $.dequeue(elem, type); 1346 }); 1347 } 1348 }); 1349 }; 1350 1351 /****************** 1352 $.fn Methods 1353 ******************/ 1354 1355 /* jQuery */ 1356 $.fn = $.prototype = { 1357 init: function (selector) { 1358 /* Just return the element wrapped inside an array; don't proceed with the actual jQuery node wrapping process. */ 1359 if (selector.nodeType) { 1360 this[0] = selector; 1361 1362 return this; 1363 } else { 1364 throw new Error("Not a DOM node."); 1365 } 1366 }, 1367 1368 offset: function () { 1369 /* jQuery altered code: Dropped disconnected DOM node checking. */ 1370 var box = this[0].getBoundingClientRect ? this[0].getBoundingClientRect() : { top: 0, left: 0 }; 1371 1372 return { 1373 top: box.top + (window.pageYOffset || document.scrollTop || 0) - (document.clientTop || 0), 1374 left: box.left + (window.pageXOffset || document.scrollLeft || 0) - (document.clientLeft || 0) 1375 }; 1376 }, 1377 1378 position: function () { 1379 /* jQuery */ 1380 function offsetParent() { 1381 var offsetParent = this.offsetParent || document; 1382
1383 while (offsetParent && (!offsetParent.nodeType.toLowerCase === "html" && offsetParent.style.position === "static")) { 1384 offsetParent = offsetParent.offsetParent; 1385 } 1386 1387 return offsetParent || document; 1388 } 1389 1390 /* Zepto */ 1391 var elem = this[0], 1392 offsetParent = offsetParent.apply(elem), 1393 offset = this.offset(), 1394 parentOffset = /^(?:body|html)$/i.test(offsetParent.nodeName) ? { top: 0, left: 0 } : $(offsetParent).offset() 1395 1396 offset.top -= parseFloat(elem.style.marginTop) || 0; 1397 offset.left -= parseFloat(elem.style.marginLeft) || 0; 1398 1399 if (offsetParent.style) { 1400 parentOffset.top += parseFloat(offsetParent.style.borderTopWidth) || 0 1401 parentOffset.left += parseFloat(offsetParent.style.borderLeftWidth) || 0 1402 } 1403 1404 return { 1405 top: offset.top - parentOffset.top, 1406 left: offset.left - parentOffset.left 1407 }; 1408 } 1409 }; 1410 1411 /********************** 1412 Private Variables 1413 **********************/ 1414 1415 /* For $.data() */ 1416 var cache = {}; 1417 $.expando = "velocity" + (new Date().getTime()); 1418 $.uuid = 0; 1419 1420 /* For $.queue() */ 1421 var class2type = {}, 1422 hasOwn = class2type.hasOwnProperty, 1423 toString = class2type.toString; 1424 1425 var types = "Boolean Number String Function Array Date RegExp Object Error".split(" "); 1426 for (var i = 0; i < types.length; i++) { 1427 class2type["[object " + types[i] + "]"] = types[i].toLowerCase(); 1428 } 1429 1430 /* Makes $(node) possible, without having to call init. */ 1431 $.fn.init.prototype = $.fn; 1432 1433 /* Globalize Velocity onto the window, and assign its Utilities property. */ 1434 window.Velocity = { Utilities: $ }; 1435})(window); 1436 1437/****************** 1438 Velocity.js 1439******************/ 1440 1441;(function (factory) { 1442 /* CommonJS module. */ 1443 if (typeof module === "object" && typeof module.exports === "object") { 1444 module.exports = factory(); 1445 /* AMD module. */ 1446 } else if (typeof define === "function" && define.amd) { 1447 define(factory); 1448 /* Browser globals. */ 1449 } else { 1450 factory(); 1451 } 1452}(function() { 1453return function (global, window, document, undefined) { 1454 1455 /*************** 1456 Summary 1457 ***************/ 1458 1459 /* 1460 - CSS: CSS stack that works independently from the rest of Velocity. 1461 - animate(): Core animation method that iterates over the targeted elements and queues the incoming call onto each element individually. 1462 - Pre-Queueing: Prepare the element for animation by instantiating its data cache and processing the call's options. 1463 - Queueing: The logic that runs once the call has reached its point of execution in the element's $.queue() stack. 1464 Most logic is placed here to avoid risking it becoming stale (if the element's properties have changed). 1465 - Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 1466 - tick(): The single requestAnimationFrame loop responsible for tweening all in-progress calls. 1467 - completeCall(): Handles the cleanup process for each Velocity call. 1468 */ 1469 1470 /********************* 1471 Helper Functions 1472 *********************/ 1473 1474 /* IE detection. Gist: https://gist.github.com/julianshapiro/9098609 */ 1475 var IE = (function() { 1476 if (document.documentMode) { 1477 return document.documentMode; 1478 } else { 1479 for (var i = 7; i > 4; i--) { 1480 var div = document.createElement("div"); 1481 1482 div.innerHTML = "<!--[if IE " + i + "]><span></span><![endif]-->"; 1483 1484 if (div.getElementsByTagName("span").length) { 1485 div = null; 1486 1487 return i; 1488 } 1489 } 1490 } 1491 1492 return undefined; 1493 })(); 1494 1495 /* rAF shim. Gist: https://gist.github.com/julianshapiro/9497513 */ 1496 var rAFShim = (function() { 1497 var timeLast = 0; 1498 1499 return window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { 1500 var timeCurrent = (new Date()).getTime(), 1501 timeDelta; 1502 1503 /* Dynamically set delay on a per-tick basis to match 60fps. */ 1504 /* Technique by Erik Moller. MIT license: https://gist.github.com/paulirish/1579671 */ 1505 timeDelta = Math.max(0, 16 - (timeCurrent - timeLast)); 1506 timeLast = timeCurrent + timeDelta; 1507 1508 return setTimeout(function() { callback(timeCurrent + timeDelta); }, timeDelta); 1509 }; 1510 })(); 1511 1512 /* Array compacting. Copyright Lo-Dash. MIT License: https://github.com/lodash/lodash/blob/master/LICENSE.txt */ 1513 function compactSparseArray (array) { 1514 var index = -1, 1515 length = array ? array.length : 0, 1516 result = []; 1517 1518 while (++index < length) { 1519 var value = array[index]; 1520 1521 if (value) { 1522 result.push(value); 1523 } 1524 } 1525 1526 return result; 1527 } 1528 1529 function sanitizeElements (elements) { 1530 /* Unwrap jQuery/Zepto objects. */ 1531 if (Type.isWrapped(elements)) { 1532 elements = [].slice.call(elements); 1533 /* Wrap a single element in an array so that $.each() can iterate with the element instead of its node's children. */ 1534 } else if (Type.isNode(elements)) { 1535 elements = [ elements ]; 1536 } 1537 1538 return elements; 1539 } 1540 1541 var Type = { 1542 isString: function (variable) { 1543 return (typeof variable === "string"); 1544 }, 1545 isArray: Array.isArray || function (variable) { 1546 return Object.prototype.toString.call(variable) === "[object Array]"; 1547 }, 1548 isFunction: function (variable) { 1549 return Object.prototype.toString.call(variable) === "[object Function]"; 1550 }, 1551 isNode: function (variable) { 1552 return variable && variable.nodeType; 1553 }, 1554 /* Copyright Martin Bohm. MIT License: https://gist.github.com/Tomalak/818a78a226a0738eaade */ 1555 isNodeList: function (variable) { 1556 return typeof variable === "object" && 1557 /^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(variable)) && 1558 variable.length !== undefined && 1559 (variable.length === 0 || (typeof variable[0] === "object" && variable[0].nodeType > 0)); 1560 }, 1561 /* Determine if variable is a wrapped jQuery or Zepto element. */ 1562 isWrapped: function (variable) { 1563 return variable && (variable.jquery || (window.Zepto && window.Zepto.zepto.isZ(variable))); 1564 }, 1565 isSVG: function (variable) { 1566 return window.SVGElement && (variable instanceof window.SVGElement); 1567 }, 1568 isEmptyObject: function (variable) { 1569 for (var name in variable) { 1570 return false;
vendor: 7,701 bytes, lines 1571-1737
1571 } 1572 1573 return true; 1574 } 1575 }; 1576 1577 /***************** 1578 Dependencies 1579 *****************/ 1580 1581 var $, 1582 isJQuery = false; 1583 1584 if (global.fn && global.fn.jquery) { 1585 $ = global; 1586 isJQuery = true; 1587 } else { 1588 $ = window.Velocity.Utilities; 1589 } 1590 1591 if (IE <= 8 && !isJQuery) { 1592 throw new Error("Velocity: IE8 and below require jQuery to be loaded before Velocity."); 1593 } else if (IE <= 7) { 1594 /* Revert to jQuery's $.animate(), and lose Velocity's extra features. */ 1595 jQuery.fn.velocity = jQuery.fn.animate; 1596 1597 /* Now that $.fn.velocity is aliased, abort this Velocity declaration. */ 1598 return; 1599 } 1600 1601 /***************** 1602 Constants 1603 *****************/ 1604 1605 var DURATION_DEFAULT = 400, 1606 EASING_DEFAULT = "swing"; 1607 1608 /************* 1609 State 1610 *************/ 1611 1612 /* Note: The global object also doubles as a publicly-accessible data store for the purposes of unit testing. */ 1613 /* Note: Alias the lowercase and uppercase variants of "velocity" to minimize user confusion due to the lowercase nature of the $.fn extension. */ 1614 var Velocity = { 1615 /* Container for page-wide Velocity state data. */ 1616 State: { 1617 /* Detect mobile devices to determine if mobileHA should be turned on. */ 1618 isMobile: /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent), 1619 /* The mobileHA option's behavior changes on older Android devices (Gingerbread, versions 2.3.3-2.3.7). */ 1620 isAndroid: /Android/i.test(navigator.userAgent), 1621 isGingerbread: /Android 2\.3\.[3-7]/i.test(navigator.userAgent), 1622 isChrome: window.chrome, 1623 isFirefox: /Firefox/i.test(navigator.userAgent), 1624 /* Create a cached element for re-use when checking for CSS property prefixes. */ 1625 prefixElement: document.createElement("div"), 1626 /* Cache every prefix match to avoid repeating lookups. */ 1627 prefixMatches: {}, 1628 /* Cache the anchor used for animating window scrolling. */ 1629 scrollAnchor: null, 1630 /* Cache the property names associated with the scroll anchor. */ 1631 scrollPropertyLeft: null, 1632 scrollPropertyTop: null, 1633 /* Keep track of whether our RAF tick is running. */ 1634 isTicking: false, 1635 /* Container for every in-progress call to Velocity. */ 1636 calls: [] 1637 }, 1638 /* Velocity's custom CSS stack. Made global for unit testing. */ 1639 CSS: { /* Defined below. */ }, 1640 /* Defined by Velocity's optional jQuery shim. */ 1641 Utilities: $, 1642 /* Container for the user's custom animation redirects that are referenced by name in place of a properties map object. */ 1643 Redirects: { /* Manually registered by the user. */ }, 1644 Easings: { /* Defined below. */ }, 1645 /* Attempt to use ES6 Promises by default. Users can override this with a third-party promises library. */ 1646 Promise: window.Promise, 1647 /* Page-wide option defaults, which can be overriden by the user. */ 1648 defaults: { 1649 queue: "", 1650 duration: DURATION_DEFAULT, 1651 easing: EASING_DEFAULT, 1652 begin: undefined, 1653 complete: undefined, 1654 progress: undefined, 1655 display: undefined, 1656 visibility: undefined, 1657 loop: false, 1658 delay: false, 1659 mobileHA: true, 1660 /* Set to false to prevent property values from being cached between consecutive Velocity-initiated chain calls. */ 1661 _cacheValues: true 1662 }, 1663 /* A design goal of Velocity is to cache data wherever possible in order to avoid DOM requerying. 1664 Accordingly, each element has a data cache instantiated on it. */ 1665 init: function (element) { 1666 $.data(element, "velocity", { 1667 /* Store whether this is an SVG element, since its properties are retrieved and updated differently than standard HTML elements. */ 1668 isSVG: Type.isSVG(element), 1669 /* Keep track of whether the element is currently being animated by Velocity. 1670 This is used to ensure that property values are not transferred between non-consecutive (stale) calls. */ 1671 isAnimating: false, 1672 /* A reference to the element's live computedStyle object. Learn more here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 1673 computedStyle: null, 1674 /* Tween data is cached for each animation on the element so that data can be passed across calls -- 1675 in particular, end values are used as subsequent start values in consecutive Velocity calls. */ 1676 tweensContainer: null, 1677 /* The full root property values of each CSS hook being animated on this element are cached so that: 1678 1) Concurrently-animating hooks sharing the same root can have their root values' merged into one while tweening. 1679 2) Post-hook-injection root values can be transferred over to consecutively chained Velocity calls as starting root values. */ 1680 rootPropertyValueCache: {}, 1681 /* A cache for transform updates, which must be manually flushed via CSS.flushTransformCache(). */ 1682 transformCache: {} 1683 }); 1684 }, 1685 /* A parallel to jQuery's $.css(), used for getting/setting Velocity's hooked CSS properties. */ 1686 hook: null, /* Defined below. */ 1687 /* Velocity-wide animation time remapping for testing purposes. */ 1688 mock: false, 1689 version: { major: 1, minor: 1, patch: 0 }, 1690 /* Set to 1 or 2 (most verbose) to output debug info to console. */ 1691 debug: false 1692 }; 1693 1694 /* Retrieve the appropriate scroll anchor and property name for the browser: https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY */ 1695 if (window.pageYOffset !== undefined) { 1696 Velocity.State.scrollAnchor = window; 1697 Velocity.State.scrollPropertyLeft = "pageXOffset"; 1698 Velocity.State.scrollPropertyTop = "pageYOffset"; 1699 } else { 1700 Velocity.State.scrollAnchor = document.documentElement || document.body.parentNode || document.body; 1701 Velocity.State.scrollPropertyLeft = "scrollLeft"; 1702 Velocity.State.scrollPropertyTop = "scrollTop"; 1703 } 1704 1705 /* Shorthand alias for jQuery's $.data() utility. */ 1706 function Data (element) { 1707 /* Hardcode a reference to the plugin name. */ 1708 var response = $.data(element, "velocity"); 1709 1710 /* jQuery <=1.4.2 returns null instead of undefined when no match is found. We normalize this behavior. */ 1711 return response === null ? undefined : response; 1712 }; 1713 1714 /************** 1715 Easing 1716 **************/ 1717 1718 /* Step easing generator. */ 1719 function generateStep (steps) { 1720 return function (p) { 1721 return Math.round(p * steps) * (1 / steps); 1722 }; 1723 } 1724 1725 /* Bezier curve function generator. Copyright Gaetan Renaudeau. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 1726 function generateBezier (mX1, mY1, mX2, mY2) { 1727 var NEWTON_ITERATIONS = 4, 1728 NEWTON_MIN_SLOPE = 0.001, 1729 SUBDIVISION_PRECISION = 0.0000001, 1730 SUBDIVISION_MAX_ITERATIONS = 10, 1731 kSplineTableSize = 11, 1732 kSampleStepSize = 1.0 / (kSplineTableSize - 1.0), 1733 float32ArraySupported = "Float32Array" in window; 1734 1735 /* Must contain four arguments. */ 1736 if (arguments.length !== 4) { 1737 return false;
1738 } 1739 1740 /* Arguments must be numbers. */ 1741 for (var i = 0; i < 4; ++i) { 1742 if (typeof arguments[i] !== "number" || isNaN(arguments[i]) || !isFinite(arguments[i])) { 1743 return false; 1744 } 1745 } 1746 1747 /* X values must be in the [0, 1] range. */ 1748 mX1 = Math.min(mX1, 1); 1749 mX2 = Math.min(mX2, 1); 1750 mX1 = Math.max(mX1, 0); 1751 mX2 = Math.max(mX2, 0); 1752 1753 var mSampleValues = float32ArraySupported ? new Float32Array(kSplineTableSize) : new Array(kSplineTableSize); 1754 1755 function A (aA1, aA2) { return 1.0 - 3.0 * aA2 + 3.0 * aA1; } 1756 function B (aA1, aA2) { return 3.0 * aA2 - 6.0 * aA1; } 1757 function C (aA1) { return 3.0 * aA1; } 1758 1759 function calcBezier (aT, aA1, aA2) { 1760 return ((A(aA1, aA2)*aT + B(aA1, aA2))*aT + C(aA1))*aT; 1761 } 1762 1763 function getSlope (aT, aA1, aA2) { 1764 return 3.0 * A(aA1, aA2)*aT*aT + 2.0 * B(aA1, aA2) * aT + C(aA1); 1765 } 1766 1767 function newtonRaphsonIterate (aX, aGuessT) { 1768 for (var i = 0; i < NEWTON_ITERATIONS; ++i) { 1769 var currentSlope = getSlope(aGuessT, mX1, mX2); 1770 1771 if (currentSlope === 0.0) return aGuessT; 1772 1773 var currentX = calcBezier(aGuessT, mX1, mX2) - aX; 1774 aGuessT -= currentX / currentSlope; 1775 } 1776 1777 return aGuessT; 1778 } 1779 1780 function calcSampleValues () { 1781 for (var i = 0; i < kSplineTableSize; ++i) { 1782 mSampleValues[i] = calcBezier(i * kSampleStepSize, mX1, mX2); 1783 } 1784 } 1785 1786 function binarySubdivide (aX, aA, aB) { 1787 var currentX, currentT, i = 0; 1788 1789 do { 1790 currentT = aA + (aB - aA) / 2.0; 1791 currentX = calcBezier(currentT, mX1, mX2) - aX; 1792 if (currentX > 0.0) { 1793 aB = currentT; 1794 } else { 1795 aA = currentT; 1796 } 1797 } while (Math.abs(currentX) > SUBDIVISION_PRECISION && ++i < SUBDIVISION_MAX_ITERATIONS); 1798 1799 return currentT; 1800 } 1801 1802 function getTForX (aX) { 1803 var intervalStart = 0.0, 1804 currentSample = 1, 1805 lastSample = kSplineTableSize - 1; 1806 1807 for (; currentSample != lastSample && mSampleValues[currentSample] <= aX; ++currentSample) { 1808 intervalStart += kSampleStepSize; 1809 } 1810 1811 --currentSample; 1812 1813 var dist = (aX - mSampleValues[currentSample]) / (mSampleValues[currentSample+1] - mSampleValues[currentSample]), 1814 guessForT = intervalStart + dist * kSampleStepSize, 1815 initialSlope = getSlope(guessForT, mX1, mX2); 1816 1817 if (initialSlope >= NEWTON_MIN_SLOPE) { 1818 return newtonRaphsonIterate(aX, guessForT); 1819 } else if (initialSlope == 0.0) { 1820 return guessForT; 1821 } else { 1822 return binarySubdivide(aX, intervalStart, intervalStart + kSampleStepSize); 1823 } 1824 } 1825 1826 var _precomputed = false; 1827 1828 function precompute() { 1829 _precomputed = true; 1830 if (mX1 != mY1 || mX2 != mY2) calcSampleValues(); 1831 } 1832 1833 var f = function (aX) { 1834 if (!_precomputed) precompute(); 1835 if (mX1 === mY1 && mX2 === mY2) return aX; 1836 if (aX === 0) return 0; 1837 if (aX === 1) return 1; 1838 1839 return calcBezier(getTForX(aX), mY1, mY2); 1840 }; 1841 1842 f.getControlPoints = function() { return [{ x: mX1, y: mY1 }, { x: mX2, y: mY2 }]; }; 1843 1844 var str = "generateBezier(" + [mX1, mY1, mX2, mY2] + ")"; 1845 f.toString = function () { return str; }; 1846 1847 return f; 1848 } 1849 1850 /* Runge-Kutta spring physics function generator. Adapted from Framer.js, copyright Koen Bok. MIT License: http://en.wikipedia.org/wiki/MIT_License */ 1851 /* Given a tension, friction, and duration, a simulation at 60FPS will first run without a defined duration in order to calculate the full path. A second pass 1852 then adjusts the time delta -- using the relation between actual time and duration -- to calculate the path for the duration-constrained animation. */ 1853 var generateSpringRK4 = (function () { 1854 function springAccelerationForState (state) { 1855 return (-state.tension * state.x) - (state.friction * state.v); 1856 } 1857 1858 function springEvaluateStateWithDerivative (initialState, dt, derivative) { 1859 var state = { 1860 x: initialState.x + derivative.dx * dt, 1861 v: initialState.v + derivative.dv * dt, 1862 tension: initialState.tension, 1863 friction: initialState.friction 1864 }; 1865 1866 return { dx: state.v, dv: springAccelerationForState(state) }; 1867 } 1868 1869 function springIntegrateState (state, dt) { 1870 var a = { 1871 dx: state.v, 1872 dv: springAccelerationForState(state) 1873 }, 1874 b = springEvaluateStateWithDerivative(state, dt * 0.5, a), 1875 c = springEvaluateStateWithDerivative(state, dt * 0.5, b), 1876 d = springEvaluateStateWithDerivative(state, dt, c), 1877 dxdt = 1.0 / 6.0 * (a.dx + 2.0 * (b.dx + c.dx) + d.dx), 1878 dvdt = 1.0 / 6.0 * (a.dv + 2.0 * (b.dv + c.dv) + d.dv); 1879 1880 state.x = state.x + dxdt * dt; 1881 state.v = state.v + dvdt * dt; 1882 1883 return state; 1884 } 1885 1886 return function springRK4Factory (tension, friction, duration) { 1887 1888 var initState = { 1889 x: -1, 1890 v: 0, 1891 tension: null, 1892 friction: null 1893 }, 1894 path = [0],
vendor: 9,606 bytes, lines 1895-2083
1895 time_lapsed = 0, 1896 tolerance = 1 / 10000, 1897 DT = 16 / 1000, 1898 have_duration, dt, last_state; 1899 1900 tension = parseFloat(tension) || 500; 1901 friction = parseFloat(friction) || 20; 1902 duration = duration || null; 1903 1904 initState.tension = tension; 1905 initState.friction = friction; 1906 1907 have_duration = duration !== null; 1908 1909 /* Calculate the actual time it takes for this animation to complete with the provided conditions. */ 1910 if (have_duration) { 1911 /* Run the simulation without a duration. */ 1912 time_lapsed = springRK4Factory(tension, friction); 1913 /* Compute the adjusted time delta. */ 1914 dt = time_lapsed / duration * DT; 1915 } else { 1916 dt = DT; 1917 } 1918 1919 while (true) { 1920 /* Next/step function .*/ 1921 last_state = springIntegrateState(last_state || initState, dt); 1922 /* Store the position. */ 1923 path.push(1 + last_state.x); 1924 time_lapsed += 16; 1925 /* If the change threshold is reached, break. */ 1926 if (!(Math.abs(last_state.x) > tolerance && Math.abs(last_state.v) > tolerance)) { 1927 break; 1928 } 1929 } 1930 1931 /* If duration is not defined, return the actual time required for completing this animation. Otherwise, return a closure that holds the 1932 computed path and returns a snapshot of the position according to a given percentComplete. */ 1933 return !have_duration ? time_lapsed : function(percentComplete) { return path[ (percentComplete * (path.length - 1)) | 0 ]; }; 1934 }; 1935 }()); 1936 1937 /* jQuery easings. */ 1938 Velocity.Easings = { 1939 linear: function(p) { return p; }, 1940 swing: function(p) { return 0.5 - Math.cos( p * Math.PI ) / 2 }, 1941 /* Bonus "spring" easing, which is a less exaggerated version of easeInOutElastic. */ 1942 spring: function(p) { return 1 - (Math.cos(p * 4.5 * Math.PI) * Math.exp(-p * 6)); } 1943 }; 1944 1945 /* CSS3 and Robert Penner easings. */ 1946 $.each( 1947 [ 1948 [ "ease", [ 0.25, 0.1, 0.25, 1.0 ] ], 1949 [ "ease-in", [ 0.42, 0.0, 1.00, 1.0 ] ], 1950 [ "ease-out", [ 0.00, 0.0, 0.58, 1.0 ] ], 1951 [ "ease-in-out", [ 0.42, 0.0, 0.58, 1.0 ] ], 1952 [ "easeInSine", [ 0.47, 0, 0.745, 0.715 ] ], 1953 [ "easeOutSine", [ 0.39, 0.575, 0.565, 1 ] ], 1954 [ "easeInOutSine", [ 0.445, 0.05, 0.55, 0.95 ] ], 1955 [ "easeInQuad", [ 0.55, 0.085, 0.68, 0.53 ] ], 1956 [ "easeOutQuad", [ 0.25, 0.46, 0.45, 0.94 ] ], 1957 [ "easeInOutQuad", [ 0.455, 0.03, 0.515, 0.955 ] ], 1958 [ "easeInCubic", [ 0.55, 0.055, 0.675, 0.19 ] ], 1959 [ "easeOutCubic", [ 0.215, 0.61, 0.355, 1 ] ], 1960 [ "easeInOutCubic", [ 0.645, 0.045, 0.355, 1 ] ], 1961 [ "easeInQuart", [ 0.895, 0.03, 0.685, 0.22 ] ], 1962 [ "easeOutQuart", [ 0.165, 0.84, 0.44, 1 ] ], 1963 [ "easeInOutQuart", [ 0.77, 0, 0.175, 1 ] ], 1964 [ "easeInQuint", [ 0.755, 0.05, 0.855, 0.06 ] ], 1965 [ "easeOutQuint", [ 0.23, 1, 0.32, 1 ] ], 1966 [ "easeInOutQuint", [ 0.86, 0, 0.07, 1 ] ], 1967 [ "easeInExpo", [ 0.95, 0.05, 0.795, 0.035 ] ], 1968 [ "easeOutExpo", [ 0.19, 1, 0.22, 1 ] ], 1969 [ "easeInOutExpo", [ 1, 0, 0, 1 ] ], 1970 [ "easeInCirc", [ 0.6, 0.04, 0.98, 0.335 ] ], 1971 [ "easeOutCirc", [ 0.075, 0.82, 0.165, 1 ] ], 1972 [ "easeInOutCirc", [ 0.785, 0.135, 0.15, 0.86 ] ] 1973 ], function(i, easingArray) { 1974 Velocity.Easings[easingArray[0]] = generateBezier.apply(null, easingArray[1]); 1975 }); 1976 1977 /* Determine the appropriate easing type given an easing input. */ 1978 function getEasing(value, duration) { 1979 var easing = value; 1980 1981 /* The easing option can either be a string that references a pre-registered easing, 1982 or it can be a two-/four-item array of integers to be converted into a bezier/spring function. */ 1983 if (Type.isString(value)) { 1984 /* Ensure that the easing has been assigned to jQuery's Velocity.Easings object. */ 1985 if (!Velocity.Easings[value]) { 1986 easing = false; 1987 } 1988 } else if (Type.isArray(value) && value.length === 1) { 1989 easing = generateStep.apply(null, value); 1990 } else if (Type.isArray(value) && value.length === 2) { 1991 /* springRK4 must be passed the animation's duration. */ 1992 /* Note: If the springRK4 array contains non-numbers, generateSpringRK4() returns an easing 1993 function generated with default tension and friction values. */ 1994 easing = generateSpringRK4.apply(null, value.concat([ duration ])); 1995 } else if (Type.isArray(value) && value.length === 4) { 1996 /* Note: If the bezier array contains non-numbers, generateBezier() returns false. */ 1997 easing = generateBezier.apply(null, value); 1998 } else { 1999 easing = false; 2000 } 2001 2002 /* Revert to the Velocity-wide default easing type, or fall back to "swing" (which is also jQuery's default) 2003 if the Velocity-wide default has been incorrectly modified. */ 2004 if (easing === false) { 2005 if (Velocity.Easings[Velocity.defaults.easing]) { 2006 easing = Velocity.defaults.easing; 2007 } else { 2008 easing = EASING_DEFAULT; 2009 } 2010 } 2011 2012 return easing; 2013 } 2014 2015 /***************** 2016 CSS Stack 2017 *****************/ 2018 2019 /* The CSS object is a highly condensed and performant CSS stack that fully replaces jQuery's. 2020 It handles the validation, getting, and setting of both standard CSS properties and CSS property hooks. */ 2021 /* Note: A "CSS" shorthand is aliased so that our code is easier to read. */ 2022 var CSS = Velocity.CSS = { 2023 2024 /************* 2025 RegEx 2026 *************/ 2027 2028 RegEx: { 2029 isHex: /^#([A-f\d]{3}){1,2}$/i, 2030 /* Unwrap a property value's surrounding text, e.g. "rgba(4, 3, 2, 1)" ==> "4, 3, 2, 1" and "rect(4px 3px 2px 1px)" ==> "4px 3px 2px 1px". */ 2031 valueUnwrap: /^[A-z]+\((.*)\)$/i, 2032 wrappedValueAlreadyExtracted: /[0-9.]+ [0-9.]+ [0-9.]+( [0-9.]+)?/, 2033 /* Split a multi-value property into an array of subvalues, e.g. "rgba(4, 3, 2, 1) 4px 3px 2px 1px" ==> [ "rgba(4, 3, 2, 1)", "4px", "3px", "2px", "1px" ]. */ 2034 valueSplit: /([A-z]+\(.+\))|(([A-z0-9#-.]+?)(?=\s|$))/ig 2035 }, 2036 2037 /************ 2038 Lists 2039 ************/ 2040 2041 Lists: { 2042 colors: [ "fill", "stroke", "stopColor", "color", "backgroundColor", "borderColor", "borderTopColor", "borderRightColor", "borderBottomColor", "borderLeftColor", "outlineColor" ], 2043 transformsBase: [ "translateX", "translateY", "scale", "scaleX", "scaleY", "skewX", "skewY", "rotateZ" ], 2044 transforms3D: [ "transformPerspective", "translateZ", "scaleZ", "rotateX", "rotateY" ] 2045 }, 2046 2047 /************ 2048 Hooks 2049 ************/ 2050 2051 /* Hooks allow a subproperty (e.g. "boxShadowBlur") of a compound-value CSS property 2052 (e.g. "boxShadow: X Y Blur Spread Color") to be animated as if it were a discrete property. */ 2053 /* Note: Beyond enabling fine-grained property animation, hooking is necessary since Velocity only 2054 tweens properties with single numeric values; unlike CSS transitions, Velocity does not interpolate compound-values. */ 2055 Hooks: { 2056 /******************** 2057 Registration 2058 ********************/ 2059 2060 /* Templates are a concise way of indicating which subproperties must be individually registered for each compound-value CSS property. */ 2061 /* Each template consists of the compound-value's base name, its constituent subproperty names, and those subproperties' default values. */ 2062 templates: { 2063 "textShadow": [ "Color X Y Blur", "black 0px 0px 0px" ], 2064 /* Todo: Add support for inset boxShadows. (webkit places it last whereas IE places it first.) */ 2065 "boxShadow": [ "Color X Y Blur Spread", "black 0px 0px 0px 0px" ], 2066 "clip": [ "Top Right Bottom Left", "0px 0px 0px 0px" ], 2067 "backgroundPosition": [ "X Y", "0% 0%" ], 2068 "transformOrigin": [ "X Y Z", "50% 50% 0px" ], 2069 "perspectiveOrigin": [ "X Y", "50% 50%" ] 2070 }, 2071 2072 /* A "registered" hook is one that has been converted from its template form into a live, 2073 tweenable property. It contains data to associate it with its root property. */ 2074 registered: { 2075 /* Note: A registered hook looks like this ==> textShadowBlur: [ "textShadow", 3 ], 2076 which consists of the subproperty's name, the associated root property's name, 2077 and the subproperty's position in the root's value. */ 2078 }, 2079 /* Convert the templates into individual hooks then append them to the registered object above. */ 2080 register: function () { 2081 /* Color hooks registration: Colors are defaulted to white -- as opposed to black -- since colors that are 2082 currently set to "transparent" default to their respective template below when color-animated, 2083 and white is typically a closer match to transparent than black
2083is. An exception is made for text ("color"), 2084 which is almost always set closer to black than white. */ 2085 for (var i = 0; i < CSS.Lists.colors.length; i++) { 2086 var rgbComponents = (CSS.Lists.colors[i] === "color") ? "0 0 0 1" : "255 255 255 1"; 2087 CSS.Hooks.templates[CSS.Lists.colors[i]] = [ "Red Green Blue Alpha", rgbComponents ]; 2088 } 2089 2090 var rootProperty, 2091 hookTemplate, 2092 hookNames; 2093 2094 /* In IE, color values inside compound-value properties are positioned at the end the value instead of at the beginning. 2095 Thus, we re-arrange the templates accordingly. */ 2096 if (IE) { 2097 for (rootProperty in CSS.Hooks.templates) { 2098 hookTemplate = CSS.Hooks.templates[rootProperty]; 2099 hookNames = hookTemplate[0].split(" "); 2100 2101 var defaultValues = hookTemplate[1].match(CSS.RegEx.valueSplit); 2102 2103 if (hookNames[0] === "Color") { 2104 /* Reposition both the hook's name and its default value to the end of their respective strings. */ 2105 hookNames.push(hookNames.shift()); 2106 defaultValues.push(defaultValues.shift()); 2107 2108 /* Replace the existing template for the hook's root property. */ 2109 CSS.Hooks.templates[rootProperty] = [ hookNames.join(" "), defaultValues.join(" ") ]; 2110 } 2111 } 2112 } 2113 2114 /* Hook registration. */ 2115 for (rootProperty in CSS.Hooks.templates) { 2116 hookTemplate = CSS.Hooks.templates[rootProperty]; 2117 hookNames = hookTemplate[0].split(" "); 2118 2119 for (var i in hookNames) { 2120 var fullHookName = rootProperty + hookNames[i], 2121 hookPosition = i; 2122 2123 /* For each hook, register its full name (e.g. textShadowBlur) with its root property (e.g. textShadow) 2124 and the hook's position in its template's default value string. */ 2125 CSS.Hooks.registered[fullHookName] = [ rootProperty, hookPosition ]; 2126 } 2127 } 2128 }, 2129 2130 /***************************** 2131 Injection and Extraction 2132 *****************************/ 2133 2134 /* Look up the root property associated with the hook (e.g. return "textShadow" for "textShadowBlur"). */ 2135 /* Since a hook cannot be set directly (the browser won't recognize it), style updating for hooks is routed through the hook's root property. */ 2136 getRoot: function (property) { 2137 var hookData = CSS.Hooks.registered[property]; 2138 2139 if (hookData) { 2140 return hookData[0]; 2141 } else { 2142 /* If there was no hook match, return the property name untouched. */ 2143 return property; 2144 } 2145 }, 2146 /* Convert any rootPropertyValue, null or otherwise, into a space-delimited list of hook values so that 2147 the targeted hook can be injected or extracted at its standard position. */ 2148 cleanRootPropertyValue: function(rootProperty, rootPropertyValue) { 2149 /* If the rootPropertyValue is wrapped with "rgb()", "clip()", etc., remove the wrapping to normalize the value before manipulation. */ 2150 if (CSS.RegEx.valueUnwrap.test(rootPropertyValue)) { 2151 rootPropertyValue = rootPropertyValue.match(CSS.RegEx.valueUnwrap)[1]; 2152 } 2153 2154 /* If rootPropertyValue is a CSS null-value (from which there's inherently no hook value to extract), 2155 default to the root's default value as defined in CSS.Hooks.templates. */ 2156 /* Note: CSS null-values include "none", "auto", and "transparent". They must be converted into their
2157 zero-values (e.g. textShadow: "none" ==> textShadow: "0px 0px 0px black") for hook manipulation to proceed. */ 2158 if (CSS.Values.isCSSNullValue(rootPropertyValue)) { 2159 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 2160 } 2161 2162 return rootPropertyValue; 2163 }, 2164 /* Extracted the hook's value from its root property's value. This is used to get the starting value of an animating hook. */ 2165 extractValue: function (fullHookName, rootPropertyValue) { 2166 var hookData = CSS.Hooks.registered[fullHookName]; 2167 2168 if (hookData) { 2169 var hookRoot = hookData[0], 2170 hookPosition = hookData[1]; 2171 2172 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 2173 2174 /* Split rootPropertyValue into its constituent hook values then grab the desired hook at its standard position. */ 2175 return rootPropertyValue.toString().match(CSS.RegEx.valueSplit)[hookPosition]; 2176 } else { 2177 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 2178 return rootPropertyValue; 2179 } 2180 }, 2181 /* Inject the hook's value into its root property's value. This is used to piece back together the root property 2182 once Velocity has updated one of its individually hooked values through tweening. */ 2183 injectValue: function (fullHookName, hookValue, rootPropertyValue) { 2184 var hookData = CSS.Hooks.registered[fullHookName]; 2185 2186 if (hookData) { 2187 var hookRoot = hookData[0], 2188 hookPosition = hookData[1], 2189 rootPropertyValueParts, 2190 rootPropertyValueUpdated; 2191 2192 rootPropertyValue = CSS.Hooks.cleanRootPropertyValue(hookRoot, rootPropertyValue); 2193 2194 /* Split rootPropertyValue into its individual hook values, replace the targeted value with hookValue, 2195 then reconstruct the rootPropertyValue string. */ 2196 rootPropertyValueParts = rootPropertyValue.toString().match(CSS.RegEx.valueSplit); 2197 rootPropertyValueParts[hookPosition] = hookValue; 2198 rootPropertyValueUpdated = rootPropertyValueParts.join(" "); 2199 2200 return rootPropertyValueUpdated; 2201 } else { 2202 /* If the provided fullHookName isn't a registered hook, return the rootPropertyValue that was passed in. */ 2203 return rootPropertyValue; 2204 } 2205 } 2206 }, 2207 2208 /******************* 2209 Normalizations 2210 *******************/ 2211 2212 /* Normalizations standardize CSS property manipulation by pollyfilling browser-specific implementations (e.g. opacity) 2213 and reformatting special properties (e.g. clip, rgba) to look like standard ones. */ 2214 Normalizations: { 2215 /* Normalizations are passed a normalization target (either the property's name, its extracted value, or its injected value), 2216 the targeted element (which may need to be queried), and the targeted property value. */ 2217 registered: { 2218 clip: function (type, element, propertyValue) { 2219 switch (type) { 2220 case "name": 2221 return "clip"; 2222 /* Clip needs to be unwrapped and stripped of its commas during extraction. */ 2223 case "extract": 2224 var extracted; 2225 2226 /* If Velocity also extracted this value, skip extraction. */ 2227 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 2228 extracted = propertyValue; 2229 } else { 2230 /* Remove the "rect()" wrapper. */ 2231 extracted = propertyValue.toString().match(CSS.RegEx.valueUnwrap
vendor: 8,245 bytes, lines 2231-2365
2231); 2232 2233 /* Strip off commas. */ 2234 extracted = extracted ? extracted[1].replace(/,(\s+)?/g, " ") : propertyValue; 2235 } 2236 2237 return extracted; 2238 /* Clip needs to be re-wrapped during injection. */ 2239 case "inject": 2240 return "rect(" + propertyValue + ")"; 2241 } 2242 }, 2243 2244 blur: function(type, element, propertyValue) { 2245 switch (type) { 2246 case "name": 2247 return "-webkit-filter"; 2248 case "extract": 2249 var extracted = parseFloat(propertyValue); 2250 2251 /* If extracted is NaN, meaning the value isn't already extracted. */ 2252 if (!(extracted || extracted === 0)) { 2253 var blurComponent = propertyValue.toString().match(/blur\(([0-9]+[A-z]+)\)/i); 2254 2255 /* If the filter string had a blur component, return just the blur value and unit type. */ 2256 if (blurComponent) { 2257 extracted = blurComponent[1]; 2258 /* If the component doesn't exist, default blur to 0. */ 2259 } else { 2260 extracted = 0; 2261 } 2262 } 2263 2264 return extracted; 2265 /* Blur needs to be re-wrapped during injection. */ 2266 case "inject": 2267 /* For the blur effect to be fully de-applied, it needs to be set to "none" instead of 0. */ 2268 if (!parseFloat(propertyValue)) { 2269 return "none"; 2270 } else { 2271 return "blur(" + propertyValue + ")"; 2272 } 2273 } 2274 }, 2275 2276 /* <=IE8 do not support the standard opacity property. They use filter:alpha(opacity=INT) instead. */ 2277 opacity: function (type, element, propertyValue) { 2278 if (IE <= 8) { 2279 switch (type) { 2280 case "name": 2281 return "filter"; 2282 case "extract": 2283 /* <=IE8 return a "filter" value of "alpha(opacity=\d{1,3})". 2284 Extract the value and convert it to a decimal value to match the standard CSS opacity property's formatting. */ 2285 var extracted = propertyValue.toString().match(/alpha\(opacity=(.*)\)/i); 2286 2287 if (extracted) { 2288 /* Convert to decimal value. */ 2289 propertyValue = extracted[1] / 100; 2290 } else { 2291 /* When extracting opacity, default to 1 since a null value means opacity hasn't been set. */ 2292 propertyValue = 1; 2293 } 2294 2295 return propertyValue; 2296 case "inject": 2297 /* Opacified elements are required to have their zoom property set to a non-zero value. */ 2298 element.style.zoom = 1; 2299 2300 /* Setting the filter property on elements with certain font property combinations can result in a 2301 highly unappealing ultra-bolding effect. There's no way to remedy this throughout a tween, but dropping the 2302 value altogether (when opacity hits 1) at leasts ensures that the glitch is gone post-tweening. */ 2303 if (parseFloat(propertyValue) >= 1) { 2304 return ""; 2305 } else { 2306 /* As per the filter property's spec, convert the decimal value to a whole number and wrap the value. */ 2307 return "alpha(opacity=" + parseInt(parseFloat(propertyValue) * 100, 10) + ")"; 2308 } 2309 } 2310 /* With all other browsers, normalization is not required; return the same values that were passed in. */ 2311 } else { 2312 switch (type) { 2313 case "name": 2314 return "opacity"; 2315 case "extract": 2316 return propertyValue; 2317 case "inject": 2318 return propertyValue; 2319 } 2320 } 2321 } 2322 }, 2323 2324 /***************************** 2325 Batched Registrations 2326 *****************************/ 2327 2328 /* Note: Batched normalizations extend the CSS.Normalizations.registered object. */ 2329 register: function () { 2330 2331 /***************** 2332 Transforms 2333 *****************/ 2334 2335 /* Transforms are the subproperties contained by the CSS "transform" property. Transforms must undergo normalization 2336 so that they can be referenced in a properties map by their individual names. */ 2337 /* Note: When transforms are "set", they are actually assigned to a per-element transformCache. When all transform 2338 setting is complete complete, CSS.flushTransformCache() must be manually called to flush the values to the DOM. 2339 Transform setting is batched in this way to improve performance: the transform style only needs to be updated 2340 once when multiple transform subproperties are being animated simultaneously. */ 2341 /* Note: IE9 and Android Gingerbread have support for 2D -- but not 3D -- transforms. Since animating unsupported 2342 transform properties results in the browser ignoring the *entire* transform string, we prevent these 3D values 2343 from being normalized for these browsers so that tweening skips these properties altogether 2344 (since it will ignore them as being unsupported by the browser.) */ 2345 if (!(IE <= 9) && !Velocity.State.isGingerbread) { 2346 /* Note: Since the standalone CSS "perspective" property and the CSS transform "perspective" subproperty 2347 share the same name, the latter is given a unique token within Velocity: "transformPerspective". */ 2348 CSS.Lists.transformsBase = CSS.Lists.transformsBase.concat(CSS.Lists.transforms3D); 2349 } 2350 2351 for (var i = 0; i < CSS.Lists.transformsBase.length; i++) { 2352 /* Wrap the dynamically generated normalization function in a new scope so that transformName's value is 2353 paired with its respective function. (Otherwise, all functions would take the final for loop's transformName.) */ 2354 (function() { 2355 var transformName = CSS.Lists.transformsBase[i]; 2356 2357 CSS.Normalizations.registered[transformName] = function (type, element, propertyValue) { 2358 switch (type) { 2359 /* The normalized property name is the parent "transform" property -- the property that is actually set in CSS. */ 2360 case "name": 2361 return "transform"; 2362 /* Transform values are cached onto a per-element transformCache object. */ 2363 case "extract": 2364 /* If this transform has yet to be assigned a value, return its null value. */ 2365 if (Data(element) === undefined || Data(element).transformCache[transformName] === undefined) {
2366 /* Scale CSS.Lists.transformsBase default to 1 whereas all other transform properties default to 0. */ 2367 return /^scale/i.test(transformName) ? 1 : 0; 2368 /* When transform values are set, they are wrapped in parentheses as per the CSS spec. 2369 Thus, when extracting their values (for tween calculations), we strip off the parentheses. */ 2370 } else { 2371 return Data(element).transformCache[transformName].replace(/[()]/g, ""); 2372 } 2373 case "inject": 2374 var invalid = false; 2375 2376 /* If an individual transform property contains an unsupported unit type, the browser ignores the *entire* transform property. 2377 Thus, protect users from themselves by skipping setting for transform values supplied with invalid unit types. */ 2378 /* Switch on the base transform type; ignore the axis by removing the last letter from the transform's name. */ 2379 switch (transformName.substr(0, transformName.length - 1)) { 2380 /* Whitelist unit types for each transform. */ 2381 case "translate": 2382 invalid = !/(%|px|em|rem|vw|vh|\d)$/i.test(propertyValue); 2383 break; 2384 /* Since an axis-free "scale" property is supported as well, a little hack is used here to detect it by chopping off its last letter. */ 2385 case "scal": 2386 case "scale": 2387 /* Chrome on Android has a bug in which scaled elements blur if their initial scale 2388 value is below 1 (which can happen with forcefeeding). Thus, we detect a yet-unset scale property 2389 and ensure that its first value is always 1. More info: http://stackoverflow.com/questions/10417890/css3-animations-with-transform-causes-blurred-elements-on-webkit/10417962#10417962 */ 2390 if (Velocity.State.isAndroid && Data(element).transformCache[transformName] === undefined && propertyValue < 1) { 2391 propertyValue = 1; 2392 } 2393 2394 invalid = !/(\d)$/i.test(propertyValue); 2395 break; 2396 case "skew": 2397 invalid = !/(deg|\d)$/i.test(propertyValue); 2398 break; 2399 case "rotate": 2400 invalid = !/(deg|\d)$/i.test(propertyValue); 2401 break; 2402 } 2403 2404 if (!invalid) { 2405 /* As per the CSS spec, wrap the value in parentheses. */ 2406 Data(element).transformCache[transformName] = "(" + propertyValue + ")"; 2407 } 2408 2409 /* Although the value is set on the transformCache object, return the newly-updated value for the calling code to process as normal. */ 2410 return Data(element).transformCache[transformName]; 2411 } 2412 }; 2413 })(); 2414 } 2415 2416 /************* 2417 Colors 2418 *************/ 2419 2420 /* Since Velocity only animates a single numeric value per property, color animation is achieved by hooking the individual RGBA components of CSS color properties. 2421 Accordingly, color values must be normalized (e.g. "#ff0000", "red", and "rgb(255, 0, 0)" ==> "255 0 0 1") so that their components can be injected/extracted by CSS.Hooks logic. */ 2422 for (var i = 0; i < CSS.Lists.colors.length; i++) { 2423 /* Wrap the dynamically generated normalization function in a new scope so that colorName's value is paired with its respective function. 2424 (Otherwise, all functions would take the final for loop's colorName.) */ 2425 (function () { 2426 var colorName = CSS.Lists.colors[i]; 2427 2428 /* Note: In IE<=8, which support rgb but not rgba, c
2428olor properties are reverted to rgb by stripping off the alpha component. */ 2429 CSS.Normalizations.registered[colorName] = function(type, element, propertyValue) { 2430 switch (type) { 2431 case "name": 2432 return colorName; 2433 /* Convert all color values into the rgb format. (Old IE can return hex values and color names instead of rgb/rgba.) */ 2434 case "extract": 2435 var extracted; 2436 2437 /* If the color is already in its hookable form (e.g. "255 255 255 1") due to having been previously extracted, skip extraction. */ 2438 if (CSS.RegEx.wrappedValueAlreadyExtracted.test(propertyValue)) { 2439 extracted = propertyValue; 2440 } else { 2441 var converted, 2442 colorNames = { 2443 black: "rgb(0, 0, 0)", 2444 blue: "rgb(0, 0, 255)", 2445 gray: "rgb(128, 128, 128)", 2446 green: "rgb(0, 128, 0)", 2447 red: "rgb(255, 0, 0)", 2448 white: "rgb(255, 255, 255)" 2449 }; 2450 2451 /* Convert color names to rgb. */ 2452 if (/^[A-z]+$/i.test(propertyValue)) { 2453 if (colorNames[propertyValue] !== undefined) { 2454 converted = colorNames[propertyValue] 2455 } else { 2456 /* If an unmatched color name is provided, default to black. */ 2457 converted = colorNames.black; 2458 } 2459 /* Convert hex values to rgb. */ 2460 } else if (CSS.RegEx.isHex.test(propertyValue)) { 2461 converted = "rgb(" + CSS.Values.hexToRgb(propertyValue).join(" ") + ")"; 2462 /* If the provided color doesn't match any of the accepted color formats, default to black. */ 2463 } else if (!(/^rgba?\(/i.test(propertyValue))) { 2464 converted = colorNames.black; 2465 } 2466 2467 /* Remove the surrounding "rgb/rgba()" string then replace commas with spaces and strip 2468 repeated spaces (in case the value included spaces to begin with). */ 2469 extracted = (converted || propertyValue).toString().match(CSS.RegEx.valueUnwrap)[1].replace(/,(\s+)?/g, " "); 2470 } 2471 2472 /* So long as this isn't <=IE8, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 2473 if (!(IE <= 8) && extracted.split(" ").length === 3) { 2474 extracted += " 1"; 2475 } 2476 2477 return extracted; 2478 case "inject": 2479 /* If this is IE<=8 and an alpha component exists, strip it off. */ 2480 if (IE <= 8) { 2481 if (propertyValue.split(" ").length === 4) { 2482 propertyValue = propertyValue.split(/\s+/).slice(0, 3).join(" "); 2483 } 2484 /* Otherwise, add a fourth (alpha) component if it's missing and default it to 1 (visible). */ 2485 } else if (propertyValue.split(" ").length === 3) { 2486 propertyValue += " 1"; 2487 } 2488 2489 /* Re-insert the browser-appropriate wrapper("rgb/rgba()"), insert commas, and strip off decimal units 2490 on all values but the fourth (R, G, and B only accept whole numbers). */ 2491 return (IE <= 8 ? "rgb" : "rgba") + "(" + propertyValue.replace(/\s+/g, ",").replace(/\.(\d)+(?=,)/g, "") + ")"; 2492 } 2493 }; 2494 })(); 2495 } 2496 } 2497 }, 2498 2499 /************************ 2500 CSS Property Names 2501 ************************/ 2502 2503 Names: {
vendor: 5,382 bytes, lines 2504-2601
2504 /* Camelcase a property name into its JavaScript notation (e.g. "background-color" ==> "backgroundColor"). 2505 Camelcasing is used to normalize property names between and across calls. */ 2506 camelCase: function (property) { 2507 return property.replace(/-(\w)/g, function (match, subMatch) { 2508 return subMatch.toUpperCase(); 2509 }); 2510 }, 2511 2512 /* For SVG elements, some properties (namely, dimensional ones) are GET/SET via the element's HTML attributes (instead of via CSS styles). */ 2513 SVGAttribute: function (property) { 2514 var SVGAttributes = "width|height|x|y|cx|cy|r|rx|ry|x1|x2|y1|y2"; 2515 2516 /* Certain browsers require an SVG transform to be applied as an attribute. (Otherwise, application via CSS is preferable due to 3D support.) */ 2517 if (IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) { 2518 SVGAttributes += "|transform"; 2519 } 2520 2521 return new RegExp("^(" + SVGAttributes + ")$", "i").test(property); 2522 }, 2523 2524 /* Determine whether a property should be set with a vendor prefix. */ 2525 /* If a prefixed version of the property exists, return it. Otherwise, return the original property name. 2526 If the property is not at all supported by the browser, return a false flag. */ 2527 prefixCheck: function (property) { 2528 /* If this property has already been checked, return the cached value. */ 2529 if (Velocity.State.prefixMatches[property]) { 2530 return [ Velocity.State.prefixMatches[property], true ]; 2531 } else { 2532 var vendors = [ "", "Webkit", "Moz", "ms", "O" ]; 2533 2534 for (var i = 0, vendorsLength = vendors.length; i < vendorsLength; i++) { 2535 var propertyPrefixed; 2536 2537 if (i === 0) { 2538 propertyPrefixed = property; 2539 } else { 2540 /* Capitalize the first letter of the property to conform to JavaScript vendor prefix notation (e.g. webkitFilter). */ 2541 propertyPrefixed = vendors[i] + property.replace(/^\w/, function(match) { return match.toUpperCase(); }); 2542 } 2543 2544 /* Check if the browser supports this property as prefixed. */ 2545 if (Type.isString(Velocity.State.prefixElement.style[propertyPrefixed])) { 2546 /* Cache the match. */ 2547 Velocity.State.prefixMatches[property] = propertyPrefixed; 2548 2549 return [ propertyPrefixed, true ]; 2550 } 2551 } 2552 2553 /* If the browser doesn't support this property in any form, include a false flag so that the caller can decide how to proceed. */ 2554 return [ property, false ]; 2555 } 2556 } 2557 }, 2558 2559 /************************ 2560 CSS Property Values 2561 ************************/ 2562 2563 Values: { 2564 /* Hex to RGB conversion. Copyright Tim Down: http://stackoverflow.com/questions/5623838/rgb-to-hex-and-hex-to-rgb */ 2565 hexToRgb: function (hex) { 2566 var shortformRegex = /^#?([a-f\d])([a-f\d])([a-f\d])$/i, 2567 longformRegex = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i, 2568 rgbParts; 2569 2570 hex = hex.replace(shortformRegex, function (m, r, g, b) { 2571 return r + r + g + g + b + b; 2572 }); 2573 2574 rgbParts = longformRegex.exec(hex); 2575 2576 return rgbParts ? [ parseInt(rgbParts[1], 16), parseInt(rgbParts[2], 16), parseInt(rgbParts[3], 16) ] : [ 0, 0, 0 ]; 2577 }, 2578 2579 isCSSNullValue: function (value) { 2580 /* The browser defaults CSS values that have not been set to either 0 or one of several possible null-value strings. 2581 Thus, we check for both falsiness and these special strings. */ 2582 /* Null-value checking is performed to default the special strings to 0 (for the sake of tweening) or their hook 2583 templates as defined as CSS.Hooks (for the sake of hook injection/extraction). */ 2584 /* Note: Chrome returns "rgba(0, 0, 0, 0)" for an undefined color whereas IE returns "transparent". */ 2585 return (value == 0 || /^(none|auto|transparent|(rgba\(0, ?0, ?0, ?0\)))$/i.test(value)); 2586 }, 2587 2588 /* Retrieve a property's default unit type. Used for assigning a unit type when one is not supplied by the user. */ 2589 getUnitType: function (property) { 2590 if (/^(rotate|skew)/i.test(property)) { 2591 return "deg"; 2592 } else if (/(^(scale|scaleX|scaleY|scaleZ|alpha|flexGrow|flexHeight|zIndex|fontWeight)$)|((opacity|red|green|blue|alpha)$)/i.test(property)) { 2593 /* The above properties are unitless. */ 2594 return ""; 2595 } else { 2596 /* Default to px for all other properties. */ 2597 return "px"; 2598 } 2599 }, 2600 2601 /* HTML elements default to an associated display type when they're not set to display:none. */
2602 /* Note: This function is used for correctly setting the non-"none" display value in certain Velocity redirects, such as fadeIn/Out. */ 2603 getDisplayType: function (element) { 2604 var tagName = element && element.tagName.toString().toLowerCase(); 2605 2606 if (/^(b|big|i|small|tt|abbr|acronym|cite|code|dfn|em|kbd|strong|samp|var|a|bdo|br|img|map|object|q|script|span|sub|sup|button|input|label|select|textarea)$/i.test(tagName)) { 2607 return "inline"; 2608 } else if (/^(li)$/i.test(tagName)) { 2609 return "list-item"; 2610 } else if (/^(tr)$/i.test(tagName)) { 2611 return "table-row"; 2612 /* Default to "block" when no match is found. */ 2613 } else { 2614 return "block"; 2615 } 2616 }, 2617 2618 /* The class add/remove functions are used to temporarily apply a "velocity-animating" class to elements while they're animating. */ 2619 addClass: function (element, className) { 2620 if (element.classList) { 2621 element.classList.add(className); 2622 } else { 2623 element.className += (element.className.length ? " " : "") + className; 2624 } 2625 }, 2626 2627 removeClass: function (element, className) { 2628 if (element.classList) { 2629 element.classList.remove(className); 2630 } else { 2631 element.className = element.className.toString().replace(new RegExp("(^|\\s)" + className.split(" ").join("|") + "(\\s|$)", "gi"), " "); 2632 } 2633 } 2634 }, 2635 2636 /**************************** 2637 Style Getting & Setting 2638 ****************************/ 2639 2640 /* The singular getPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 2641 getPropertyValue: function (element, property, rootPropertyValue, forceStyleLookup) { 2642 /* Get an element's computed property value. */ 2643 /* Note: Retrieving the value of a CSS property cannot simply be performed by checking an element's 2644 style attribute (which only reflects user-defined values). Instead, the browser must be queried for a property's 2645 *computed* value. You can read more about getComputedStyle here: https://developer.mozilla.org/en/docs/Web/API/window.getComputedStyle */ 2646 function computePropertyValue (element, property) { 2647 /* When box-sizing isn't set to border-box, height and width style values are incorrectly computed when an 2648 element's scrollbars are visible (which expands the element's dimensions). Thus, we defer to the more accurate 2649 offsetHeight/Width property, which includes the total dimensions for interior, border, padding, and scrollbar. 2650 We subtract border and padding to get the sum of interior + scrollbar. */ 2651 var computedValue = 0; 2652 2653 /* IE<=8 doesn't support window.getComputedStyle, thus we defer to jQuery, which has an extensive array 2654 of hacks to accurately retrieve IE8 property values. Re-implementing that logic here is not worth bloating the 2655 codebase for a dying browser. The performance repercussions of using jQuery here are minimal since 2656 Velocity is optimized to rarely (and sometimes never) query the DOM. Further, the $.css() codepath isn't that slow. */ 2657 if (IE <= 8) { 2658 computedValue = $.css(element, property); /* GET */ 2659 /* All other browsers support getComputedStyle. The returned live object reference is cached onto its 2660 associated element so that it does not need to be refetched upon every GET. */ 2661 } else { 2662 /* Browsers do not return height and width values for elements that are set to display:"none". Thus, we temporarily 2663 toggle display to the element type's default value. */ 2664 var toggleDisplay = false;
vendor: 7,262 bytes, lines 2665-2770
2665 2666 if (/^(width|height)$/.test(property) && CSS.getPropertyValue(element, "display") === 0) { 2667 toggleDisplay = true; 2668 CSS.setPropertyValue(element, "display", CSS.Values.getDisplayType(element)); 2669 } 2670 2671 function revertDisplay () { 2672 if (toggleDisplay) { 2673 CSS.setPropertyValue(element, "display", "none"); 2674 } 2675 } 2676 2677 if (!forceStyleLookup) { 2678 if (property === "height" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 2679 var contentBoxHeight = element.offsetHeight - (parseFloat(CSS.getPropertyValue(element, "borderTopWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderBottomWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingTop")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingBottom")) || 0); 2680 revertDisplay(); 2681 2682 return contentBoxHeight; 2683 } else if (property === "width" && CSS.getPropertyValue(element, "boxSizing").toString().toLowerCase() !== "border-box") { 2684 var contentBoxWidth = element.offsetWidth - (parseFloat(CSS.getPropertyValue(element, "borderLeftWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "borderRightWidth")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingLeft")) || 0) - (parseFloat(CSS.getPropertyValue(element, "paddingRight")) || 0); 2685 revertDisplay(); 2686 2687 return contentBoxWidth; 2688 } 2689 } 2690 2691 var computedStyle; 2692 2693 /* For elements that Velocity hasn't been called on directly (e.g. when Velocity queries the DOM on behalf 2694 of a parent of an element its animating), perform a direct getComputedStyle lookup since the object isn't cached. */ 2695 if (Data(element) === undefined) { 2696 computedStyle = window.getComputedStyle(element, null); /* GET */ 2697 /* If the computedStyle object has yet to be cached, do so now. */ 2698 } else if (!Data(element).computedStyle) { 2699 computedStyle = Data(element).computedStyle = window.getComputedStyle(element, null); /* GET */ 2700 /* If computedStyle is cached, use it. */ 2701 } else { 2702 computedStyle = Data(element).computedStyle; 2703 } 2704 2705 /* IE and Firefox do not return a value for the generic borderColor -- they only return individual values for each border side's color. 2706 As a polyfill for querying individual border side colors, just return the top border's color. */ 2707 if ((IE || Velocity.State.isFirefox) && property === "borderColor") { 2708 property = "borderTopColor"; 2709 } 2710 2711 /* IE9 has a bug in which the "filter" property must be accessed from computedStyle using the getPropertyValue method 2712 instead of a direct property lookup. The getPropertyValue method is slower than a direct lookup, which is why we avoid it by default. */ 2713 if (IE === 9 && property === "filter") { 2714 computedValue = computedStyle.getPropertyValue(property); /* GET */ 2715 } else { 2716 computedValue = computedStyle[property]; 2717 } 2718 2719 /* Fall back to the property's style value (if defined) when computedValue returns nothing, 2720 which can happen when the element hasn't been painted. */ 2721 if (computedValue === "" || computedValue === null) { 2722 computedValue = element.style[property]; 2723 } 2724 2725 revertDisplay(); 2726 } 2727 2728 /* For top, right, bottom, and left (TRBL) values that are set to "auto" on elements of "fixed" or "absolute" position, 2729 defer to jQuery for converting "auto" to a numeric value. (For elements with a "static" or "relative" position, "auto" has the same 2730 effect as being set to 0, so no conversion is necessary.) */ 2731 /* An example of why numeric conversion is necessary: When an element with "position:absolute" has an untouched "left" 2732 property, which reverts to "auto", left's value is 0 relative to its parent element, but is often non-zero relative 2733 to its *containing* (not parent) element, which is the nearest "position:relative" ancestor or the viewport (and always the viewport in the case of "position:fixed"). */ 2734 if (computedValue === "auto" && /^(top|right|bottom|left)$/i.test(property)) { 2735 var position = computePropertyValue(element, "position"); /* GET */ 2736 2737 /* For absolute positioning, jQuery's $.position() only returns values for top and left; 2738 right and bottom will have their "auto" value reverted to 0. */ 2739 /* Note: A jQuery object must be created here since jQuery doesn't have a low-level alias for $.position(). 2740 Not a big deal since we're currently in a GET batch anyway. */ 2741 if (position === "fixed" || (position === "absolute" && /top|left/i.test(property))) { 2742 /* Note: jQuery strips the pixel unit from its returned values; we re-add it here to conform with computePropertyValue's behavior. */ 2743 computedValue = $(element).position()[property] + "px"; /* GET */ 2744 } 2745 } 2746 2747 return computedValue; 2748 } 2749 2750 var propertyValue; 2751 2752 /* If this is a hooked property (e.g. "clipLeft" instead of the root property of "clip"), 2753 extract the hook's value from a normalized rootPropertyValue using CSS.Hooks.extractValue(). */ 2754 if (CSS.Hooks.registered[property]) { 2755 var hook = property, 2756 hookRoot = CSS.Hooks.getRoot(hook); 2757 2758 /* If a cached rootPropertyValue wasn't passed in (which Velocity always attempts to do in order to avoid requerying the DOM), 2759 query the DOM for the root property's value. */ 2760 if (rootPropertyValue === undefined) { 2761 /* Since the browser is now being directly queried, use the official post-prefixing property name for this lookup. */ 2762 rootPropertyValue = CSS.getPropertyValue(element, CSS.Names.prefixCheck(hookRoot)[0]); /* GET */ 2763 } 2764 2765 /* If this root has a normalization registered, peform the associated normalization extraction. */ 2766 if (CSS.Normalizations.registered[hookRoot]) { 2767 rootPropertyValue = CSS.Normalizations.registered[hookRoot]("extract", element, rootPropertyValue); 2768 } 2769 2770 /* Extract the hook's value. */
2771 propertyValue = CSS.Hooks.extractValue(hook, rootPropertyValue); 2772 2773 /* If this is a normalized property (e.g. "opacity" becomes "filter" in <=IE8) or "translateX" becomes "transform"), 2774 normalize the property's name and value, and handle the special case of transforms. */ 2775 /* Note: Normalizing a property is mutually exclusive from hooking a property since hook-extracted values are strictly 2776 numerical and therefore do not require normalization extraction. */ 2777 } else if (CSS.Normalizations.registered[property]) { 2778 var normalizedPropertyName, 2779 normalizedPropertyValue; 2780 2781 normalizedPropertyName = CSS.Normalizations.registered[property]("name", element); 2782 2783 /* Transform values are calculated via normalization extraction (see below), which checks against the element's transformCache. 2784 At no point do transform GETs ever actually query the DOM; initial stylesheet values are never processed. 2785 This is because parsing 3D transform matrices is not always accurate and would bloat our codebase; 2786 thus, normalization extraction defaults initial transform values to their zero-values (e.g. 1 for scaleX and 0 for translateX). */ 2787 if (normalizedPropertyName !== "transform") { 2788 normalizedPropertyValue = computePropertyValue(element, CSS.Names.prefixCheck(normalizedPropertyName)[0]); /* GET */ 2789 2790 /* If the value is a CSS null-value and this property has a hook template, use that zero-value template so that hooks can be extracted from it. */ 2791 if (CSS.Values.isCSSNullValue(normalizedPropertyValue) && CSS.Hooks.templates[property]) { 2792 normalizedPropertyValue = CSS.Hooks.templates[property][1]; 2793 } 2794 } 2795 2796 propertyValue = CSS.Normalizations.registered[property]("extract", element, normalizedPropertyValue); 2797 } 2798 2799 /* If a (numeric) value wasn't produced via hook extraction or normalization, query the DOM. */ 2800 if (!/^[\d-]/.test(propertyValue)) { 2801 /* For SVG elements, dimensional properties (which SVGAttribute() detects) are tweened via 2802 their HTML attribute values instead of their CSS style values. */ 2803 if (Data(element) && Data(element).isSVG && CSS.Names.SVGAttribute(property)) { 2804 /* Since the height/width attribute values must be set manually, they don't reflect computed values. 2805 Thus, we use use getBBox() to ensure we always get values for elements with undefined height/width attributes. */ 2806 if (/^(height|width)$/i.test(property)) { 2807 propertyValue = element.getBBox()[property]; 2808 /* Otherwise, access the attribute value directly. */ 2809 } else { 2810 propertyValue = element.getAttribute(property); 2811 } 2812 } else { 2813 propertyValue = computePropertyValue(element, CSS.Names.prefixCheck(property)[0]); /* GET */ 2814 } 2815 } 2816 2817 /* Since property lookups are for animation purposes (which entails computing the numeric delta between start and end values), 2818 convert CSS null-values to an integer of value 0. */ 2819 if (CSS.Values.isCSSNullValue(propertyValue)) { 2820 propertyValue = 0; 2821 } 2822 2823 if (Velocity.debug >= 2) console.log("Get " + property + ": " + propertyValue); 2824 2825 return propertyValue; 2826 }, 2827 2828 /* The singular setPropertyValue, which routes the logic for all normalizations, hooks, and standard CSS properties. */ 2829 setPropertyValue: function(element, property, propertyValue, rootPropertyValue, scrollData) { 2830 var propertyName = property; 2831 2832 /* In order to be subjected to call options and element queueing, scroll animation is routed through Velocity as if it were a standard CSS property. */ 2833 if (property === "scroll") { 2834 /* If a container option is present, scroll the container instead of the browser window. */ 2835 if (scrollData.container) { 2836 scrollData.container["scroll" + scrollData.direction] = propertyValue; 2837 /* Otherwise, Velocity defaults to scrolling the browser window. */ 2838 } else { 2839 if (scrollData.direction === "Left") { 2840 window.scrollTo(propertyValue, scrollData.alternateValue); 2841 } else { 2842 window.scrollTo(scrollData.alternateValue, propertyValue); 2843 } 2844 } 2845 } else { 2846 /* Transforms (translateX, rotateZ, etc.) are applied to a per-element transformCache object, which is manually flushed via flushTransformCache(). 2847 Thus, for now, we merely cache transforms being SET. */ 2848 if (CSS.Normalizations.registered[property] && CSS.Normalizations.registered[property]("name", element) === "transform") { 2849 /* Perform a normalization injection. */ 2850 /* Note: The normalization logic handles the transformCache updating. */ 2851 CSS.Normalizations.registered[property]("inject", element, propertyValue); 2852 2853 propertyName = "transform"; 2854 propertyValue = Data(element).transformCache[property]; 2855 } else { 2856 /* Inject hooks. */ 2857 if (CSS.Hooks.registered[property]) { 2858 var hookName = property, 2859 hookRoot = CSS.Hooks.getRoot(property); 2860 2861 /* If a cached rootPropertyValue was not provided, query the DOM for the hookRoot's current value. */ 2862 rootPropertyValue = rootPropertyValue || CSS.getPropertyValue(element, hookRoot); /* GET */ 2863 2864 propertyValue = CSS.Hooks.injectValue(ho
2864okName, propertyValue, rootPropertyValue); 2865 property = hookRoot; 2866 } 2867 2868 /* Normalize names and values. */ 2869 if (CSS.Normalizations.registered[property]) { 2870 propertyValue = CSS.Normalizations.registered[property]("inject", element, propertyValue); 2871 property = CSS.Normalizations.registered[property]("name", element); 2872 } 2873 2874 /* Assign the appropriate vendor prefix before performing an official style update. */ 2875 propertyName = CSS.Names.prefixCheck(property)[0]; 2876 2877 /* A try/catch is used for IE<=8, which throws an error when "invalid" CSS values are set, e.g. a negative width. 2878 Try/catch is avoided for other browsers since it incurs a performance overhead. */ 2879 if (IE <= 8) { 2880 try { 2881 element.style[propertyName] = propertyValue; 2882 } catch (error) { if (Velocity.debug) console.log("Browser does not support [" + propertyValue + "] for [" + propertyName + "]"); } 2883 /* SVG elements have their dimensional properties (width, height, x, y, cx, etc.) applied directly as attributes instead of as styles. */ 2884 /* Note: IE8 does not support SVG elements, so it's okay that we skip it for SVG animation. */ 2885 } else if (Data(element) && Data(element).isSVG && CSS.Names.SVGAttribute(property)) { 2886 /* Note: For SVG attributes, vendor-prefixed property names are never used. */ 2887 /* Note: Not all CSS properties can be animated via attributes, but the browser won't throw an error for unsupported properties. */ 2888 element.setAttribute(property, propertyValue); 2889 } else { 2890 element.style[propertyName] = propertyValue; 2891 } 2892 2893 if (Velocity.debug >= 2) console.log("Set " + property + " (" + propertyName + "): " + propertyValue); 2894 } 2895 } 2896 2897 /* Return the normalized property name and value in case the caller wants to know how these values were modified before being applied to the DOM. */ 2898 return [ propertyName, propertyValue ]; 2899 }, 2900 2901 /* To increase performance by batching transform updates into a single SET, transforms are not directly applied to an element until flushTransformCache() is called. */ 2902 /* Note: Velocity applies transform properties in the same order that they are chronogically introduced to the element's CSS styles. */ 2903 flushTransformCache: function(element) { 2904 var transformString = ""; 2905 2906 /* Certain browsers require that SVG transforms be applied as an attribute. However, the SVG transform attribute takes a modified version of CSS's transform string 2907 (units are dropped and, except for skewX/Y, subproperties are merged into their master property -- e.g. scaleX and scaleY are merged into scale(X Y). */ 2908 if ((IE || (Velocity.State.isAndroid && !Velocity.State.isChrome)) && Data(element).isSVG) { 2909 /* Since transform values are stored in their parentheses-wrapped form, we use a helper function to strip out their numeric values. 2910 Further, SVG transform properties only take unitless (representing pixels) values, so it's okay that parseFloat() strips the unit suffixed to the float value. */ 2911 function getTransformFloat (transformProperty) { 2912 return parseFloat(CSS.getPropertyValue(element, transformProperty)); 2913 } 2914 2915 /* Create an object to organize all the transforms that we'll apply to the SVG element. To keep the logic simple, 2916 we process *all* transform properties -- even those that may not be explicitly applied (since they default to their zero-values anyway). */ 2917 var SVGTransforms = { 2918 translate: [ getTransformFloat("translateX"), getTransformFloat("translateY") ], 2919 skewX: [ getTransformFloat("skewX") ], skewY: [ getTransformFloat("skewY") ],
vendor: 6,513 bytes, lines 2920-3049
2920 /* If the scale property is set (non-1), use that value for the scaleX and scaleY values 2921 (this behavior mimics the result of animating all these properties at once on HTML elements). */ 2922 scale: getTransformFloat("scale") !== 1 ? [ getTransformFloat("scale"), getTransformFloat("scale") ] : [ getTransformFloat("scaleX"), getTransformFloat("scaleY") ], 2923 /* Note: SVG's rotate transform takes three values: rotation degrees followed by the X and Y values 2924 defining the rotation's origin point. We ignore the origin values (default them to 0). */ 2925 rotate: [ getTransformFloat("rotateZ"), 0, 0 ] 2926 }; 2927 2928 /* Iterate through the transform properties in the user-defined property map order. 2929 (This mimics the behavior of non-SVG transform animation.) */ 2930 $.each(Data(element).transformCache, function(transformName) { 2931 /* Except for with skewX/Y, revert the axis-specific transform subproperties to their axis-free master 2932 properties so that they match up with SVG's accepted transform properties. */ 2933 if (/^translate/i.test(transformName)) { 2934 transformName = "translate"; 2935 } else if (/^scale/i.test(transformName)) { 2936 transformName = "scale"; 2937 } else if (/^rotate/i.test(transformName)) { 2938 transformName = "rotate"; 2939 } 2940 2941 /* Check that we haven't yet deleted the property from the SVGTransforms container. */ 2942 if (SVGTransforms[transformName]) { 2943 /* Append the transform property in the SVG-supported transform format. As per the spec, surround the space-delimited values in parentheses. */ 2944 transformString += transformName + "(" + SVGTransforms[transformName].join(" ") + ")" + " "; 2945 2946 /* After processing an SVG transform property, delete it from the SVGTransforms container so we don't 2947 re-insert the same master property if we encounter another one of its axis-specific properties. */ 2948 delete SVGTransforms[transformName]; 2949 } 2950 }); 2951 } else { 2952 var transformValue, 2953 perspective; 2954 2955 /* Transform properties are stored as members of the transformCache object. Concatenate all the members into a string. */ 2956 $.each(Data(element).transformCache, function(transformName) { 2957 transformValue = Data(element).transformCache[transformName]; 2958 2959 /* Transform's perspective subproperty must be set first in order to take effect. Store it temporarily. */ 2960 if (transformName === "transformPerspective") { 2961 perspective = transformValue; 2962 return true; 2963 } 2964 2965 /* IE9 only supports one rotation type, rotateZ, which it refers to as "rotate". */ 2966 if (IE === 9 && transformName === "rotateZ") { 2967 transformName = "rotate"; 2968 } 2969 2970 transformString += transformName + transformValue + " "; 2971 }); 2972 2973 /* If present, set the perspective subproperty first. */ 2974 if (perspective) { 2975 transformString = "perspective" + perspective + " " + transformString; 2976 } 2977 } 2978 2979 CSS.setPropertyValue(element, "transform", transformString); 2980 } 2981 }; 2982 2983 /* Register hooks and normalizations. */ 2984 CSS.Hooks.register(); 2985 CSS.Normalizations.register(); 2986 2987 /* Allow hook setting in the same fashion as jQuery's $.css(). */ 2988 Velocity.hook = function (elements, arg2, arg3) { 2989 var value = undefined; 2990 2991 elements = sanitizeElements(elements); 2992 2993 $.each(elements, function(i, element) { 2994 /* Initialize Velocity's per-element data cache if this element hasn't previously been animated. */ 2995 if (Data(element) === undefined) { 2996 Velocity.init(element); 2997 } 2998 2999 /* Get property value. If an element set was passed in, only return the value for the first element. */ 3000 if (arg3 === undefined) { 3001 if (value === undefined) { 3002 value = Velocity.CSS.getPropertyValue(element, arg2); 3003 } 3004 /* Set property value. */ 3005 } else { 3006 /* sPV returns an array of the normalized propertyName/propertyValue pair used to update the DOM. */ 3007 var adjustedSet = Velocity.CSS.setPropertyValue(element, arg2, arg3); 3008 3009 /* Transform properties don't automatically set. They have to be flushed to the DOM. */ 3010 if (adjustedSet[0] === "transform") { 3011 Velocity.CSS.flushTransformCache(element); 3012 } 3013 3014 value = adjustedSet; 3015 } 3016 }); 3017 3018 return value; 3019 }; 3020 3021 /***************** 3022 Animation 3023 *****************/ 3024 3025 var animate = function() { 3026 3027 /****************** 3028 Call Chain 3029 ******************/ 3030 3031 /* Logic for determining what to return to the call stack when exiting out of Velocity. */ 3032 function getChain () { 3033 /* If we are using the utility function, attempt to return this call's promise. If no promise library was detected, 3034 default to null instead of returning the targeted elements so that utility function's return value is standardized. */ 3035 if (isUtility) { 3036 return promiseData.promise || null; 3037 /* Otherwise, if we're using $.fn, return the jQuery-/Zepto-wrapped element set. */ 3038 } else { 3039 return elementsWrapped; 3040 } 3041 } 3042 3043 /************************* 3044 Arguments Assignment 3045 *************************/ 3046 3047 /* To allow for expressive CoffeeScript code, Velocity supports an alternative syntax in which "properties" and "options" 3048 objects are defined on a container object that's passed in as Velocity's sole argument. */ 3049 /* Note: Some browsers automatically populate arguments with a "properties" object. We detect it by checking for its default "n
3049ames" property. */ 3050 var syntacticSugar = (arguments[0] && (($.isPlainObject(arguments[0].properties) && !arguments[0].properties.names) || Type.isString(arguments[0].properties))), 3051 /* Whether Velocity was called via the utility function (as opposed to on a jQuery/Zepto object). */ 3052 isUtility, 3053 /* When Velocity is called via the utility function ($.Velocity()/Velocity()), elements are explicitly 3054 passed in as the first parameter. Thus, argument positioning varies. We normalize them here. */ 3055 elementsWrapped, 3056 argumentIndex; 3057 3058 var elements, 3059 propertiesMap, 3060 options; 3061 3062 /* Detect jQuery/Zepto elements being animated via the $.fn method. */ 3063 if (Type.isWrapped(this)) { 3064 isUtility = false; 3065 3066 argumentIndex = 0; 3067 elements = this; 3068 elementsWrapped = this; 3069 /* Otherwise, raw elements are being animated via the utility function. */ 3070 } else { 3071 isUtility = true; 3072 3073 argumentIndex = 1; 3074 elements = syntacticSugar ? arguments[0].elements : arguments[0]; 3075 } 3076 3077 elements = sanitizeElements(elements); 3078 3079 if (!elements) { 3080 return; 3081 } 3082 3083 if (syntacticSugar) { 3084 propertiesMap = arguments[0].properties; 3085 options = arguments[0].options; 3086 } else { 3087 propertiesMap = arguments[argumentIndex]; 3088 options = arguments[argumentIndex + 1]; 3089 } 3090 3091 /* The length of the element set (in the form of a nodeList or an array of elements) is defaulted to 1 in case a 3092 single raw DOM element is passed in (which doesn't contain a length property). */ 3093 var elementsLength = elements.length, 3094 elementsIndex = 0; 3095 3096 /*************************** 3097 Argument Overloading 3098 ***************************/ 3099 3100 /* Support is included for jQuery's argument overloading: $.animate(propertyMap [, duration] [, easing] [, complete]). 3101 Overloading is detected by checking for the absence of an object being passed into options. */ 3102 /* Note: The stop action does not accept animation options, and is therefore excluded from this check. */ 3103 if (propertiesMap !== "stop" && !$.isPlainObject(options)) { 3104 /* The utility function shifts all arguments one position to the right, so we adjust for that offset. */ 3105 var startingArgumentPosition = argumentIndex + 1; 3106 3107 options = {}; 3108 3109 /* Iterate through all options arguments */ 3110 for (var i = startingArgumentPosition; i < arguments.length; i++) { 3111 /* Treat a number as a duration. Parse it out. */ 3112 /* Note: The following RegEx will return true if passed an array with a number as its first item. 3113 Thus, arrays are skipped from this check. */ 3114 if (!Type.isArray(arguments[i]) && (/^(fast|normal|slow)$/i.test(arguments[i]) || /^\d/.test(arguments[i]))) { 3115 options.duration = arguments[i]; 3116 /* Treat strings and arrays as easings. */ 3117 } else if (Type.isString(arguments[i]) || Type.isArray(arguments[i])) { 3118 options.easing = arguments[i]; 3119 /* Treat a function as a complete callback. */ 3120 } else if (Type.isFunction(arguments[i])) { 3121 options.complete = arguments[i]; 3122 } 3123 } 3124 } 3125 3126 /*************** 3127 Promises 3128 ***************/ 3129 3130 var promiseData = { 3131 promise: null, 3132 resolver: null, 3133 rejecter: null 3134 }; 3135 3136 /* If this call was made via the utility function (which is the default method of invocation when jQuery/Zepto are not being used), and if 3137 promise support was detected, create a promise object for this call and store references to its resolver and rejecter methods. The resolve 3138 method is used when a call completes naturally or is prematurely stopped by the user. In both cases, completeCall() handles the associated 3139 call cleanup and promise resolving logic. The reject method is used when an invali
3139d set of arguments is passed into a Velocity call. */ 3140 /* Note: Velocity employs a call-based queueing architecture, which means that stopping an animating element actually stops the full call that 3141 triggered it -- not that one element exclusively. Similarly, there is one promise per call, and all elements targeted by a Velocity call are 3142 grouped together for the purposes of resolving and rejecting a promise. */ 3143 if (isUtility && Velocity.Promise) { 3144 promiseData.promise = new Velocity.Promise(function (resolve, reject) { 3145 promiseData.resolver = resolve; 3146 promiseData.rejecter = reject; 3147 }); 3148 } 3149 3150 /********************* 3151 Action Detection 3152 *********************/ 3153 3154 /* Velocity's behavior is categorized into "actions": Elements can either be specially scrolled into view, 3155 or they can be started, stopped, or reversed. If a literal or referenced properties map is passed in as Velocity's 3156 first argument, the associated action is "start". Alternatively, "scroll", "reverse", or "stop" can be passed in instead of a properties map. */ 3157 var action; 3158 3159 switch (propertiesMap) { 3160 case "scroll": 3161 action = "scroll"; 3162 break; 3163 3164 case "reverse": 3165 action = "reverse"; 3166 break; 3167 3168 case "stop": 3169 /******************* 3170 Action: Stop 3171 *******************/ 3172 3173 /* Clear the currently-active delay on each targeted element. */ 3174 $.each(elements, function(i, element) { 3175 if (Data(element) && Data(element).delayTimer) { 3176 /* Stop the timer from triggering its cached next() function. */ 3177 clearTimeout(Data(element).delayTimer.setTimeout); 3178 3179 /* Manually call the next() function so that the subsequent queue items can progress. */ 3180 if (Data(element).delayTimer.next) { 3181 Data(element).delayTimer.next(); 3182 } 3183 3184 delete Data(element).delayTimer; 3185 } 3186 }); 3187 3188 var callsToStop = []; 3189 3190 /* When the stop action is triggered, the elements' currently active call is immediately stopped. The active call might have 3191 been applied to multiple elements, in which case all of the call's elements will be subjected to stopping. When an element 3192 is stopped, the next item in its animation queue is immediately triggered. */ 3193 /* An additional argument may be passed in to clear an element's remaining queued calls. Either true (which defaults to the "fx" queue) 3194 or a custom queue string can be passed in. */ 3195 /* Note: The stop command runs prior to Queueing since its behavior is intended to take effect *immediately*, 3196 regardless of the element's current queue state. */ 3197 3198 /* Iterate through every active call. */ 3199 $.each(Velocity.State.calls, function(i, activeCall) { 3200 /* Inactive calls are set to false by the logic inside completeCall(). Skip them. */ 3201 if (activeCall) { 3202 /* Iterate through the active call's targeted elements. */ 3203 $.each(activeCall[1], function(k, activeElement) { 3204 var queueName = Type.isString(options) ? options : ""; 3205 3206 if (options !== undefined && activeCall[2].queue !== queueName) { 3207 return true; 3208 } 3209 3210 /* Iterate through the calls targeted by the stop command. */ 3211 $.each(elements, function(l, element) { 3212 /* Check that this call was applied to the target element. */ 3213 if (element === activeElement) { 3214 /* Optionally clear the remaining queued calls. */ 3215 if (options !== undefined) { 3216 /* Iterate through the items in the element's queue. */ 3217 $.each($.queue(element, queueName), function(_, item) { 3218 /* The queue array can contain an "inprogress" string, which we skip. */ 3219 if (Type.isFunction(item)) { 3220 /* Pass the item's callback a flag indicating that we want to abort from the queue call. 3221 (Specifically, the queue will resolve the call's associated promise then abort.) */ 3222 item(null, true); 3223 } 3224 }); 3225 3226 /* Clearing the $.queue() array is achieved by resetting it to []. */ 3227 $.queue(element, queueName, []); 3228 } 3229 3230 if (Data(element) && queueName === "") { 3231 /* Since "reverse" uses cached start values (the previous call's endValues), 3232 these values must be changed to reflect the final value that the elements were actually tweened to. */ 3233 $.each(Data(element).tweensContainer, function(m, activeTween) { 3234 activeTween.endValue = activeTween.currentValue; 3235 }); 3236 } 3237 3238 callsToStop.push(i); 3239 } 3240 }); 3241 }); 3242 } 3243 }); 3244 3245 /* Prematurely call completeCall() on each matched active call, passing an additional flag to indicate 3246 that the complete callback and display:none setting should be skipped since we're completing prematurely. */ 3247 $.each(callsToStop, function(i, j) { 3248 completeCall(j, true); 3249 }); 3250 3251 if (promiseData.promise) { 3252 /* Immediately resolve the promise associated with this stop call since stop runs synchronously. */ 3253 promiseData.resolver(elements); 3254 } 3255 3256 /* Since we're stopping, and not proceeding with queueing, exit out of Velocity. */ 3257 return getChain(); 3258 3259 default: 3260 /* Treat a non-empty plain object as a literal properties map. */ 3261 if ($.isPlainObject(propertiesMap) && !Type.isEmptyObject(propertiesMap)) { 3262 action = "start"; 3263 3264 /**************** 3265 Redirects 3266 ****************/ 3267 3268 /* Check if a string matches a registered redirect (see Redirects above). */ 3269 } else if (Type.isString(propertiesMap) && Velocity.Redirects[propertiesMap]) { 3270 var opts = $.extend({}, options), 3271 durationOriginal = opts.duration, 3272 delayOriginal = opts.delay || 0; 3273 3274 /* If the backwards option was passed in, reverse the element set so that elements animate from the last to the first. */ 3275 if (opts.backwards === true) { 3276 elements = $.extend(true, [], elements).reverse(); 3277 } 3278 3279 /* Individually trigger the redirect for each element in the set to prevent users from having to handle iteration logic in their redirect. */ 3280 $.each(elements, function(elementIndex, element) { 3281 /* If the stagger option was passed in, successively delay each element by the stagger value (in ms). Retain the original delay value. */ 3282 if (parseFloat(opts.stagger)) {
vendor: 18,569 bytes, lines 3283-3589
3283 opts.delay = delayOriginal + (parseFloat(opts.stagger) * elementIndex); 3284 } else if (Type.isFunction(opts.stagger)) { 3285 opts.delay = delayOriginal + opts.stagger.call(element, elementIndex, elementsLength); 3286 } 3287 3288 /* If the drag option was passed in, successively increase/decrease (depending on the presense of opts.backwards) 3289 the duration of each element's animation, using floors to prevent producing very short durations. */ 3290 if (opts.drag) { 3291 /* Default the duration of UI pack effects (callouts and transitions) to 1000ms instead of the usual default duration of 400ms. */ 3292 opts.duration = parseFloat(durationOriginal) || (/^(callout|transition)/.test(propertiesMap) ? 1000 : DURATION_DEFAULT); 3293 3294 /* For each element, take the greater duration of: A) animation completion percentage relative to the original duration, 3295 B) 75% of the original duration, or C) a 200ms fallback (in case duration is already set to a low value). 3296 The end result is a baseline of 75% of the redirect's duration that increases/decreases as the end of the element set is approached. */ 3297 opts.duration = Math.max(opts.duration * (opts.backwards ? 1 - elementIndex/elementsLength : (elementIndex + 1) / elementsLength), opts.duration * 0.75, 200); 3298 } 3299 3300 /* Pass in the call's opts object so that the redirect can optionally extend it. It defaults to an empty object instead of null to 3301 reduce the opts checking logic required inside the redirect. */ 3302 Velocity.Redirects[propertiesMap].call(element, element, opts || {}, elementIndex, elementsLength, elements, promiseData.promise ? promiseData : undefined); 3303 }); 3304 3305 /* Since the animation logic resides within the redirect's own code, abort the remainder of this call. 3306 (The performance overhead up to this point is virtually non-existant.) */ 3307 /* Note: The jQuery call chain is kept intact by returning the complete element set. */ 3308 return getChain(); 3309 } else { 3310 var abortError = "Velocity: First argument (" + propertiesMap + ") was not a property map, a known action, or a registered redirect. Aborting."; 3311 3312 if (promiseData.promise) { 3313 promiseData.rejecter(new Error(abortError)); 3314 } else { 3315 console.log(abortError); 3316 } 3317 3318 return getChain(); 3319 } 3320 } 3321 3322 /************************** 3323 Call-Wide Variables 3324 **************************/ 3325 3326 /* A container for CSS unit conversion ratios (e.g. %, rem, and em ==> px) that is used to cache ratios across all elements 3327 being animated in a single Velocity call. Calculating unit ratios necessitates DOM querying and updating, and is therefore 3328 avoided (via caching) wherever possible. This container is call-wide instead of page-wide to avoid the risk of using stale 3329 conversion metrics across Velocity animations that are not immediately consecutively chained. */ 3330 var callUnitConversionData = { 3331 lastParent: null, 3332 lastPosition: null, 3333 lastFontSize: null, 3334 lastPercentToPxWidth: null, 3335 lastPercentToPxHeight: null, 3336 lastEmToPx: null, 3337 remToPx: null, 3338 vwToPx: null, 3339 vhToPx: null 3340 }; 3341 3342 /* A container for all the ensuing tween data and metadata associated with this call. This container gets pushed to the page-wide 3343 Velocity.State.calls array that is processed during animation ticking. */ 3344 var call = []; 3345 3346 /************************ 3347 Element Processing 3348 ************************/ 3349 3350 /* Element processing consists of three parts -- data processing that cannot go stale and data processing that *can* go stale (i.e. third-party style modifications): 3351 1) Pre-Queueing: Element-wide variables, including the element's data storage, are instantiated. Call options are prepared. If triggered, the Stop action is executed. 3352 2) Queueing: The logic that runs once this call has reached its point of execution in the element's $.queue() stack. Most logic is placed here to avoid risking it becoming stale. 3353 3) Pushing: Consolidation of the tween data followed by its push onto the global in-progress calls container. 3354 */ 3355 3356 function processElement () { 3357 3358 /************************* 3359 Part I: Pre-Queueing 3360 *************************/ 3361 3362 /*************************** 3363 Element-Wide Variables 3364 ***************************/ 3365 3366 var element = this, 3367 /* The runtime opts object is the extension of the current call's options and Velocity's page-wide option defaults. */ 3368 opts = $.extend({}, Velocity.defaults, options), 3369 /* A container for the processed data associated with each property in the propertyMap. 3370 (Each property in the map produces its own "tween".) */ 3371 tweensContainer = {}, 3372 elementUnitConversionData; 3373 3374 /****************** 3375 Element Init 3376 ******************/ 3377 3378 if (Data(element) === undefined) { 3379 Velocity.init(element); 3380 } 3381 3382 /****************** 3383 Option: Delay 3384 ******************/ 3385 3386 /* Since queue:false doesn't respect the item's existing queue, we avoid injecting its delay here (it's set later on). */ 3387 /* Note: Velocity rolls its own delay function since jQuery doesn't have a utility alias for $.fn.delay() 3388 (and thus requires jQuery element creation, which we avoid since its overhead includes DOM querying). */ 3389 if (parseFloat(opts.delay) && opts.queue !== false) { 3390 $.queue(element, opts.queue, function(next) { 3391 /* This is a flag used to indicate to the upcoming completeCall() function that this queue entry was initiated by Velocity. See completeCall() for further details. */ 3392 Velocity.velocityQueueEntryFlag = true; 3393 3394 /* The ensuing queue item (which is assigned to the "next" argument that $.queue() automatically passes in) will be triggered after a setTimeout delay. 3395 The setTimeout is stored so that it can be subjected to clearTimeout() if this animation is prematurely stopped via Velocity's "stop" command. */ 3396 Data(element).delayTimer = { 3397 setTimeout: setTimeout(next, parseFloat(opts.delay)), 3398 next: next 3399 }; 3400 }); 3401 } 3402 3403 /********************* 3404 Option: Duration 3405 *********************/ 3406 3407 /* Support for jQuery's named durations. */ 3408 switch (opts.duration.toString().toLowerCase()) { 3409 case "fast": 3410 opts.duration = 200; 3411 break; 3412 3413 case "normal": 3414 opts.duration = DURATION_DEFAULT; 3415 break; 3416 3417 case "slow": 3418 opts.duration = 600; 3419 break; 3420 3421 default: 3422 /* Remove the potential "ms" suffix and default to 1 if the user is attempting to set a duration of 0 (in order to produce an immediate style change). */ 3423 opts.duration = parseFloat(opts.duration) || 1; 3424 } 3425 3426 /************************ 3427 Global Option: Mock 3428 ************************/ 3429 3430 if (Velocity.mock !== false) { 3431 /* In mock mode, all animations are forced to 1ms so that they occur immediately upon the next rAF tick. 3432 Alternatively, a multiplier can be passed in to time remap all delays and durations. */ 3433 if (Velocity.mock === true) { 3434 opts.duration = opts.delay = 1; 3435 } else { 3436 opts.duration *= parseFloat(Velocity.mock) || 1; 3437 opts.delay *= parseFloat(Velocity.mock) || 1; 3438 } 3439 } 3440 3441 /******************* 3442 Option: Easing 3443 *******************/ 3444 3445 opts.easing = getEasing(opts.easing, opts.duration); 3446 3447 /********************** 3448 Option: Callbacks 3449 **********************/ 3450 3451 /* Callbacks must functions. Otherwise, default to null. */ 3452 if (opts.begin && !Type.isFunction(opts.begin)) { 3453 opts.begin = null; 3454 } 3455 3456 if (opts.progress && !Type.isFunction(opts.progress)) { 3457 opts.progress = null; 3458 } 3459 3460 if (opts.complete && !Type.isFunction(opts.complete)) { 3461 opts.complete = null; 3462 } 3463 3464 /********************************* 3465 Option: Display & Visibility 3466 *********************************/ 3467 3468 /* Refer to Velocity's documentation (VelocityJS.org/#displayAndVisibility) for a description of the display and visibility options' behavior. */ 3469 /* Note: We strictly check for undefined instead of falsiness because display accepts an empty string value. */ 3470 if (opts.display !== undefined && opts.display !== null) { 3471 opts.display = opts.display.toString().toLowerCase(); 3472 3473 /* Users can pass in a special "auto" value to instruct Velocity to set the element to its default display value. */ 3474 if (opts.display === "auto") { 3475 opts.display = Velocity.CSS.Values.getDisplayType(element); 3476 } 3477 } 3478 3479 if (opts.visibility !== undefined && opts.visibility !== null) { 3480 opts.visibility = opts.visibility.toString().toLowerCase(); 3481 } 3482 3483 /********************** 3484 Option: mobileHA 3485 **********************/ 3486 3487 /* When set to true, and if this is a mobile device, mobileHA automatically enables hardware acceleration (via a null transform hack) 3488 on animating elements. HA is removed from the element at the completion of its animation. */ 3489 /* Note: Android Gingerbread doesn't support HA. If a null transform hack (mobileHA) is in fact set, it will prevent other tranform subproperties from taking effect. */ 3490 /* Note: You can read more about the use of mobileHA in Velocity's documentation: VelocityJS.org/#mobileHA. */ 3491 opts.mobileHA = (opts.mobileHA && Velocity.State.isMobile && !Velocity.State.isGingerbread); 3492 3493 /*********************** 3494 Part II: Queueing 3495 ***********************/ 3496 3497 /* When a set of elements is targeted by a Velocity call, the set is broken up and each element has the current Velocity call individually queued onto it. 3498 In this way, each element's existing queue is respected; some elements may already be animating and accordingly should not have this current Velocity call triggered immediately. */ 3499 /* In each queue, tween data is processed for each animating property then pushed onto the call-wide calls array. When the last element in the set has had its tweens processed, 3500 the call array is pushed to Velocity.State.calls for live processing by the requestAnimationFrame tick. */ 3501 function buildQueue (next) { 3502 3503 /******************* 3504 Option: Begin 3505 *******************/ 3506 3507 /* The begin callback is fired once per call -- not once per elemenet -- and is passed the full raw DOM element set as both its context and its first argument. */ 3508 if (opts.begin && elementsIndex === 0) { 3509 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 3510 try { 3511 opts.begin.call(elements, elements); 3512 } catch (error) { 3513 setTimeout(function() { throw error; }, 1); 3514 } 3515 } 3516 3517 /***************************************** 3518 Tween Data Construction (for Scroll) 3519 *****************************************/ 3520 3521 /* Note: In order to be subjected to chaining and animation options, scroll's tweening is routed through Velocity as if it were a standard CSS property animation. */ 3522 if (action === "scroll") { 3523 /* The scroll action uniquely takes an optional "offset" option -- specified in pixels -- that offsets the targeted scroll position. */ 3524 var scrollDirection = (/^x$/i.test(opts.axis) ? "Left" : "Top"), 3525 scrollOffset = parseFloat(opts.offset) || 0, 3526 scrollPositionCurrent, 3527 scrollPositionCurrentAlternate, 3528 scrollPositionEnd; 3529 3530 /* Scroll also uniquely takes an optional "container" option, which indicates the parent element that should be scrolled -- 3531 as opposed to the browser window itself. This is useful for scrolling toward an element that's inside an overflowing parent element. */ 3532 if (opts.container) { 3533 /* Ensure that either a jQuery object or a raw DOM element was passed in. */ 3534 if (Type.isWrapped(opts.container) || Type.isNode(opts.container)) { 3535 /* Extract the raw DOM element from the jQuery wrapper. */ 3536 opts.container = opts.container[0] || opts.container; 3537 /* Note: Unlike other properties in Velocity, the browser's scroll position is never cached since it so frequently changes 3538 (due to the user's natural interaction with the page). */ 3539 scrollPositionCurrent = opts.container["scroll" + scrollDirection]; /* GET */ 3540 3541 /* $.position() values are relative to the container's currently viewable area (without taking into account the container's true dimensions 3542 -- say, for example, if the container was not overflowing). Thus, the scroll end value is the sum of the child element's position *and* 3543 the scroll container's current scroll position. */ 3544 /* Note: jQuery does not offer a utility alias for $.position(), so we have to incur jQuery object conversion here. 3545 This syncs up with an ensuing batch of GETs, so it fortunately does not trigger layout thrashing. */ 3546 scrollPositionEnd = (scrollPositionCurrent + $(element).position()[scrollDirection.toLowerCase()]) + scrollOffset; /* GET */ 3547 /* If a value other than a jQuery object or a raw DOM element was passed in, default to null so that this option is ignored. */ 3548 } else { 3549 opts.container = null; 3550 } 3551 } else { 3552 /* If the window itself is being scrolled -- not a containing element -- perform a live scroll position lookup using 3553 the appropriate cached property names (which differ based on browser type). */ 3554 scrollPositionCurrent = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + scrollDirection]]; /* GET */ 3555 /* When scrolling the browser window, cache the alternate axis's current value since window.scrollTo() doesn't let us change only one value at a time. */ 3556 scrollPositionCurrentAlternate = Velocity.State.scrollAnchor[Velocity.State["scrollProperty" + (scrollDirection === "Left" ? "Top" : "Left")]]; /* GET */ 3557 3558 /* Unlike $.position(), $.offset() values are relative to the browser window's true dimensions -- not merely its currently viewable area -- 3559 and therefore end values do not need to be compounded onto current values. */ 3560 scrollPositionEnd = $(element).offset()[scrollDirection.toLowerCase()] + scrollOffset; /* GET */ 3561 } 3562 3563 /* Since there's only one format that scroll's associated tweensContainer can take, we create it manually. */ 3564 tweensContainer = { 3565 scroll: { 3566 rootPropertyValue: false, 3567 startValue: scrollPositionCurrent, 3568 currentValue: scrollPositionCurrent, 3569 endValue: scrollPositionEnd, 3570 unitType: "", 3571 easing: opts.easing, 3572 scrollData: { 3573 container: opts.container, 3574 direction: scrollDirection, 3575 alternateValue: scrollPositionCurrentAlternate 3576 } 3577 }, 3578 element: element 3579 }; 3580 3581 if (Velocity.debug) console.log("tweensContainer (scroll): ", tweensContainer.scroll, element); 3582 3583 /****************************************** 3584 Tween Data Construction (for Reverse) 3585 ******************************************/ 3586 3587 /* Reverse acts like a "start" action in that a property map is animated toward. The only difference is 3588 that the property map used for reverse is the inverse of the map used in the previous call. Thus, we manipulate 3589 the previous call to construct our new map: use the previous map's end values as our new map's start values. Copy over all other data. */
3590 /* Note: Reverse can be directly called via the "reverse" parameter, or it can be indirectly triggered via the loop option. (Loops are composed of multiple reverses.) */ 3591 /* Note: Reverse calls do not need to be consecutively chained onto a currently-animating element in order to operate on cached values; 3592 there is no harm to reverse being called on a potentially stale data cache since reverse's behavior is simply defined 3593 as reverting to the element's values as they were prior to the previous *Velocity* call. */ 3594 } else if (action === "reverse") { 3595 /* Abort if there is no prior animation data to reverse to. */ 3596 if (!Data(element).tweensContainer) { 3597 /* Dequeue the element so that this queue entry releases itself immediately, allowing subsequent queue entries to run. */ 3598 $.dequeue(element, opts.queue); 3599 3600 return; 3601 } else { 3602 /********************* 3603 Options Parsing 3604 *********************/ 3605 3606 /* If the element was hidden via the display option in the previous call, 3607 revert display to "auto" prior to reversal so that the element is visible again. */ 3608 if (Data(element).opts.display === "none") { 3609 Data(element).opts.display = "auto"; 3610 } 3611 3612 if (Data(element).opts.visibility === "hidden") { 3613 Data(element).opts.visibility = "visible"; 3614 } 3615 3616 /* If the loop option was set in the previous call, disable it so that "reverse" calls aren't recursively generated. 3617 Further, remove the previous call's callback options; typically, users do not want these to be refired. */ 3618 Data(element).opts.loop = false; 3619 Data(element).opts.begin = null; 3620 Data(element).opts.complete = null; 3621 3622 /* Since we're extending an opts object that has already been extended with the defaults options object, 3623 we remove non-explicitly-defined properties that are auto-assigned values. */ 3624 if (!options.easing) { 3625 delete opts.easing; 3626 } 3627 3628 if (!options.duration) { 3629 delete opts.duration; 3630 } 3631 3632 /* The opts object used for reversal is an extension of the options object optionally passed into this 3633 reverse call plus the options used in the previous Velocity call. */ 3634 opts = $.extend({}, Data(element).opts, opts); 3635 3636 /************************************* 3637 Tweens Container Reconstruction 3638 *************************************/ 3639 3640 /* Create a deepy copy (indicated via the true flag) of the previous call's tweensContainer. */ 3641 var lastTweensContainer = $.extend(true, {}, Data(element).tweensContainer); 3642 3643 /* Manipulate the previous tweensContainer by replacing its end values and currentValues with its start values. */ 3644 for (var lastTween in lastTweensContainer) { 3645 /* In addition to tween data, tweensContainers contain an element property that we ignore here. */ 3646 if (lastTween !== "element") { 3647 var lastStartValue = lastTweensContainer[lastTween].startValue; 3648 3649 lastTweensContainer[lastTween].startValue = lastTweensContainer[lastTween].currentValue = lastTweensContainer[lastTween].endValue; 3650 lastTweensContainer[lastTween].endValue = lastStartValue; 3651 3652 /* Easing is the only option that embeds into the individual tween data (since it can be defined on a per-property basis). 3653 Accordingly, every property's easing value must be updated when an options object is passed in with a reverse call. 3654 The side effect of this extensibility is that all per-property easing values are forcefully reset to the new value. */ 3655 if (!Type.isEmptyObject(options)) { 3656 lastTweensContainer[lastTween].easing = opts.easing; 3657 } 3658 3659 if (Velocity.debug) console.log("reverse tweensContainer (" + lastTween + "): " + JSON.stringify(lastTweensContainer[lastTween]), element); 3660 } 3661 } 3662 3663 tweensContainer = lastTweensContainer; 3664 } 3665 3666 /***************************************** 3667 Tween Data Construction (for Start) 3668 *****************************************/ 3669 3670 } else if (action === "start") { 3671 3672 /************************* 3673 Value Transferring 3674 *************************/ 3675 3676 /* If this queue entry follows a previous Velocity-initiated queue entry *and* if this entry was created 3677 while the element was in the process of being animated by Velocity, then this current call is safe to use 3678 the end values from the prior call as its start values. Velocity attempts to perform this value transfer 3679 process whenever possible in order to avoid requerying the DOM. */ 3680 /* If values aren't transferred from a prior call and start values were not forcefed by the user (more on this below), 3681 then the DOM is queried for the element's current values as a last resort. */ 3682 /* Note: Conversely, animation reversal (and looping) *always* perform inter-call value transfers; they never requery the DOM. */ 3683 var lastTweensContainer; 3684 3685 /* The per-element isAnimating flag is used to indicate whether it's safe (i.e. the data isn't stale) 3686 to transfer over end values to use as start values. If it's set to true and there is a previous 3687 Velocity call to pull values from, do so. */ 3688 if (Data(element).tweensContainer && Data(element).isAnimating === true) { 3689 lastTweensContainer = Data(element).tweensContainer; 3690 } 3691 3692 /*************************** 3693 Tween Data Calculation 3694 ***************************/ 3695 3696 /* This function parses property data and defaults endValue, easing, and startValue as appropriate. */ 3697 /* Property map values can either take the form of 1) a single value representing the end value, 3698 or 2) an array in the form of [ endValue, [, easing] [, startValue] ]. 3699 The optional third parameter is a forcefed startValue to be used instead of querying the DOM for 3700 the element's current value. Read Velocity's docmentation to learn more about forcefeeding: VelocityJS.org/#forcefeeding */ 3701 function parsePropertyValue (valueData, skipResolvingEasing) { 3702 var endValue = undefined, 3703 easing = undefined, 3704 startValue = undefined; 3705 3706 /* Handle the array format, which can be structured as one of three potential overloads: 3707 A) [ endValue, easing, startValue ], B) [ endValue, easing ], or C) [ endValue, startValue ] */ 3708 if (Type.isArray(valueData)) { 3709 /* endValue is always the first item in the array. Don't bother validating endValue's value now 3710 since the ensuing property cycling logic does that. */ 3711 endValue = valueData[0]; 3712 3713 /* Two-item array format: If the second item is a number, function, or hex string, treat it as a 3714 start value since easings can only be non-hex strings or arrays. */ 3715 if ((!Type.isArray(valueData[1]) && /^[\d-]/.test(valueData[1])) || Type.isFunction(valueData[1]) || CSS.RegEx.isHex.test(valueData[1])) { 3716 startValue = valueData[1]; 3717 /* Two or three-item array: If the second item is a non-hex string or an array, treat it as an easing. */ 3718 } else if ((Type.isString(valueData[1]) && !CSS.RegEx.isHex.test(valueData[1])) || Type.isArray(valueData[1])) { 3719 easing = skipResolvingEasing ? valueData[1] : getEasing(valueData[1], opts.duration); 3720 3721 /* Don't bother validating startValue's value now since the ensuing property cycling logic inherently does that. */ 3722 if (valueData[2] !== undefined) { 3723 startValue = valueData[2]; 3724 } 3725 } 3726 /* Handle the single-value format. */ 3727 } else { 3728 endValue = valueData; 3729 } 3730 3731 /* Default to the call's easing if a per-property easing type was not defined. */ 3732 if (!skipResolvingEasing) { 3733 easing = easing || opts.easing; 3734 } 3735 3736 /* If functions were passed in as values, pass the function the current element as its context, 3737 plus the element's index and the element set's size as arguments. Then, assign the returned value. */
3738 if (Type.isFunction(endValue)) { 3739 endValue = endValue.call(element, elementsIndex, elementsLength); 3740 } 3741 3742 if (Type.isFunction(startValue)) { 3743 startValue = startValue.call(element, elementsIndex, elementsLength); 3744 } 3745 3746 /* Allow startValue to be left as undefined to indicate to the ensuing code that its value was not forcefed. */ 3747 return [ endValue || 0, easing, startValue ]; 3748 } 3749 3750 /* Cycle through each property in the map, looking for shorthand color properties (e.g. "color" as opposed to "colorRed"). Inject the corresponding 3751 colorRed, colorGreen, and colorBlue RGB component tweens into the propertiesMap (which Velocity understands) and remove the shorthand property. */ 3752 $.each(propertiesMap, function(property, value) { 3753 /* Find shorthand color properties that have been passed a hex string. */ 3754 if (RegExp("^" + CSS.Lists.colors.join("$|^") + "$").test(property)) { 3755 /* Parse the value data for each shorthand. */ 3756 var valueData = parsePropertyValue(value, true), 3757 endValue = valueData[0], 3758 easing = valueData[1], 3759 startValue = valueData[2]; 3760 3761 if (CSS.RegEx.isHex.test(endValue)) { 3762 /* Convert the hex strings into their RGB component arrays. */ 3763 var colorComponents = [ "Red", "Green", "Blue" ], 3764 endValueRGB = CSS.Values.hexToRgb(endValue), 3765 startValueRGB = startValue ? CSS.Values.hexToRgb(startValue) : undefined; 3766 3767 /* Inject the RGB component tweens into propertiesMap. */ 3768 for (var i = 0; i < colorComponents.length; i++) { 3769 var dataArray = [ endValueRGB[i] ]; 3770 3771 if (easing) { 3772 dataArray.push(easing); 3773 } 3774 3775 if (startValueRGB !== undefined) { 3776 dataArray.push(startValueRGB[i]); 3777 } 3778 3779 propertiesMap[property + colorComponents[i]] = dataArray; 3780 } 3781 3782 /* Remove the intermediary shorthand property entry now that we've processed it. */ 3783 delete propertiesMap[property]; 3784 } 3785 } 3786 }); 3787 3788 /* Create a tween out of each property, and append its associated data to tweensContainer. */ 3789 for (var property in propertiesMap) { 3790 3791 /************************** 3792 Start Value Sourcing 3793 **************************/ 3794 3795 /* Parse out endValue, easing, and startValue from the property's data. */ 3796 var valueData = parsePropertyValue(propertiesMap[property]), 3797 endValue = valueData[0], 3798 easing = valueData[1], 3799 startValue = valueData[2]; 3800 3801 /* Now that the original property name's format has been used for the parsePropertyValue() lookup above, 3802 we force the property to its camelCase styling to normalize it for manipulation. */ 3803 property = CSS.Names.camelCase(property); 3804 3805 /* In case this property is a hook, there are circumstances where we will intend to work on the hook's root property and not the hooked subproperty. */ 3806 var rootProperty = CSS.Hooks.getRoot(property), 3807 rootPropertyValue = false;
3808 3809 /* Properties that are not supported by the browser (and do not have an associated normalization) will 3810 inherently produce no style changes when set, so they are skipped in order to decrease animation tick overhead. 3811 Property support is determined via prefixCheck(), which returns a false flag when no supported is detected. */ 3812 /* Note: Since SVG elements have some of their properties directly applied as HTML attributes, 3813 there is no way to check for their explicit browser support, and so we skip skip this check for them. */ 3814 if (!Data(element).isSVG && CSS.Names.prefixCheck(rootProperty)[1] === false && CSS.Normalizations.registered[rootProperty] === undefined) { 3815 if (Velocity.debug) console.log("Skipping [" + rootProperty + "] due to a lack of browser support."); 3816 3817 continue; 3818 } 3819 3820 /* If the display option is being set to a non-"none" (e.g. "block") and opacity (filter on IE<=8) is being 3821 animated to an endValue of non-zero, the user's intention is to fade in from invisible, thus we forcefeed opacity 3822 a startValue of 0 if its startValue hasn't already been sourced by value transferring or prior forcefeeding. */ 3823 if (((opts.display !== undefined && opts.display !== null && opts.display !== "none") || (opts.visibility !== undefined && opts.visibility !== "hidden")) && /opacity|filter/.test(property) && !startValue && endValue !== 0) { 3824 startValue = 0; 3825 } 3826 3827 /* If values have been transferred from the previous Velocity call, extract the endValue and rootPropertyValue 3828 for all of the current call's properties that were *also* animated in the previous call. */ 3829 /* Note: Value transferring can optionally be disabled by the user via the _cacheValues option. */ 3830 if (opts._cacheValues && lastTweensContainer && lastTweensContainer[property]) { 3831 if (startValue === undefined) { 3832 startValue = lastTweensContainer[property].endValue + lastTweensContainer[property].unitType; 3833 } 3834 3835 /* The previous call's rootPropertyValue is extracted from the element's data cache since that's the 3836 instance of rootPropertyValue that gets freshly updated by the tweening process, whereas the rootPropertyValue 3837 attached to the incoming lastTweensContainer is equal to the root property's value prior to any tweening. */ 3838 rootPropertyValue = Data(element).rootPropertyValueCache[rootProperty]; 3839 /* If values were not transferred from a previous Velocity call, query the DOM as needed. */ 3840 } else { 3841 /* Handle hooked properties. */ 3842 if (CSS.Hooks.registered[property]) { 3843 if (startValue === undefined) { 3844 rootPropertyValue = CSS.getPropertyValue(element, rootProperty); /* GET */ 3845 /* Note: The following getPropertyValue() call does not actually trigger a DOM query; 3846 getPropertyValue() will extract the hook from rootPropertyValue. */ 3847 startValue = CSS.getPropertyValue(element, property, rootPropertyValue); 3848 /* If startValue is already defined via forcefeeding, do not query the DOM for the root property's value; 3849 just grab rootProperty's zero-value template from CSS.Hooks. This overwrites the element's actual 3850 root property value (if one is set), but this is acceptable since the primary reason users forcefeed is 3851 to avoid DOM queries, and thus we likewise avoid querying the DOM for the root property's value. */ 3852 } else { 3853 /* Grab this hook's zero-value template, e.g. "0px 0px 0px black". */ 3854 rootPropertyValue = CSS.Hooks.templates[rootProperty][1]; 3855 } 3856 /* Handle non-hooked properties that haven't already been defined via forcefeeding. */ 3857 } else if (startValue === undefined) { 3858 startValue = CSS.getPropertyValue(element, property); /* GET */ 3859 } 3860 } 3861 3862 /************************** 3863 Value Data Extraction 3864 **************************/ 3865 3866 var separatedValue, 3867 endValueUnitType, 3868 startValueUnitType, 3869 operator = false;
vendor: 4,539 bytes, lines 3870-3945
3870 3871 /* Separates a property value into its numeric value and its unit type. */ 3872 function separateValue (property, value) { 3873 var unitType, 3874 numericValue; 3875 3876 numericValue = (value || "0") 3877 .toString() 3878 .toLowerCase() 3879 /* Match the unit type at the end of the value. */ 3880 .replace(/[%A-z]+$/, function(match) { 3881 /* Grab the unit type. */ 3882 unitType = match; 3883 3884 /* Strip the unit type off of value. */ 3885 return ""; 3886 }); 3887 3888 /* If no unit type was supplied, assign one that is appropriate for this property (e.g. "deg" for rotateZ or "px" for width). */ 3889 if (!unitType) { 3890 unitType = CSS.Values.getUnitType(property); 3891 } 3892 3893 return [ numericValue, unitType ]; 3894 } 3895 3896 /* Separate startValue. */ 3897 separatedValue = separateValue(property, startValue); 3898 startValue = separatedValue[0]; 3899 startValueUnitType = separatedValue[1]; 3900 3901 /* Separate endValue, and extract a value operator (e.g. "+=", "-=") if one exists. */ 3902 separatedValue = separateValue(property, endValue); 3903 endValue = separatedValue[0].replace(/^([+-\/*])=/, function(match, subMatch) { 3904 operator = subMatch; 3905 3906 /* Strip the operator off of the value. */ 3907 return ""; 3908 }); 3909 endValueUnitType = separatedValue[1]; 3910 3911 /* Parse float values from endValue and startValue. Default to 0 if NaN is returned. */ 3912 startValue = parseFloat(startValue) || 0; 3913 endValue = parseFloat(endValue) || 0; 3914 3915 /*************************************** 3916 Property-Specific Value Conversion 3917 ***************************************/ 3918 3919 /* Custom support for properties that don't actually accept the % unit type, but where pollyfilling is trivial and relatively foolproof. */ 3920 if (endValueUnitType === "%") { 3921 /* A %-value fontSize/lineHeight is relative to the parent's fontSize (as opposed to the parent's dimensions), 3922 which is identical to the em unit's behavior, so we piggyback off of that. */ 3923 if (/^(fontSize|lineHeight)$/.test(property)) { 3924 /* Convert % into an em decimal value. */ 3925 endValue = endValue / 100; 3926 endValueUnitType = "em"; 3927 /* For scaleX and scaleY, convert the value into its decimal format and strip off the unit type. */ 3928 } else if (/^scale/.test(property)) { 3929 endValue = endValue / 100; 3930 endValueUnitType = ""; 3931 /* For RGB components, take the defined percentage of 255 and strip off the unit type. */ 3932 } else if (/(Red|Green|Blue)$/i.test(property)) { 3933 endValue = (endValue / 100) * 255; 3934 endValueUnitType = ""; 3935 } 3936 } 3937 3938 /*************************** 3939 Unit Ratio Calculation 3940 ***************************/ 3941 3942 /* When queried, the browser returns (most) CSS property values in pixels. Therefore, if an endValue with a unit type of 3943 %, em, or rem is animated toward, startValue must be converted from pixels into the same unit type as endValue in order 3944 for value manipulation logic (increment/decrement) to proceed. Further, if the startValue was forcefed or transferred 3945 from a previous call, startValue may al
3945so not be in pixels. Unit conversion logic therefore consists of two steps: 3946 1) Calculating the ratio of %/em/rem/vh/vw relative to pixels 3947 2) Converting startValue into the same unit of measurement as endValue based on these ratios. */ 3948 /* Unit conversion ratios are calculated by inserting a sibling node next to the target node, copying over its position property, 3949 setting values with the target unit type then comparing the returned pixel value. */ 3950 /* Note: Even if only one of these unit types is being animated, all unit ratios are calculated at once since the overhead 3951 of batching the SETs and GETs together upfront outweights the potential overhead 3952 of layout thrashing caused by re-querying for uncalculated ratios for subsequently-processed properties. */ 3953 /* Todo: Shift this logic into the calls' first tick instance so that it's synced with RAF. */ 3954 function calculateUnitRatios () { 3955 3956 /************************ 3957 Same Ratio Checks 3958 ************************/ 3959 3960 /* The properties below are used to determine whether the element differs sufficiently from this call's 3961 previously iterated element to also differ in its unit conversion ratios. If the properties match up with those 3962 of the prior element, the prior element's conversion ratios are used. Like most optimizations in Velocity, 3963 this is done to minimize DOM querying. */ 3964 var sameRatioIndicators = { 3965 myParent: element.parentNode || document.body, /* GET */ 3966 position: CSS.getPropertyValue(element, "position"), /* GET */ 3967 fontSize: CSS.getPropertyValue(element, "fontSize") /* GET */ 3968 }, 3969 /* Determine if the same % ratio can be used. % is based on the element's position value and its parent's width and height dimensions. */ 3970 samePercentRatio = ((sameRatioIndicators.position === callUnitConversionData.lastPosition) && (sameRatioIndicators.myParent === callUnitConversionData.lastParent)), 3971 /* Determine if the same em ratio can be used. em is relative to the element's fontSize. */ 3972 sameEmRatio = (sameRatioIndicators.fontSize === callUnitConversionData.lastFontSize); 3973 3974 /* Store these ratio indicators call-wide for the next element to compare against. */ 3975 callUnitConversionData.lastParent = sameRatioIndicators.myParent; 3976 callUnitConversionData.lastPosition = sameRatioIndicators.position; 3977 callUnitConversionData.lastFontSize = sameRatioIndicators.fontSize; 3978 3979 /*************************** 3980 Element-Specific Units 3981 ***************************/ 3982 3983 /* Note: IE8 rounds to the nearest pixel when returning CSS values, thus we perform conversions using a measurement 3984 of 100 (instead of 1) to give our ratios a precision of at least 2 decimal values. */ 3985 var measurement = 100, 3986 unitRatios = {}; 3987 3988 if (!sameEmRatio || !samePercentRatio) { 3989 var dummy = Data(element).isSVG ? document.createElementNS("http://www.w3.org/2000/svg", "rect") : document.createElement("div"); 3990 3991 Velocity.init(dummy); 3992 sameRatioIndicators.myParent.appendChild(dummy); 3993 3994 /* To accurately and consistently calculate conversion ratios, the element's cascaded overflow and box-sizing are stripped. 3995 Similarly, since width/height can be artificially constrained by their min-/max- equivalents, these are controlled for as well. */ 3996 /* Note: Overflow must be also be c
3996ontrolled for per-axis since the overflow property overwrites its per-axis values. */ 3997 $.each([ "overflow", "overflowX", "overflowY" ], function(i, property) { 3998 Velocity.CSS.setPropertyValue(dummy, property, "hidden"); 3999 }); 4000 Velocity.CSS.setPropertyValue(dummy, "position", sameRatioIndicators.position); 4001 Velocity.CSS.setPropertyValue(dummy, "fontSize", sameRatioIndicators.fontSize); 4002 Velocity.CSS.setPropertyValue(dummy, "boxSizing", "content-box"); 4003 4004 /* width and height act as our proxy properties for measuring the horizontal and vertical % ratios. */ 4005 $.each([ "minWidth", "maxWidth", "width", "minHeight", "maxHeight", "height" ], function(i, property) { 4006 Velocity.CSS.setPropertyValue(dummy, property, measurement + "%"); 4007 }); 4008 /* paddingLeft arbitrarily acts as our proxy property for the em ratio. */ 4009 Velocity.CSS.setPropertyValue(dummy, "paddingLeft", measurement + "em"); 4010 4011 /* Divide the returned value by the measurement to get the ratio between 1% and 1px. Default to 1 since working with 0 can produce Infinite. */ 4012 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth = (parseFloat(CSS.getPropertyValue(dummy, "width", null, true)) || 1) / measurement; /* GET */ 4013 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight = (parseFloat(CSS.getPropertyValue(dummy, "height", null, true)) || 1) / measurement; /* GET */ 4014 unitRatios.emToPx = callUnitConversionData.lastEmToPx = (parseFloat(CSS.getPropertyValue(dummy, "paddingLeft")) || 1) / measurement; /* GET */ 4015 4016 sameRatioIndicators.myParent.removeChild(dummy); 4017 } else { 4018 unitRatios.emToPx = callUnitConversionData.lastEmToPx; 4019 unitRatios.percentToPxWidth = callUnitConversionData.lastPercentToPxWidth; 4020 unitRatios.percentToPxHeight = callUnitConversionData.lastPercentToPxHeight; 4021 } 4022 4023 /*************************** 4024 Element-Agnostic Units 4025 ***************************/ 4026 4027 /* Whereas % and em ratios are determined on a per-element basis, the rem unit only needs to be checked 4028 once per call since it's exclusively dependant upon document.body's fontSize. If this is the first time 4029 that calculateUnitRatios() is being run during this call, remToPx will still be set to its default value of null, 4030 so we calculate it now. */ 4031 if (callUnitConversionData.remToPx === null) { 4032 /* Default to browsers' default fontSize of 16px in the case of 0. */ 4033 callUnitConversionData.remToPx = parseFloat(CSS.getPropertyValue(document.body, "fontSize")) || 16; /* GET */ 4034 } 4035 4036 /* Similarly, viewport units are %-relative to the window's inner dimensions. */ 4037 if (callUnitConversionData.vwToPx === null) { 4038 callUnitConversionData.vwToPx = parseFloat(window.innerWidth) / 100; /* GET */ 4039 callUnitConversionData.vhToPx = parseFloat(window.innerHeight) / 100; /* GET */ 4040 } 4041 4042 unitRatios.remToPx = callUnitConversionData.remToPx; 4043 unitRatios.vwToPx = callUnitConversionData.vwToPx; 4044 unitRatios.vhToPx = callUnitConversionData.vhToPx; 4045 4046 if (Velocity.debug >= 1) console.log("Unit ratios: " + JSON.stringify(unitRatios), element); 4047 4048 return unitRatios; 4049 } 4050 4051 /******************** 4052 Unit Conversion 4053 ********************/ 4054 4055 /* The * and / operators, which are not passed in with an associated unit, inherently use startValue's unit. Skip value and unit conversion. */ 4056 if (/[\/*]/.test(operator)) { 4057 endValueUnitType = startValueUnitType; 4058 /* If startValue and endValue differ in unit type, convert startValue into the same unit type as endValue so that if endValueUnitType 4059 is a relative unit (%, em, rem), the values set during tweening will continue to be accurately relative even if the metrics they depen
4059d 4060 on are dynamically changing during the course of the animation. Conversely, if we always normalized into px and used px for setting values, the px ratio 4061 would become stale if the original unit being animated toward was relative and the underlying metrics change during the animation. */ 4062 /* Since 0 is 0 in any unit type, no conversion is necessary when startValue is 0 -- we just start at 0 with endValueUnitType. */ 4063 } else if ((startValueUnitType !== endValueUnitType) && startValue !== 0) { 4064 /* Unit conversion is also skipped when endValue is 0, but *startValueUnitType* must be used for tween values to remain accurate. */ 4065 /* Note: Skipping unit conversion here means that if endValueUnitType was originally a relative unit, the animation won't relatively 4066 match the underlying metrics if they change, but this is acceptable since we're animating toward invisibility instead of toward visibility, 4067 which remains past the point of the animation's completion. */ 4068 if (endValue === 0) { 4069 endValueUnitType = startValueUnitType; 4070 } else { 4071 /* By this point, we cannot avoid unit conversion (it's undesirable since it causes layout thrashing). 4072 If we haven't already, we trigger calculateUnitRatios(), which runs once per element per call. */ 4073 elementUnitConversionData = elementUnitConversionData || calculateUnitRatios(); 4074 4075 /* The following RegEx matches CSS properties that have their % values measured relative to the x-axis. */ 4076 /* Note: W3C spec mandates that all of margin and padding's properties (even top and bottom) are %-relative to the *width* of the parent element. */ 4077 var axis = (/margin|padding|left|right|width|text|word|letter/i.test(property) || /X$/.test(property) || property === "x") ? "x" : "y"; 4078 4079 /* In order to avoid generating n^2 bespoke conversion functions, unit conversion is a two-step process: 4080 1) Convert startValue into pixels. 2) Convert this new pixel value into endValue's unit type. */ 4081 switch (startValueUnitType) { 4082 case "%": 4083 /* Note: translateX and translateY are the only properties that are %-relative to an element's own dimensions -- not its parent's dimensions. 4084 Velocity does not include a special conversion process to account for this behavior. Therefore, animating translateX/Y from a % value 4085 to a non-% value will produce an incorrect start value. Fortunately, this sort of cross-unit conversion is rarely done by users in practice. */ 4086 startValue *= (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 4087 break; 4088 4089 case "px": 4090 /* px acts as our midpoint in the unit conversion process; do nothing. */ 4091 break; 4092 4093 default: 4094 startValue *= elementUnitConversionData[startValueUnitType + "ToPx"]; 4095 } 4096 4097 /* Invert the px ratios to convert into to the target unit. */ 4098 switch (endValueUnitType) { 4099 case "%": 4100 startValue *= 1 / (axis === "x" ? elementUnitConversionData.percentToPxWidth : elementUnitConversionData.percentToPxHeight); 4101 break; 4102 4103 case "px": 4104 /* startValue is already in px, do nothing; we're done. */ 4105 break; 4106 4107 default: 4108 startValue *= 1 / elementUnitConversionData[endValueUnitType + "ToPx"]; 4109 } 4110 } 4111 } 4112 4113 /********************* 4114 Relative Values 4115 *********************/ 4116 4117 /* Operator logic must be performed last since it requires unit-normalized start and end values. */ 4118 /* Note: Relative *percent values* do not behave how most people think; while one would expect "+=50%" 4119 to increase the property 1.5x its current value, it in fact increases the percent units in absolute terms: 4120 50 points is added on top of the current % value. */ 4121 switch (operator) { 4122 case "+": 4123 endValue = startValue + endValue; 4124 break; 4125 4126 case "-": 4127 endValue = startValue - endValue; 4128 break; 4129 4130 case "*": 4131 endValue = startValue * endValue; 4132 break; 4133 4134 case "/": 4135 endValue = startValue / endValue; 4136 break; 4137 } 4138 4139 /************************** 4140 tweensContainer Push 4141 **************************/ 4142 4143 /* Construct the per-property tween object, and push it to the element's tweensContainer. */ 4144 tweensContainer[property] = { 4145 rootPropertyValue: rootPropertyValue, 4146 startValue: startValue, 4147 currentValue: startValue, 4148 endValue: endValue, 4149 unitType: endValueUnitType, 4150 easing: easing 4151 }; 4152 4153 if (Velocity.debug) console.log("tweensContainer (" + property + "): " + JSON.stringify(tweensContainer[property]), element); 4154 } 4155 4156 /* Along with its property data, store a reference to the element itself onto tweensContainer. */ 4157 tweensContainer.element = element; 4158 } 4159 4160 /***************** 4161 Call Push 4162 *****************/ 4163 4164 /* Note: tweensContainer can be empty if all of the properties in this call's property map were skipped due to not 4165 being supported by the browser. The element property is used for checking that the tweensContainer has been appended to. */ 4166 if (tweensContainer.element) { 4167 /* Apply the "velocity-animating" indicator class. */ 4168 CSS.Values.addClass(element, "velocity-animating"); 4169 4170 /* The call array houses the tweensContainers for each element being animated in the current call. */ 4171 call.push(tweensContainer); 4172 4173 /* Store the tweensContainer and options if we're working on the default effects queue, so that they can be used by the reverse command. */ 4174 if (opts.queue === "") { 4175 Data(element).tweensContainer = tweensContainer; 4176 Data(element).opts = opts; 4177 } 4178 4179 /* Switch on the element's animating flag. */ 4180 Data(element).isAnimating = true; 4181 4182 /* Once the final element in this call's element set has been processed, push the call array onto 4183 Velocity.State.calls for the animation tick to immediately begin processing. */ 4184 if (elementsIndex === elementsLength - 1) { 4185 /* To speed up iterating over this array, it is compacted (falsey items -- calls that have completed -- are removed) 4186 when its length has ballooned to a point that can impact tick performance. This only becomes necessary when animation 4187 has been continuous with many elements over a long period of time; whenever all active calls are completed, completeCall() clears Velocity.State.calls. */ 4188 if (Velocity.State.calls.length > 10000) { 4189 Velocity.State.calls = compactSparseArray(Velocity.State.calls); 4190 } 4191 4192 /* Add the current call plus its associated metadata (the element set and the call's options) onto the global call container. 4193 Anything on this call container is subjected to tick() processing. */ 4194 Velocity.State.calls.push([ call, elements, opts, null, promiseData.resolver ]); 4195 4196 /* If the animation tick isn't running, start it. (Velocity shuts it off when there are no active calls to process.) */ 4197 if (Velocity.State.isTicking === false) { 4198 Velocity.State.isTicking = true; 4199 4200 /* Start the tick loop. */ 4201 tick(); 4202 } 4203 } else { 4204 elementsIndex++; 4205 } 4206 } 4207 } 4208 4209 /* When the queue option is set to false, the call skips the element's queue and fires immediately. */ 4210 if (opts.queue === false) { 4211 /* Since this buildQueue call doesn't respect the element's existing queue (which is where a delay option would have been appended), 4212 we manually inject the delay property here with an explicit setTimeout. */ 4213 if (opts.delay) { 4214 setTimeout(buildQueue, opts.delay); 4215 } else { 4216 buildQueue(); 4217 } 4218 /* Otherwise, the call undergoes element queueing as normal. */ 4219 /* Note: To interoperate with jQuery, Velocity uses jQuery's own $.queue() stack for queuing logic. */ 4220 } else { 4221 $.queue(element, opts.queue, function(next, clearQueue) { 4222 /* If the clearQueue flag was passed in by the stop command, resolve this call's promise. (Promises can only be resolved once, 4223 so it's fine if this is repeatedly triggered for each element in the associated call.) */ 4224 if (clearQueue === true) { 4225 if (promiseData.promise) { 4226 promiseData.resolver(elements); 4227 } 4228 4229 /* Do not continue with animation queueing. */ 4230 return true; 4231 } 4232 4233 /* This flag indicates to the upcoming completeCall() function that this queue entry was initiated by Velocity. 4234 See completeCall() for further details. */ 4235 Velocity.velocityQueueEntryFlag = true; 4236 4237 buildQueue(next); 4238 }); 4239 } 4240 4241 /********************* 4242 Auto-Dequeuing 4243 *********************/ 4244 4245 /* As per jQuery's $.queue() behavior, to fire the first non-custom-queue entry on an element, the element 4246 must be dequeued if its queue stack consists *solely* of the current call. (This can be determined by checking 4247 for the "inprogress" item that jQuery prepends to active queue stack arrays.) Regardless, whenever the element's 4248 queue is further appended with additional items -- including $.delay()'s or even $.animate() calls, the queue's 4249 first entry is automatically fired. This behavior contrasts that of custom queues, which never auto-fire. */ 4250 /* Note: When an element set is being subjected to a non-parallel Velocity call, the animation will not begin until 4251 each one of the elements in the set has reached the end of its individually pre-existing queue chain. */ 4252 /* Note: Unfortunately, most people don't fully grasp jQuery's powerful, yet quirky, $.queue() function. 4253 Lean more here: http://stackoverflow.com/questions/1058158/can-somebody-explain-jquery-queue-to-me */ 4254 if ((opts.queue === "" || opts.queue === "fx") && $.queue(element)[0] !== "inprogress") { 4255 $.dequeue(element); 4256 } 4257 } 4258 4259 /************************** 4260 Element Set Iteration 4261 **************************/ 4262 4263 /* If the "nodeType" property exists on the elements variable, we're animating a single element. 4264 Place it in an array so that $.each() can iterate over it. */ 4265 $.each(elements, function(i, element) { 4266 /* Ensure each element in a set has a nodeType (is a real element) to avoid throwing errors. */ 4267 if (Type.isNode(element)) { 4268 processElement.call(element); 4269 } 4270 }); 4271 4272 /****************** 4273 Option: Loop 4274 ******************/ 4275 4276 /* The loop option accepts an integer indicating how many times the element should loop between the values in the 4277 current call's properties map and the element's property values prior to this call. */ 4278 /* Note: The loop option's logic is performed here -- after element processing -- because the current call needs 4279 to undergo its queue insertion prior to the loop option generating its series of constituent "reverse" calls, 4280 which chain after the current call. Two reverse calls (two "alternations") constitute one loop. */ 4281 var opts = $.extend({}, Velocity.defaults, options), 4282 reverseCallsCount; 4283 4284 opts.loop = parseInt(opts.loop); 4285 reverseCallsCount = (opts.loop * 2) - 1; 4286 4287 if (opts.loop) {
4288 /* Double the loop count to convert it into its appropriate number of "reverse" calls. 4289 Subtract 1 from the resulting value since the current call is included in the total alternation count. */ 4290 for (var x = 0; x < reverseCallsCount; x++) { 4291 /* Since the logic for the reverse action occurs inside Queueing and therefore this call's options object 4292 isn't parsed until then as well, the current call's delay option must be explicitly passed into the reverse 4293 call so that the delay logic that occurs inside *Pre-Queueing* can process it. */ 4294 var reverseOptions = { 4295 delay: opts.delay, 4296 progress: opts.progress 4297 }; 4298 4299 /* If a complete callback was passed into this call, transfer it to the loop redirect's final "reverse" call 4300 so that it's triggered when the entire redirect is complete (and not when the very first animation is complete). */ 4301 if (x === reverseCallsCount - 1) { 4302 reverseOptions.display = opts.display; 4303 reverseOptions.visibility = opts.visibility; 4304 reverseOptions.complete = opts.complete; 4305 } 4306 4307 animate(elements, "reverse", reverseOptions); 4308 } 4309 } 4310 4311 /*************** 4312 Chaining 4313 ***************/ 4314 4315 /* Return the elements back to the call chain, with wrapped elements taking precedence in case Velocity was called via the $.fn. extension. */ 4316 return getChain(); 4317 }; 4318 4319 /* Turn Velocity into the animation function, extended with the pre-existing Velocity object. */ 4320 Velocity = $.extend(animate, Velocity); 4321 /* For legacy support, also expose the literal animate method. */ 4322 Velocity.animate = animate; 4323 4324 /************** 4325 Timing 4326 **************/ 4327 4328 /* Ticker function. */ 4329 var ticker = window.requestAnimationFrame || rAFShim; 4330 4331 /* Inactive browser tabs pause rAF, which results in all active animations immediately sprinting to their completion states when the tab refocuses. 4332 To get around this, we dynamically switch rAF to setTimeout (which the browser *doesn't* pause) when the tab loses focus. We skip this for mobile 4333 devices to avoid wasting battery power on inactive tabs. */ 4334 /* Note: Tab focus detection doesn't work on older versions of IE, but that's okay since they don't support rAF to begin with. */ 4335 if (!Velocity.State.isMobile && document.hidden !== undefined) { 4336 document.addEventListener("visibilitychange", function() { 4337 /* Reassign the rAF function (which the global tick() function uses) based on the tab's focus state. */ 4338 if (document.hidden) { 4339 ticker = function(callback) { 4340 /* The tick function needs a truthy first argument in order to pass its internal timestamp check. */ 4341 return setTimeout(function() { callback(true) }, 16); 4342 }; 4343 4344 /* The rAF loop has been paused by the browser, so we manually restart the tick. */ 4345 tick(); 4346 } else { 4347 ticker = window.requestAnimationFrame || rAFShim; 4348 } 4349 }); 4350 } 4351 4352 /************ 4353 Tick 4354 ************/ 4355 4356 /* Note: All calls to Velocity are pushed to the Velocity.State.calls array, which is fully iterated through upon each tick. */ 4357 function tick (timestamp) { 4358 /* An empty timestamp argument indicates that this is the first tick occurence since ticking was turned on. 4359 We leverage this metadata to fully ignore the first tick pass since RAF's initial pass is fired whenever 4360 the browser's next tick sync time occurs, which results in the first elements subjected to Velocity 4361 calls being animated out of sync with any elements animated immediately thereafter. In short, we ignore 4362 the first RAF tick pass so that elements being immediately consecutively animated -- instead of simultaneously animated 4363 by the same Velocity call -- are properly batched into the same initial RAF tick and consequently remain in sync thereafter. */ 4364 if (timestamp) { 4365 /* We ignore RAF's high resolution timestamp since it can be significantly offset when the browser is 4366 under high stress; we opt for choppiness over allowing the browser to drop huge chunks of frames. */ 4367 var timeCurrent = (new Date).getTime(); 4368 4369 /******************** 4370 Call Iteration 4371 ********************/ 4372 4373 /* Iterate through each active call. */ 4374 for (var i = 0, callsLength = Velocity.State.calls.length; i < callsLength; i++) { 4375 /* When a Velocity call is completed, its Velocity.State.calls entry is set to false. Continue on to the next call. */ 4376 if (!Velocity.State.calls[i]) { 4377 continue; 4378 } 4379 4380 /************************ 4381 Call-Wide Variables 4382 ************************/ 4383 4384 var callContainer = Velocity.State.calls[i], 4385 call = callContainer[0], 4386 opts = callContainer[2], 4387 timeStart = callContainer[3], 4388 firstTick = !!timeStart; 4389 4390 /* If timeStart is undefined, then this is the first time that this call has been processed by tick(). 4391 We assign timeStart now so that its value is as close to the real animation start time as possible. 4392 (Conversely, had timeStart been defined when this call was added to Velocity.State.calls, the delay 4393 between that time and now would cause the first few frames of the tween to be skipped since 4394 percentComplete is calculated relative to timeStart.) */ 4395 /* Further, subtract 16ms (the approximate resolution of RAF) from the current time value so that the 4396 first tick iteration isn't wasted by animating at 0% tween completion, which would produce the 4397 same style value as the element's current value. */ 4398 if (!timeStart) { 4399 timeStart = Velocity.State.calls[i][3] = timeCurrent - 16; 4400 } 4401 4402 /* The tween's completion percentage is relative to the tween's start time, not the tween's start value 4403 (which would result in unpredictable tween durations since JavaScript's timers are not particularly accurate). 4404 Accordingly, we ensure that percentComplete does not exceed 1. */ 4405 var percentComplete = Math.min((timeCurrent - timeStart) / opts.duration, 1); 4406 4407 /********************** 4408 Element Iteration 4409 **********************/ 4410 4411 /* For every call, iterate through each of the elements in its set. */ 4412 for (var j = 0, callLength = call.length; j < callLength; j++) { 4413 var tweensContainer = call[j], 4414 element = tweensContainer.element; 4415 4416 /* Check to see if this element has been deleted midway through the animation by checking for the 4417 continued existence of its data cache. If it's gone, skip animating this element. */ 4418 if (!Data(element)) { 4419 continue; 4420 } 4421 4422 var transformPropertyExists = false;
4423 4424 /********************************** 4425 Display & Visibility Toggling 4426 **********************************/ 4427 4428 /* If the display option is set to non-"none", set it upfront so that the element can become visible before tweening begins. 4429 (Otherwise, display's "none" value is set in completeCall() once the animation has completed.) */ 4430 if (opts.display !== undefined && opts.display !== null && opts.display !== "none") { 4431 if (opts.display === "flex") { 4432 var flexValues = [ "-webkit-box", "-moz-box", "-ms-flexbox", "-webkit-flex" ]; 4433 4434 $.each(flexValues, function(i, flexValue) { 4435 CSS.setPropertyValue(element, "display", flexValue); 4436 }); 4437 } 4438 4439 CSS.setPropertyValue(element, "display", opts.display); 4440 } 4441 4442 /* Same goes with the visibility option, but its "none" equivalent is "hidden". */ 4443 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 4444 CSS.setPropertyValue(element, "visibility", opts.visibility); 4445 } 4446 4447 /************************ 4448 Property Iteration 4449 ************************/ 4450 4451 /* For every element, iterate through each property. */ 4452 for (var property in tweensContainer) { 4453 /* Note: In addition to property tween data, tweensContainer contains a reference to its associated element. */ 4454 if (property !== "element") { 4455 var tween = tweensContainer[property], 4456 currentValue, 4457 /* Easing can either be a pre-genereated function or a string that references a pre-registered easing 4458 on the Velocity.Easings object. In either case, return the appropriate easing *function*. */ 4459 easing = Type.isString(tween.easing) ? Velocity.Easings[tween.easing] : tween.easing; 4460 4461 /****************************** 4462 Current Value Calculation 4463 ******************************/ 4464 4465 /* If this is the last tick pass (if we've reached 100% completion for this tween), 4466 ensure that currentValue is explicitly set to its target endValue so that it's not subjected to any rounding. */ 4467 if (percentComplete === 1) { 4468 currentValue = tween.endValue; 4469 /* Otherwise, calculate currentValue based on the current delta from startValue. */ 4470 } else { 4471 currentValue = tween.startValue + ((tween.endValue - tween.startValue) * easing(percentComplete)); 4472 4473 /* If no value change is occurring, don't proceed with DOM updating. */ 4474 if (!firstTick && (currentValue === tween.currentValue)) { 4475 continue; 4476 } 4477 } 4478 4479 tween.currentValue = currentValue; 4480 4481 /****************** 4482 Hooks: Part I 4483 ******************/ 4484 4485 /* For hooked properties, the newly-updated rootPropertyValueCache is cached onto the element so that it can be used 4486 for subsequent hooks in this call that are associated with the same root property. If we didn't cache the updated 4487 rootPropertyValue, each subsequent update to the root property in this tick pass would reset the previous hook's 4488 updates to rootPropertyValue prior to injection. A nice performance byproduct of rootPropertyValue caching is that 4489 subsequently chained animations using the same hookRoot but a different hook can use this cached rootPropertyValue. */ 4490 if (CSS.Hooks.registered[property]) { 4491 var hookRoot = CSS.Hooks.getRoot(property), 4492 rootPropertyValueCache = Data(element).rootPropertyValueCache[hookRoot]; 4493 4494 if (rootPropertyValueCache) { 4495 tween.rootPropertyValue = rootPropertyValueCache; 4496 } 4497 } 4498 4499 /***************** 4500 DOM Update 4501 *****************/ 4502 4503 /* setPropertyValue() returns an array of the property name and property value post any normalization that may have been performed. */ 4504 /* Note: To solve an IE<=8 positioning bug, the unit type is dropped when setting a property value of 0. */ 4505 var adjustedSetData = CSS.setPropertyValue(element, /* SET */ 4506 property, 4507 tween.currentValue + (parseFloat(currentValue) === 0 ? "" : tween.unitType), 4508 tween.rootPropertyValue, 4509 tween.scrollData); 4510 4511 /******************* 4512 Hooks: Part II 4513 *******************/ 4514 4515 /* Now that we have the hook's updated rootPropertyValue (the post-processed value provided by adjustedSetData), cache it onto the element. */ 4516 if (CSS.Hooks.registered[property]) { 4517 /* Since adjustedSetData contains
4517normalized data ready for DOM updating, the rootPropertyValue needs to be re-extracted from its normalized form. ?? */ 4518 if (CSS.Normalizations.registered[hookRoot]) { 4519 Data(element).rootPropertyValueCache[hookRoot] = CSS.Normalizations.registered[hookRoot]("extract", null, adjustedSetData[1]); 4520 } else { 4521 Data(element).rootPropertyValueCache[hookRoot] = adjustedSetData[1]; 4522 } 4523 } 4524 4525 /*************** 4526 Transforms 4527 ***************/ 4528 4529 /* Flag whether a transform property is being animated so that flushTransformCache() can be triggered once this tick pass is complete. */ 4530 if (adjustedSetData[0] === "transform") { 4531 transformPropertyExists = true; 4532 } 4533 } 4534 } 4535 4536 /**************** 4537 mobileHA 4538 ****************/ 4539 4540 /* If mobileHA is enabled, set the translate3d transform to null to force hardware acceleration. 4541 It's safe to override this property since Velocity doesn't actually support its animation (hooks are used in its place). */ 4542 if (opts.mobileHA) { 4543 /* Don't set the null transform hack if we've already done so. */ 4544 if (Data(element).transformCache.translate3d === undefined) { 4545 /* All entries on the transformCache object are later concatenated into a single transform string via flushTransformCache(). */ 4546 Data(element).transformCache.translate3d = "(0px, 0px, 0px)"; 4547 4548 transformPropertyExists = true; 4549 } 4550 } 4551 4552 if (transformPropertyExists) { 4553 CSS.flushTransformCache(element); 4554 } 4555 } 4556 4557 /* The non-"none" display value is only applied to an element once -- when its associated call is first ticked through. 4558 Accordingly, it's set to false so that it isn't re-processed by this call in the next tick. */ 4559 if (opts.display !== undefined && opts.display !== "none") { 4560 Velocity.State.calls[i][2].display = false; 4561 } 4562 if (opts.visibility !== undefined && opts.visibility !== "hidden") { 4563 Velocity.State.calls[i][2].visibility = false; 4564 } 4565 4566 4567 /* Pass the elements and the timing data (percentComplete, msRemaining, and timeStart) into the progress callback. */ 4568 if (opts.progress) { 4569 opts.progress.call(callContainer[1], 4570 callContainer[1], 4571 percentComplete, 4572 Math.max(0, (timeStart + opts.duration) - timeCurrent), 4573 timeStart); 4574 } 4575 4576 /* If this call has finished tweening, pass its index to completeCall() to handle call cleanup. */ 4577 if (percentComplete === 1) { 4578 completeCall(i); 4579 } 4580 } 4581 } 4582 4583 /* Note: completeCall() sets the isTicking flag to false when the last call on Velocity.State.calls has completed. */ 4584 if (Velocity.State.isTicking) { 4585 ticker(tick); 4586 } 4587 } 4588 4589 /********************** 4590 Call Completion 4591 **********************/ 4592 4593 /* Note: Unlike tick(), which processes all active calls at once, call completion is handled on a per-call basis. */ 4594 function completeCall (callIndex, isStopped) { 4595 /* Ensure the call exists. */ 4596 if (!Velocity.State.calls[callIndex]) { 4597 return false; 4598 } 4599 4600 /* Pull the metadata from the call. */ 4601 var call = Velocity.State.calls[callIndex][0], 4602 elements = Velocity.State.calls[callIndex][1], 4603 opts = Velocity.State.calls[callIndex][2], 4604 resolver = Velocity.State.calls[callIndex][4]; 4605 4606 var remainingCallsExist = false;
4607 4608 /************************* 4609 Element Finalization 4610 *************************/ 4611 4612 for (var i = 0, callLength = call.length; i < callLength; i++) { 4613 var element = call[i].element; 4614 4615 /* If the user set display to "none" (intending to hide the element), set it now that the animation has completed. */ 4616 /* Note: display:none isn't set when calls are manually stopped (via Velocity("stop"). */ 4617 /* Note: Display gets ignored with "reverse" calls and infinite loops, since this behavior would be undesirable. */ 4618 if (!isStopped && !opts.loop) { 4619 if (opts.display === "none") { 4620 CSS.setPropertyValue(element, "display", opts.display); 4621 } 4622 4623 if (opts.visibility === "hidden") { 4624 CSS.setPropertyValue(element, "visibility", opts.visibility); 4625 } 4626 } 4627 4628 /* If the element's queue is empty (if only the "inprogress" item is left at position 0) or if its queue is about to run 4629 a non-Velocity-initiated entry, turn off the isAnimating flag. A non-Velocity-initiatied queue entry's logic might alter 4630 an element's CSS values and thereby cause Velocity's cached value data to go stale. To detect if a queue entry was initiated by Velocity, 4631 we check for the existence of our special Velocity.queueEntryFlag declaration, which minifiers won't rename since the flag 4632 is assigned to jQuery's global $ object and thus exists out of Velocity's own scope. */ 4633 if (opts.loop !== true && ($.queue(element)[1] === undefined || !/\.velocityQueueEntryFlag/i.test($.queue(element)[1]))) { 4634 /* The element may have been deleted. Ensure that its data cache still exists before acting on it. */ 4635 if (Data(element)) { 4636 Data(element).isAnimating = false; 4637 /* Clear the element's rootPropertyValueCache, which will become stale. */ 4638 Data(element).rootPropertyValueCache = {}; 4639 4640 var transformHAPropertyExists = false; 4641 /* If any 3D transform subproperty is at its default value (regardless of unit type), remove it. */ 4642 $.each(CSS.Lists.transforms3D, function(i, transformName) { 4643 var defaultValue = /^scale/.test(transformName) ? 1 : 0, 4644 currentValue = Data(element).transformCache[transformName]; 4645 4646 if (Data(element).transformCache[transformName] !== undefined && new RegExp("^\\(" + defaultValue + "[^.]").test(currentValue)) { 4647 transformHAPropertyExists = true; 4648 4649 delete Data(element).transformCache[transformName]; 4650 } 4651 }); 4652 4653 /* Mobile devices have hardware acceleration removed at the end of the animation in order to avoid hogging the GPU's memory. */ 4654 if (opts.mobileHA) { 4655 transformHAPropertyExists = true; 4656 delete Data(element).transformCache.translate3d; 4657 } 4658 4659 /* Flush the subproperty removals to the DOM. */ 4660 if (transformHAPropertyExists) { 4661 CSS.flushTransformCache(element); 4662 } 4663 4664 /* Remove the "velocity-animating" indicator class. */ 4665 CSS.Values.removeClass(element, "velocity-animating"); 4666 } 4667 } 4668 4669 /********************* 4670 Option: Complete 4671 *********************/ 4672 4673 /* Complete is fired once per call (not once per element) and is passed the full raw DOM element set as both its context and its first argument. */ 4674 /* Note: Callbacks aren't fired when calls are manually stopped (via Velocity("stop"). */ 4675 if (!isStopped && opts.complete && !opts.loop && (i === callLength - 1)) { 4676 /* We throw callbacks in a setTimeout so that thrown errors don't halt the execution of Velocity itself. */ 4677 try { 4678 opts.complete.call(elements, elements); 4679 } catch (error) { 4680 setTimeout(function() { throw error; }, 1); 4681 } 4682 } 4683 4684 /********************** 4685 Promise Resolving 4686 **********************/ 4687 4688 /* Note: Infinite loops don't return promises. */ 4689 if (resolver && opts.loop !== true) { 4690 resolver(elements); 4691 } 4692 4693 /**************************** 4694 Option: Loop (Infinite) 4695 ****************************/ 4696 4697 if (opts.loop === true && !isStopped) { 4698 /* If a rotateX/Y/Z property is being animated to 360 deg with loop:true, swap tween start/end values to enable 4699 continuous iterative rotation looping. (Otherise, the element would just rotate back and forth.) */ 4700 $.each(Data(element).tweensContainer, function(propertyName, tweenContainer) { 4701 if (/^rotate/.test(propertyName) && parseFloat(tweenContainer.endValue) === 360) { 4702 tweenContainer.endValue = 0; 4703 tweenContainer.startValue = 360; 4704 } 4705 }); 4706 4707 Velocity(element, "reverse", { loop: true, delay: opts.delay }); 4708 } 4709 4710 /*************** 4711 Dequeueing 4712 ***************/ 4713 4714 /* Fire the next call in the queue so long as this call's queue wasn't set to false (to trigger a parallel animation), 4715 which would have already caused the next call to fire. Note: Even if the end of the animation queue has been reached, 4716 $.dequeue() must still be called in order to completely clear jQuery's animation queue. */ 4717 if (opts.queue !== false) { 4718 $.dequeue(element, opts.queue); 4719 } 4720 } 4721 4722 /************************ 4723 Calls Array Cleanup 4724 ************************/ 4725 4726 /* Since this call is complete, set it to false so that the rAF tick skips it. This array is later compacted via compactSparseArray(). 4727 (For performance reasons, the call is set to false instead of being deleted from the array: http://www.html5rocks.com/en/tutorials/speed/v8/) */ 4728 Velocity.State.calls[callIndex] = false;
4729 4730 /* Iterate through the calls array to determine if this was the final in-progress animation. 4731 If so, set a flag to end ticking and clear the calls array. */ 4732 for (var j = 0, callsLength = Velocity.State.calls.length; j < callsLength; j++) { 4733 if (Velocity.State.calls[j] !== false) { 4734 remainingCallsExist = true; 4735 4736 break; 4737 } 4738 } 4739 4740 if (remainingCallsExist === false) { 4741 /* tick() will detect this flag upon its next iteration and subsequently turn itself off. */ 4742 Velocity.State.isTicking = false; 4743 4744 /* Clear the calls array so that its length is reset. */ 4745 delete Velocity.State.calls; 4746 Velocity.State.calls = []; 4747 } 4748 } 4749 4750 /****************** 4751 Frameworks 4752 ******************/ 4753 4754 /* Both jQuery and Zepto allow their $.fn object to be extended to allow wrapped elements to be subjected to plugin calls. 4755 If either framework is loaded, register a "velocity" extension pointing to Velocity's core animate() method. Velocity 4756 also registers itself onto a global container (window.jQuery || window.Zepto || window) so that certain features are 4757 accessible beyond just a per-element scope. This master object contains an .animate() method, which is later assigned to $.fn 4758 (if jQuery or Zepto are present). Accordingly, Velocity can both act on wrapped DOM elements and stand alone for targeting raw DOM elements. */ 4759 global.Velocity = Velocity; 4760 4761 if (global !== window) { 4762 /* Assign the element function to Velocity's core animate() method. */ 4763 global.fn.velocity = animate; 4764 /* Assign the object function's defaults to Velocity's global defaults object. */ 4765 global.fn.velocity.defaults = Velocity.defaults; 4766 } 4767 4768 /*********************** 4769 Packaged Redirects 4770 ***********************/ 4771 4772 /* slideUp, slideDown */ 4773 $.each([ "Down", "Up" ], function(i, direction) { 4774 Velocity.Redirects["slide" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { 4775 var opts = $.extend({}, options), 4776 begin = opts.begin, 4777 complete = opts.complete, 4778 computedValues = { height: "", marginTop: "", marginBottom: "", paddingTop: "", paddingBottom: "" }, 4779 inlineValues = {}; 4780 4781 if (opts.display === undefined) { 4782 /* Show the element before slideDown begins and hide the element after slideUp completes. */ 4783 /* Note: Inline elements cannot have dimensions animated, so they're reverted to inline-block. */ 4784 opts.display = (direction === "Down" ? (Velocity.CSS.Values.getDisplayType(element) === "inline" ? "inline-block" : "block") : "none"); 4785 } 4786 4787 opts.begin = function() { 4788 /* If the user passed in a begin callback, fire it now. */ 4789 begin && begin.call(elements, elements); 4790 4791 /* Cache the elements' original vertical dimensional property values so that we can animate back to them. */ 4792 for (var property in computedValues) { 4793 /* Cache all inline values, we reset to upon animation completion. */ 4794 inlineValues[property] = element.style[property]; 4795 4796 /* For slideDown, use forcefeeding to animate all vertical properties from 0. For slideUp, 4797 use forcefeeding to start from computed values and animate down to 0. */ 4798 var propertyValue = Velocity.CSS.getPropertyValue(element, property); 4799 computedValues[property] = (direction === "Down") ? [ propertyValue, 0 ] : [ 0, propertyValue ]; 4800 } 4801 4802 /* Force vertical overflow content to clip so that sliding works as expected. */ 4803 inlineValues.overflow = element.style.overflow; 4804 element.style.overflow = "hidden"; 4805 } 4806 4807 opts.complete = function() { 4808 /* Reset element to its pre-slide inline values once its slide animation is complete. */ 4809 for (var property in inlineValues) { 4810 element.style[property] = inlineValues[property]; 4811 } 4812 4813 /* If the user passed in a complete callback, fire it now. */ 4814 complete && complete.call(elements, elements); 4815 promiseData && promiseData.resolver(elements); 4816 }; 4817 4818 Velocity(element, computedValues, opts); 4819 }; 4820 }); 4821 4822 /* fadeIn, fadeOut */ 4823 $.each([ "In", "Out" ], function(i, direction) { 4824 Velocity.Redirects["fade" + direction] = function (element, options, elementsIndex, elementsSize, elements, promiseData) { 4825 var opts = $.extend({}, options), 4826 propertiesMap = { opacity: (direction === "In") ? 1 : 0 },
4827 originalComplete = opts.complete; 4828 4829 /* Since redirects are triggered individually for each element in the animated set, avoid repeatedly triggering 4830 callbacks by firing them only when the final element has been reached. */ 4831 if (elementsIndex !== elementsSize - 1) { 4832 opts.complete = opts.begin = null; 4833 } else { 4834 opts.complete = function() { 4835 if (originalComplete) { 4836 originalComplete.call(elements, elements); 4837 } 4838 4839 promiseData && promiseData.resolver(elements); 4840 } 4841 } 4842 4843 /* If a display was passed in, use it. Otherwise, default to "none" for fadeOut or the element-specific default for fadeIn. */ 4844 /* Note: We allow users to pass in "null" to skip display setting altogether. */ 4845 if (opts.display === undefined) { 4846 opts.display = (direction === "In" ? "auto" : "none"); 4847 } 4848 4849 Velocity(this, propertiesMap, opts); 4850 }; 4851 }); 4852 4853 return Velocity; 4854}((window.jQuery || window.Zepto || window), window, document); 4855})); 4856 4857/****************** 4858 Known Issues 4859******************/ 4860 4861/* The CSS spec mandates that the translateX/Y/Z transforms are %-relative to the element itself -- not its parent. 4862Velocity, however, doesn't make this distinction. Thus, converting to or from the % unit with these subproperties 4863will produce an inaccurate conversion value. The same issue exists with the cx/cy attributes of SVG circles and ellipses. */ 4864; 4865(function ($, window, undefined) { 4866 4867 // /* ====== SHARED VARS - jQuery ====== */ 4868 // These depend on jQuery 4869 var $window = $(window), 4870 windowHeight = $window.height(), 4871 windowWidth = $window.width(); 4872 4873 /** 4874 * Detect browser size and remember it in global variables 4875 */ 4876 4877 function browserSize() { 4878 wh = $window.height(); 4879 ww = $window.width(); 4880 dh = $(document).height(); 4881 ar = ww / wh; 4882 } 4883 4884 4885 /** 4886 * Detect what platform are we on (browser, mobile, etc) 4887 */ 4888 4889 function platformDetect() { 4890 $.support.touch = 'ontouchend' in document; 4891 var navUA = navigator.userAgent.toLowerCase(), 4892 navPlat = navigator.platform.toLowerCase(); 4893 4894 var isiPhone = navPlat.indexOf("iphone"), 4895 isiPod = navPlat.indexOf("ipod"), 4896 isAndroidPhone = navPlat.indexOf("android"), 4897 safari = (navUA.indexOf('safari') != -1 && navUA.indexOf('chrome') == -1) ? true : false, 4898 svgSupport = (window.SVGAngle) ? true : false, 4899 svgSupportAlt = (document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")) ? true : false, 4900 ff3x = (/gecko/i.test(navUA) && /rv:1.9/i.test(navUA)) ? true : false; 4901 4902 ieMobile = navigator.userAgent.match(/Windows Phone/i) ? true : false; 4903 phone = (isiPhone > -1 || isiPod > -1 || isAndroidPhone > -1) ? true : false; 4904 touch = $.support.touch ? true : false; 4905 4906 if (touch) $html.addClass('touch'); 4907 4908 if (ieMobile) $html.addClass('is--winmob'); 4909 if (is_android) $html.addClass('is--ancient-android'); 4910 4911 if (safari) $body.addClass('safari'); 4912 if (phone) $body.addClass('phone'); 4913 } 4914 4915 // /* ====== SHARED VARS ====== */ 4916 // These do not depend on jQuery 4917 var phone, touch, wh, ww, dh, ar, fonts; 4918 4919 var ua = navigator.userAgent; 4920 var winLoc = window.location.toString(); 4921 4922 var is_webkit = ua.match(/webkit/i); 4923 var is_firefox = ua.match(/gecko/i); 4924 var is_newer_ie = ua.match(/msie (9|([1-9][0-9]))/i); 4925 var is_older_ie = ua.match(/msie/i) && !is_newer_ie; 4926 var is_ancient_ie = ua.match(/msie 6/i); 4927 var is_mobile = ua.match(/mobile/i);
4928 var is_OSX = (ua.match(/(iPad|iPhone|iPod|Macintosh)/g) ? true : false); 4929 4930 var nua = navigator.userAgent; 4931 var is_android = ((nua.indexOf('Mozilla/5.0') !== -1 && nua.indexOf('Android ') !== -1 && nua.indexOf('AppleWebKit') !== -1) && nua.indexOf('Chrome') === -1); 4932 4933 var useTransform = true; 4934 var use2DTransform = (ua.match(/msie 9/i) || winLoc.match(/transform\=2d/i)); 4935 var transform; 4936 4937 var $html = $('html'); 4938 var $body = $('body'); 4939 4940 // setting up transform prefixes 4941 var prefixes = { 4942 webkit: 'webkitTransform', 4943 firefox: 'MozTransform', 4944 ie: 'msTransform', 4945 w3c: 'transform' 4946 }; 4947 4948 if (useTransform) { 4949 if (is_webkit) { 4950 transform = prefixes.webkit; 4951 } else if (is_firefox) { 4952 transform = prefixes.firefox; 4953 } else if (is_newer_ie) { 4954 transform = prefixes.ie; 4955 } 4956 } 4957 // /* ====== Masonry Logic ====== */ 4958 (function () { 4959 4960 var $container = $('.archive__grid'), 4961 $blocks = $container.children().addClass('post--animated post--loaded'), 4962 slices = $blocks.first().children().length; 4963 4964 var observerConfig = { attributes: false, childList: true, characterData: true }, 4965 observer; 4966 4967 if ( "MutationObserver" in window ) { 4968 observer = new MutationObserver( function( mutations ) { 4969 $container.masonry( 'layout' ); 4970 } ); 4971 } 4972 4973 // initialize masonry after the images have loaded 4974 $container.imagesLoaded(function () { 4975 4976 // prepare hover animations 4977 if (!$html.hasClass('touch')) 4978 $blocks.addHoverAnimation(); 4979 4980 // initialize masonry 4981 $container.masonry({ 4982 isAnimated: false, 4983 itemSelector: '.grid__item', 4984 transitionDuration: 0, 4985 hiddenStyle: { 4986 opacity: 0 4987 } 4988 }); 4989 4990 /** 4991 * function used to display cards with a simple fade in transition 4992 */ 4993 4994 function showBlocks($blocks) { 4995 4996 // use different delays for each card to stagger them 4997 $blocks.each(function (i, obj) { 4998 4999 var $block = $(obj), 5000 duration = 200 + slices * 0.1; 5001 5002 $block.velocity({ 5003 translateY: 40 5004 }, { 5005 duration: 0 5006 }); 5007 setTimeout(function () { 5008 $block.velocity({ 5009 translateY: 0 5010 }, { 5011 easing: "easeOutQuad", 5012 duration: 100 5013 }); 5014 5015 $block.children().each(function (j, child) { 5016 var $child = $(child), 5017 timeout = (j + 1) * 100; 5018 5019 $child.velocity({ 5020 opacity: 0, 5021 translateY: 40 5022 }, { 5023 duration: 0 5024 }); 5025 5026 $child.velocity({ 5027 opacity: 1, 5028 translateY: 0 5029 }, { 5030 duration: 300, 5031 delay: timeout 5032 }); 5033 }); 5034 5035 setTimeout(function () { 5036 $block.toggleClass('sticky--bg', $block.hasClass('sticky')); 5037 $block.addClass('post--visible'); 5038 }, 300); 5039 5040 }, i * 200); 5041 }); 5042 } 5043 5044 // animate cards in 5045 showBlocks($blocks); 5046 5047 $blocks.each( function( i, obj ) { 5048 if ( typeof observer !== "undefined" ) { 5049 observer.observe( obj, observerConfig ); 5050 } 5051 } ); 5052 5053 // update the masonry layout on window.resize 5054 $(window).smartresize(function () { 5055 $container.masonry('layout'); 5056 }); 5057 5058 $(window).load(function () { 5059 $container.masonry('layout'); 5060 }); 5061 5062 // handle behavior for infinite scroll 5063 $(document.body).on('post-load', function () { 5064 5065 // figure out which are the new loaded posts 5066 var $newBlocks = $('.archive__grid').children().not('.post--loaded').addClass('post--loaded'); 5067 5068 // when images have loaded take care of the layout, prepare hover animations, and animate cards in 5069 $newBlocks.imagesLoaded( function() { 5070 $container.masonry( 'appended', $newBlocks, true ).masonry( 'layout' ); 5071 if ( ! $html.hasClass( 'touch' ) ) { 5072 $newBlocks.addHoverAnimation(); 5073 } 5074 showBlocks( $newBlocks ); 5075 } ); 5076 5077 if ( typeof observer !== "undefined" ) { 5078 $newBlocks.each( function(i, obj ) { 5079 observer.observe( obj, observerConfig ); 5080 } ); 5081 } 5082 }); 5083 }); 5084 })(); 5085 5086 // /* ====== Navigation Logic ====== */ 5087 var $nav = $('.nav--main'), 5088 $navTrigger = $('.navigation__trigger'), 5089 $navContainer = $('.main-navigation'), 5090 navTop = (typeof $navContainer.offset() !== 'undefined') ? $navContainer.offset().top : 0, 5091 navLeft = (typeof $navContainer.offset() !== 'undefined') ? $navContainer.offset().left : 0, 5092 navWidth = $nav.outerWidth(), 5093 containerWidth = $navContainer.outerWidth(),
5094 navHeight = $nav.outerHeight(), 5095 $toolbar = $('.toolbar'), 5096 isOpen = false, 5097 pageTop = $('#page').offset().top, 5098 pageWidth = $('#page').width(), 5099 pageLeft = $('#page').offset().left, 5100 sticked = false; 5101 5102 /** 5103 * bind toggling the navigation drawer to click and touchstart 5104 *in order to get rid of the 300ms delay on touch devices we use the touchstart event 5105 */ 5106 var triggerEvents = 'click touchstart'; 5107 if (is_android) triggerEvents = 'click'; 5108 5109 // Set the Navigation Container Height 5110 $navContainer.height(navHeight); 5111 5112 $navTrigger.on(triggerEvents, function (e) { 5113 // but we still have to prevent the default behavior of the touchstart event 5114 // because this way we're making sure the click event won't fire anymore 5115 e.preventDefault(); 5116 e.stopPropagation(); 5117 5118 isOpen = !isOpen; 5119 $('body').toggleClass('nav--is-open'); 5120 5121 var offset; 5122 5123 navWidth = $nav.outerWidth(); 5124 5125 if ($('body').hasClass('rtl')) { 5126 offset = -1 * navWidth; 5127 } else { 5128 offset = navWidth; 5129 } 5130 5131 if (!is_android) { 5132 if (!isOpen) { 5133 5134 $([$nav, $navTrigger]).each(function (i, obj) { 5135 $(obj).velocity({ 5136 translateX: 0, 5137 translateZ: 0.01 5138 }, {
5139 duration: 300, 5140 easing: "easeInQuart", 5141 begin: function () { 5142 $navContainer.removeClass('shadow'); 5143 } 5144 }); 5145 }); 5146 5147 } else { 5148 5149 $([$nav, $navTrigger]).each(function (i, obj) { 5150 $(obj).velocity({ 5151 translateX: offset, 5152 translateZ: 0.01 5153 }, { 5154 easing: "easeOutCubic", 5155 duration: 300, 5156 complete: function () { 5157 $navContainer.addClass('shadow'); 5158 } 5159 }); 5160 }); 5161 } 5162 } 5163 }); 5164 5165 var HandleParentMenuItems = (function() { 5166 // Handle parent menu items on tablet in landscape mode; 5167 // use case: normal, horizontal menu, touch events, 5168 // sub menus are not visible. 5169 function handleParentMenuItems() { 5170 // Make sure there are no open menu items 5171 $('[class*="has-children"]').removeClass('hover'); 5172 5173 $('[class*="has-children"] > a').each( function(){ 5174 // Add a class so we know the items to handle 5175 $(this).addClass('prevent-one').attr('hasbeenclicked', false); 5176 }); 5177 5178 $('a.prevent-one').on('click', function(e) { 5179 if( $( this ).attr( 'hasbeenclicked' ) == "false" ) { 5180 e.preventDefault(); 5181 e.stopPropagation(); 5182 5183 $(this).attr('hasbeenclicked', true); 5184 5185 // Open the sub menu of this parent item 5186 $(this).parent().addClass('hover') 5187 // When a parent menu item is activated, 5188 // close other menu items on the same level 5189 .siblings().removeClass('hover').find('> a.prevent-one').attr('hasbeenclicked', false); 5190 } 5191 }); 5192 } 5193 5194 // Restore the original behaviour when in portrait mode; 5195 // use case: vertical menu, all menu items are visible. 5196 function unHandleParentMenuItems() { 5197 $('a.prevent-one').each(function(){ 5198 // Unbind te click handler 5199 $(this).unbind(); 5200 }); 5201 } 5202 5203 // When a sub menu is open, close it by a touch on 5204 // any other part of the viewport than navigation. 5205 // use case: normal, horizontal menu, touch events, 5206 // sub menus are not visible. 5207 function bindOuterNavClick() { 5208 $('body').on( 'touchstart', function (e) { 5209 var container = $('.nav--main'); 5210 5211 if (!container.is(e.target) // if the target of the click isn't the container... 5212 && container.has(e.target).length === 0) // ... nor a descendant of the container 5213 { 5214 $('[class*="has-children"]').removeClass('hover'); 5215 $('a.prevent-one').attr('hasbeenclicked', false); 5216 } 5217 }); 5218 } 5219 5220 return { 5221 handle: handleParentMenuItems, 5222 unHandle: unHandleParentMenuItems, 5223 bindOuterNavClick: bindOuterNavClick 5224 } 5225 }()); 5226 5227 /** 5228 * function used to make the navigation bar on big screens 5229 * sticky or static depending on the scroll position 5230 */ 5231 5232 function updateStickyMenu() { 5233 5234 // pin 5235 if (latestKnownScrollY + pageTop > navTop && !sticked) { 5236 $nav.css({ 5237 position: 'fixed', 5238 top: pageTop, 5239 left: pageLeft, 5240 width: pageWidth 5241 }); 5242 5243 sticked = true; 5244 return; 5245 } 5246 5247 // unpin 5248 if (latestKnownScrollY + pageTop <= navTop && sticked) { 5249 5250 $nav.css({ 5251 position: '', 5252 left: '', 5253 top: '', 5254 width: '' 5255 }); 5256 5257 sticked = false; 5258 } 5259 5260 } 5261 5262 /** 5263 * because we hard-code properties on the navigation bar when we stick it at the top of the window 5264 * we need to update some properties on window resize 5265 */ 5266 5267 function refreshNavigation() { 5268 navTop = (typeof $navContainer.offset() !== 'undefined') ? $navContainer.offset().top : 0; 5269 navLeft = (typeof $navContainer.offset() !== 'undefined') ? $navContainer.offset().left : 0; 5270 containerWidth = $navContainer.outerWidth(); 5271 navWidth = $nav.outerWidth(); 5272 navHeight = $nav.outerHeight(); 5273 pageTop = $('#page').offset().top; 5274 pageWidth = $('#page').width(); 5275 5276 $navContainer.height(navHeight); 5277 5278 if (sticked) { 5279 $nav.velocity({ 5280 width: pageWidth 5281 }, { 5282 easing: "easeOutCubic", 5283 duration: 200 5284 }); 5285 } 5286 5287 if (isOpen) { 5288 $([$nav, $navTrigger]).each(function (i, obj) { 5289 $(obj).velocity({ 5290 translateX: navWidth 5291 }, { 5292 easing: "easeOutQuint", 5293 duration: 200 5294 }); 5295 }); 5296 } 5297 5298 navWidth = containerWidth; 5299 } 5300 5301 /** 5302 * cardHover jQuery plugin 5303 * 5304 * we need to create a jQuery plugin so we can easily create the hover animations on the archive 5305 * both an window.load and on jetpack's infinite scroll 'post-load' 5306 */ 5307 $.fn.addHoverAnimation = function () { 5308 5309 return this.each(function (i, obj) { 5310 5311 var $obj = $(obj), 5312 $handler = $obj.find('.hover__handler'), 5313 $hover = $obj.find('.hover'); 5314 5315 // if we don't have have elements that need to be animated return 5316 if (!$hover.length) { 5317 return; 5318 } 5319 5320 var $letter = $hover.find('.hover__letter'), 5321 letterWidth = $letter.outerWidth, 5322 letterHeight = $letter.outerHeight; 5323 5324 $hover.find('.hover__bg').velocity({ 5325 opacity: 0 5326 }, { 5327 duration: 0 5328 }); 5329 $hover.find('.hover__line').velocity({ 5330 height: 0 5331 }, { 5332 duration: 0 5333 }); 5334 $hover.find('.hover__more').velocity({ 5335 opacity: 0 5336 }, { 5337 duration: 0 5338 }); 5339 $hover.find('.hover__letter').velocity({ 5340 opacity: 0, 5341 translateX: '-50%', 5342 translateY: '-50%', 5343 scaleX: 1.25, 5344 scaleY: 1.25 5345 }, { 5346 duration: 0 5347 }); 5348 5349 // bind the tweens we created above to mouse events accordingly, through hoverIntent to avoid flickering 5350 if ($handler.length) { 5351 $handler.hoverIntent({ 5352 over: animateHoverIn, 5353 out: animateHoverOut, 5354 timeout: 100, 5355 interval: 50 5356 }); 5357 } 5358 5359 function animateHoverIn() { 5360 5361 $hover.find('.hover__bg').velocity("reverse", { 5362 easing: "easeOutQuart", 5363 duration: 500 5364 }); 5365 $hover.find('.hover__line').velocity("reverse", { 5366 easing: "easeOutQuart", 5367 duration: 350, 5368 delay: 150 5369 }); 5370 $hover.find('.hover__more').velocity("reverse", { 5371 easing: "easeOutQuart", 5372 duration: 350, 5373 delay: 150 5374 }); 5375 $hover.find('.hover__letter').velocity({ 5376 scaleX: 1, 5377 scaleY: 1, 5378 opacity: 0.2, 5379 translateX: '-50%', 5380 translateY: '-50%' 5381 }, { 5382 easing: "easeOutQuart", 5383 duration: 350, 5384 delay: 150 5385 }); 5386 5387 } 5388 5389 function animateHoverOut() { 5390 5391 var letterHeight = $hover.find('.hover__letter-mask').outerHeight(); 5392 5393 $hover.find('.hover__letter').velocity({ 5394 opacity: 0, 5395 translateX: '-50%', 5396 translateY: '-50%', 5397 scaleX: 1.25, 5398 scaleY: 1.25 5399 }, { 5400 easing: "easeOutQuart", 5401 duration: 350, 5402 delay: 0 5403 }); 5404 $hover.find('.hover__more').velocity("reverse", { 5405 duration: 350, 5406 delay: 0 5407 }); 5408 $hover.find('.hover__line').velocity("reverse", { 5409 duration: 350, 5410 delay: 0 5411 }); 5412 $hover.find('.hover__bg').velocity("reverse", { 5413 duration: 350, 5414 delay: 0 5415 }); 5416 5417 } 5418 5419 }); 5420 }; 5421 5422 // /* ====== Search Overlay Logic ====== */ 5423 (function () { 5424 5425 var isOpen = false,
5426 $overlay = $('.overlay--search'); 5427 5428 // update overlay position (if it's open) on window.resize 5429 $(window).on('smartresize', function () { 5430 5431 windowWidth = $(window).outerWidth(); 5432 5433 if (isOpen) { 5434 $overlay.velocity({ 5435 translateX: -1 * windowWidth 5436 }, { 5437 duration: 200, 5438 easing: "easeInCubic" 5439 }); 5440 } 5441 5442 }); 5443 5444 /** 5445 * dismiss overlay 5446 */ 5447 5448 function closeOverlay() { 5449 5450 if (!isOpen) { 5451 return; 5452 } 5453 5454 var offset; 5455 5456 if ($('body').hasClass('rtl')) { 5457 offset = windowWidth 5458 } else { 5459 offset = -1 * windowWidth 5460 } 5461 5462 // we don't need a timeline for this animations so we'll use a simple tween between two states 5463 $overlay.velocity({ 5464 translateX: offset 5465 }, { 5466 duration: 0 5467 }); 5468 $overlay.velocity({ 5469 translateX: 0 5470 }, { 5471 duration: 300, 5472 easing: "easeInCubic" 5473 }); 5474 5475 // remove focus from the search field 5476 $overlay.find('input').blur(); 5477 5478 isOpen = false; 5479 } 5480 5481 function escOverlay(e) { 5482 if (e.keyCode == 27) { 5483 closeOverlay(); 5484 } 5485 } 5486 5487 // create animation and run it on 5488 $('.nav__item--search').on('click touchstart', function (e) { 5489 // prevent default behavior and stop propagation 5490 e.preventDefault(); 5491 e.stopPropagation(); 5492 5493 // if through some kind of sorcery the navigation drawer is already open return 5494 if (isOpen) { 5495 return; 5496 } 5497 5498 var offset; 5499 5500 if ($('body').hasClass('rtl')) { 5501 offset = windowWidth 5502 } else { 5503 offset = -1 * windowWidth 5504 } 5505 5506 // automatically focus the search field so the user can type right away 5507 $overlay.find('input').focus(); 5508 5509 $overlay.velocity({ 5510 translateX: 0 5511 }, { 5512 duration: 0 5513 }).velocity({ 5514 translateX: offset 5515 }, { 5516 duration: 300, 5517 easing: "easeOut", 5518 queue: false 5519 }); 5520 5521 $('.search-form').velocity({ 5522 translateX: 300, 5523 opacity: 0 5524 }, { 5525 duration: 0 5526 }).velocity({ 5527 opacity: 1 5528 }, { 5529 duration: 200, 5530 easing: "easeOutQuad", 5531 delay: 200, 5532 queue: false 5533 }).velocity({ 5534 translateX: 0 5535 }, { 5536 duration: 400, 5537 easeing: [0.175, 0.885, 0.320, 1.275], 5538 delay: 50, 5539 queue: false 5540 }); 5541 5542 $('.overlay__wrapper > p').velocity({ 5543 translateX: 200, 5544 opacity: 0 5545 }, { 5546 duration: 0 5547 }).velocity({ 5548 opacity: 1 5549 }, { 5550 duration: 400, 5551 easing: "easeOutQuad", 5552 delay: 350, 5553 queue: false 5554 }).velocity({ 5555 translateX: 0 5556 }, { 5557 duration: 400, 5558 easing: [0.175, 0.885, 0.320, 1.275], 5559 delay: 250, 5560 queue: false 5561 }); 5562 5563 // bind overlay dismissal to escape key 5564 $(document).on('keyup', escOverlay); 5565 5566 isOpen = true; 5567 }); 5568 5569 // create function to hide the search overlay and bind it to the click event 5570 $('.overlay__close').on('click touchstart', function (e) { 5571 5572 e.preventDefault(); 5573 e.stopPropagation(); 5574 5575 closeOverlay(); 5576 5577 // unbind overlay dismissal from escape key 5578 $(document).off('keyup', escOverlay); 5579 5580 }); 5581 5582 })(); 5583 5584 // /* ====== Smart Resize Logic ====== */ 5585 // It's best to debounce the resize event to a void performance hiccups 5586 (function ($, sr) { 5587 5588 /** 5589 * debouncing function from John Hann 5590 * http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/ 5591 */ 5592 var debounce = function (func, threshold, execAsap) { 5593 var timeout; 5594 5595 return function debounced() { 5596 var obj = this, 5597 args = arguments; 5598 5599 function delayed() { 5600 if (!execAsap) func.apply(obj, args); 5601 timeout = null; 5602 } 5603 5604 if (timeout) clearTimeout(timeout); 5605 else if (execAsap) func.apply(obj, args); 5606 5607 timeout = setTimeout(delayed, threshold || 200); 5608 }; 5609 } 5610 // smartresize 5611 jQuery.fn[sr] = function (fn) { 5612 return fn ? this.bind('resize', debounce(fn)) : this.trigger(sr); 5613 }; 5614 5615 })(jQuery, 'smartresize'); 5616 var latestKnownScrollY = window.scrollY, 5617 ticking = false; 5618 5619 function requestTick() { 5620 "use strict"; 5621 5622 if (!ticking) { 5623 requestAnimationFrame(update); 5624 } 5625 ticking = true; 5626 } 5627 5628 function update() { 5629 "use strict"; 5630 5631 ticking = false; 5632 5633 if (!is_android) { 5634 updateStickyMenu(); 5635 } 5636 } 5637 5638 /* ====== INTERNAL FUNCTIONS END ====== */ 5639 5640 5641 /* ====== ONE TIME INIT ====== */ 5642
5643 function init() { 5644 5645 // /* GLOBAL VARS */ 5646 touch = false; 5647 5648 // GET BROWSER DIMENSIONS 5649 browserSize(); 5650 5651 // /* DETECT PLATFORM */ 5652 platformDetect(); 5653 } 5654 5655 5656 /* --- GLOBAL EVENT HANDLERS --- */ 5657 5658 5659 /* ====== ON DOCUMENT READY ====== */ 5660 5661 $(document).ready(function () { 5662 init(); 5663 }); 5664 5665 5666 /* ====== ON WINDOW LOAD ====== */ 5667 5668 $window.load(function () { 5669 5670 if ( !$html.hasClass( 'touch' ) ) { 5671 var $nav = $( '.nav--main' ).addClass( 'hover-intent' ); 5672 5673 $( '.nav--main li' ).hoverIntent({ 5674 over: showSubMenu, 5675 out: hideSubMenu, 5676 timeout: 300 5677 }); 5678 } else if ( $html.hasClass( 'touch') && windowWidth > 1000 ) { 5679 HandleParentMenuItems.handle(); 5680 HandleParentMenuItems.bindOuterNavClick(); 5681 } 5682 5683 function showSubMenu() { 5684 $(this).addClass('hover'); 5685 } 5686 5687 function hideSubMenu() { 5688 $(this).removeClass('hover'); 5689 } 5690 5691 }); 5692 5693 /* ====== ON RESIZE ====== */ 5694 5695 $(window).smartresize(function () { 5696 if (!is_android) { 5697 refreshNavigation(); 5698 } 5699 windowWidth = $(window).outerWidth(); 5700 windowHeight = $(window).outerHeight(); 5701 5702 if( $html.hasClass( 'touch' ) ) { 5703 if( windowWidth >= 1000 ) { 5704 // Handle parent menu items 5705 HandleParentMenuItems.handle(); 5706 } else if ( windowWidth < 1000 ) { 5707 // Remove handlers 5708 HandleParentMenuItems.unHandle(); 5709 } 5710 } 5711 }); 5712 5713 /* ====== ON SCROLL ====== */ 5714 5715 $window.on('scroll', function (e) { 5716 "use strict"; 5717 5718 latestKnownScrollY = window.scrollY; 5719 requestTick(); 5720 }); 5721 // /* ====== HELPER FUNCTIONS ====== */ 5722 /** 5723 * function similar to PHP's empty function 5724 */ 5725 5726 function empty(data) { 5727 if (typeof(data) == 'number' || typeof(data) == 'boolean') { 5728 return false; 5729 } 5730 if (typeof(data) == 'undefined' || data === null) { 5731 return true; 5732 } 5733 if (typeof(data.length) != 'undefined') { 5734 return data.length === 0; 5735 } 5736 var count = 0; 5737 for (var i in data) { 5738 // if(data.hasOwnProperty(i)) 5739 // 5740 // This doesn't work in ie8/ie9 due the fact that hasOwnProperty works only on native objects. 5741 // http://stackoverflow.com/questions/8157700/object-has-no-hasownproperty-method-i-e-its-undefined-ie8 5742 // 5743 // for hosts objects we do this 5744 if (Object.prototype.hasOwnProperty.call(data, i)) { 5745 count++; 5746 } 5747 } 5748 return count === 0; 5749 } 5750 5751 /** 5752 * function to add/modify a GET parameter 5753 */ 5754 5755 function setQueryParameter(uri, key, value) { 5756 var re = new RegExp("([?|&])" + key + "=.*?(&|$)", "i"); 5757 separator = uri.indexOf('?') !== -1 ? "&" : "?"; 5758 if (uri.match(re)) { 5759 return uri.replace(re, '$1' + key + "=" + value + '$2'); 5760 } 5761 else { 5762 return uri + separator + key + "=" + value; 5763 } 5764 } 5765 5766 /** 5767 * requestAnimationFrame polyfill by Erik Möller. 5768 * Fixes from Paul Irish, Tino Zijdel, Andrew Mao, Klemen SlaviÄ, Darius Bacon 5769 * 5770 * MIT license 5771 */ 5772 5773 if (!Date.now) 5774 Date.now = function () { 5775 return new Date().getTime(); 5776 }; 5777 5778 (function () { 5779 'use strict'; 5780 5781 var vendors = ['webkit', 'moz']; 5782 for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) { 5783 var vp = vendors[i]; 5784 window.requestAnimationFrame = window[vp + 'RequestAnimationFrame']; 5785 window.cancelAnimationFrame = (window[vp + 'CancelAnimationFrame'] 5786 || window[vp + 'CancelRequestAnimationFrame']); 5787 } 5788 if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) // iOS6 is buggy 5789 || !window.requestAnimationFrame || !window.cancelAnimationFrame) { 5790 var lastTime = 0; 5791 window.requestAnimationFrame = function (callback) { 5792 var now = Date.now(); 5793 var nextTime = Math.max(lastTime + 16, now); 5794 return setTimeout(function () { 5795 callback(lastTime = nextTime); 5796 }, 5797 nextTime - now); 5798 }; 5799 window.cancelAnimationFrame = clearTimeout; 5800 } 5801 }()); 5802 5803})(jQuery, window);; 5804/** 5805 * core-js 3.39.0 5806 * © 2014-2024 Denis Pushkarev (zloirock.ru) 5807 * license: https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE 5808 * source: https://github.com/zloirock/core-js 5809 */ 5810!function(r){"use strict";var t,e,n;t=[function(r,t,e){e(1),e(71),e(72),e(85),e(109),r.exports=e(111)},function(t,e,n){var o=n(2),a=n(3),c=n(67),i=n(68),u=n(69),s=n(29),f=n(70),p=a.Promise,l=!1;o({target:"Promise",stat:!0,forced:!p||!p.try||f(function(){p.try(function(r){l=8===r},8)}).error||!l},{try:function(t){var e=arguments.length>
58101?i(arguments,1):[],n=u.f(this),o=f(function(){return c(s(t),r,e)});return(o.error?n.reject:n.resolve)(o.value),n.promise}})},function(t,e,n){var o=n(3),a=n(4).f,c=n(42),i=n(46),u=n(36),s=n(54),f=n(66);t.exports=function(t,e){var n,p,l,y,v,h=t.target,b=t.global,g=t.stat;if(n=b?o:g?o[h]||u(h,{}):o[h]&&o[h].prototype)for(p in e){if(y=e[p],l=t.dontCallGetSet?(v=a(n,p))&&v.value:n[p],!f(b?p:h+(g?".":"#")+p,t.forced)&&l!==r){if(typeof y==typeof l)continue;s(y,l)}(t.sham||l&&l.sham)&&c(y,"sham",!0),i(n,p,y,t)}}},function(r,t,e){var n=function(r){return r&&r.Math===Math&&r};r.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof global&&global)||n("object"==typeof this&&this)||function(){return this}()||Function("return this")()},function(r,t,e){var n=e(5),o=e(7),a=e(9),c=e(10),i=e(11),u=e(17),s=e(37),f=e(40),p=Object.getOwnPropertyDescriptor;t.f=n?p:function(r,t){if(r=i(r),t=u(t),f)try{return p(r,t)}catch(r){}if(s(r,t))return c(!o(a.f,r,t),r[t])}},function(r,t,e){var n=e(6);r.exports=!n(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},function(r,t,e){r.exports=function(r){try{return!!r()}catch(r){return!0}}},function(r,t,e){var n=e(8),o=Function.prototype.call;r.exports=n?o.bind(o):function(){return o.apply(o,arguments)}},function(r,t,e){var n=e(6);r.exports=!n(function(){var r=function(){}.bind();return"function"!=typeof r||r.hasOwnProperty("prototype")})},function(r,t,e){var n={}.propertyIsEnumerable,o=Object.getOwnPropertyDescriptor,a=o&&!n.call({1:2},1);t.f=a?function(r){var t=o(this,r);return!!t&&t.enumerable}:n},function(r,t,e){r.exports=function(r,t){return{enumerable:!(1&r),configurable:!(2&r),writable:!(4&r),value:t}}},function(r,t,e){var n=e(12),o=e(15);r.exports=function(r){return n(o(r))}},function(r,t,e){var n=e(13),o=e(6),a=e(14),c=Object,i=n("".split);r.exports=o(function(){return!c("z").propertyIsEnumerable(0)})?function(r){return"String"===a(r)?i(r,""):c(r)}:c},function(r,t,e){var n=e(8),o=Function.prototype,a=o.call,c=n&&o.bind.bind(a,a);r.exports=n?c:function(r){return function(){return a.apply(r,arguments)}}},function(r,t,e){var n=e(13),o=n({}.toString),a=n("".slice);r.exports=function(r){return a(o(r),8,-1)}},function(r,t,e){var n=e(16),o=TypeError;r.exports=function(r){if(n(r))throw new o("Can't call method on "+r);return r}},function(t,e,n){t.exports=function(t){return null===t||t===r}},function(r,t,e){var n=e(18),o=e(21);
5810r.exports=function(r){var t=n(r,"string");return o(t)?t:t+""}},function(t,e,n){var o=n(7),a=n(19),c=n(21),i=n(28),u=n(31),s=n(32),f=TypeError,p=s("toPrimitive");t.exports=function(t,e){if(!a(t)||c(t))return t;var n,s=i(t,p);if(s){if(e===r&&(e="default"),n=o(s,t,e),!a(n)||c(n))return n;throw new f("Can't convert object to primitive value")}return e===r&&(e="number"),u(t,e)}},function(r,t,e){var n=e(20);r.exports=function(r){return"object"==typeof r?null!==r:n(r)}},function(t,e,n){var o="object"==typeof document&&document.all;t.exports=void 0===o&&o!==r?function(r){return"function"==typeof r||r===o}:function(r){return"function"==typeof r}},function(r,t,e){var n=e(22),o=e(20),a=e(23),c=e(24),i=Object;r.exports=c?function(r){return"symbol"==typeof r}:function(r){var t=n("Symbol");return o(t)&&a(t.prototype,i(r))}},function(t,e,n){var o=n(3),a=n(20);t.exports=function(t,e){return arguments.length<2?(n=o[t],a(n)?n:r):o[t]&&o[t][e];var n}},function(r,t,e){var n=e(13);r.exports=n({}.isPrototypeOf)},function(r,t,e){var n=e(25);r.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},function(r,t,e){var n=e(26),o=e(6),a=e(3).String;r.exports=!!Object.getOwnPropertySymbols&&!o(function(){var r=Symbol("symbol detection");return!a(r)||!(Object(r)instanceof Symbol)||!Symbol.sham&&n&&n<41})},function(r,t,e){var n,o,a=e(3),c=e(27),i=a.process,u=a.Deno,s=i&&i.versions||u&&u.version,f=s&&s.v8;f&&(o=(n=f.split("."))[0]>
vendor: 6,353 bytes, line 5810
58100&&n[0]<4?1:+(n[0]+n[1])),!o&&c&&(!(n=c.match(/Edge\/(\d+)/))||n[1]>=74)&&(n=c.match(/Chrome\/(\d+)/))&&(o=+n[1]),r.exports=o},function(r,t,e){var n=e(3).navigator,o=n&&n.userAgent;r.exports=o?String(o):""},function(t,e,n){var o=n(29),a=n(16);t.exports=function(t,e){var n=t[e];return a(n)?r:o(n)}},function(r,t,e){var n=e(20),o=e(30),a=TypeError;r.exports=function(r){if(n(r))return r;throw new a(o(r)+" is not a function")}},function(r,t,e){var n=String;r.exports=function(r){try{return n(r)}catch(r){return"Object"}}},function(r,t,e){var n=e(7),o=e(20),a=e(19),c=TypeError;r.exports=function(r,t){var e,i;if("string"===t&&o(e=r.toString)&&!a(i=n(e,r)))return i;if(o(e=r.valueOf)&&!a(i=n(e,r)))return i;if("string"!==t&&o(e=r.toString)&&!a(i=n(e,r)))return i;throw new c("Can't convert object to primitive value")}},function(r,t,e){var n=e(3),o=e(33),a=e(37),c=e(39),i=e(25),u=e(24),s=n.Symbol,f=o("wks"),p=u?s.for||s:s&&s.withoutSetter||c;r.exports=function(r){return a(f,r)||(f[r]=i&&a(s,r)?s[r]:p("Symbol."+r)),f[r]}},function(r,t,e){var n=e(34);r.exports=function(r,t){return n[r]||(n[r]=t||{})}},function(r,t,e){var n=e(35),o=e(3),a=e(36),c="__core-js_shared__",i=r.exports=o[c]||a(c,{});(i.versions||(i.versions=[])).push({version:"3.39.0",mode:n?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.39.0/LICENSE",source:"https://github.com/zloirock/core-js"})},function(r,t,e){r.exports=!1},function(r,t,e){var n=e(3),o=Object.defineProperty;r.exports=function(r,t){try{o(n,r,{value:t,configurable:!0,writable:!0})}catch(e){n[r]=t}return t}},function(r,t,e){var n=e(13),o=e(38),a=n({}.hasOwnProperty);r.exports=Object.hasOwn||function(r,t){return a(o(r),t)}},function(r,t,e){var n=e(15),o=Object;r.exports=function(r){return o(n(r))}},function(t,e,n){var o=n(13),a=0,c=Math.random(),i=o(1..toString);t.exports=function(t){return"Symbol("+(t===r?"":t)+")_"+i(++a+c,36)}},function(r,t,e){var n=e(5),o=e(6),a=e(41);r.exports=!n&&!o(function(){return 7!==Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a})},function(r,t,e){var n=e(3),o=e(19),a=n.document,c=o(a)&&o(a.createElement);r.exports=function(r){return c?a.createElement(r):{}}},function(r,t,e){var n=e(5),o=e(43),a=e(10);r.exports=n?function(r,t,e){return o.f(r,t,a(1,e))}:function(r,t,e){return r[t]=e,r}},function(r,t,e){var n=e(5),o=e(40),a=e(44),c=e(45),i=e(17),u=TypeError,s=Object.defineProperty,f=Object.getOwnPropertyDescriptor,p="enumerable",l="configurable",y="writable";t.f=n?a?function(r,t,e){if(c(r),t=i(t),c(e),"function"==typeof r&&"prototype"===t&&"value"in e&&y in e&&!e[y]){var n=f(r,t);n&&n[y]&&(r[t]=e.value,e={configurable:l in e?e[l]:n[l],enumerable:p in e?e[p]:n[p],writable:!1})}return s(r,t,e)}:s:function(r,t,e){if(c(r),t=i(t),c(e),o)try{return s(r,t,e)}catch(r){}if("get"in e||"set"in e)throw new u("Accessors not supported");return"value"in e&&(r[t]=e.value),r}},function(r,t,e){var n=e(5),o=e(6);r.exports=n&&o(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},function(r,t,e){var n=e(19),o=String,a=TypeError;r.exports=function(r){if(n(r))return r;throw new a(o(r)+" is not an object")}},function(t,e,n){var o=n(20),a=n(43),c=n(47),i=n(36);t.exports=function(t,e,n,u){u||(u={});var s=u.enumerable,f=u.name!==r?u.name:e;if(o(n)&&c(n,f,u),u.global)s?t[e]=n:i(e,n);else{try{u.unsafe?t[e]&&(s=!0):delete t[e]}catch(r){}s?t[e]=n:a.f(t,e,{value:n,enumerable:!1,configurable:!u.nonConfigurable,writable:!u.nonWritable})}return t}},function(t,e,n){var o=n(13),a=n(6),c=n(20),i=n(37),u=n(5),s=n(48).CONFIGURABLE,f=n(49),p=n(50),l=p.enforce,y=p.get,v=String,h=Object.defineProperty,b=o("".slice),g=o("".replace),m=o([].join),E=u&&!a(function(){return 8!==h(function(){},"length",{value:8}).length}),d=String(String).split("String"),w=t.exports=function(t,e,n){"Symbol("===b(v(e),0,7)&&(e="["+g(v(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(e="get "+e),n&&n.setter&&(e="set "+e),(!i(t,"name")||s&&t.name!==e)&&(u?h(t,"name",{value:e,configurable:!0}):t.name=e),E&&n&&i(n,"arity")&&t.length!==n.arity&&h(t,"length",{value:n.arity});try{n&&i(n,"constructor")&&n.constructor?u&&h(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=r)}catch(r){}var o=l(t);return i(o,"source")||(o.source=m(d,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return c(this)&&y(this).source||f(this)},"toString")},function(r,t,e){var n=e(5),o=e(37),a=Function.prototype,c=n&&Object.getOwnPropertyDescriptor,i=o(a,"name"),u=i&&"something"===function(){}.name,s=i&&(!n||n&&c(a,"name").configurable);r.exports={EXISTS:i,PROPER:u,CONFIGURABLE:s}},function(r,t,e){var n=e(13),o=e(20),a=e(34),c=n(Function.toString);o(a.inspectSource)||(a.inspectSource=function(r){return c(r)}),r.exports=a.inspectSource},function(r,t,e){var n,o,a,c=e(51),i=e(3),u=e(19),s=e(42),f=e(37),p=e(34),l=e(52),y=e(53),v="Object already initialized",h=i.TypeError,b=i.WeakMap;if(c||p.state){var g=p.state||(p.state=new b);g.get=g.get,g.has=g.has,g.set=g.set,n=function(r,t){if(g.has(r))throw new h(v);return t.facade=r,g.set(r,t),t},o=function(r){return g.get(r)||{}},a=function(r){return g.has(r)}}else{var m=l("state");y[m]=!0,n=function(r,t){if(f(r,m))throw new h(v);return t.facade=r,s(r,m,t),t},o=function(r){return f(r,m)?r[m]:{}},a=function(r){return f(r,m)}}r.exports={set:n,get:o,has:a,enforce:function(r){return a(r)?o(r):n(r,{})},getterFor:function(r){return function(t){var e;if(!u(t)||(e=o(t)).type!==r)throw new h("Incompatible receiver, "+r+" required");return e}}}},function(r,t,e){var n=e(3),o=e(20),a=n.WeakMap;r.exports=o(a)&&/native code/.test(String(a))},function(r,t,e){var n=e(33),o=e(39),a=n("keys");r.exports=function(r){return a[r]||(a[r]=o(r))}},function(r,t,e){r.exports={}},function(r,t,e){var n=e(37),o=e(55),a=e(4),c=e(43);r.exports=function(r,t,e){for(var i=o(t),u=c.f,s=a.f,f=0;f<i.length;f++){var p=i[f];n(r,p)||e&&n(e,p)||u(r,p,s(t,p))}}},function(r,t,e){var n=e(22),o=e(13),a=e(56),c=e(65),i=e(45),u=o([].concat);r.exports=n("Reflect","ownKeys")||function(r){var t=a.f(i(r)),e=c.f;return e?u(t,e(r)):t}},function(r,t,e){var n=e(57),o=e(64).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(r){return n(r,o)}},function(r,t,e){var n=e(13),o=e(37),a=e(11),c=e(58).indexOf,i=e(53),u=n([].push);
5810r.exports=function(r,t){var e,n=a(r),s=0,f=[];for(e in n)!o(i,e)&&o(n,e)&&u(f,e);for(;t.length>s;)o(n,e=t[s++])&&(~c(f,e)||u(f,e));return f}},function(r,t,e){var n=e(11),o=e(59),a=e(62),c=function(r){return function(t,e,c){var i=n(t),u=a(i);if(0===u)return!r&&-1;var s,f=o(c,u);if(r&&e!=e){for(;u>f;)if((s=i[f++])!=s)return!0}else for(;u>f;f++)if((r||f in i)&&i[f]===e)return r||f||0;return!r&&-1}};r.exports={includes:c(!0),indexOf:c(!1)}},function(r,t,e){var n=e(60),o=Math.max,a=Math.min;r.exports=function(r,t){var e=n(r);return e<0?o(e+t,0):a(e,t)}},function(r,t,e){var n=e(61);r.exports=function(r){var t=+r;return t!=t||0===t?0:n(t)}},function(r,t,e){var n=Math.ceil,o=Math.floor;r.exports=Math.trunc||function(r){var t=+r;return(t>0?o:n)(t)}},function(r,t,e){var n=e(63);r.exports=function(r){return n(r.length)}},function(r,t,e){var n=e(60),o=Math.min;r.exports=function(r){var t=n(r);return t>0?o(t,9007199254740991):0}},function(r,t,e){r.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},function(r,t,e){t.f=Object.getOwnPropertySymbols},function(r,t,e){var n=e(6),o=e(20),a=/#|\.prototype\./,c=function(r,t){var e=u[i(r)];return e===f||e!==s&&(o(t)?n(t):!!t)},i=c.normalize=function(r){return String(r).replace(a,".").toLowerCase()},u=c.data={},s=c.NATIVE="N",f=c.POLYFILL="P";r.exports=c},function(r,t,e){var n=e(8),o=Function.prototype,a=o.apply,c=o.call;r.exports="object"==typeof Reflect&&Reflect.apply||(n?c.bind(a):function(){return c.apply(a,arguments)})},function(r,t,e){var n=e(13);r.exports=n([].slice)},function(t,e,n){var o=n(29),a=TypeError,c=function(t){var e,n;this.promise=new t(function(t,o){if(e!==r||n!==r)throw new a("Bad Promise constructor");e=t,n=o}),this.resolve=o(e),this.reject=o(n)};t.exports.f=function(r){return new c(r)}},function(r,t,e){r.exports=function(r){try{return{error:!1,value:r()}}catch(r){return{error:!0,value:r}}}},function(r,t,e){var n=e(2),o=e(69);n({target:"Promise",stat:!0},{withResolvers:function(){var r=o.f(this);return{promise:r.promise,resolve:r.resolve,reject:r.reject}}})},function(t,e,n){var o=n(2),a=n(3),c=n(22),i=n(10),u=n(43).f,s=n(37),f=n(73),p=n(74),l=n(79),y=n(83),v=n(84),h=n(5),b=n(35),g="DOMException",m=c("Error"),E=c(g),d=function(){f(this,w);var t=arguments.length,e=l(t<1?r:arguments[0]),n=l(t<2?r:arguments[1],"Error"),o=new E(e,n),a=new m(e);return a.name=g,u(o,"stack",i(1,v(a.stack,1))),p(o,this,d),o},w=d.prototype=E.prototype,x="stack"in new m(g),O="stack"in new E(1,2),R=E&&h&&Object.getOwnPropertyDescriptor(a,g),S=!(!R||R.writable&&R.configurable),A=x&&!S&&!O;o({global:!0,constructor:!0,forced:b||A},{DOMException:A?d:E});var D=c(g),T=D.prototype;if(T.constructor!==D)for(var _ in b||u(T,"constructor",i(1,D)),y)if(s(y,_)){var I=y[_],j=I.s;s(D,j)||u(D,j,i(6,I.c))}},function(r,t,e){var n=e(23),o=TypeError;r.exports=function(r,t){if(n(t,r))return r;throw new o("Incorrect invocation")}},function(r,t,e){var n=e(20),o=e(19),a=e(75);r.exports=function(r,t,e){var c,i;return a&&n(c=t.constructor)&&c!==e&&o(i=c.prototype)&&i!==e.prototype&&a(r,i),r}},function(t,e,n){var o=n(76),a=n(19),c=n(15),i=n(77);
vendor: 2,427 bytes, line 5810
5810t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var r,t=!1,e={};try{(r=o(Object.prototype,"__proto__","set"))(e,[]),t=e instanceof Array}catch(r){}return function(e,n){return c(e),i(n),a(e)?(t?r(e,n):e.__proto__=n,e):e}}():r)},function(r,t,e){var n=e(13),o=e(29);r.exports=function(r,t,e){try{return n(o(Object.getOwnPropertyDescriptor(r,t)[e]))}catch(r){}}},function(r,t,e){var n=e(78),o=String,a=TypeError;r.exports=function(r){if(n(r))return r;throw new a("Can't set "+o(r)+" as a prototype")}},function(r,t,e){var n=e(19);r.exports=function(r){return n(r)||null===r}},function(t,e,n){var o=n(80);t.exports=function(t,e){return t===r?arguments.length<2?"":e:o(t)}},function(r,t,e){var n=e(81),o=String;r.exports=function(r){if("Symbol"===n(r))throw new TypeError("Cannot convert a Symbol value to a string");return o(r)}},function(t,e,n){var o=n(82),a=n(20),c=n(14),i=n(32)("toStringTag"),u=Object,s="Arguments"===c(function(){return arguments}());t.exports=o?c:function(t){var e,n,o;return t===r?"Undefined":null===t?"Null":"string"==typeof(n=function(r,t){try{return r[t]}catch(r){}}(e=u(t),i))?n:s?c(e):"Object"===(o=c(e))&&a(e.callee)?"Arguments":o}},function(r,t,e){var n={};n[e(32)("toStringTag")]="z",r.exports="[object z]"===String(n)},function(r,t,e){r.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1}
vendor: 8,053 bytes, line 5810
5810,InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},function(r,t,e){var n=e(13),o=Error,a=n("".replace),c=String(new o("zxcasd").stack),i=/\n\s*at [^:]*:[^\n]*/,u=i.test(c);r.exports=function(r,t){if(u&&"string"==typeof r&&!o.prepareStackTrace)for(;t--;)r=a(r,i,"");return r}},function(t,e,n){var o,a=n(35),c=n(2),i=n(3),u=n(22),s=n(13),f=n(6),p=n(39),l=n(20),y=n(86),v=n(16),h=n(19),b=n(21),g=n(87),m=n(45),E=n(81),d=n(37),w=n(95),x=n(42),O=n(62),R=n(96),S=n(97),A=n(99),D=n(100),T=n(101),_=n(103),I=n(108),j=n(107),M=i.Object,k=i.Array,P=i.Date,C=i.Error,N=i.TypeError,L=i.PerformanceMark,U=u("DOMException"),B=A.Map,F=A.has,W=A.get,z=A.set,V=D.Set,H=D.add,G=D.has,Y=u("Object","keys"),Q=s([].push),q=s((!0).valueOf),X=s(1..valueOf),K=s("".valueOf),Z=s(P.prototype.getTime),$=p("structuredClone"),J="DataCloneError",rr="Transferring",tr=function(r){return!f(function(){var t=new i.Set([7]),e=r(t),n=r(M(7));return e===t||!e.has(7)||!h(n)||7!==+n})&&r},er=function(r,t){return!f(function(){var e=new t,n=r({a:e,b:e});return!(n&&n.a===n.b&&n.a instanceof t&&n.a.stack===e.stack)})},nr=i.structuredClone,or=a||!er(nr,C)||!er(nr,U)||(o=nr,!!f(function(){var r=o(new i.AggregateError([1],$,{cause:3}));return"AggregateError"!==r.name||1!==r.errors[0]||r.message!==$||3!==r.cause})),ar=!nr&&tr(function(r){return new L($,{detail:r}).detail}),cr=tr(nr)||ar,ir=function(r){throw new U("Uncloneable type: "+r,J)},ur=function(r,t){throw new U((t||"Cloning")+" of "+r+" cannot be properly polyfilled in this engine",J)},sr=function(r,t){return cr||ur(t),cr(r)},fr=function(t,e,n){if(F(e,t))return W(e,t);var o,a,c,u,s,f;if("SharedArrayBuffer"===(n||E(t)))o=cr?cr(t):t;else{var p=i.DataView;p||l(t.slice)||ur("ArrayBuffer");try{if(l(t.slice)&&!t.resizable)o=t.slice(0);else{a=t.byteLength,c="maxByteLength"in t?{maxByteLength:t.maxByteLength}:r,o=new ArrayBuffer(a,c),u=new p(t),s=new p(o);for(f=0;f<a;f++)s.setUint8(f,u.getUint8(f))}}catch(r){throw new U("ArrayBuffer is detached",J)}}return z(e,t,o),o},pr=function(t,e){if(b(t)&&ir("Symbol"),!h(t))return t;if(e){if(F(e,t))return W(e,t)}else e=new B;var n,o,a,c,s,f,p,y,v=E(t);switch(v){case"Array":a=k(O(t));break;case"Object":a={};break;case"Map":a=new B;break;case"Set":a=new V;break;case"RegExp":a=new RegExp(t.source,S(t));break;case"Error":switch(o=t.name){case"AggregateError":a=new(u(o))([]);break;case"EvalError":case"RangeError":case"ReferenceError":case"SuppressedError":case"SyntaxError":case"TypeError":case"URIError":a=new(u(o));break;case"CompileError":case"LinkError":case"RuntimeError":a=new(u("WebAssembly",o));break;default:a=new C}break;case"DOMException":a=new U(t.message,t.name);break;case"ArrayBuffer":case"SharedArrayBuffer":a=fr(t,e,v);break;case"DataView":case"Int8Array":case"Uint8Array":case"Uint8ClampedArray":case"Int16Array":case"Uint16Array":case"Int32Array":case"Uint32Array":case"Float16Array":case"Float32Array":case"Float64Array":case"BigInt64Array":case"BigUint64Array":f="DataView"===v?t.byteLength:t.length,a=function(r,t,e,n,o){var a=i[t];return h(a)||ur(t),new a(fr(r.buffer,o),e,n)}(t,v,t.byteOffset,f,e);break;case"DOMQuad":try{a=new DOMQuad(pr(t.p1,e),pr(t.p2,e),pr(t.p3,e),pr(t.p4,e))}catch(r){a=sr(t,v)}break;case"File":if(cr)try{a=cr(t),E(a)!==v&&(a=r)}catch(r){}if(!a)try{a=new File([t],t.name,t)}catch(r){}a||ur(v);break;case"FileList":if(c=function(){var r;try{r=new i.DataTransfer}catch(t){try{r=new i.ClipboardEvent("").clipboardData}catch(r){}}return r&&r.items&&r.files?r:null}()){for(s=0,f=O(t);s<f;s++)c.items.add(pr(t[s],e));a=c.files}else a=sr(t,v);break;case"ImageData":try{a=new ImageData(pr(t.data,e),t.width,t.height,{colorSpace:t.colorSpace})}catch(r){a=sr(t,v)}break;default:if(cr)a=cr(t);else switch(v){case"BigInt":a=M(t.valueOf());break;case"Boolean":a=M(q(t));break;case"Number":a=M(X(t));break;case"String":a=M(K(t));break;case"Date":a=new P(Z(t));break;case"Blob":try{a=t.slice(0,t.size,t.type)}catch(r){ur(v)}break;case"DOMPoint":case"DOMPointReadOnly":n=i[v];try{a=n.fromPoint?n.fromPoint(t):new n(t.x,t.y,t.z,t.w)}catch(r){ur(v)}break;case"DOMRect":case"DOMRectReadOnly":n=i[v];try{a=n.fromRect?n.fromRect(t):new n(t.x,t.y,t.width,t.height)}catch(r){ur(v)}break;case"DOMMatrix":case"DOMMatrixReadOnly":n=i[v];try{a=n.fromMatrix?n.fromMatrix(t):new n(t)}catch(r){ur(v)}break;case"AudioData":case"VideoFrame":l(t.clone)||ur(v);try{a=t.clone()}catch(r){ir(v)}break;case"CropTarget":case"CryptoKey":case"FileSystemDirectoryHandle":case"FileSystemFileHandle":case"FileSystemHandle":case"GPUCompilationInfo":case"GPUCompilationMessage":case"ImageBitmap":case"RTCCertificate":case"WebAssembly.Module":ur(v);default:ir(v)}}switch(z(e,t,a),v){case"Array":case"Object":for(p=Y(t),s=0,f=O(p);s<f;s++)y=p[s],w(a,y,pr(t[y],e));break;case"Map":t.forEach(function(r,t){z(a,pr(t,e),pr(r,e))});break;case"Set":t.forEach(function(r){H(a,pr(r,e))});break;case"Error":x(a,"message",pr(t.message,e)),d(t,"cause")&&x(a,"cause",pr(t.cause,e)),"AggregateError"===o?a.errors=pr(t.errors,e):"SuppressedError"===o&&(a.error=pr(t.error,e),a.suppressed=pr(t.suppressed,e));case"DOMException":I&&x(a,"stack",pr(t.stack,e))}return a};c({global:!0,enumerable:!0,sham:!j,forced:or},{structuredClone:function(t){var e,n,o=R(arguments.length,1)>1&&!v(arguments[1])?m(arguments[1]):r,a=o?o.transfer:r;a!==r&&(n=function(t,e){if(!h(t))throw new N("Transfer option cannot be converted to a sequence");var n=[];g(t,function(r){Q(n,m(r))});for(var o,a,c,u,s,f=0,p=O(n),v=new V;f<p;){if(o=n[f++],"ArrayBuffer"===(a=E(o))?G(v,o):F(e,o))throw new U("Duplicate transferable",J);if("ArrayBuffer"!==a){if(j)u=nr(o,{transfer:[o]});else switch(a){case"ImageBitmap":c=i.OffscreenCanvas,y(c)||ur(a,rr);try{(s=new c(o.width,o.height)).getContext("bitmaprenderer").transferFromImageBitmap(o),u=s.transferToImageBitmap()}catch(r){}break;case"AudioData":case"VideoFrame":l(o.clone)&&l(o.close)||ur(a,rr);try{u=o.clone(),o.close()}catch(r){}break;case"MediaSourceHandle":case"MessagePort":case"MIDIAccess":case"OffscreenCanvas":case"ReadableStream":case"RTCDataChannel":case"TransformStream":case"WebTransportReceiveStream":case"WebTransportSendStream":case"WritableStream":ur(a,rr)}if(u===r)throw new U("This object cannot be transferred: "+a,J);z(e,o,u)}else H(v,o)}return v}(a,e=new B));var c=pr(t,e);return n&&function(r){T(r,function(r){j?cr(r,{transfer:[r]}):l(r.transfer)?r.transfer():_?_(r):ur("ArrayBuffer",rr)})}(n),c}})},function(r,t,e){var n=e(13),o=e(6),a=e(20),c=e(81),i=e(22),u=e(49),s=function(){},f=i("Reflect","construct"),p=/^\s*(?:class|function)\b/,l=n(p.exec),y=!p.test(s),v=function(r){if(!a(r))return!1;try{return f(s,[],r),!0}catch(r){return!1}},h=function(r){if(!a(r))return!1;switch(c(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return y||!!l(p,u(r))}catch(r){return!0}};h.sham=!0,r.exports=!f||o(function(){var r;return v(v.call)||!v(Object)||!v(function(){r=!0})||r})?h:v},function(r,t,e){var n=e(88),o=e(7),a=e(45),c=e(30),i=e(90),u=e(62),s=e(23),f=e(92),p=e(93),l=e(94),y=TypeError,v=function(r,t){this.stopped=r,this.result=t},h=v.prototype;r.exports=function(r,t,e){var b,g,m,E,d,w,x,O=e&&e.that,R=!(!e||!e.AS_ENTRIES),S=!(!e||!e.IS_RECORD),A=!(!e||!e.IS_ITERATOR),D=!(!e||!e.INTERRUPTED),T=n(t,O),_=function(r){return b&&l(b,"normal",r),new v(!0,r)},I=function(r){return R?(a(r),D?T(r[0],r[1],_):T(r[0],r[1])):D?T(r,_):T(r)};if(S)b=r.iterator;else if(A)b=r;else{if(!(g=p(r)))throw new y(c(r)+" is not iterable");if(i(g)){for(m=0,E=u(r);E>m;m++)if((d=I(r[m]))&&s(h,d))return d;return new v(!1)}b=f(r,g)}for(w=S?r.next:b.next;!(x=o(w,b)).done;){try{d=I(x.value)}catch(r){l(b,"throw",r)}if("object"==typeof d&&d&&s(h,d))return d}return new v(!1)}},function(t,e,n){var o=n(89),a=n(29),c=n(8),i=o(o.bind);t.exports=function(t,e){return a(t),e===r?t:c?i(t,e):function(){return t.apply(e,arguments)}}},function(r,t,e){var n=e(14),o=e(13);r.exports=function(r){if("Function"===n(r))return o(r)}},function(t,e,n){var o=n(32),a=n(91),c=o("iterator"),i=Array.prototype;
5810t.exports=function(t){return t!==r&&(a.Array===t||i[c]===t)}},function(r,t,e){r.exports={}},function(r,t,e){var n=e(7),o=e(29),a=e(45),c=e(30),i=e(93),u=TypeError;r.exports=function(r,t){var e=arguments.length<2?i(r):t;if(o(e))return a(n(e,r));throw new u(c(r)+" is not iterable")}},function(r,t,e){var n=e(81),o=e(28),a=e(16),c=e(91),i=e(32)("iterator");r.exports=function(r){if(!a(r))return o(r,i)||o(r,"@@iterator")||c[n(r)]}},function(r,t,e){var n=e(7),o=e(45),a=e(28);r.exports=function(r,t,e){var c,i;o(r);try{if(!(c=a(r,"return"))){if("throw"===t)throw e;return e}c=n(c,r)}catch(r){i=!0,c=r}if("throw"===t)throw e;if(i)throw c;return o(c),e}},function(r,t,e){var n=e(5),o=e(43),a=e(10);r.exports=function(r,t,e){n?o.f(r,t,a(0,e)):r[t]=e}},function(r,t,e){var n=TypeError;r.exports=function(r,t){if(r<t)throw new n("Not enough arguments");return r}},function(t,e,n){var o=n(7),a=n(37),c=n(23),i=n(98),u=RegExp.prototype;t.exports=function(t){var e=t.flags;return e!==r||"flags"in u||a(t,"flags")||!c(u,t)?e:o(i,t)}},function(r,t,e){var n=e(45);r.exports=function(){var r=n(this),t="";return r.hasIndices&&(t+="d"),r.global&&(t+="g"),r.ignoreCase&&(t+="i"),r.multiline&&(t+="m"),r.dotAll&&(t+="s"),r.unicode&&(t+="u"),r.unicodeSets&&(t+="v"),r.sticky&&(t+="y"),t}},function(r,t,e){var n=e(13),o=Map.prototype;r.exports={Map:Map,set:n(o.set),get:n(o.get),has:n(o.has),remove:n(o.delete),proto:o}},function(r,t,e){var n=e(13),o=Set.prototype;r.exports={Set:Set,add:n(o.add),has:n(o.has),remove:n(o.delete),proto:o}},function(r,t,e){var n=e(13),o=e(102),a=e(100),c=a.Set,i=a.proto,u=n(i.forEach),s=n(i.keys),f=s(new c).next;r.exports=function(r,t,e){return e?o({iterator:s(r),next:f},t):u(r,t)}},function(t,e,n){var o=n(7);t.exports=function(t,e,n){for(var a,c,i=n?t:t.iterator,u=t.next;!(a=o(u,i)).done;)if((c=e(a.value))!==r)return c}},function(r,t,e){var n,o,a,c,i=e(3),u=e(104),s=e(107),f=i.structuredClone,p=i.ArrayBuffer,l=i.MessageChannel,y=!1;if(s)y=function(r){f(r,{transfer:[r]})};else if(p)try{l||(n=u("worker_threads"))&&(l=n.MessageChannel),l&&(o=new l,a=new p(2),c=function(r){o.port1.postMessage(null,[r])},2===a.byteLength&&(c(a),0===a.byteLength&&(y=c)))}catch(r){}r.exports=y},function(r,t,e){var n=e(3),o=e(105);r.exports=function(r){if(o){try{return n.process.getBuiltinModule(r)}catch(r){}try{return Function('return require("'+r+'")')()}catch(r){}}}},function(r,t,e){var n=e(106);r.exports="NODE"===n},function(r,t,e){var n=e(3),o=e(27),a=e(14),c=function(r){return o.slice(0,r.length)===r};r.exports=c("Bun/")?"BUN":c("Cloudflare-Workers")?"CLOUDFLARE":c("Deno/")?"DENO":c("Node.js/")?"NODE":n.Bun&&"string"==typeof Bun.version?"BUN":n.Deno&&"object"==typeof Deno.version?"DENO":"process"===a(n.process)?"NODE":n.window&&n.document?"BROWSER":"REST"},function(r,t,e){var n=e(3),o=e(6),a=e(26),c=e(106),i=n.structuredClone;r.exports=!!i&&!o(function(){if("DENO"===c&&a>92||"NODE"===c&&a>94||"BROWSER"===c&&a>97)return!1;var r=new ArrayBuffer(8),t=i(r,{transfer:[r]});return 0!==r.byteLength||8!==t.byteLength})},function(r,t,e){var n=e(6),o=e(10);r.exports=!n(function(){var r=new Error("a");return!("stack"in r)||(Object.defineProperty(r,"stack",o(1,7)),7!==r.stack)})},function(t,e,n){var o=n(2),a=n(22),c=n(6),i=n(96),u=n(80),s=n(110),f=a("URL"),p=s&&c(function(){f.canParse()}),l=c(function(){return 1!==f.canParse.length});o({target:"URL",stat:!0,forced:!p||l},{canParse:function(t){var e=i(arguments.length,1),n=u(t),o=e<2||arguments[1]===r?r:u(arguments[1]);try{return!!new f(n,o)}catch(r){return!1}}})},function(t,e,n){var o=n(6),a=n(32),c=n(5),i=n(35),u=a("iterator");t.exports=!o(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,n=new URLSearchParams("a=1&a=2&b=3"),o="";return t.pathname="c%20d",e.forEach(function(r,t){e.delete("b"),o+=t+r}),n.delete("a",2),n.delete("b",r),i&&(!t.toJSON||!n.has("a",1)||n.has("a",2)||!n.has("a",r)||n.has("b"))||!e.size&&(i||!c)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[u]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://ÑеÑÑ").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==o||"x"!==new URL("https://x",r).host})},function(t,e,n){var o=n(2),a=n(22),c=n(96),i=n(80),u=n(110),s=a("URL");o({target:"URL",stat:!0,forced:!u},{parse:function(t){var e=c(arguments.length,1),n=i(t),o=e<2||arguments[1]===r?r:i(arguments[1]);try{return new s(n,o)}catch(r){return null}}})}],e={},(n=function(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}).m=t,n.c=e,n.d=function(r,t,e){n.o(r,t)||Object.defineProperty(r,t,{enumerable:!0,get:e})},n.r=function(r){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}
5810),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,t){if(1&t&&(r=n(r)),8&t)return r;if(4&t&&"object"==typeof r&&r&&r.__esModule)return r;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:r}),2&t&&"string"!=typeof r)for(var o in r)n.d(e,o,function(t){return r[t]}.bind(null,o));return e},n.n=function(r){var t=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(t,"a",t),t},n.o=function(r,t){return Object.prototype.hasOwnProperty.call(r,t)},n.p="",n(n.s=0)}();;
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.