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("./foundation.core"), require("jquery")); |
||
| 4 | else if(typeof define === 'function' && define.amd) |
||
| 5 | define(["./foundation.core", "jquery"], factory); |
||
| 6 | else if(typeof exports === 'object') |
||
| 7 | exports["foundation.util.mediaQuery"] = factory(require("./foundation.core"), require("jquery")); |
||
| 8 | else |
||
| 9 | root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["jQuery"]); |
||
| 14197 | obado | 10 | })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __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 = 24); |
||
| 14197 | obado | 95 | /******/ }) |
| 96 | /************************************************************************/ |
||
| 97 | /******/ ({ |
||
| 98 | |||
| 99 | /***/ "./foundation.core": |
||
| 100 | /*!****************************************************************************************************************************************************************!*\ |
||
| 101 | !*** external {"root":["__FOUNDATION_EXTERNAL__","foundation.core"],"amd":"./foundation.core","commonjs":"./foundation.core","commonjs2":"./foundation.core"} ***! |
||
| 102 | \****************************************************************************************************************************************************************/ |
||
| 103 | /*! no static exports found */ |
||
| 104 | /***/ (function(module, exports) { |
||
| 105 | |||
| 106 | module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__; |
||
| 107 | |||
| 108 | /***/ }), |
||
| 109 | |||
| 110 | /***/ "./js/entries/plugins/foundation.util.mediaQuery.js": |
||
| 111 | /*!**********************************************************!*\ |
||
| 112 | !*** ./js/entries/plugins/foundation.util.mediaQuery.js ***! |
||
| 113 | \**********************************************************/ |
||
| 114 | /*! exports provided: Foundation, MediaQuery */ |
||
| 115 | /***/ (function(module, __webpack_exports__, __webpack_require__) { |
||
| 116 | |||
| 117 | "use strict"; |
||
| 118 | __webpack_require__.r(__webpack_exports__); |
||
| 119 | /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./foundation.core */ "./foundation.core"); |
||
| 120 | /* harmony import */ var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__); |
||
| 121 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; }); |
||
| 122 | |||
| 123 | /* harmony import */ var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../foundation.util.mediaQuery */ "./js/foundation.util.mediaQuery.js"); |
||
| 124 | /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"]; }); |
||
| 125 | |||
| 126 | |||
| 127 | |||
| 128 | _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].MediaQuery = _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"]; |
||
| 129 | |||
| 130 | _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].MediaQuery._init(); |
||
| 131 | |||
| 132 | |||
| 133 | |||
| 134 | /***/ }), |
||
| 135 | |||
| 136 | /***/ "./js/foundation.util.mediaQuery.js": |
||
| 137 | /*!******************************************!*\ |
||
| 138 | !*** ./js/foundation.util.mediaQuery.js ***! |
||
| 139 | \******************************************/ |
||
| 140 | /*! exports provided: MediaQuery */ |
||
| 141 | /***/ (function(module, __webpack_exports__, __webpack_require__) { |
||
| 142 | |||
| 143 | "use strict"; |
||
| 144 | __webpack_require__.r(__webpack_exports__); |
||
| 145 | /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; }); |
||
| 146 | /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! jquery */ "jquery"); |
||
| 147 | /* harmony import */ var jquery__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__); |
||
| 148 | |||
| 149 | |||
| 150 | 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); } |
||
| 151 | |||
| 14734 | obado | 152 | function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); } |
| 153 | |||
| 154 | function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } |
||
| 155 | |||
| 156 | 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; } |
||
| 157 | |||
| 158 | function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } |
||
| 159 | |||
| 14197 | obado | 160 | // Default set of media queries |
| 161 | |||
| 162 | var defaultQueries = { |
||
| 163 | 'default': 'only screen', |
||
| 164 | landscape: 'only screen and (orientation: landscape)', |
||
| 165 | portrait: 'only screen and (orientation: portrait)', |
||
| 166 | 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)' |
||
| 167 | }; // matchMedia() polyfill - Test a CSS media type/query in JS. |
||
| 14734 | obado | 168 | // Authors & copyright © 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. MIT license |
| 14197 | obado | 169 | |
| 170 | /* eslint-disable */ |
||
| 171 | |||
| 172 | window.matchMedia || (window.matchMedia = function () { |
||
| 173 | "use strict"; // For browsers that support matchMedium api such as IE 9 and webkit |
||
| 174 | |||
| 175 | var styleMedia = window.styleMedia || window.media; // For those that don't support matchMedium |
||
| 176 | |||
| 177 | if (!styleMedia) { |
||
| 178 | var style = document.createElement('style'), |
||
| 179 | script = document.getElementsByTagName('script')[0], |
||
| 180 | info = null; |
||
| 181 | style.type = 'text/css'; |
||
| 182 | style.id = 'matchmediajs-test'; |
||
| 183 | |||
| 184 | if (!script) { |
||
| 185 | document.head.appendChild(style); |
||
| 186 | } else { |
||
| 187 | script.parentNode.insertBefore(style, script); |
||
| 188 | } // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers |
||
| 189 | |||
| 190 | |||
| 191 | info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle; |
||
| 192 | styleMedia = { |
||
| 193 | matchMedium: function matchMedium(media) { |
||
| 194 | var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers |
||
| 195 | |||
| 196 | if (style.styleSheet) { |
||
| 197 | style.styleSheet.cssText = text; |
||
| 198 | } else { |
||
| 199 | style.textContent = text; |
||
| 200 | } // Test if media query is true or false |
||
| 201 | |||
| 202 | |||
| 203 | return info.width === '1px'; |
||
| 204 | } |
||
| 205 | }; |
||
| 206 | } |
||
| 207 | |||
| 208 | return function (media) { |
||
| 209 | return { |
||
| 210 | matches: styleMedia.matchMedium(media || 'all'), |
||
| 211 | media: media || 'all' |
||
| 212 | }; |
||
| 213 | }; |
||
| 214 | }()); |
||
| 215 | /* eslint-enable */ |
||
| 216 | |||
| 217 | var MediaQuery = { |
||
| 218 | queries: [], |
||
| 219 | current: '', |
||
| 220 | |||
| 221 | /** |
||
| 222 | * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher. |
||
| 223 | * @function |
||
| 224 | * @private |
||
| 225 | */ |
||
| 226 | _init: function _init() { |
||
| 14734 | obado | 227 | // make sure the initialization is only done once when calling _init() several times |
| 228 | if (this.isInitialized === true) { |
||
| 229 | return; |
||
| 230 | } else { |
||
| 231 | this.isInitialized = true; |
||
| 232 | } |
||
| 233 | |||
| 14197 | obado | 234 | var self = this; |
| 235 | var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('meta.foundation-mq'); |
||
| 236 | |||
| 237 | if (!$meta.length) { |
||
| 238 | jquery__WEBPACK_IMPORTED_MODULE_0___default()('<meta class="foundation-mq">').appendTo(document.head); |
||
| 239 | } |
||
| 240 | |||
| 241 | var extractedStyles = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.foundation-mq').css('font-family'); |
||
| 242 | var namedQueries; |
||
| 243 | namedQueries = parseStyleToObject(extractedStyles); |
||
| 14734 | obado | 244 | self.queries = []; // reset |
| 14197 | obado | 245 | |
| 246 | for (var key in namedQueries) { |
||
| 247 | if (namedQueries.hasOwnProperty(key)) { |
||
| 248 | self.queries.push({ |
||
| 249 | name: key, |
||
| 250 | value: "only screen and (min-width: ".concat(namedQueries[key], ")") |
||
| 251 | }); |
||
| 252 | } |
||
| 253 | } |
||
| 254 | |||
| 255 | this.current = this._getCurrentSize(); |
||
| 256 | |||
| 257 | this._watcher(); |
||
| 258 | }, |
||
| 259 | |||
| 260 | /** |
||
| 14734 | obado | 261 | * Reinitializes the media query helper. |
| 262 | * Useful if your CSS breakpoint configuration has just been loaded or has changed since the initialization. |
||
| 263 | * @function |
||
| 264 | * @private |
||
| 265 | */ |
||
| 266 | _reInit: function _reInit() { |
||
| 267 | this.isInitialized = false; |
||
| 268 | |||
| 269 | this._init(); |
||
| 270 | }, |
||
| 271 | |||
| 272 | /** |
||
| 14197 | obado | 273 | * Checks if the screen is at least as wide as a breakpoint. |
| 274 | * @function |
||
| 275 | * @param {String} size - Name of the breakpoint to check. |
||
| 276 | * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller. |
||
| 277 | */ |
||
| 278 | atLeast: function atLeast(size) { |
||
| 279 | var query = this.get(size); |
||
| 280 | |||
| 281 | if (query) { |
||
| 282 | return window.matchMedia(query).matches; |
||
| 283 | } |
||
| 284 | |||
| 285 | return false; |
||
| 286 | }, |
||
| 287 | |||
| 288 | /** |
||
| 14734 | obado | 289 | * Checks if the screen is within the given breakpoint. |
| 290 | * If smaller than the breakpoint of larger than its upper limit it returns false. |
||
| 291 | * @function |
||
| 292 | * @param {String} size - Name of the breakpoint to check. |
||
| 293 | * @returns {Boolean} `true` if the breakpoint matches, `false` otherwise. |
||
| 294 | */ |
||
| 295 | only: function only(size) { |
||
| 296 | return size === this._getCurrentSize(); |
||
| 297 | }, |
||
| 298 | |||
| 299 | /** |
||
| 300 | * Checks if the screen is within a breakpoint or smaller. |
||
| 301 | * @function |
||
| 302 | * @param {String} size - Name of the breakpoint to check. |
||
| 303 | * @returns {Boolean} `true` if the breakpoint matches, `false` if it's larger. |
||
| 304 | */ |
||
| 305 | upTo: function upTo(size) { |
||
| 306 | var nextSize = this.next(size); // If the next breakpoint does not match, the screen is smaller than |
||
| 307 | // the upper limit of this breakpoint. |
||
| 308 | |||
| 309 | if (nextSize) { |
||
| 310 | return !this.atLeast(nextSize); |
||
| 311 | } // If there is no next breakpoint, the "size" breakpoint does not have |
||
| 312 | // an upper limit and the screen will always be within it or smaller. |
||
| 313 | |||
| 314 | |||
| 315 | return true; |
||
| 316 | }, |
||
| 317 | |||
| 318 | /** |
||
| 14197 | obado | 319 | * Checks if the screen matches to a breakpoint. |
| 320 | * @function |
||
| 321 | * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method. |
||
| 322 | * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not. |
||
| 323 | */ |
||
| 324 | is: function is(size) { |
||
| 14734 | obado | 325 | var parts = size.trim().split(' ').filter(function (p) { |
| 326 | return !!p.length; |
||
| 327 | }); |
||
| 14197 | obado | 328 | |
| 14734 | obado | 329 | var _parts = _slicedToArray(parts, 2), |
| 330 | bpSize = _parts[0], |
||
| 331 | _parts$ = _parts[1], |
||
| 332 | bpModifier = _parts$ === void 0 ? '' : _parts$; // Only the breakpont |
||
| 333 | |||
| 334 | |||
| 335 | if (bpModifier === 'only') { |
||
| 336 | return this.only(bpSize); |
||
| 337 | } // At least the breakpoint (included) |
||
| 338 | |||
| 339 | |||
| 340 | if (!bpModifier || bpModifier === 'up') { |
||
| 341 | return this.atLeast(bpSize); |
||
| 342 | } // Up to the breakpoint (included) |
||
| 343 | |||
| 344 | |||
| 345 | if (bpModifier === 'down') { |
||
| 346 | return this.upTo(bpSize); |
||
| 14197 | obado | 347 | } |
| 348 | |||
| 14734 | obado | 349 | 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 | 350 | }, |
| 351 | |||
| 352 | /** |
||
| 353 | * Gets the media query of a breakpoint. |
||
| 354 | * @function |
||
| 355 | * @param {String} size - Name of the breakpoint to get. |
||
| 356 | * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist. |
||
| 357 | */ |
||
| 358 | get: function get(size) { |
||
| 359 | for (var i in this.queries) { |
||
| 360 | if (this.queries.hasOwnProperty(i)) { |
||
| 361 | var query = this.queries[i]; |
||
| 362 | if (size === query.name) return query.value; |
||
| 363 | } |
||
| 364 | } |
||
| 365 | |||
| 366 | return null; |
||
| 367 | }, |
||
| 368 | |||
| 369 | /** |
||
| 14734 | obado | 370 | * Get the breakpoint following the given breakpoint. |
| 371 | * @function |
||
| 372 | * @param {String} size - Name of the breakpoint. |
||
| 373 | * @returns {String|null} - The name of the following breakpoint, or `null` if the passed breakpoint was the last one. |
||
| 374 | */ |
||
| 375 | next: function next(size) { |
||
| 376 | var _this = this; |
||
| 377 | |||
| 378 | var queryIndex = this.queries.findIndex(function (q) { |
||
| 379 | return _this._getQueryName(q) === size; |
||
| 380 | }); |
||
| 381 | |||
| 382 | if (queryIndex === -1) { |
||
| 383 | throw new Error("\n Unknown breakpoint \"".concat(size, "\" passed to MediaQuery.next().\n Ensure it is present in your Sass \"$breakpoints\" setting.\n ")); |
||
| 384 | } |
||
| 385 | |||
| 386 | var nextQuery = this.queries[queryIndex + 1]; |
||
| 387 | return nextQuery ? nextQuery.name : null; |
||
| 388 | }, |
||
| 389 | |||
| 390 | /** |
||
| 391 | * Returns the name of the breakpoint related to the given value. |
||
| 392 | * @function |
||
| 393 | * @private |
||
| 394 | * @param {String|Object} value - Breakpoint name or query object. |
||
| 395 | * @returns {String} Name of the breakpoint. |
||
| 396 | */ |
||
| 397 | _getQueryName: function _getQueryName(value) { |
||
| 398 | if (typeof value === 'string') return value; |
||
| 399 | if (_typeof(value) === 'object') return value.name; |
||
| 400 | 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 ")); |
||
| 401 | }, |
||
| 402 | |||
| 403 | /** |
||
| 14197 | obado | 404 | * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one). |
| 405 | * @function |
||
| 406 | * @private |
||
| 407 | * @returns {String} Name of the current breakpoint. |
||
| 408 | */ |
||
| 409 | _getCurrentSize: function _getCurrentSize() { |
||
| 410 | var matched; |
||
| 411 | |||
| 412 | for (var i = 0; i < this.queries.length; i++) { |
||
| 413 | var query = this.queries[i]; |
||
| 414 | |||
| 415 | if (window.matchMedia(query.value).matches) { |
||
| 416 | matched = query; |
||
| 417 | } |
||
| 418 | } |
||
| 419 | |||
| 14734 | obado | 420 | return matched && this._getQueryName(matched); |
| 14197 | obado | 421 | }, |
| 422 | |||
| 423 | /** |
||
| 424 | * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes. |
||
| 425 | * @function |
||
| 426 | * @private |
||
| 427 | */ |
||
| 428 | _watcher: function _watcher() { |
||
| 14734 | obado | 429 | var _this2 = this; |
| 14197 | obado | 430 | |
| 431 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () { |
||
| 14734 | obado | 432 | var newSize = _this2._getCurrentSize(), |
| 433 | currentSize = _this2.current; |
||
| 14197 | obado | 434 | |
| 435 | if (newSize !== currentSize) { |
||
| 436 | // Change the current media query |
||
| 14734 | obado | 437 | _this2.current = newSize; // Broadcast the media query change on the window |
| 14197 | obado | 438 | |
| 439 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]); |
||
| 440 | } |
||
| 441 | }); |
||
| 442 | } |
||
| 443 | }; // Thank you: https://github.com/sindresorhus/query-string |
||
| 444 | |||
| 445 | function parseStyleToObject(str) { |
||
| 446 | var styleObject = {}; |
||
| 447 | |||
| 448 | if (typeof str !== 'string') { |
||
| 449 | return styleObject; |
||
| 450 | } |
||
| 451 | |||
| 452 | str = str.trim().slice(1, -1); // browsers re-quote string style values |
||
| 453 | |||
| 454 | if (!str) { |
||
| 455 | return styleObject; |
||
| 456 | } |
||
| 457 | |||
| 458 | styleObject = str.split('&').reduce(function (ret, param) { |
||
| 459 | var parts = param.replace(/\+/g, ' ').split('='); |
||
| 460 | var key = parts[0]; |
||
| 461 | var val = parts[1]; |
||
| 462 | key = decodeURIComponent(key); // missing `=` should be `null`: |
||
| 463 | // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters |
||
| 464 | |||
| 465 | val = typeof val === 'undefined' ? null : decodeURIComponent(val); |
||
| 466 | |||
| 467 | if (!ret.hasOwnProperty(key)) { |
||
| 468 | ret[key] = val; |
||
| 469 | } else if (Array.isArray(ret[key])) { |
||
| 470 | ret[key].push(val); |
||
| 471 | } else { |
||
| 472 | ret[key] = [ret[key], val]; |
||
| 473 | } |
||
| 474 | |||
| 475 | return ret; |
||
| 476 | }, {}); |
||
| 477 | return styleObject; |
||
| 478 | } |
||
| 479 | |||
| 480 | |||
| 481 | |||
| 482 | /***/ }), |
||
| 483 | |||
| 484 | /***/ 24: |
||
| 485 | /*!****************************************************************!*\ |
||
| 486 | !*** multi ./js/entries/plugins/foundation.util.mediaQuery.js ***! |
||
| 487 | \****************************************************************/ |
||
| 488 | /*! no static exports found */ |
||
| 489 | /***/ (function(module, exports, __webpack_require__) { |
||
| 490 | |||
| 14734 | obado | 491 | module.exports = __webpack_require__(/*! /Volumes/Data/Development/Foundation/foundation-sites/js/entries/plugins/foundation.util.mediaQuery.js */"./js/entries/plugins/foundation.util.mediaQuery.js"); |
| 14197 | obado | 492 | |
| 493 | |||
| 494 | /***/ }), |
||
| 495 | |||
| 496 | /***/ "jquery": |
||
| 497 | /*!********************************************************************************************!*\ |
||
| 498 | !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***! |
||
| 499 | \********************************************************************************************/ |
||
| 500 | /*! no static exports found */ |
||
| 501 | /***/ (function(module, exports) { |
||
| 502 | |||
| 503 | module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__; |
||
| 504 | |||
| 505 | /***/ }) |
||
| 506 | |||
| 507 | /******/ }); |
||
| 508 | }); |
||
| 509 | //# sourceMappingURL=foundation.util.mediaQuery.js.map |