vendor/assets/js/plugins/foundation.magellan.js in foundation-rails-6.6.2.0 vs vendor/assets/js/plugins/foundation.magellan.js in foundation-rails-6.9.0.0

- old
+ new

@@ -1,519 +1,333 @@ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') - module.exports = factory(require("./foundation.core"), require("./foundation.smoothScroll"), require("./foundation.util.motion"), require("jquery")); + module.exports = factory(require("./foundation.core"), require("jquery"), require("./foundation.smoothScroll"), require("./foundation.util.motion")); else if(typeof define === 'function' && define.amd) - define(["./foundation.core", "./foundation.smoothScroll", "./foundation.util.motion", "jquery"], factory); + define(["./foundation.core", "jquery", "./foundation.smoothScroll", "./foundation.util.motion"], factory); else if(typeof exports === 'object') - exports["foundation.magellan"] = factory(require("./foundation.core"), require("./foundation.smoothScroll"), require("./foundation.util.motion"), require("jquery")); + exports["__FOUNDATION_EXTERNAL__"] = factory(require("./foundation.core"), require("jquery"), require("./foundation.smoothScroll"), require("./foundation.util.motion")); else - root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.magellan"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["__FOUNDATION_EXTERNAL__"]["foundation.smoothScroll"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.motion"], root["jQuery"]); -})(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE__foundation_smoothScroll__, __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__, __WEBPACK_EXTERNAL_MODULE_jquery__) { -return /******/ (function(modules) { // webpackBootstrap -/******/ // The module cache -/******/ var installedModules = {}; -/******/ -/******/ // The require function -/******/ function __webpack_require__(moduleId) { -/******/ -/******/ // Check if module is in cache -/******/ if(installedModules[moduleId]) { -/******/ return installedModules[moduleId].exports; -/******/ } -/******/ // Create a new module (and put it into the cache) -/******/ var module = installedModules[moduleId] = { -/******/ i: moduleId, -/******/ l: false, -/******/ exports: {} -/******/ }; -/******/ -/******/ // Execute the module function -/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); -/******/ -/******/ // Flag the module as loaded -/******/ module.l = true; -/******/ -/******/ // Return the exports of the module -/******/ return module.exports; -/******/ } -/******/ -/******/ -/******/ // expose the modules object (__webpack_modules__) -/******/ __webpack_require__.m = modules; -/******/ -/******/ // expose the module cache -/******/ __webpack_require__.c = installedModules; -/******/ -/******/ // define getter function for harmony exports -/******/ __webpack_require__.d = function(exports, name, getter) { -/******/ if(!__webpack_require__.o(exports, name)) { -/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); -/******/ } -/******/ }; -/******/ -/******/ // define __esModule on exports -/******/ __webpack_require__.r = function(exports) { -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { -/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); -/******/ } -/******/ Object.defineProperty(exports, '__esModule', { value: true }); -/******/ }; -/******/ -/******/ // create a fake namespace object -/******/ // mode & 1: value is a module id, require it -/******/ // mode & 2: merge all properties of value into the ns -/******/ // mode & 4: return value when already ns object -/******/ // mode & 8|1: behave like require -/******/ __webpack_require__.t = function(value, mode) { -/******/ if(mode & 1) value = __webpack_require__(value); -/******/ if(mode & 8) return value; -/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; -/******/ var ns = Object.create(null); -/******/ __webpack_require__.r(ns); -/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); -/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); -/******/ return ns; -/******/ }; -/******/ -/******/ // getDefaultExport function for compatibility with non-harmony modules -/******/ __webpack_require__.n = function(module) { -/******/ var getter = module && module.__esModule ? -/******/ function getDefault() { return module['default']; } : -/******/ function getModuleExports() { return module; }; -/******/ __webpack_require__.d(getter, 'a', getter); -/******/ return getter; -/******/ }; -/******/ -/******/ // Object.prototype.hasOwnProperty.call -/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; -/******/ -/******/ // __webpack_public_path__ -/******/ __webpack_require__.p = ""; -/******/ -/******/ -/******/ // Load entry module and return exports -/******/ return __webpack_require__(__webpack_require__.s = 8); -/******/ }) -/************************************************************************/ -/******/ ({ + root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.magellan"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["jQuery"], root["__FOUNDATION_EXTERNAL__"]["foundation.smoothScroll"], root["__FOUNDATION_EXTERNAL__"]["foundation.util.motion"]); +})(self, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__, __WEBPACK_EXTERNAL_MODULE__foundation_smoothScroll__, __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__) { +return /******/ (function() { // webpackBootstrap +/******/ "use strict"; +/******/ var __webpack_modules__ = ({ -/***/ "./foundation.core": -/*!****************************************************************************************************************************************************************!*\ - !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***! - \****************************************************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__; - -/***/ }), - -/***/ "./foundation.smoothScroll": -/*!************************************************************************************************************************************************************************************************!*\ - !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.smoothScroll"],"amd":"./foundation.smoothScroll","commonjs":"./foundation.smoothScroll","commonjs2":"./foundation.smoothScroll"} ***! - \************************************************************************************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_smoothScroll__; - -/***/ }), - -/***/ "./foundation.util.motion": -/*!********************************************************************************************************************************************************************************************!*\ - !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.motion"],"amd":"./foundation.util.motion","commonjs":"./foundation.util.motion","commonjs2":"./foundation.util.motion"} ***! - \********************************************************************************************************************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { - -module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__; - -/***/ }), - -/***/ "./js/entries/plugins/foundation.magellan.js": -/*!***************************************************!*\ - !*** ./js/entries/plugins/foundation.magellan.js ***! - \***************************************************/ -/*! exports provided: Foundation, Magellan */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { - -"use strict"; -__webpack_require__.r(__webpack_exports__); -/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core"); -/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; }); - -/* harmony import */ var _foundation_magellan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.magellan */ "./js/foundation.magellan.js"); -/* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Magellan", function() { return _foundation_magellan__WEBPACK_IMPORTED_MODULE_1__["Magellan"]; }); - - - -_foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].plugin(_foundation_magellan__WEBPACK_IMPORTED_MODULE_1__["Magellan"], 'Magellan'); - - -/***/ }), - /***/ "./js/foundation.magellan.js": /*!***********************************!*\ !*** ./js/foundation.magellan.js ***! \***********************************/ -/*! exports provided: Magellan */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Magellan", function() { return Magellan; }); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Magellan: function() { return /* binding */ Magellan; } +/* harmony export */ }); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); -/* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.plugin */ "./foundation.core"); +/* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core"); /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _foundation_smoothScroll__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.smoothScroll */ "./foundation.smoothScroll"); /* harmony import */ var _foundation_smoothScroll__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_smoothScroll__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./foundation.util.triggers */ "./js/foundation.util.triggers.js"); +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } +function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); } +function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } } +function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; } +function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; } +function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } +function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } +function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); } +function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; } +function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } +function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); } +function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); } +function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); } -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } -function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } -function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } -function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } -function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } - -function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } - -function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } - -function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } - -function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } - - - - - - /** * Magellan module. * @module foundation.magellan * @requires foundation.smoothScroll * @requires foundation.util.triggers */ - -var Magellan = -/*#__PURE__*/ -function (_Plugin) { - _inherits(Magellan, _Plugin); - +var Magellan = /*#__PURE__*/function (_Plugin) { function Magellan() { _classCallCheck(this, Magellan); - - return _possibleConstructorReturn(this, _getPrototypeOf(Magellan).apply(this, arguments)); + return _callSuper(this, Magellan, arguments); } - - _createClass(Magellan, [{ + _inherits(Magellan, _Plugin); + return _createClass(Magellan, [{ key: "_setup", - + value: /** * Creates a new instance of Magellan. * @class * @name Magellan * @fires Magellan#init * @param {Object} element - jQuery object to add the trigger to. * @param {Object} options - Overrides to the default plugin settings. */ - value: function _setup(element, options) { + function _setup(element, options) { this.$element = element; - this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default.a.extend({}, Magellan.defaults, this.$element.data(), options); + this.options = jquery__WEBPACK_IMPORTED_MODULE_0___default().extend({}, Magellan.defaults, this.$element.data(), options); this.className = 'Magellan'; // ie9 back compat - // Triggers init is idempotent, just need to make sure it is initialized - _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_3__["Triggers"].init(jquery__WEBPACK_IMPORTED_MODULE_0___default.a); - + // Triggers init is idempotent, just need to make sure it is initialized + _foundation_util_triggers__WEBPACK_IMPORTED_MODULE_3__.Triggers.init((jquery__WEBPACK_IMPORTED_MODULE_0___default())); this._init(); - this.calcPoints(); } + /** * Initializes the Magellan plugin and calls functions to get equalizer functioning on load. * @private */ - }, { key: "_init", value: function _init() { - var id = this.$element[0].id || Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, 'magellan'); - - var _this = this; - + var id = this.$element[0].id || (0,_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__.GetYoDigits)(6, 'magellan'); this.$targets = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-magellan-target]'); this.$links = this.$element.find('a'); this.$element.attr({ 'data-resize': id, 'data-scroll': id, 'id': id }); this.$active = jquery__WEBPACK_IMPORTED_MODULE_0___default()(); this.scrollPos = parseInt(window.pageYOffset, 10); - this._events(); } + /** * Calculates an array of pixel values that are the demarcation lines between locations on the page. * Can be invoked if new elements are added or the size of a location changes. * @function */ - }, { key: "calcPoints", value: function calcPoints() { var _this = this, - body = document.body, - html = document.documentElement; - + body = document.body, + html = document.documentElement; this.points = []; this.winHeight = Math.round(Math.max(window.innerHeight, html.clientHeight)); this.docHeight = Math.round(Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight)); this.$targets.each(function () { var $tar = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), - pt = Math.round($tar.offset().top - _this.options.threshold); + pt = Math.round($tar.offset().top - _this.options.threshold); $tar.targetPoint = pt; - _this.points.push(pt); }); } + /** * Initializes events for Magellan. * @private */ - }, { key: "_events", value: function _events() { var _this = this; - jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).one('load', function () { if (_this.options.deepLinking) { if (location.hash) { _this.scrollToLoc(location.hash); } } - _this.calcPoints(); - _this._updateActive(); }); - _this.onLoadListener = Object(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["onLoad"])(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window), function () { + _this.onLoadListener = (0,_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__.onLoad)(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window), function () { _this.$element.on({ 'resizeme.zf.trigger': _this.reflow.bind(_this), 'scrollme.zf.trigger': _this._updateActive.bind(_this) }).on('click.zf.magellan', 'a[href^="#"]', function (e) { e.preventDefault(); var arrival = this.getAttribute('href'); - _this.scrollToLoc(arrival); }); }); - - this._deepLinkScroll = function (e) { + this._deepLinkScroll = function () { if (_this.options.deepLinking) { _this.scrollToLoc(window.location.hash); } }; - jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on('hashchange', this._deepLinkScroll); } + /** * Function to scroll to a given location on the page. * @param {String} loc - a properly formatted jQuery id selector. Example: '#foo' * @function */ - }, { key: "scrollToLoc", value: function scrollToLoc(loc) { this._inTransition = true; - var _this = this; - var options = { animationEasing: this.options.animationEasing, animationDuration: this.options.animationDuration, threshold: this.options.threshold, offset: this.options.offset }; - _foundation_smoothScroll__WEBPACK_IMPORTED_MODULE_2__["SmoothScroll"].scrollToLoc(loc, options, function () { + _foundation_smoothScroll__WEBPACK_IMPORTED_MODULE_2__.SmoothScroll.scrollToLoc(loc, options, function () { _this._inTransition = false; }); } + /** * Calls necessary functions to update Magellan upon DOM change * @function */ - }, { key: "reflow", value: function reflow() { this.calcPoints(); - this._updateActive(); } + /** * Updates the visibility of an active location link, and updates the url hash for the page, if deepLinking enabled. * @private * @function * @fires Magellan#update */ - }, { key: "_updateActive", - value: function _updateActive() - /*evt, elem, scrollPos*/ - { + value: function _updateActive(/*evt, elem, scrollPos*/ + ) { var _this2 = this; - if (this._inTransition) return; var newScrollPos = parseInt(window.pageYOffset, 10); var isScrollingUp = this.scrollPos > newScrollPos; this.scrollPos = newScrollPos; - var activeIdx; // Before the first point: no link - - if (newScrollPos < this.points[0]) {} - /* do nothing */ + var activeIdx; + // Before the first point: no link + if (newScrollPos < this.points[0] - this.options.offset - (isScrollingUp ? this.options.threshold : 0)) {/* do nothing */} // At the bottom of the page: last link else if (newScrollPos + this.winHeight === this.docHeight) { - activeIdx = this.points.length - 1; - } // Otherwhise, use the last visible link - else { - var visibleLinks = this.points.filter(function (p, i) { - return p - _this2.options.offset - (isScrollingUp ? _this2.options.threshold : 0) <= newScrollPos; - }); - activeIdx = visibleLinks.length ? visibleLinks.length - 1 : 0; - } // Get the new active link + activeIdx = this.points.length - 1; + } + // Otherwhise, use the last visible link + else { + var visibleLinks = this.points.filter(function (p) { + return p - _this2.options.offset - (isScrollingUp ? _this2.options.threshold : 0) <= newScrollPos; + }); + activeIdx = visibleLinks.length ? visibleLinks.length - 1 : 0; + } - + // Get the new active link var $oldActive = this.$active; var activeHash = ''; - if (typeof activeIdx !== 'undefined') { this.$active = this.$links.filter('[href="#' + this.$targets.eq(activeIdx).data('magellan-target') + '"]'); if (this.$active.length) activeHash = this.$active[0].getAttribute('href'); } else { this.$active = jquery__WEBPACK_IMPORTED_MODULE_0___default()(); } - var isNewActive = !(!this.$active.length && !$oldActive.length) && !this.$active.is($oldActive); - var isNewHash = activeHash !== window.location.hash; // Update the active link element + var isNewHash = activeHash !== window.location.hash; + // Update the active link element if (isNewActive) { $oldActive.removeClass(this.options.activeClass); this.$active.addClass(this.options.activeClass); - } // Update the hash (it may have changed with the same active link) + } - + // Update the hash (it may have changed with the same active link) if (this.options.deepLinking && isNewHash) { if (window.history.pushState) { // Set or remove the hash (see: https://stackoverflow.com/a/5298684/4317384 var url = activeHash ? activeHash : window.location.pathname + window.location.search; - if (this.options.updateHistory) { window.history.pushState({}, '', url); } else { window.history.replaceState({}, '', url); } } else { window.location.hash = activeHash; } } - if (isNewActive) { /** * Fires when magellan is finished updating to the new active element. * @event Magellan#update */ this.$element.trigger('update.zf.magellan', [this.$active]); } } + /** * Destroys an instance of Magellan and resets the url of the window. * @function */ - }, { key: "_destroy", value: function _destroy() { this.$element.off('.zf.trigger .zf.magellan').find(".".concat(this.options.activeClass)).removeClass(this.options.activeClass); - if (this.options.deepLinking) { var hash = this.$active[0].getAttribute('href'); window.location.hash.replace(hash, ''); } - jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('hashchange', this._deepLinkScroll); if (this.onLoadListener) jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(this.onLoadListener); } }]); - - return Magellan; -}(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__["Plugin"]); +}(_foundation_core_plugin__WEBPACK_IMPORTED_MODULE_1__.Plugin); /** * Default settings for plugin */ - - Magellan.defaults = { /** * Amount of time, in ms, the animated scrolling should take between locations. * @option * @type {number} * @default 500 */ animationDuration: 500, - /** * Animation style to use when scrolling between locations. Can be `'swing'` or `'linear'`. * @option * @type {string} * @default 'linear' * @see {@link https://api.jquery.com/animate|Jquery animate} */ animationEasing: 'linear', - /** * Number of pixels to use as a marker for location changes. * @option * @type {number} * @default 50 */ threshold: 50, - /** * Class applied to the active locations link on the magellan container. * @option * @type {string} * @default 'is-active' */ activeClass: 'is-active', - /** * Allows the script to manipulate the url of the current page, and if supported, alter the history. * @option * @type {boolean} * @default false */ deepLinking: false, - /** * Update the browser history with the active link, if deep linking is enabled. * @option * @type {boolean} * @default false */ updateHistory: false, - /** * Number of pixels to offset the scroll of the page on item click if using a sticky nav bar. * @option * @type {number} * @default 0 @@ -526,48 +340,40 @@ /***/ "./js/foundation.util.triggers.js": /*!****************************************!*\ !*** ./js/foundation.util.triggers.js ***! \****************************************/ -/*! exports provided: Triggers */ -/***/ (function(module, __webpack_exports__, __webpack_require__) { +/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { -"use strict"; __webpack_require__.r(__webpack_exports__); -/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Triggers", function() { return Triggers; }); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Triggers: function() { return /* binding */ Triggers; } +/* harmony export */ }); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./foundation.core"); /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.motion */ "./foundation.util.motion"); /* harmony import */ var _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__); +function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } -function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } - - - - var MutationObserver = function () { var prefixes = ['WebKit', 'Moz', 'O', 'Ms', '']; - for (var i = 0; i < prefixes.length; i++) { if ("".concat(prefixes[i], "MutationObserver") in window) { return window["".concat(prefixes[i], "MutationObserver")]; } } - return false; }(); - var triggers = function triggers(el, type) { el.data(type).split(' ').forEach(function (id) { jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id))[type === 'close' ? 'trigger' : 'triggerHandler']("".concat(type, ".zf.trigger"), [el]); }); }; - var Triggers = { Listeners: { Basic: {}, Global: {} }, @@ -577,201 +383,183 @@ openListener: function openListener() { triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'open'); }, closeListener: function closeListener() { var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('close'); - if (id) { triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'close'); } else { jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('close.zf.trigger'); } }, toggleListener: function toggleListener() { var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle'); - if (id) { triggers(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), 'toggle'); } else { jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('toggle.zf.trigger'); } }, closeableListener: function closeableListener(e) { - var animation = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('closable'); // Only close the first closable element. See https://git.io/zf-7833 + var animation = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('closable'); + // Only close the first closable element. See https://git.io/zf-7833 e.stopPropagation(); - if (animation !== '') { - _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__["Motion"].animateOut(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), animation, function () { + _foundation_util_motion__WEBPACK_IMPORTED_MODULE_2__.Motion.animateOut(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), animation, function () { jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).trigger('closed.zf'); }); } else { jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).fadeOut().trigger('closed.zf'); } }, toggleFocusListener: function toggleFocusListener() { var id = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('toggle-focus'); jquery__WEBPACK_IMPORTED_MODULE_0___default()("#".concat(id)).triggerHandler('toggle.zf.trigger', [jquery__WEBPACK_IMPORTED_MODULE_0___default()(this)]); } -}; // Elements with [data-open] will reveal a plugin that supports it when clicked. +}; +// Elements with [data-open] will reveal a plugin that supports it when clicked. Triggers.Initializers.addOpenListener = function ($elem) { $elem.off('click.zf.trigger', Triggers.Listeners.Basic.openListener); $elem.on('click.zf.trigger', '[data-open]', Triggers.Listeners.Basic.openListener); -}; // Elements with [data-close] will close a plugin that supports it when clicked. -// If used without a value on [data-close], the event will bubble, allowing it to close a parent component. +}; - +// Elements with [data-close] will close a plugin that supports it when clicked. +// If used without a value on [data-close], the event will bubble, allowing it to close a parent component. Triggers.Initializers.addCloseListener = function ($elem) { $elem.off('click.zf.trigger', Triggers.Listeners.Basic.closeListener); $elem.on('click.zf.trigger', '[data-close]', Triggers.Listeners.Basic.closeListener); -}; // Elements with [data-toggle] will toggle a plugin that supports it when clicked. +}; - +// Elements with [data-toggle] will toggle a plugin that supports it when clicked. Triggers.Initializers.addToggleListener = function ($elem) { $elem.off('click.zf.trigger', Triggers.Listeners.Basic.toggleListener); $elem.on('click.zf.trigger', '[data-toggle]', Triggers.Listeners.Basic.toggleListener); -}; // Elements with [data-closable] will respond to close.zf.trigger events. +}; - +// Elements with [data-closable] will respond to close.zf.trigger events. Triggers.Initializers.addCloseableListener = function ($elem) { $elem.off('close.zf.trigger', Triggers.Listeners.Basic.closeableListener); $elem.on('close.zf.trigger', '[data-closeable], [data-closable]', Triggers.Listeners.Basic.closeableListener); -}; // Elements with [data-toggle-focus] will respond to coming in and out of focus +}; - +// Elements with [data-toggle-focus] will respond to coming in and out of focus Triggers.Initializers.addToggleFocusListener = function ($elem) { $elem.off('focus.zf.trigger blur.zf.trigger', Triggers.Listeners.Basic.toggleFocusListener); $elem.on('focus.zf.trigger blur.zf.trigger', '[data-toggle-focus]', Triggers.Listeners.Basic.toggleFocusListener); -}; // More Global/complex listeners and triggers +}; - +// More Global/complex listeners and triggers Triggers.Listeners.Global = { resizeListener: function resizeListener($nodes) { if (!MutationObserver) { //fallback for IE 9 $nodes.each(function () { jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('resizeme.zf.trigger'); }); - } //trigger all listening elements and signal a resize event - - + } + //trigger all listening elements and signal a resize event $nodes.attr('data-events', "resize"); }, scrollListener: function scrollListener($nodes) { if (!MutationObserver) { //fallback for IE 9 $nodes.each(function () { jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).triggerHandler('scrollme.zf.trigger'); }); - } //trigger all listening elements and signal a scroll event - - + } + //trigger all listening elements and signal a scroll event $nodes.attr('data-events', "scroll"); }, closeMeListener: function closeMeListener(e, pluginId) { var plugin = e.namespace.split('.')[0]; var plugins = jquery__WEBPACK_IMPORTED_MODULE_0___default()("[data-".concat(plugin, "]")).not("[data-yeti-box=\"".concat(pluginId, "\"]")); plugins.each(function () { var _this = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this); - _this.triggerHandler('close.zf.trigger', [_this]); }); - } // Global, parses whole document. - + } }; +// Global, parses whole document. Triggers.Initializers.addClosemeListener = function (pluginName) { var yetiBoxes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-yeti-box]'), - plugNames = ['dropdown', 'tooltip', 'reveal']; - + plugNames = ['dropdown', 'tooltip', 'reveal']; if (pluginName) { if (typeof pluginName === 'string') { plugNames.push(pluginName); } else if (_typeof(pluginName) === 'object' && typeof pluginName[0] === 'string') { plugNames = plugNames.concat(pluginName); } else { console.error('Plugin names must be strings'); } } - if (yetiBoxes.length) { var listeners = plugNames.map(function (name) { return "closeme.zf.".concat(name); }).join(' '); jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(listeners).on(listeners, Triggers.Listeners.Global.closeMeListener); } }; - function debounceGlobalListener(debounce, trigger, listener) { var timer, - args = Array.prototype.slice.call(arguments, 3); - jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off(trigger).on(trigger, function (e) { + args = Array.prototype.slice.call(arguments, 3); + jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).on(trigger, function () { if (timer) { clearTimeout(timer); } - timer = setTimeout(function () { listener.apply(null, args); }, debounce || 10); //default time to emit scroll event }); } - Triggers.Initializers.addResizeListener = function (debounce) { var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-resize]'); - if ($nodes.length) { debounceGlobalListener(debounce, 'resize.zf.trigger', Triggers.Listeners.Global.resizeListener, $nodes); } }; - Triggers.Initializers.addScrollListener = function (debounce) { var $nodes = jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-scroll]'); - if ($nodes.length) { debounceGlobalListener(debounce, 'scroll.zf.trigger', Triggers.Listeners.Global.scrollListener, $nodes); } }; - Triggers.Initializers.addMutationEventsListener = function ($elem) { if (!MutationObserver) { return false; } + var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); - var $nodes = $elem.find('[data-resize], [data-scroll], [data-mutate]'); //element callback - + //element callback var listeningElementsMutation = function listeningElementsMutation(mutationRecordsList) { - var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mutationRecordsList[0].target); //trigger the event handler for the element depending on type + var $target = jquery__WEBPACK_IMPORTED_MODULE_0___default()(mutationRecordsList[0].target); + //trigger the event handler for the element depending on type switch (mutationRecordsList[0].type) { case "attributes": if ($target.attr("data-events") === "scroll" && mutationRecordsList[0].attributeName === "data-events") { $target.triggerHandler('scrollme.zf.trigger', [$target, window.pageYOffset]); } - if ($target.attr("data-events") === "resize" && mutationRecordsList[0].attributeName === "data-events") { $target.triggerHandler('resizeme.zf.trigger', [$target]); } - if (mutationRecordsList[0].attributeName === "style") { $target.closest("[data-mutate]").attr("data-events", "mutate"); $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); } - break; - case "childList": $target.closest("[data-mutate]").attr("data-events", "mutate"); $target.closest("[data-mutate]").triggerHandler('mutateme.zf.trigger', [$target.closest("[data-mutate]")]); break; - default: return false; //nothing } }; - if ($nodes.length) { //for each element that needs to listen for resizing, scrolling, or mutation add a single observer for (var i = 0; i <= $nodes.length - 1; i++) { var elementObserver = new MutationObserver(listeningElementsMutation); elementObserver.observe($nodes[i], { @@ -782,69 +570,170 @@ attributeFilter: ["data-events", "style"] }); } } }; - Triggers.Initializers.addSimpleListeners = function () { var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document); Triggers.Initializers.addOpenListener($document); Triggers.Initializers.addCloseListener($document); Triggers.Initializers.addToggleListener($document); Triggers.Initializers.addCloseableListener($document); Triggers.Initializers.addToggleFocusListener($document); }; - Triggers.Initializers.addGlobalListeners = function () { var $document = jquery__WEBPACK_IMPORTED_MODULE_0___default()(document); Triggers.Initializers.addMutationEventsListener($document); - Triggers.Initializers.addResizeListener(); + Triggers.Initializers.addResizeListener(250); Triggers.Initializers.addScrollListener(); Triggers.Initializers.addClosemeListener(); }; - -Triggers.init = function ($, Foundation) { - Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["onLoad"])($(window), function () { - if ($.triggersInitialized !== true) { +Triggers.init = function (__, Foundation) { + (0,_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__.onLoad)(jquery__WEBPACK_IMPORTED_MODULE_0___default()(window), function () { + if ((jquery__WEBPACK_IMPORTED_MODULE_0___default().triggersInitialized) !== true) { Triggers.Initializers.addSimpleListeners(); Triggers.Initializers.addGlobalListeners(); - $.triggersInitialized = true; + (jquery__WEBPACK_IMPORTED_MODULE_0___default().triggersInitialized) = true; } }); - if (Foundation) { - Foundation.Triggers = Triggers; // Legacy included to be backwards compatible for now. - + Foundation.Triggers = Triggers; + // Legacy included to be backwards compatible for now. Foundation.IHearYou = Triggers.Initializers.addGlobalListeners; } }; +/***/ }), +/***/ "./foundation.core": +/*!****************************************************************************************************************************************************************!*\ + !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***! + \****************************************************************************************************************************************************************/ +/***/ (function(module) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__; + /***/ }), -/***/ 8: -/*!*********************************************************!*\ - !*** multi ./js/entries/plugins/foundation.magellan.js ***! - \*********************************************************/ -/*! no static exports found */ -/***/ (function(module, exports, __webpack_require__) { +/***/ "./foundation.smoothScroll": +/*!************************************************************************************************************************************************************************************************!*\ + !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.smoothScroll"],"amd":"./foundation.smoothScroll","commonjs":"./foundation.smoothScroll","commonjs2":"./foundation.smoothScroll"} ***! + \************************************************************************************************************************************************************************************************/ +/***/ (function(module) { -module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.magellan.js */"./js/entries/plugins/foundation.magellan.js"); +module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_smoothScroll__; +/***/ }), +/***/ "./foundation.util.motion": +/*!********************************************************************************************************************************************************************************************!*\ + !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.util.motion"],"amd":"./foundation.util.motion","commonjs":"./foundation.util.motion","commonjs2":"./foundation.util.motion"} ***! + \********************************************************************************************************************************************************************************************/ +/***/ (function(module) { + +module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_util_motion__; + /***/ }), /***/ "jquery": /*!********************************************************************************************!*\ !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***! \********************************************************************************************/ -/*! no static exports found */ -/***/ (function(module, exports) { +/***/ (function(module) { module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__; /***/ }) -/******/ }); +/******/ }); +/************************************************************************/ +/******/ // The module cache +/******/ var __webpack_module_cache__ = {}; +/******/ +/******/ // The require function +/******/ function __webpack_require__(moduleId) { +/******/ // Check if module is in cache +/******/ var cachedModule = __webpack_module_cache__[moduleId]; +/******/ if (cachedModule !== undefined) { +/******/ return cachedModule.exports; +/******/ } +/******/ // Create a new module (and put it into the cache) +/******/ var module = __webpack_module_cache__[moduleId] = { +/******/ // no module.id needed +/******/ // no module.loaded needed +/******/ exports: {} +/******/ }; +/******/ +/******/ // Execute the module function +/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); +/******/ +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } +/******/ +/************************************************************************/ +/******/ /* webpack/runtime/compat get default export */ +/******/ !function() { +/******/ // getDefaultExport function for compatibility with non-harmony modules +/******/ __webpack_require__.n = function(module) { +/******/ var getter = module && module.__esModule ? +/******/ function() { return module['default']; } : +/******/ function() { return module; }; +/******/ __webpack_require__.d(getter, { a: getter }); +/******/ return getter; +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/define property getters */ +/******/ !function() { +/******/ // define getter functions for harmony exports +/******/ __webpack_require__.d = function(exports, definition) { +/******/ for(var key in definition) { +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); +/******/ } +/******/ } +/******/ }; +/******/ }(); +/******/ +/******/ /* webpack/runtime/hasOwnProperty shorthand */ +/******/ !function() { +/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } +/******/ }(); +/******/ +/******/ /* webpack/runtime/make namespace object */ +/******/ !function() { +/******/ // define __esModule on exports +/******/ __webpack_require__.r = function(exports) { +/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { +/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); +/******/ } +/******/ Object.defineProperty(exports, '__esModule', { value: true }); +/******/ }; +/******/ }(); +/******/ +/************************************************************************/ +var __webpack_exports__ = {}; +// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. +!function() { +/*!***************************************************!*\ + !*** ./js/entries/plugins/foundation.magellan.js ***! + \***************************************************/ +__webpack_require__.r(__webpack_exports__); +/* harmony export */ __webpack_require__.d(__webpack_exports__, { +/* harmony export */ Foundation: function() { return /* reexport safe */ _foundation_core__WEBPACK_IMPORTED_MODULE_0__.Foundation; }, +/* harmony export */ Magellan: function() { return /* reexport safe */ _foundation_magellan__WEBPACK_IMPORTED_MODULE_1__.Magellan; } +/* harmony export */ }); +/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core"); +/* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__); +/* harmony import */ var _foundation_magellan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.magellan */ "./js/foundation.magellan.js"); + + +_foundation_core__WEBPACK_IMPORTED_MODULE_0__.Foundation.plugin(_foundation_magellan__WEBPACK_IMPORTED_MODULE_1__.Magellan, 'Magellan'); + +}(); +/******/ return __webpack_exports__; +/******/ })() +; }); //# sourceMappingURL=foundation.magellan.js.map \ No newline at end of file