additional_plugins/homepage/scripts/master.js

2 lines
6.8 KiB
JavaScript
Raw Normal View History

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