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