additional_plugins/homepage/scripts/master.js

2 lines
6.8 KiB
JavaScript
Raw Normal View History

2017-12-29 16:05:41 +01:00
!function(e,t,n){"use strict";var i=function(i,s){!!t.getComputedStyle||(t.getComputedStyle=function(e){return this.el=e,this.getPropertyValue=function(t){var n=/(\-([a-z]){1})/g;return"float"===t&&(t="styleFloat"),n.test(t)&&(t=t.replace(n,function(){return arguments[2].toUpperCase()})),e.currentStyle[t]?e.currentStyle[t]:null},this});var o,a,r,c,l,h,u=function(e,t,n,i){if("addEventListener"in e)try{e.addEventListener(t,n,i)}catch(s){if("object"!=typeof n||!n.handleEvent)throw s;e.addEventListener(t,function(e){n.handleEvent.call(n,e)},i)}else"attachEvent"in e&&("object"==typeof n&&n.handleEvent?e.attachEvent("on"+t,function(){n.handleEvent.call(n)}):e.attachEvent("on"+t,n))},p=function(e,t,n,i){if("removeEventListener"in e)try{e.removeEventListener(t,n,i)}catch(s){if("object"!=typeof n||!n.handleEvent)throw s;e.removeEventListener(t,function(e){n.handleEvent.call(n,e)},i)}else"detachEvent"in e&&("object"==typeof n&&n.handleEvent?e.detachEvent("on"+t,function(){n.handleEvent.call(n)}):e.detachEvent("on"+t,n))},v=function(e,t){for(var n in t)e.setAttribute(n,t[n])},d=function(e,t){0!==e.className.indexOf(t)&&(e.className+=" "+t,e.className=e.className.replace(/(^\s*)|(\s*$)/g,""))},f=function(e,t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").replace(/(^\s*)|(\s*$)/g,"")},m=e.createElement("style"),g=e.documentElement,y=function(t,n){var i;this.options={animate:!0,transition:284,label:"Menu",insert:"before",customToggle:"",closeOnNavClick:!1,openPos:"relative",navClass:"nav-collapse",navActiveClass:"js-nav-active",jsClass:"js",init:function(){},open:function(){},close:function(){}};for(i in n)this.options[i]=n[i];if(d(g,this.options.jsClass),this.wrapperEl=t.replace("#",""),e.getElementById(this.wrapperEl))this.wrapper=e.getElementById(this.wrapperEl);else{if(!e.querySelector(this.wrapperEl))throw new Error("The nav element you are trying to select doesn't exist");this.wrapper=e.querySelector(this.wrapperEl)}this.wrapper.inner=function(e){if(e.children.length<1)throw new Error("The Nav container has no containing elements");for(var t=[],n=0;n<e.children.length;n++)1===e.children[n].nodeType&&t.push(e.children[n]);return t}(this.wrapper),a=this.options,o=this.wrapper,this._init(this)};return y.prototype={destroy:function(){this._removeStyles(),f(o,"closed"),f(o,"opened"),f(o,a.navClass),f(o,a.navClass+"-"+this.index),f(g,a.navActiveClass),o.removeAttribute("style"),o.removeAttribute("aria-hidden"),p(t,"resize",this,!1),p(t,"focus",this,!1),p(e.body,"touchmove",this,!1),p(r,"touchstart",this,!1),p(r,"touchend",this,!1),p(r,"mouseup",this,!1),p(r,"keyup",this,!1),p(r,"click",this,!1),a.customToggle?r.removeAttribute("aria-hidden"):r.parentNode.removeChild(r)},toggle:function(){!0===c&&(h?this.close():this.open())},open:function(){h||(f(o,"closed"),d(o,"opened"),d(g,a.navActiveClass),d(r,"active"),o.style.position=a.openPos,v(o,{"aria-hidden":"false"}),h=!0,a.open())},close:function(){h&&(d(o,"closed"),f(o,"opened"),f(g,a.navActiveClass),f(r,"active"),v(o,{"aria-hidden":"true"}),a.animate?(c=!1,setTimeout(function(){o.style.position="absolute",c=!0},a.transition+10)):o.style.position="absolute",h=!1,a.close())},resize:function(){"none"!==t.getComputedStyle(r,null).getPropertyValue("display")?(l=!0,v(r,{"aria-hidden":"false"}),o.className.match(/(^|\s)closed(\s|$)/)&&(v(o,{"aria-hidden":"true"}),o.style.position="absolute"),this._createStyles(),this._calcHeight()):(l=!1,v(r,{"aria-hidden":"true"}),v(o,{"aria-hidden":"false"}),o.style.position=a.openPos,this._removeStyles())},handleEvent:function(e){var n=e||t.event;switch(n.type){case"touchstart":this._onTouchStart(n);break;case"touchmove":this._onTouchMove(n);break;case"touchend":case"mouseup":this._onTouchEnd(n);break;case"click":this._preventDefault(n);break;case"keyup":this._onKeyUp(n);break;case"focus":case"resize":this.resize(n)}},_init:function(){this.index=n++,d(o,a.navClass),d(o,a.navClass+"-"+this.index),d(o,"closed"),c=!0,h=!1,this._closeOnNavClick(),this._createToggle(),this._transitions(),this.resize();var i=this;setTimeout(funct
//# sourceMappingURL=master.js.map