additional_plugins/homepage/scripts/master.js

9 lines
7 KiB
JavaScript
Raw Normal View History

2019-04-27 16:55:49 +02:00
/*! responsive-nav.js 1.0.39
* https://github.com/viljamis/responsive-nav.js
* http://responsive-nav.com
*
* Copyright (c) 2015 @viljamis
* Available under the MIT license
*/
!function(m,g,y){"use strict";function e(e,t){function s(t,n,i,s){if("addEventListener"in t)try{t.addEventListener(n,i,s)}catch(e){if("object"!=typeof i||!i.handleEvent)throw e;t.addEventListener(n,function(e){i.handleEvent.call(i,e)},s)}else"attachEvent"in t&&("object"==typeof i&&i.handleEvent?t.attachEvent("on"+n,function(){i.handleEvent.call(i)}):t.attachEvent("on"+n,i))}function n(t,n,i,s){if("removeEventListener"in t)try{t.removeEventListener(n,i,s)}catch(e){if("object"!=typeof i||!i.handleEvent)throw e;t.removeEventListener(n,function(e){i.handleEvent.call(i,e)},s)}else"detachEvent"in t&&("object"==typeof i&&i.handleEvent?t.detachEvent("on"+n,function(){i.handleEvent.call(i)}):t.detachEvent("on"+n,i))}function i(e,t){for(var n in t)e.setAttribute(n,t[n])}function o(e,t){0!==e.className.indexOf(t)&&(e.className+=" "+t,e.className=e.className.replace(/(^\s*)|(\s*$)/g,""))}function a(e,t){var n=new RegExp("(\\s|^)"+t+"(\\s|$)");e.className=e.className.replace(n," ").replace(/(^\s*)|(\s*$)/g,"")}function r(e,t){var n;for(n in 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(){}},t)this.options[n]=t[n];if(o(f,this.options.jsClass),this.wrapperEl=e.replace("#",""),m.getElementById(this.wrapperEl))this.wrapper=m.getElementById(this.wrapperEl);else{if(!m.querySelector(this.wrapperEl))throw new Error("The nav element you are trying to select doesn't exist");this.wrapper=m.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),l=this.options,c=this.wrapper,this._init(this)}g.getComputedStyle||(g.getComputedStyle=function(n){return this.el=n,this.getPropertyValue=function(e){var t=/(\-([a-z]){1})/g;return"float"===e&&(e="styleFloat"),t.test(e)&&(e=e.replace(t,function(){return arguments[2].toUpperCase()})),n.currentStyle[e]?n.currentStyle[e]:null},this});var c,l,h,u,p,v,d=m.createElement("style"),f=m.documentElement;return r.prototype={destroy:function(){this._removeStyles(),a(c,"closed"),a(c,"opened"),a(c,l.navClass),a(c,l.navClass+"-"+this.index),a(f,l.navActiveClass),c.removeAttribute("style"),c.removeAttribute("aria-hidden"),n(g,"resize",this,!1),n(g,"focus",this,!1),n(m.body,"touchmove",this,!1),n(h,"touchstart",this,!1),n(h,"touchend",this,!1),n(h,"mouseup",this,!1),n(h,"keyup",this,!1),n(h,"click",this,!1),l.customToggle?h.removeAttribute("aria-hidden"):h.parentNode.removeChild(h)},toggle:function(){!0===u&&(v?this.close():this.open())},open:function(){v||(a(c,"closed"),o(c,"opened"),o(f,l.navActiveClass),o(h,"active"),c.style.position=l.openPos,i(c,{"aria-hidden":"false"}),v=!0,l.open())},close:function(){v&&(o(c,"closed"),a(c,"opened"),a(f,l.navActiveClass),a(h,"active"),i(c,{"aria-hidden":"true"}),l.animate?(u=!1,setTimeout(function(){c.style.position="absolute",u=!0},l.transition+10)):c.style.position="absolute",v=!1,l.close())},resize:function(){"none"!==g.getComputedStyle(h,null).getPropertyValue("display")?(p=!0,i(h,{"aria-hidden":"false"}),c.className.match(/(^|\s)closed(\s|$)/)&&(i(c,{"aria-hidden":"true"}),c.style.position="absolute"),this._createStyles(),this._calcHeight()):(p=!1,i(h,{"aria-hidden":"true"}),i(c,{"aria-hidden":"false"}),c.style.position=l.openPos,this._removeStyles())},handleEvent:function(e){var t=e||g.event;switch(t.type){case"touchstart":this._onTouchStart(t);break;case"touchmove":this._onTouchMove(t);break;case"touchend":case"mouseup":this._onTouchEnd(t);break;case"click":this._preventDefault(t);break;case"keyup":this._onKeyUp(t);break;case"focus":case"resize":this.resize(t)}},_init:function(){this.index=y++,o(c,l.navClass),o(c,l.navClass+"-"+this.index),o(c,"closed"),v=!(u=!0),this._closeOnNavClick(),this._createToggle(),this._transitions(),this.resize();var e=this;setTimeout(function(){e.resi
//# sourceMappingURL=master.js.map