2 lines
7.4 KiB
JavaScript
2 lines
7.4 KiB
JavaScript
!function(e,t){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",t):"object"==typeof module&&module.exports?module.exports=t():e.EvEmitter=t()}("undefined"!=typeof window?window:this,function(){function e(){}var t=e.prototype;return t.on=function(e,t){var i;if(e&&t)return-1==(i=(i=this._events=this._events||{})[e]=i[e]||[]).indexOf(t)&&i.push(t),this},t.once=function(e,t){var i;if(e&&t)return this.on(e,t),((i=this._onceEvents=this._onceEvents||{})[e]=i[e]||{})[t]=!0,this},t.off=function(e,t){e=this._events&&this._events[e];if(e&&e.length)return-1!=(t=e.indexOf(t))&&e.splice(t,1),this},t.emitEvent=function(e,t){var i=this._events&&this._events[e];if(i&&i.length){i=i.slice(0),t=t||[];for(var n=this._onceEvents&&this._onceEvents[e],o=0;o<i.length;o++){var s=i[o];n&&n[s]&&(this.off(e,s),delete n[s]),s.apply(this,t)}return this}},t.allOff=function(){delete this._events,delete this._onceEvents},e}),function(t,i){"use strict";"function"==typeof define&&define.amd?define(["ev-emitter/ev-emitter"],function(e){return i(t,e)}):"object"==typeof module&&module.exports?module.exports=i(t,require("ev-emitter")):t.imagesLoaded=i(t,t.EvEmitter)}("undefined"!=typeof window?window:this,function(t,e){function s(e,t){for(var i in t)e[i]=t[i];return e}function r(e,t,i){var n,o;return this instanceof r?(n="string"==typeof(n=e)?document.querySelectorAll(e):n)?(this.elements=(o=n,Array.isArray(o)?o:"object"==typeof o&&"number"==typeof o.length?h.call(o):[o]),this.options=s({},this.options),"function"==typeof t?i=t:s(this.options,t),i&&this.on("always",i),this.getImages(),a&&(this.jqDeferred=new a.Deferred),void setTimeout(this.check.bind(this))):void d.error("Bad element for imagesLoaded "+(n||e)):new r(e,t,i)}function i(e){this.img=e}function n(e,t){this.url=e,this.element=t,this.img=new Image}var a=t.jQuery,d=t.console,h=Array.prototype.slice,c=((r.prototype=Object.create(e.prototype)).options={},r.prototype.getImages=function(){this.images=[],this.elements.forEach(this.addElementImages,this)},r.prototype.addElementImages=function(e){"IMG"==e.nodeName&&this.addImage(e),!0===this.options.background&&this.addElementBackgroundImages(e);var t=e.nodeType;if(t&&c[t]){for(var i=e.querySelectorAll("img"),n=0;n<i.length;n++){var o=i[n];this.addImage(o)}if("string"==typeof this.options.background)for(var s=e.querySelectorAll(this.options.background),n=0;n<s.length;n++){var r=s[n];this.addElementBackgroundImages(r)}}},{1:!0,9:!0,11:!0});return r.prototype.addElementBackgroundImages=function(e){var t=getComputedStyle(e);if(t)for(var i=/url\((['"])?(.*?)\1\)/gi,n=i.exec(t.backgroundImage);null!==n;){var o=n&&n[2];o&&this.addBackground(o,e),n=i.exec(t.backgroundImage)}},r.prototype.addImage=function(e){e=new i(e);this.images.push(e)},r.prototype.addBackground=function(e,t){e=new n(e,t);this.images.push(e)},r.prototype.check=function(){function t(e,t,i){setTimeout(function(){n.progress(e,t,i)})}var n=this;return this.progressedCount=0,this.hasAnyBroken=!1,this.images.length?void this.images.forEach(function(e){e.once("progress",t),e.check()}):void this.complete()},r.prototype.progress=function(e,t,i){this.progressedCount++,this.hasAnyBroken=this.hasAnyBroken||!e.isLoaded,this.emitEvent("progress",[this,e,t]),this.jqDeferred&&this.jqDeferred.notify&&this.jqDeferred.notify(this,e),this.progressedCount==this.images.length&&this.complete(),this.options.debug&&d&&d.log("progress: "+i,e,t)},r.prototype.complete=function(){var e=this.hasAnyBroken?"fail":"done";this.isComplete=!0,this.emitEvent(e,[this]),this.emitEvent("always",[this]),this.jqDeferred&&(e=this.hasAnyBroken?"reject":"resolve",this.jqDeferred[e](this))},(i.prototype=Object.create(e.prototype)).check=function(){return this.getIsImageComplete()?void this.confirm(0!==this.img.naturalWidth,"naturalWidth"):(this.proxyImage=new Image,this.proxyImage.addEventListener("load",this),this.proxyImage.addEventListener("error",this),this.img.addEventListener("load",this),this.img.addEventListener("error",this),void(this.proxyImage.src=this.img.src))},i.prototype.getIsImageComplete=function(){return this.img.complete&&this.img.naturalWidth},i.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.img,t])},i.prototype.handleEvent=function(e){var t="on"+e.type;this[t]&&this[t](e)},i.prototype.onload=function(){this.confirm(!0,"onload"),this.unbindEvents()},i.prototype.onerror=function(){this.confirm(!1,"onerror"),this.unbindEvents()},i.prototype.unbindEvents=function(){this.proxyImage.removeEventListener("load",this),this.proxyImage.removeEventListener("error",this),this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},(n.prototype=Object.create(i.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())},n.prototype.unbindEvents=function(){this.img.removeEventListener("load",this),this.img.removeEventListener("error",this)},n.prototype.confirm=function(e,t){this.isLoaded=e,this.emitEvent("progress",[this,this.element,t])},(r.makeJQueryPlugin=function(e){(e=e||t.jQuery)&&((a=e).fn.imagesLoaded=function(e,t){return new r(this,e,t).jqDeferred.promise(a(this))})})(),r}),function(){const n=window.matchMedia("(max-width: 767px)"),o=document.querySelector(".gh-navigation"),s=o.querySelector(".gh-navigation-menu"),r=s?.querySelector(".nav");if(r){const e=document.querySelector(".gh-navigation-logo"),t=r.innerHTML;n.matches&&r.querySelectorAll("li").forEach(function(e,t){e.style.transitionDelay=.03*(t+1)+"s"});const i=function(){if(!n.matches){for(var e=[];r.offsetWidth+64>s.offsetWidth&&r.lastElementChild;)e.unshift(r.lastElementChild),r.lastElementChild.remove();if(e.length){const t=document.createElement("button"),i=(t.setAttribute("class","gh-more-toggle gh-icon-button"),t.setAttribute("aria-label","More"),t.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32" fill="currentColor"><path d="M21.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM13.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0zM5.333 16c0-1.473 1.194-2.667 2.667-2.667v0c1.473 0 2.667 1.194 2.667 2.667v0c0 1.473-1.194 2.667-2.667 2.667v0c-1.473 0-2.667-1.194-2.667-2.667v0z"></path></svg>',document.createElement("div"));i.setAttribute("class","gh-dropdown"),10<=e.length?(o.classList.add("is-dropdown-mega"),i.style.gridTemplateRows=`repeat(${Math.ceil(e.length/2)}, 1fr)`):o.classList.remove("is-dropdown-mega"),e.forEach(function(e){i.appendChild(e)}),t.appendChild(i),r.appendChild(t),o.classList.add("is-dropdown-loaded"),window.addEventListener("click",function(e){o.classList.contains("is-dropdown-open")?o.classList.remove("is-dropdown-open"):t.contains(e.target)&&o.classList.add("is-dropdown-open")})}else o.classList.add("is-dropdown-loaded")}};imagesLoaded(e,function(){i()}),window.addEventListener("load",function(){e||i()}),window.addEventListener("resize",function(){setTimeout(()=>{r.innerHTML=t,i()},1)})}}(),function(){const e=document.querySelector(".gh-navigation");var t=e.querySelector(".gh-burger");t&&t.addEventListener("click",function(){e.classList.contains("is-open")?e.classList.remove("is-open"):e.classList.add("is-open")})}();
|
|
//# sourceMappingURL=casper.js.map
|