3 lines
7.6 KiB
JavaScript
3 lines
7.6 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./foundation.core"),require("./foundation.core.utils"),require("./foundation.util.motion"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","./foundation.core.utils","./foundation.util.motion","jquery"],t):"object"==typeof exports?exports["foundation.util.triggers"]=t(require("./foundation.core"),require("./foundation.core.utils"),require("./foundation.util.motion"),require("jquery")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.util.triggers"]=t(e.__FOUNDATION_EXTERNAL__["foundation.core"],e.__FOUNDATION_EXTERNAL__["foundation.core"],e.__FOUNDATION_EXTERNAL__["foundation.util.motion"],e.jQuery))}(window,function(i,r,n,o){return function(i){var r={};function n(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return i[e].call(t.exports,t,t.exports,n),t.l=!0,t.exports}return n.m=i,n.c=r,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)n.d(i,r,function(e){return t[e]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=29)}({"./foundation.core":function(e,t){e.exports=i},"./foundation.core.utils":function(e,t){e.exports=r},"./foundation.util.motion":function(e,t){e.exports=n},"./js/entries/plugins/foundation.util.triggers.js":function(e,t,i){"use strict";i.r(t);var r=i("./foundation.core");i.d(t,"Foundation",function(){return r.Foundation});var n=i("jquery"),o=i.n(n),s=i("./js/foundation.util.triggers.js");i.d(t,"Triggers",function(){return s.Triggers}),s.Triggers.init(o.a,r.Foundation)},"./js/foundation.util.triggers.js":function(e,t,i){"use strict";i.r(t),i.d(t,"Triggers",function(){return c});var r=i("jquery"),o=i.n(r),n=i("./foundation.core.utils"),s=i("./foundation.util.motion");function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}var l=function(){for(var e=["WebKit","Moz","O","Ms",""],t=0;t<e.length;t++)if("".concat(e[t],"MutationObserver")in window)return window["".concat(e[t],"MutationObserver")];return!1}(),u=function(t,i){t.data(i).split(" ").forEach(function(e){o()("#".concat(e))["close"===i?"trigger":"triggerHandler"]("".concat(i,".zf.trigger"),[t])})},c={Listeners:{Basic:{},Global:{}},Initializers:{}};function f(t,e,i){var r,n=Array.prototype.slice.call(arguments,3);o()(window).off(e).on(e,function(e){r&&clearTimeout(r),r=setTimeout(function(){i.apply(null,n)},t||10)})}c.Listeners.Basic={openListener:function(){u(o()(this),"open")},closeListener:function(){o()(this).data("close")?u(o()(this),"close"):o()(this).trigger("close.zf.trigger")},toggleListener:function(){o()(this).data("toggle")?u(o()(this),"toggle"):o()(this).trigger("toggle.zf.trigger")},closeableListener:function(e){e.stopPropagation();var t=o()(this).data("closable");""!==t?s.Motion.animateOut(o()(this),t,function(){o()(this).trigger("closed.zf")}):o()(this).fadeOut().trigger("closed.zf")},toggleFocusListener:function(){var e=o()(this).data("toggle-focus");o()("#".concat(e)).triggerHandler("toggle.zf.trigger",[o()(this)])}},c.Initializers.addOpenListener=function(e){e.off("click.zf.trigger",c.Listeners.Basic.openListener),e.on("click.zf.trigger","[data-open]",c.Listeners.Basic.openListener)},c.Initializers.addCloseListener=function(e){e.off("click.zf.trigger",c.Listeners.Basic.closeListener),e.on("click.zf.trigger","[data-close]",c.Listeners.Basic.closeListener)},c.Initializers.addToggleListener=function(e){e.off("click.zf.trigger",c.Listeners.Basic.toggleListener),e.on("click.zf.trigger","[data-toggle]",c.Listeners.Basic.toggleListener)},c.Initializers.addCloseableListener=function(e){e.off("close.zf.trigger",c.Listeners.Basic.closeableListener),e.on("close.zf.trigger","[data-closeable], [data-closable]",c.Listeners.Basic.closeableListener)},c.Initializers.addToggleFocusListener=function(e){e.off("focus.zf.trigger blur.zf.trigger",c.Listeners.Basic.toggleFocusListener),e.on("focus.zf.trigger blur.zf.trigger","[data-toggle-focus]",c.Listeners.Basic.toggleFocusListener)},c.Listeners.Global={resizeListener:function(e){l||e.each(function(){o()(this).triggerHandler("resizeme.zf.trigger")}),e.attr("data-events","resize")},scrollListener:function(e){l||e.each(function(){o()(this).triggerHandler("scrollme.zf.trigger")}),e.attr("data-events","scroll")},closeMeListener:function(e,t){var i=e.namespace.split(".")[0];o()("[data-".concat(i,"]")).not('[data-yeti-box="'.concat(t,'"]')).each(function(){var e=o()(this);e.triggerHandler("close.zf.trigger",[e])})}},c.Initializers.addClosemeListener=function(e){var t=o()("[data-yeti-box]"),i=["dropdown","tooltip","reveal"];if(e&&("string"==typeof e?i.push(e):"object"===a(e)&&"string"==typeof e[0]?i.concat(e):console.error("Plugin names must be strings")),t.length){var r=i.map(function(e){return"closeme.zf.".concat(e)}).join(" ");o()(window).off(r).on(r,c.Listeners.Global.closeMeListener)}},c.Initializers.addResizeListener=function(e){var t=o()("[data-resize]");t.length&&f(e,"resize.zf.trigger",c.Listeners.Global.resizeListener,t)},c.Initializers.addScrollListener=function(e){var t=o()("[data-scroll]");t.length&&f(e,"scroll.zf.trigger",c.Listeners.Global.scrollListener,t)},c.Initializers.addMutationEventsListener=function(e){if(!l)return!1;var t=e.find("[data-resize], [data-scroll], [data-mutate]"),i=function(e){var t=o()(e[0].target);switch(e[0].type){case"attributes":"scroll"===t.attr("data-events")&&"data-events"===e[0].attributeName&&t.triggerHandler("scrollme.zf.trigger",[t,window.pageYOffset]),"resize"===t.attr("data-events")&&"data-events"===e[0].attributeName&&t.triggerHandler("resizeme.zf.trigger",[t]),"style"===e[0].attributeName&&(t.closest("[data-mutate]").attr("data-events","mutate"),t.closest("[data-mutate]").triggerHandler("mutateme.zf.trigger",[t.closest("[data-mutate]")]));break;case"childList":t.closest("[data-mutate]").attr("data-events","mutate"),t.closest("[data-mutate]").triggerHandler("mutateme.zf.trigger",[t.closest("[data-mutate]")]);break;default:return!1}};if(t.length)for(var r=0;r<=t.length-1;r++){new l(i).observe(t[r],{attributes:!0,childList:!0,characterData:!1,subtree:!0,attributeFilter:["data-events","style"]})}},c.Initializers.addSimpleListeners=function(){var e=o()(document);c.Initializers.addOpenListener(e),c.Initializers.addCloseListener(e),c.Initializers.addToggleListener(e),c.Initializers.addCloseableListener(e),c.Initializers.addToggleFocusListener(e)},c.Initializers.addGlobalListeners=function(){var e=o()(document);c.Initializers.addMutationEventsListener(e),c.Initializers.addResizeListener(),c.Initializers.addScrollListener(),c.Initializers.addClosemeListener()},c.init=function(e,t){Object(n.onLoad)(e(window),function(){!0!==e.triggersInitialized&&(c.Initializers.addSimpleListeners(),c.Initializers.addGlobalListeners(),e.triggersInitialized=!0)}),t&&(t.Triggers=c,t.IHearYou=c.Initializers.addGlobalListeners)}},29:function(e,t,i){e.exports=i("./js/entries/plugins/foundation.util.triggers.js")},jquery:function(e,t){e.exports=o}})});
|
|
//# sourceMappingURL=foundation.util.triggers.min.js.map
|