foundation.core.js 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  1. (function webpackUniversalModuleDefinition(root, factory) {
  2. if(typeof exports === 'object' && typeof module === 'object')
  3. module.exports = factory(require("jquery"));
  4. else if(typeof define === 'function' && define.amd)
  5. define(["jquery"], factory);
  6. else if(typeof exports === 'object')
  7. exports["foundation.core"] = factory(require("jquery"));
  8. else
  9. root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.core"] = factory(root["jQuery"]);
  10. })(window, function(__WEBPACK_EXTERNAL_MODULE_jquery__) {
  11. return /******/ (function(modules) { // webpackBootstrap
  12. /******/ // The module cache
  13. /******/ var installedModules = {};
  14. /******/
  15. /******/ // The require function
  16. /******/ function __webpack_require__(moduleId) {
  17. /******/
  18. /******/ // Check if module is in cache
  19. /******/ if(installedModules[moduleId]) {
  20. /******/ return installedModules[moduleId].exports;
  21. /******/ }
  22. /******/ // Create a new module (and put it into the cache)
  23. /******/ var module = installedModules[moduleId] = {
  24. /******/ i: moduleId,
  25. /******/ l: false,
  26. /******/ exports: {}
  27. /******/ };
  28. /******/
  29. /******/ // Execute the module function
  30. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/ // Flag the module as loaded
  33. /******/ module.l = true;
  34. /******/
  35. /******/ // Return the exports of the module
  36. /******/ return module.exports;
  37. /******/ }
  38. /******/
  39. /******/
  40. /******/ // expose the modules object (__webpack_modules__)
  41. /******/ __webpack_require__.m = modules;
  42. /******/
  43. /******/ // expose the module cache
  44. /******/ __webpack_require__.c = installedModules;
  45. /******/
  46. /******/ // define getter function for harmony exports
  47. /******/ __webpack_require__.d = function(exports, name, getter) {
  48. /******/ if(!__webpack_require__.o(exports, name)) {
  49. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/ }
  51. /******/ };
  52. /******/
  53. /******/ // define __esModule on exports
  54. /******/ __webpack_require__.r = function(exports) {
  55. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/ }
  58. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/ };
  60. /******/
  61. /******/ // create a fake namespace object
  62. /******/ // mode & 1: value is a module id, require it
  63. /******/ // mode & 2: merge all properties of value into the ns
  64. /******/ // mode & 4: return value when already ns object
  65. /******/ // mode & 8|1: behave like require
  66. /******/ __webpack_require__.t = function(value, mode) {
  67. /******/ if(mode & 1) value = __webpack_require__(value);
  68. /******/ if(mode & 8) return value;
  69. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/ var ns = Object.create(null);
  71. /******/ __webpack_require__.r(ns);
  72. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/ return ns;
  75. /******/ };
  76. /******/
  77. /******/ // getDefaultExport function for compatibility with non-harmony modules
  78. /******/ __webpack_require__.n = function(module) {
  79. /******/ var getter = module && module.__esModule ?
  80. /******/ function getDefault() { return module['default']; } :
  81. /******/ function getModuleExports() { return module; };
  82. /******/ __webpack_require__.d(getter, 'a', getter);
  83. /******/ return getter;
  84. /******/ };
  85. /******/
  86. /******/ // Object.prototype.hasOwnProperty.call
  87. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/ // __webpack_public_path__
  90. /******/ __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/ // Load entry module and return exports
  94. /******/ return __webpack_require__(__webpack_require__.s = 0);
  95. /******/ })
  96. /************************************************************************/
  97. /******/ ({
  98. /***/ "./js/entries/plugins/foundation.core.js":
  99. /*!***********************************************!*\
  100. !*** ./js/entries/plugins/foundation.core.js ***!
  101. \***********************************************/
  102. /*! exports provided: Foundation, Plugin, rtl, GetYoDigits, RegExpEscape, transitionend, onLoad, ignoreMousedisappear */
  103. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  104. "use strict";
  105. __webpack_require__.r(__webpack_exports__);
  106. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  107. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  108. /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.core */ "./js/foundation.core.js");
  109. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"]; });
  110. /* harmony import */ var _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../foundation.core.plugin */ "./js/foundation.core.plugin.js");
  111. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../foundation.core.utils */ "./js/foundation.core.utils.js");
  112. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Plugin", function() { return _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__["Plugin"]; });
  113. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "rtl", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["rtl"]; });
  114. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GetYoDigits", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"]; });
  115. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "RegExpEscape", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["RegExpEscape"]; });
  116. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "transitionend", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"]; });
  117. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onLoad", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["onLoad"]; });
  118. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreMousedisappear", function() { return _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["ignoreMousedisappear"]; });
  119. // --- Foundation Core API ---
  120. // Initialize Foundation and add some utilities to its public API for backward compatibility.
  121. // Please note that every utility do not have to be added to the core API.
  122. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].addToJquery(jquery__WEBPACK_IMPORTED_MODULE_0___default.a); // Every plugin depends on plugin now, we can include that on the core for the
  123. // script inclusion path.
  124. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].Plugin = _foundation_core_plugin__WEBPACK_IMPORTED_MODULE_2__["Plugin"]; // These are now separated out, but historically were a part of this module,
  125. // and since this is here for backwards compatibility we include them in
  126. // this entry.
  127. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].rtl = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["rtl"];
  128. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].GetYoDigits = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["GetYoDigits"];
  129. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].transitionend = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["transitionend"];
  130. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].RegExpEscape = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["RegExpEscape"];
  131. _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"].onLoad = _foundation_core_utils__WEBPACK_IMPORTED_MODULE_3__["onLoad"];
  132. window.Foundation = _foundation_core__WEBPACK_IMPORTED_MODULE_1__["Foundation"]; // --- Foundation Core exports ---
  133. // Export "Plugin" and all core utilities, since the `foundation.core` entry plays the role of
  134. // all core source files.
  135. /***/ }),
  136. /***/ "./js/foundation.core.js":
  137. /*!*******************************!*\
  138. !*** ./js/foundation.core.js ***!
  139. \*******************************/
  140. /*! exports provided: Foundation */
  141. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  142. "use strict";
  143. __webpack_require__.r(__webpack_exports__);
  144. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return Foundation; });
  145. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  146. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  147. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./js/foundation.core.utils.js");
  148. /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./foundation.util.mediaQuery */ "./js/foundation.util.mediaQuery.js");
  149. 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); }
  150. var FOUNDATION_VERSION = '6.6.3'; // Global Foundation object
  151. // This is attached to the window, or used as a module for AMD/Browserify
  152. var Foundation = {
  153. version: FOUNDATION_VERSION,
  154. /**
  155. * Stores initialized plugins.
  156. */
  157. _plugins: {},
  158. /**
  159. * Stores generated unique ids for plugin instances
  160. */
  161. _uuids: [],
  162. /**
  163. * Defines a Foundation plugin, adding it to the `Foundation` namespace and the list of plugins to initialize when reflowing.
  164. * @param {Object} plugin - The constructor of the plugin.
  165. */
  166. plugin: function plugin(_plugin, name) {
  167. // Object key to use when adding to global Foundation object
  168. // Examples: Foundation.Reveal, Foundation.OffCanvas
  169. var className = name || functionName(_plugin); // Object key to use when storing the plugin, also used to create the identifying data attribute for the plugin
  170. // Examples: data-reveal, data-off-canvas
  171. var attrName = hyphenate(className); // Add to the Foundation object and the plugins list (for reflowing)
  172. this._plugins[attrName] = this[className] = _plugin;
  173. },
  174. /**
  175. * @function
  176. * Populates the _uuids array with pointers to each individual plugin instance.
  177. * Adds the `zfPlugin` data-attribute to programmatically created plugins to allow use of $(selector).foundation(method) calls.
  178. * Also fires the initialization event for each plugin, consolidating repetitive code.
  179. * @param {Object} plugin - an instance of a plugin, usually `this` in context.
  180. * @param {String} name - the name of the plugin, passed as a camelCased string.
  181. * @fires Plugin#init
  182. */
  183. registerPlugin: function registerPlugin(plugin, name) {
  184. var pluginName = name ? hyphenate(name) : functionName(plugin.constructor).toLowerCase();
  185. plugin.uuid = Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, pluginName);
  186. if (!plugin.$element.attr("data-".concat(pluginName))) {
  187. plugin.$element.attr("data-".concat(pluginName), plugin.uuid);
  188. }
  189. if (!plugin.$element.data('zfPlugin')) {
  190. plugin.$element.data('zfPlugin', plugin);
  191. }
  192. /**
  193. * Fires when the plugin has initialized.
  194. * @event Plugin#init
  195. */
  196. plugin.$element.trigger("init.zf.".concat(pluginName));
  197. this._uuids.push(plugin.uuid);
  198. return;
  199. },
  200. /**
  201. * @function
  202. * Removes the plugins uuid from the _uuids array.
  203. * Removes the zfPlugin data attribute, as well as the data-plugin-name attribute.
  204. * Also fires the destroyed event for the plugin, consolidating repetitive code.
  205. * @param {Object} plugin - an instance of a plugin, usually `this` in context.
  206. * @fires Plugin#destroyed
  207. */
  208. unregisterPlugin: function unregisterPlugin(plugin) {
  209. var pluginName = hyphenate(functionName(plugin.$element.data('zfPlugin').constructor));
  210. this._uuids.splice(this._uuids.indexOf(plugin.uuid), 1);
  211. plugin.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin')
  212. /**
  213. * Fires when the plugin has been destroyed.
  214. * @event Plugin#destroyed
  215. */
  216. .trigger("destroyed.zf.".concat(pluginName));
  217. for (var prop in plugin) {
  218. plugin[prop] = null; //clean up script to prep for garbage collection.
  219. }
  220. return;
  221. },
  222. /**
  223. * @function
  224. * Causes one or more active plugins to re-initialize, resetting event listeners, recalculating positions, etc.
  225. * @param {String} plugins - optional string of an individual plugin key, attained by calling `$(element).data('pluginName')`, or string of a plugin class i.e. `'dropdown'`
  226. * @default If no argument is passed, reflow all currently active plugins.
  227. */
  228. reInit: function reInit(plugins) {
  229. var isJQ = plugins instanceof jquery__WEBPACK_IMPORTED_MODULE_0___default.a;
  230. try {
  231. if (isJQ) {
  232. plugins.each(function () {
  233. jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data('zfPlugin')._init();
  234. });
  235. } else {
  236. var type = _typeof(plugins),
  237. _this = this,
  238. fns = {
  239. 'object': function object(plgs) {
  240. plgs.forEach(function (p) {
  241. p = hyphenate(p);
  242. jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-' + p + ']').foundation('_init');
  243. });
  244. },
  245. 'string': function string() {
  246. plugins = hyphenate(plugins);
  247. jquery__WEBPACK_IMPORTED_MODULE_0___default()('[data-' + plugins + ']').foundation('_init');
  248. },
  249. 'undefined': function undefined() {
  250. this['object'](Object.keys(_this._plugins));
  251. }
  252. };
  253. fns[type](plugins);
  254. }
  255. } catch (err) {
  256. console.error(err);
  257. } finally {
  258. return plugins;
  259. }
  260. },
  261. /**
  262. * Initialize plugins on any elements within `elem` (and `elem` itself) that aren't already initialized.
  263. * @param {Object} elem - jQuery object containing the element to check inside. Also checks the element itself, unless it's the `document` object.
  264. * @param {String|Array} plugins - A list of plugins to initialize. Leave this out to initialize everything.
  265. */
  266. reflow: function reflow(elem, plugins) {
  267. // If plugins is undefined, just grab everything
  268. if (typeof plugins === 'undefined') {
  269. plugins = Object.keys(this._plugins);
  270. } // If plugins is a string, convert it to an array with one item
  271. else if (typeof plugins === 'string') {
  272. plugins = [plugins];
  273. }
  274. var _this = this; // Iterate through each plugin
  275. jquery__WEBPACK_IMPORTED_MODULE_0___default.a.each(plugins, function (i, name) {
  276. // Get the current plugin
  277. var plugin = _this._plugins[name]; // Localize the search to all elements inside elem, as well as elem itself, unless elem === document
  278. var $elem = jquery__WEBPACK_IMPORTED_MODULE_0___default()(elem).find('[data-' + name + ']').addBack('[data-' + name + ']').filter(function () {
  279. return typeof jquery__WEBPACK_IMPORTED_MODULE_0___default()(this).data("zfPlugin") === 'undefined';
  280. }); // For each plugin found, initialize it
  281. $elem.each(function () {
  282. var $el = jquery__WEBPACK_IMPORTED_MODULE_0___default()(this),
  283. opts = {
  284. reflow: true
  285. };
  286. if ($el.attr('data-options')) {
  287. $el.attr('data-options').split(';').forEach(function (option, _index) {
  288. var opt = option.split(':').map(function (el) {
  289. return el.trim();
  290. });
  291. if (opt[0]) opts[opt[0]] = parseValue(opt[1]);
  292. });
  293. }
  294. try {
  295. $el.data('zfPlugin', new plugin(jquery__WEBPACK_IMPORTED_MODULE_0___default()(this), opts));
  296. } catch (er) {
  297. console.error(er);
  298. } finally {
  299. return;
  300. }
  301. });
  302. });
  303. },
  304. getFnName: functionName,
  305. addToJquery: function addToJquery($) {
  306. // TODO: consider not making this a jQuery function
  307. // TODO: need way to reflow vs. re-initialize
  308. /**
  309. * The Foundation jQuery method.
  310. * @param {String|Array} method - An action to perform on the current jQuery object.
  311. */
  312. var foundation = function foundation(method) {
  313. var type = _typeof(method),
  314. $noJS = $('.no-js');
  315. if ($noJS.length) {
  316. $noJS.removeClass('no-js');
  317. }
  318. if (type === 'undefined') {
  319. //needs to initialize the Foundation object, or an individual plugin.
  320. _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_2__["MediaQuery"]._init();
  321. Foundation.reflow(this);
  322. } else if (type === 'string') {
  323. //an individual method to invoke on a plugin or group of plugins
  324. var args = Array.prototype.slice.call(arguments, 1); //collect all the arguments, if necessary
  325. var plugClass = this.data('zfPlugin'); //determine the class of plugin
  326. if (typeof plugClass !== 'undefined' && typeof plugClass[method] !== 'undefined') {
  327. //make sure both the class and method exist
  328. if (this.length === 1) {
  329. //if there's only one, call it directly.
  330. plugClass[method].apply(plugClass, args);
  331. } else {
  332. this.each(function (i, el) {
  333. //otherwise loop through the jQuery collection and invoke the method on each
  334. plugClass[method].apply($(el).data('zfPlugin'), args);
  335. });
  336. }
  337. } else {
  338. //error for no class or no method
  339. throw new ReferenceError("We're sorry, '" + method + "' is not an available method for " + (plugClass ? functionName(plugClass) : 'this element') + '.');
  340. }
  341. } else {
  342. //error for invalid argument type
  343. throw new TypeError("We're sorry, ".concat(type, " is not a valid parameter. You must use a string representing the method you wish to invoke."));
  344. }
  345. return this;
  346. };
  347. $.fn.foundation = foundation;
  348. return $;
  349. }
  350. };
  351. Foundation.util = {
  352. /**
  353. * Function for applying a debounce effect to a function call.
  354. * @function
  355. * @param {Function} func - Function to be called at end of timeout.
  356. * @param {Number} delay - Time in ms to delay the call of `func`.
  357. * @returns function
  358. */
  359. throttle: function throttle(func, delay) {
  360. var timer = null;
  361. return function () {
  362. var context = this,
  363. args = arguments;
  364. if (timer === null) {
  365. timer = setTimeout(function () {
  366. func.apply(context, args);
  367. timer = null;
  368. }, delay);
  369. }
  370. };
  371. }
  372. };
  373. window.Foundation = Foundation; // Polyfill for requestAnimationFrame
  374. (function () {
  375. if (!Date.now || !window.Date.now) window.Date.now = Date.now = function () {
  376. return new Date().getTime();
  377. };
  378. var vendors = ['webkit', 'moz'];
  379. for (var i = 0; i < vendors.length && !window.requestAnimationFrame; ++i) {
  380. var vp = vendors[i];
  381. window.requestAnimationFrame = window[vp + 'RequestAnimationFrame'];
  382. window.cancelAnimationFrame = window[vp + 'CancelAnimationFrame'] || window[vp + 'CancelRequestAnimationFrame'];
  383. }
  384. if (/iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent) || !window.requestAnimationFrame || !window.cancelAnimationFrame) {
  385. var lastTime = 0;
  386. window.requestAnimationFrame = function (callback) {
  387. var now = Date.now();
  388. var nextTime = Math.max(lastTime + 16, now);
  389. return setTimeout(function () {
  390. callback(lastTime = nextTime);
  391. }, nextTime - now);
  392. };
  393. window.cancelAnimationFrame = clearTimeout;
  394. }
  395. /**
  396. * Polyfill for performance.now, required by rAF
  397. */
  398. if (!window.performance || !window.performance.now) {
  399. window.performance = {
  400. start: Date.now(),
  401. now: function now() {
  402. return Date.now() - this.start;
  403. }
  404. };
  405. }
  406. })();
  407. if (!Function.prototype.bind) {
  408. Function.prototype.bind = function (oThis) {
  409. if (typeof this !== 'function') {
  410. // closest thing possible to the ECMAScript 5
  411. // internal IsCallable function
  412. throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
  413. }
  414. var aArgs = Array.prototype.slice.call(arguments, 1),
  415. fToBind = this,
  416. fNOP = function fNOP() {},
  417. fBound = function fBound() {
  418. return fToBind.apply(this instanceof fNOP ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments)));
  419. };
  420. if (this.prototype) {
  421. // native functions don't have a prototype
  422. fNOP.prototype = this.prototype;
  423. }
  424. fBound.prototype = new fNOP();
  425. return fBound;
  426. };
  427. } // Polyfill to get the name of a function in IE9
  428. function functionName(fn) {
  429. if (typeof Function.prototype.name === 'undefined') {
  430. var funcNameRegex = /function\s([^(]{1,})\(/;
  431. var results = funcNameRegex.exec(fn.toString());
  432. return results && results.length > 1 ? results[1].trim() : "";
  433. } else if (typeof fn.prototype === 'undefined') {
  434. return fn.constructor.name;
  435. } else {
  436. return fn.prototype.constructor.name;
  437. }
  438. }
  439. function parseValue(str) {
  440. if ('true' === str) return true;else if ('false' === str) return false;else if (!isNaN(str * 1)) return parseFloat(str);
  441. return str;
  442. } // Convert PascalCase to kebab-case
  443. // Thank you: http://stackoverflow.com/a/8955580
  444. function hyphenate(str) {
  445. return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  446. }
  447. /***/ }),
  448. /***/ "./js/foundation.core.plugin.js":
  449. /*!**************************************!*\
  450. !*** ./js/foundation.core.plugin.js ***!
  451. \**************************************/
  452. /*! exports provided: Plugin */
  453. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  454. "use strict";
  455. __webpack_require__.r(__webpack_exports__);
  456. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plugin", function() { return Plugin; });
  457. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  458. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  459. /* harmony import */ var _foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./foundation.core.utils */ "./js/foundation.core.utils.js");
  460. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  461. 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); } }
  462. function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
  463. // Abstract class for providing lifecycle hooks. Expect plugins to define AT LEAST
  464. // {function} _setup (replaces previous constructor),
  465. // {function} _destroy (replaces previous destroy)
  466. var Plugin =
  467. /*#__PURE__*/
  468. function () {
  469. function Plugin(element, options) {
  470. _classCallCheck(this, Plugin);
  471. this._setup(element, options);
  472. var pluginName = getPluginName(this);
  473. this.uuid = Object(_foundation_core_utils__WEBPACK_IMPORTED_MODULE_1__["GetYoDigits"])(6, pluginName);
  474. if (!this.$element.attr("data-".concat(pluginName))) {
  475. this.$element.attr("data-".concat(pluginName), this.uuid);
  476. }
  477. if (!this.$element.data('zfPlugin')) {
  478. this.$element.data('zfPlugin', this);
  479. }
  480. /**
  481. * Fires when the plugin has initialized.
  482. * @event Plugin#init
  483. */
  484. this.$element.trigger("init.zf.".concat(pluginName));
  485. }
  486. _createClass(Plugin, [{
  487. key: "destroy",
  488. value: function destroy() {
  489. this._destroy();
  490. var pluginName = getPluginName(this);
  491. this.$element.removeAttr("data-".concat(pluginName)).removeData('zfPlugin')
  492. /**
  493. * Fires when the plugin has been destroyed.
  494. * @event Plugin#destroyed
  495. */
  496. .trigger("destroyed.zf.".concat(pluginName));
  497. for (var prop in this) {
  498. this[prop] = null; //clean up script to prep for garbage collection.
  499. }
  500. }
  501. }]);
  502. return Plugin;
  503. }(); // Convert PascalCase to kebab-case
  504. // Thank you: http://stackoverflow.com/a/8955580
  505. function hyphenate(str) {
  506. return str.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
  507. }
  508. function getPluginName(obj) {
  509. return hyphenate(obj.className);
  510. }
  511. /***/ }),
  512. /***/ "./js/foundation.core.utils.js":
  513. /*!*************************************!*\
  514. !*** ./js/foundation.core.utils.js ***!
  515. \*************************************/
  516. /*! exports provided: rtl, GetYoDigits, RegExpEscape, transitionend, onLoad, ignoreMousedisappear */
  517. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  518. "use strict";
  519. __webpack_require__.r(__webpack_exports__);
  520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rtl", function() { return rtl; });
  521. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GetYoDigits", function() { return GetYoDigits; });
  522. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegExpEscape", function() { return RegExpEscape; });
  523. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transitionend", function() { return transitionend; });
  524. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onLoad", function() { return onLoad; });
  525. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ignoreMousedisappear", function() { return ignoreMousedisappear; });
  526. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  527. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  528. // Core Foundation Utilities, utilized in a number of places.
  529. /**
  530. * Returns a boolean for RTL support
  531. */
  532. function rtl() {
  533. return jquery__WEBPACK_IMPORTED_MODULE_0___default()('html').attr('dir') === 'rtl';
  534. }
  535. /**
  536. * returns a random base-36 uid with namespacing
  537. * @function
  538. * @param {Number} length - number of random base-36 digits desired. Increase for more random strings.
  539. * @param {String} namespace - name of plugin to be incorporated in uid, optional.
  540. * @default {String} '' - if no plugin name is provided, nothing is appended to the uid.
  541. * @returns {String} - unique id
  542. */
  543. function GetYoDigits() {
  544. var length = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 6;
  545. var namespace = arguments.length > 1 ? arguments[1] : undefined;
  546. var str = '';
  547. var chars = '0123456789abcdefghijklmnopqrstuvwxyz';
  548. var charsLength = chars.length;
  549. for (var i = 0; i < length; i++) {
  550. str += chars[Math.floor(Math.random() * charsLength)];
  551. }
  552. return namespace ? "".concat(str, "-").concat(namespace) : str;
  553. }
  554. /**
  555. * Escape a string so it can be used as a regexp pattern
  556. * @function
  557. * @see https://stackoverflow.com/a/9310752/4317384
  558. *
  559. * @param {String} str - string to escape.
  560. * @returns {String} - escaped string
  561. */
  562. function RegExpEscape(str) {
  563. return str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
  564. }
  565. function transitionend($elem) {
  566. var transitions = {
  567. 'transition': 'transitionend',
  568. 'WebkitTransition': 'webkitTransitionEnd',
  569. 'MozTransition': 'transitionend',
  570. 'OTransition': 'otransitionend'
  571. };
  572. var elem = document.createElement('div'),
  573. end;
  574. for (var transition in transitions) {
  575. if (typeof elem.style[transition] !== 'undefined') {
  576. end = transitions[transition];
  577. }
  578. }
  579. if (end) {
  580. return end;
  581. } else {
  582. setTimeout(function () {
  583. $elem.triggerHandler('transitionend', [$elem]);
  584. }, 1);
  585. return 'transitionend';
  586. }
  587. }
  588. /**
  589. * Return an event type to listen for window load.
  590. *
  591. * If `$elem` is passed, an event will be triggered on `$elem`. If window is already loaded, the event will still be triggered.
  592. * If `handler` is passed, attach it to the event on `$elem`.
  593. * Calling `onLoad` without handler allows you to get the event type that will be triggered before attaching the handler by yourself.
  594. * @function
  595. *
  596. * @param {Object} [] $elem - jQuery element on which the event will be triggered if passed.
  597. * @param {Function} [] handler - function to attach to the event.
  598. * @returns {String} - event type that should or will be triggered.
  599. */
  600. function onLoad($elem, handler) {
  601. var didLoad = document.readyState === 'complete';
  602. var eventType = (didLoad ? '_didLoad' : 'load') + '.zf.util.onLoad';
  603. var cb = function cb() {
  604. return $elem.triggerHandler(eventType);
  605. };
  606. if ($elem) {
  607. if (handler) $elem.one(eventType, handler);
  608. if (didLoad) setTimeout(cb);else jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).one('load', cb);
  609. }
  610. return eventType;
  611. }
  612. /**
  613. * Retuns an handler for the `mouseleave` that ignore disappeared mouses.
  614. *
  615. * If the mouse "disappeared" from the document (like when going on a browser UI element, See https://git.io/zf-11410),
  616. * the event is ignored.
  617. * - If the `ignoreLeaveWindow` is `true`, the event is ignored when the user actually left the window
  618. * (like by switching to an other window with [Alt]+[Tab]).
  619. * - If the `ignoreReappear` is `true`, the event will be ignored when the mouse will reappear later on the document
  620. * outside of the element it left.
  621. *
  622. * @function
  623. *
  624. * @param {Function} [] handler - handler for the filtered `mouseleave` event to watch.
  625. * @param {Object} [] options - object of options:
  626. * - {Boolean} [false] ignoreLeaveWindow - also ignore when the user switched windows.
  627. * - {Boolean} [false] ignoreReappear - also ignore when the mouse reappeared outside of the element it left.
  628. * @returns {Function} - filtered handler to use to listen on the `mouseleave` event.
  629. */
  630. function ignoreMousedisappear(handler) {
  631. var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
  632. _ref$ignoreLeaveWindo = _ref.ignoreLeaveWindow,
  633. ignoreLeaveWindow = _ref$ignoreLeaveWindo === void 0 ? false : _ref$ignoreLeaveWindo,
  634. _ref$ignoreReappear = _ref.ignoreReappear,
  635. ignoreReappear = _ref$ignoreReappear === void 0 ? false : _ref$ignoreReappear;
  636. return function leaveEventHandler(eLeave) {
  637. for (var _len = arguments.length, rest = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  638. rest[_key - 1] = arguments[_key];
  639. }
  640. var callback = handler.bind.apply(handler, [this, eLeave].concat(rest)); // The mouse left: call the given callback if the mouse entered elsewhere
  641. if (eLeave.relatedTarget !== null) {
  642. return callback();
  643. } // Otherwise, check if the mouse actually left the window.
  644. // In firefox if the user switched between windows, the window sill have the focus by the time
  645. // the event is triggered. We have to debounce the event to test this case.
  646. setTimeout(function leaveEventDebouncer() {
  647. if (!ignoreLeaveWindow && document.hasFocus && !document.hasFocus()) {
  648. return callback();
  649. } // Otherwise, wait for the mouse to reeapear outside of the element,
  650. if (!ignoreReappear) {
  651. jquery__WEBPACK_IMPORTED_MODULE_0___default()(document).one('mouseenter', function reenterEventHandler(eReenter) {
  652. if (!jquery__WEBPACK_IMPORTED_MODULE_0___default()(eLeave.currentTarget).has(eReenter.target).length) {
  653. // Fill where the mouse finally entered.
  654. eLeave.relatedTarget = eReenter.target;
  655. callback();
  656. }
  657. });
  658. }
  659. }, 0);
  660. };
  661. }
  662. /***/ }),
  663. /***/ "./js/foundation.util.mediaQuery.js":
  664. /*!******************************************!*\
  665. !*** ./js/foundation.util.mediaQuery.js ***!
  666. \******************************************/
  667. /*! exports provided: MediaQuery */
  668. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  669. "use strict";
  670. __webpack_require__.r(__webpack_exports__);
  671. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; });
  672. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery");
  673. /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
  674. 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); }
  675. function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
  676. function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
  677. function _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
  678. function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
  679. // Default set of media queries
  680. var defaultQueries = {
  681. 'default': 'only screen',
  682. landscape: 'only screen and (orientation: landscape)',
  683. portrait: 'only screen and (orientation: portrait)',
  684. retina: 'only screen and (-webkit-min-device-pixel-ratio: 2),' + 'only screen and (min--moz-device-pixel-ratio: 2),' + 'only screen and (-o-min-device-pixel-ratio: 2/1),' + 'only screen and (min-device-pixel-ratio: 2),' + 'only screen and (min-resolution: 192dpi),' + 'only screen and (min-resolution: 2dppx)'
  685. }; // matchMedia() polyfill - Test a CSS media type/query in JS.
  686. // Authors & copyright © 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. MIT license
  687. /* eslint-disable */
  688. window.matchMedia || (window.matchMedia = function () {
  689. "use strict"; // For browsers that support matchMedium api such as IE 9 and webkit
  690. var styleMedia = window.styleMedia || window.media; // For those that don't support matchMedium
  691. if (!styleMedia) {
  692. var style = document.createElement('style'),
  693. script = document.getElementsByTagName('script')[0],
  694. info = null;
  695. style.type = 'text/css';
  696. style.id = 'matchmediajs-test';
  697. if (!script) {
  698. document.head.appendChild(style);
  699. } else {
  700. script.parentNode.insertBefore(style, script);
  701. } // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
  702. info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle;
  703. styleMedia = {
  704. matchMedium: function matchMedium(media) {
  705. var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
  706. if (style.styleSheet) {
  707. style.styleSheet.cssText = text;
  708. } else {
  709. style.textContent = text;
  710. } // Test if media query is true or false
  711. return info.width === '1px';
  712. }
  713. };
  714. }
  715. return function (media) {
  716. return {
  717. matches: styleMedia.matchMedium(media || 'all'),
  718. media: media || 'all'
  719. };
  720. };
  721. }());
  722. /* eslint-enable */
  723. var MediaQuery = {
  724. queries: [],
  725. current: '',
  726. /**
  727. * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
  728. * @function
  729. * @private
  730. */
  731. _init: function _init() {
  732. // make sure the initialization is only done once when calling _init() several times
  733. if (this.isInitialized === true) {
  734. return;
  735. } else {
  736. this.isInitialized = true;
  737. }
  738. var self = this;
  739. var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('meta.foundation-mq');
  740. if (!$meta.length) {
  741. jquery__WEBPACK_IMPORTED_MODULE_0___default()('<meta class="foundation-mq">').appendTo(document.head);
  742. }
  743. var extractedStyles = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.foundation-mq').css('font-family');
  744. var namedQueries;
  745. namedQueries = parseStyleToObject(extractedStyles);
  746. self.queries = []; // reset
  747. for (var key in namedQueries) {
  748. if (namedQueries.hasOwnProperty(key)) {
  749. self.queries.push({
  750. name: key,
  751. value: "only screen and (min-width: ".concat(namedQueries[key], ")")
  752. });
  753. }
  754. }
  755. this.current = this._getCurrentSize();
  756. this._watcher();
  757. },
  758. /**
  759. * Reinitializes the media query helper.
  760. * Useful if your CSS breakpoint configuration has just been loaded or has changed since the initialization.
  761. * @function
  762. * @private
  763. */
  764. _reInit: function _reInit() {
  765. this.isInitialized = false;
  766. this._init();
  767. },
  768. /**
  769. * Checks if the screen is at least as wide as a breakpoint.
  770. * @function
  771. * @param {String} size - Name of the breakpoint to check.
  772. * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller.
  773. */
  774. atLeast: function atLeast(size) {
  775. var query = this.get(size);
  776. if (query) {
  777. return window.matchMedia(query).matches;
  778. }
  779. return false;
  780. },
  781. /**
  782. * Checks if the screen is within the given breakpoint.
  783. * If smaller than the breakpoint of larger than its upper limit it returns false.
  784. * @function
  785. * @param {String} size - Name of the breakpoint to check.
  786. * @returns {Boolean} `true` if the breakpoint matches, `false` otherwise.
  787. */
  788. only: function only(size) {
  789. return size === this._getCurrentSize();
  790. },
  791. /**
  792. * Checks if the screen is within a breakpoint or smaller.
  793. * @function
  794. * @param {String} size - Name of the breakpoint to check.
  795. * @returns {Boolean} `true` if the breakpoint matches, `false` if it's larger.
  796. */
  797. upTo: function upTo(size) {
  798. var nextSize = this.next(size); // If the next breakpoint does not match, the screen is smaller than
  799. // the upper limit of this breakpoint.
  800. if (nextSize) {
  801. return !this.atLeast(nextSize);
  802. } // If there is no next breakpoint, the "size" breakpoint does not have
  803. // an upper limit and the screen will always be within it or smaller.
  804. return true;
  805. },
  806. /**
  807. * Checks if the screen matches to a breakpoint.
  808. * @function
  809. * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method.
  810. * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not.
  811. */
  812. is: function is(size) {
  813. var parts = size.trim().split(' ').filter(function (p) {
  814. return !!p.length;
  815. });
  816. var _parts = _slicedToArray(parts, 2),
  817. bpSize = _parts[0],
  818. _parts$ = _parts[1],
  819. bpModifier = _parts$ === void 0 ? '' : _parts$; // Only the breakpont
  820. if (bpModifier === 'only') {
  821. return this.only(bpSize);
  822. } // At least the breakpoint (included)
  823. if (!bpModifier || bpModifier === 'up') {
  824. return this.atLeast(bpSize);
  825. } // Up to the breakpoint (included)
  826. if (bpModifier === 'down') {
  827. return this.upTo(bpSize);
  828. }
  829. throw new Error("\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like \"<size> <modifier>\", got \"".concat(size, "\".\n "));
  830. },
  831. /**
  832. * Gets the media query of a breakpoint.
  833. * @function
  834. * @param {String} size - Name of the breakpoint to get.
  835. * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist.
  836. */
  837. get: function get(size) {
  838. for (var i in this.queries) {
  839. if (this.queries.hasOwnProperty(i)) {
  840. var query = this.queries[i];
  841. if (size === query.name) return query.value;
  842. }
  843. }
  844. return null;
  845. },
  846. /**
  847. * Get the breakpoint following the given breakpoint.
  848. * @function
  849. * @param {String} size - Name of the breakpoint.
  850. * @returns {String|null} - The name of the following breakpoint, or `null` if the passed breakpoint was the last one.
  851. */
  852. next: function next(size) {
  853. var _this = this;
  854. var queryIndex = this.queries.findIndex(function (q) {
  855. return _this._getQueryName(q) === size;
  856. });
  857. if (queryIndex === -1) {
  858. throw new Error("\n Unknown breakpoint \"".concat(size, "\" passed to MediaQuery.next().\n Ensure it is present in your Sass \"$breakpoints\" setting.\n "));
  859. }
  860. var nextQuery = this.queries[queryIndex + 1];
  861. return nextQuery ? nextQuery.name : null;
  862. },
  863. /**
  864. * Returns the name of the breakpoint related to the given value.
  865. * @function
  866. * @private
  867. * @param {String|Object} value - Breakpoint name or query object.
  868. * @returns {String} Name of the breakpoint.
  869. */
  870. _getQueryName: function _getQueryName(value) {
  871. if (typeof value === 'string') return value;
  872. if (_typeof(value) === 'object') return value.name;
  873. throw new TypeError("\n Invalid value passed to MediaQuery._getQueryName().\n Expected a breakpoint name (String) or a breakpoint query (Object), got \"".concat(value, "\" (").concat(_typeof(value), ")\n "));
  874. },
  875. /**
  876. * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one).
  877. * @function
  878. * @private
  879. * @returns {String} Name of the current breakpoint.
  880. */
  881. _getCurrentSize: function _getCurrentSize() {
  882. var matched;
  883. for (var i = 0; i < this.queries.length; i++) {
  884. var query = this.queries[i];
  885. if (window.matchMedia(query.value).matches) {
  886. matched = query;
  887. }
  888. }
  889. return matched && this._getQueryName(matched);
  890. },
  891. /**
  892. * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes.
  893. * @function
  894. * @private
  895. */
  896. _watcher: function _watcher() {
  897. var _this2 = this;
  898. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () {
  899. var newSize = _this2._getCurrentSize(),
  900. currentSize = _this2.current;
  901. if (newSize !== currentSize) {
  902. // Change the current media query
  903. _this2.current = newSize; // Broadcast the media query change on the window
  904. jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
  905. }
  906. });
  907. }
  908. }; // Thank you: https://github.com/sindresorhus/query-string
  909. function parseStyleToObject(str) {
  910. var styleObject = {};
  911. if (typeof str !== 'string') {
  912. return styleObject;
  913. }
  914. str = str.trim().slice(1, -1); // browsers re-quote string style values
  915. if (!str) {
  916. return styleObject;
  917. }
  918. styleObject = str.split('&').reduce(function (ret, param) {
  919. var parts = param.replace(/\+/g, ' ').split('=');
  920. var key = parts[0];
  921. var val = parts[1];
  922. key = decodeURIComponent(key); // missing `=` should be `null`:
  923. // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
  924. val = typeof val === 'undefined' ? null : decodeURIComponent(val);
  925. if (!ret.hasOwnProperty(key)) {
  926. ret[key] = val;
  927. } else if (Array.isArray(ret[key])) {
  928. ret[key].push(val);
  929. } else {
  930. ret[key] = [ret[key], val];
  931. }
  932. return ret;
  933. }, {});
  934. return styleObject;
  935. }
  936. /***/ }),
  937. /***/ 0:
  938. /*!*****************************************************!*\
  939. !*** multi ./js/entries/plugins/foundation.core.js ***!
  940. \*****************************************************/
  941. /*! no static exports found */
  942. /***/ (function(module, exports, __webpack_require__) {
  943. module.exports = __webpack_require__(/*! /Users/joeworkman/Development/foundation-sites/js/entries/plugins/foundation.core.js */"./js/entries/plugins/foundation.core.js");
  944. /***/ }),
  945. /***/ "jquery":
  946. /*!********************************************************************************************!*\
  947. !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
  948. \********************************************************************************************/
  949. /*! no static exports found */
  950. /***/ (function(module, exports) {
  951. module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
  952. /***/ })
  953. /******/ });
  954. });
  955. //# sourceMappingURL=foundation.core.js.map