UNPKG

5.86 kBJavaScriptView Raw
1!function(n,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("./foundation.accordionMenu"),require("./foundation.core"),require("./foundation.drilldown"),require("./foundation.dropdownMenu"),require("./foundation.util.mediaQuery"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.accordionMenu","./foundation.core","./foundation.drilldown","./foundation.dropdownMenu","./foundation.util.mediaQuery","jquery"],e):"object"==typeof exports?exports["foundation.responsiveMenu"]=e(require("./foundation.accordionMenu"),require("./foundation.core"),require("./foundation.drilldown"),require("./foundation.dropdownMenu"),require("./foundation.util.mediaQuery"),require("jquery")):(n.__FOUNDATION_EXTERNAL__=n.__FOUNDATION_EXTERNAL__||{},n.__FOUNDATION_EXTERNAL__["foundation.responsiveMenu"]=e(n.__FOUNDATION_EXTERNAL__["foundation.accordionMenu"],n.__FOUNDATION_EXTERNAL__["foundation.core"],n.__FOUNDATION_EXTERNAL__["foundation.drilldown"],n.__FOUNDATION_EXTERNAL__["foundation.dropdownMenu"],n.__FOUNDATION_EXTERNAL__["foundation.util.mediaQuery"],n.jQuery))}(window,function(t,o,r,i,u,s){return c={},a.m=f={"./foundation.accordionMenu":function(n,e){n.exports=t},"./foundation.core":function(n,e){n.exports=o},"./foundation.drilldown":function(n,e){n.exports=r},"./foundation.dropdownMenu":function(n,e){n.exports=i},"./foundation.util.mediaQuery":function(n,e){n.exports=u},"./js/entries/plugins/foundation.responsiveMenu.js":function(n,e,t){"use strict";t.r(e);var o=t("./foundation.core");t.d(e,"Foundation",function(){return o.Foundation});var r=t("./js/foundation.responsiveMenu.js");t.d(e,"ResponsiveMenu",function(){return r.ResponsiveMenu}),o.Foundation.plugin(r.ResponsiveMenu,"ResponsiveMenu")},"./js/foundation.responsiveMenu.js":function(n,e,t){"use strict";t.r(e),t.d(e,"ResponsiveMenu",function(){return h});var o=t("jquery"),u=t.n(o),s=t("./foundation.util.mediaQuery"),a=t("./foundation.core"),r=t("./foundation.dropdownMenu"),i=t("./foundation.drilldown"),f=t("./foundation.accordionMenu");function c(n){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(n){return typeof n}:function(n){return n&&"function"==typeof Symbol&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n})(n)}function d(n,e){for(var t=0;t<e.length;t++){var o=e[t];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(n,o.key,o)}}function l(n,e){return!e||"object"!==c(e)&&"function"!=typeof e?function(n){if(void 0!==n)return n;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(n):e}function p(n){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)})(n)}function y(n,e){return(y=Object.setPrototypeOf||function(n,e){return n.__proto__=e,n})(n,e)}var _={dropdown:{cssClass:"dropdown",plugin:r.DropdownMenu},drilldown:{cssClass:"drilldown",plugin:i.Drilldown},accordion:{cssClass:"accordion-menu",plugin:f.AccordionMenu}},h=function(){function n(){return function(n,e){if(!(n instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),l(this,p(n).apply(this,arguments))}return function(n,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");n.prototype=Object.create(e&&e.prototype,{constructor:{value:n,writable:!0,configurable:!0}}),e&&y(n,e)}(n,a["Plugin"]),function(n,e,t){e&&d(n.prototype,e),t&&d(n,t)}(n,[{key:"_setup",value:function(n,e){this.$element=u()(n),this.rules=this.$element.data("responsive-menu"),this.currentMq=null,this.currentPlugin=null,this.className="ResponsiveMenu",this._init(),this._events()}},{key:"_init",value:function(){if(s.MediaQuery._init(),"string"==typeof this.rules){for(var n={},e=this.rules.split(" "),t=0;t<e.length;t++){var o=e[t].split("-"),r=1<o.length?o[0]:"small",i=1<o.length?o[1]:o[0];null!==_[i]&&(n[r]=_[i])}this.rules=n}u.a.isEmptyObject(this.rules)||this._checkMediaQueries(),this.$element.attr("data-mutate",this.$element.attr("data-mutate")||Object(a.GetYoDigits)(6,"responsive-menu"))}},{key:"_events",value:function(){var n=this;u()(window).on("changed.zf.mediaquery",function(){n._checkMediaQueries()})}},{key:"_checkMediaQueries",value:function(){var e,t=this;u.a.each(this.rules,function(n){s.MediaQuery.atLeast(n)&&(e=n)}),e&&(this.currentPlugin instanceof this.rules[e].plugin||(u.a.each(_,function(n,e){t.$element.removeClass(e.cssClass)}),this.$element.addClass(this.rules[e].cssClass),this.currentPlugin&&this.currentPlugin.destroy(),this.currentPlugin=new this.rules[e].plugin(this.$element,{})))}},{key:"_destroy",value:function(){this.currentPlugin.destroy(),u()(window).off(".zf.ResponsiveMenu")}}]),n}();h.defaults={}},12:function(n,e,t){n.exports=t("./js/entries/plugins/foundation.responsiveMenu.js")},jquery:function(n,e){n.exports=s}},a.c=c,a.d=function(n,e,t){a.o(n,e)||Object.defineProperty(n,e,{enumerable:!0,get:t})},a.r=function(n){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},a.t=function(e,n){if(1&n&&(e=a(e)),8&n)return e;if(4&n&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(a.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&n&&"string"!=typeof e)for(var o in e)a.d(t,o,function(n){return e[n]}.bind(null,o));return t},a.n=function(n){var e=n&&n.__esModule?function(){return n.default}:function(){return n};return a.d(e,"a",e),e},a.o=function(n,e){return Object.prototype.hasOwnProperty.call(n,e)},a.p="",a(a.s=12);function a(n){if(c[n])return c[n].exports;var e=c[n]={i:n,l:!1,exports:{}};return f[n].call(e.exports,e,e.exports,a),e.l=!0,e.exports}var f,c});
2//# sourceMappingURL=foundation.responsiveMenu.min.js.map