biofriction-wp-theme/node_modules/foundation-sites/dist/js/plugins/foundation.magellan.min.js

3 lines
7.3 KiB
JavaScript

!function(t,n){"object"==typeof exports&&"object"==typeof module?module.exports=n(require("./foundation.core"),require("./foundation.core.plugin"),require("./foundation.core.utils"),require("./foundation.smoothScroll"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","./foundation.core.plugin","./foundation.core.utils","./foundation.smoothScroll","jquery"],n):"object"==typeof exports?exports["foundation.magellan"]=n(require("./foundation.core"),require("./foundation.core.plugin"),require("./foundation.core.utils"),require("./foundation.smoothScroll"),require("jquery")):(t.__FOUNDATION_EXTERNAL__=t.__FOUNDATION_EXTERNAL__||{},t.__FOUNDATION_EXTERNAL__["foundation.magellan"]=n(t.__FOUNDATION_EXTERNAL__["foundation.core"],t.__FOUNDATION_EXTERNAL__["foundation.core"],t.__FOUNDATION_EXTERNAL__["foundation.core"],t.__FOUNDATION_EXTERNAL__["foundation.smoothScroll"],t.jQuery))}(window,function(e,o,i,r,a){return function(e){var o={};function i(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=e,i.c=o,i.d=function(t,n,e){i.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(n,t){if(1&t&&(n=i(n)),8&t)return n;if(4&t&&"object"==typeof n&&n&&n.__esModule)return n;var e=Object.create(null);if(i.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:n}),2&t&&"string"!=typeof n)for(var o in n)i.d(e,o,function(t){return n[t]}.bind(null,o));return e},i.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(n,"a",n),n},i.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},i.p="",i(i.s=8)}({"./foundation.core":function(t,n){t.exports=e},"./foundation.core.plugin":function(t,n){t.exports=o},"./foundation.core.utils":function(t,n){t.exports=i},"./foundation.smoothScroll":function(t,n){t.exports=r},"./js/entries/plugins/foundation.magellan.js":function(t,n,e){"use strict";e.r(n);var o=e("./foundation.core");e.d(n,"Foundation",function(){return o.Foundation});var i=e("./js/foundation.magellan.js");e.d(n,"Magellan",function(){return i.Magellan}),o.Foundation.plugin(i.Magellan,"Magellan")},"./js/foundation.magellan.js":function(t,n,e){"use strict";e.r(n),e.d(n,"Magellan",function(){return d});var o=e("jquery"),c=e.n(o),r=e("./foundation.core.utils"),a=e("./foundation.core.plugin"),s=e("./foundation.smoothScroll");function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function l(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}function u(t,n){return!n||"object"!==i(n)&&"function"!=typeof n?function(t){if(void 0!==t)return t;throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}(t):n}function f(t){return(f=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(t,n){return(h=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}var d=function(t){function e(){return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,e),u(this,f(e).apply(this,arguments))}var n,o,i;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&h(t,n)}(e,a["Plugin"]),n=e,(o=[{key:"_setup",value:function(t,n){this.$element=t,this.options=c.a.extend({},e.defaults,this.$element.data(),n),this.className="Magellan",this._init(),this.calcPoints()}},{key:"_init",value:function(){var t=this.$element[0].id||Object(r.GetYoDigits)(6,"magellan");this.$targets=c()("[data-magellan-target]"),this.$links=this.$element.find("a"),this.$element.attr({"data-resize":t,"data-scroll":t,id:t}),this.$active=c()(),this.scrollPos=parseInt(window.pageYOffset,10),this._events()}},{key:"calcPoints",value:function(){var e=this,t=document.body,n=document.documentElement;this.points=[],this.winHeight=Math.round(Math.max(window.innerHeight,n.clientHeight)),this.docHeight=Math.round(Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight)),this.$targets.each(function(){var t=c()(this),n=Math.round(t.offset().top-e.options.threshold);t.targetPoint=n,e.points.push(n)})}},{key:"_events",value:function(){var e=this;c()("html, body"),e.options.animationDuration,e.options.animationEasing;c()(window).one("load",function(){e.options.deepLinking&&location.hash&&e.scrollToLoc(location.hash),e.calcPoints(),e._updateActive()}),e.onLoadListener=Object(r.onLoad)(c()(window),function(){e.$element.on({"resizeme.zf.trigger":e.reflow.bind(e),"scrollme.zf.trigger":e._updateActive.bind(e)}).on("click.zf.magellan",'a[href^="#"]',function(t){t.preventDefault();var n=this.getAttribute("href");e.scrollToLoc(n)})}),this._deepLinkScroll=function(t){e.options.deepLinking&&e.scrollToLoc(window.location.hash)},c()(window).on("hashchange",this._deepLinkScroll)}},{key:"scrollToLoc",value:function(t){this._inTransition=!0;var n=this,e={animationEasing:this.options.animationEasing,animationDuration:this.options.animationDuration,threshold:this.options.threshold,offset:this.options.offset};s.SmoothScroll.scrollToLoc(t,e,function(){n._inTransition=!1})}},{key:"reflow",value:function(){this.calcPoints(),this._updateActive()}},{key:"_updateActive",value:function(){var e=this;if(!this._inTransition){var t,o=parseInt(window.pageYOffset,10),i=this.scrollPos>o;if((this.scrollPos=o)<this.points[0]);else if(o+this.winHeight===this.docHeight)t=this.points.length-1;else{var n=this.points.filter(function(t,n){return t-e.options.offset-(i?e.options.threshold:0)<=o});t=n.length?n.length-1:0}var r=this.$active,a="";void 0!==t?(this.$active=this.$links.filter('[href="#'+this.$targets.eq(t).data("magellan-target")+'"]'),this.$active.length&&(a=this.$active[0].getAttribute("href"))):this.$active=c()();var s=!(!this.$active.length&&!r.length||this.$active.is(r)),l=a!==window.location.hash;if(s&&(r.removeClass(this.options.activeClass),this.$active.addClass(this.options.activeClass)),this.options.deepLinking&&l)if(window.history.pushState){var u=a||window.location.pathname+window.location.search;window.history.pushState(null,null,u)}else window.location.hash=a;s&&this.$element.trigger("update.zf.magellan",[this.$active])}}},{key:"_destroy",value:function(){if(this.$element.off(".zf.trigger .zf.magellan").find(".".concat(this.options.activeClass)).removeClass(this.options.activeClass),this.options.deepLinking){var t=this.$active[0].getAttribute("href");window.location.hash.replace(t,"")}c()(window).off("hashchange",this._deepLinkScroll),this.onLoadListener&&c()(window).off(this.onLoadListener)}}])&&l(n.prototype,o),i&&l(n,i),e}();d.defaults={animationDuration:500,animationEasing:"linear",threshold:50,activeClass:"is-active",deepLinking:!1,offset:0}},8:function(t,n,e){t.exports=e("./js/entries/plugins/foundation.magellan.js")},jquery:function(t,n){t.exports=a}})});
//# sourceMappingURL=foundation.magellan.min.js.map