1 | (function webpackUniversalModuleDefinition(root, factory) {
|
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"]);
|
10 | })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
|
11 | return (function(modules) {
|
12 |
|
13 | var installedModules = {};
|
14 |
|
15 |
|
16 | function __webpack_require__(moduleId) {
|
17 |
|
18 |
|
19 | if(installedModules[moduleId]) {
|
20 | return installedModules[moduleId].exports;
|
21 | }
|
22 |
|
23 | var module = installedModules[moduleId] = {
|
24 | i: moduleId,
|
25 | l: false,
|
26 | exports: {}
|
27 | };
|
28 |
|
29 |
|
30 | modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
31 |
|
32 |
|
33 | module.l = true;
|
34 |
|
35 |
|
36 | return module.exports;
|
37 | }
|
38 |
|
39 |
|
40 |
|
41 | __webpack_require__.m = modules;
|
42 |
|
43 |
|
44 | __webpack_require__.c = installedModules;
|
45 |
|
46 |
|
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 |
|
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 |
|
62 |
|
63 |
|
64 |
|
65 |
|
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 |
|
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 |
|
87 | __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
|
88 |
|
89 |
|
90 | __webpack_require__.p = "";
|
91 |
|
92 |
|
93 |
|
94 | return __webpack_require__(__webpack_require__.s = 24);
|
95 | })
|
96 |
|
97 | ({
|
98 |
|
99 | "./foundation.core":
|
100 |
|
101 |
|
102 |
|
103 |
|
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 |
|
113 |
|
114 |
|
115 | (function(module, __webpack_exports__, __webpack_require__) {
|
116 |
|
117 | "use strict";
|
118 | __webpack_require__.r(__webpack_exports__);
|
119 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
|
120 | var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
|
121 | __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
|
122 |
|
123 | var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.util.mediaQuery.js");
|
124 | __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 |
|
139 |
|
140 |
|
141 | (function(module, __webpack_exports__, __webpack_require__) {
|
142 |
|
143 | "use strict";
|
144 | __webpack_require__.r(__webpack_exports__);
|
145 | __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; });
|
146 | var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
|
147 | var jquery__WEBPACK_IMPORTED_MODULE_0___default = __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 |
|
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 |
|
160 |
|
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 | };
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | window.matchMedia || (window.matchMedia = function () {
|
173 | "use strict";
|
174 |
|
175 | var styleMedia = window.styleMedia || window.media;
|
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 | }
|
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; } }';
|
195 |
|
196 | if (style.styleSheet) {
|
197 | style.styleSheet.cssText = text;
|
198 | } else {
|
199 | style.textContent = text;
|
200 | }
|
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 |
|
216 |
|
217 | var MediaQuery = {
|
218 | queries: [],
|
219 | current: '',
|
220 |
|
221 | |
222 |
|
223 |
|
224 |
|
225 |
|
226 | _init: function _init() {
|
227 |
|
228 | if (this.isInitialized === true) {
|
229 | return;
|
230 | } else {
|
231 | this.isInitialized = true;
|
232 | }
|
233 |
|
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);
|
244 | self.queries = [];
|
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 | |
261 |
|
262 |
|
263 |
|
264 |
|
265 |
|
266 | _reInit: function _reInit() {
|
267 | this.isInitialized = false;
|
268 |
|
269 | this._init();
|
270 | },
|
271 |
|
272 | |
273 |
|
274 |
|
275 |
|
276 |
|
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 | |
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 | only: function only(size) {
|
296 | return size === this._getCurrentSize();
|
297 | },
|
298 |
|
299 | |
300 |
|
301 |
|
302 |
|
303 |
|
304 |
|
305 | upTo: function upTo(size) {
|
306 | var nextSize = this.next(size);
|
307 |
|
308 |
|
309 | if (nextSize) {
|
310 | return !this.atLeast(nextSize);
|
311 | }
|
312 |
|
313 |
|
314 |
|
315 | return true;
|
316 | },
|
317 |
|
318 | |
319 |
|
320 |
|
321 |
|
322 |
|
323 |
|
324 | is: function is(size) {
|
325 | var parts = size.trim().split(' ').filter(function (p) {
|
326 | return !!p.length;
|
327 | });
|
328 |
|
329 | var _parts = _slicedToArray(parts, 2),
|
330 | bpSize = _parts[0],
|
331 | _parts$ = _parts[1],
|
332 | bpModifier = _parts$ === void 0 ? '' : _parts$;
|
333 |
|
334 |
|
335 | if (bpModifier === 'only') {
|
336 | return this.only(bpSize);
|
337 | }
|
338 |
|
339 |
|
340 | if (!bpModifier || bpModifier === 'up') {
|
341 | return this.atLeast(bpSize);
|
342 | }
|
343 |
|
344 |
|
345 | if (bpModifier === 'down') {
|
346 | return this.upTo(bpSize);
|
347 | }
|
348 |
|
349 | throw new Error("\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like \"<size> <modifier>\", got \"".concat(size, "\".\n "));
|
350 | },
|
351 |
|
352 | |
353 |
|
354 |
|
355 |
|
356 |
|
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 | |
370 |
|
371 |
|
372 |
|
373 |
|
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 |
|
392 |
|
393 |
|
394 |
|
395 |
|
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 | |
404 |
|
405 |
|
406 |
|
407 |
|
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 |
|
420 | return matched && this._getQueryName(matched);
|
421 | },
|
422 |
|
423 | |
424 |
|
425 |
|
426 |
|
427 |
|
428 | _watcher: function _watcher() {
|
429 | var _this2 = this;
|
430 |
|
431 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () {
|
432 | var newSize = _this2._getCurrentSize(),
|
433 | currentSize = _this2.current;
|
434 |
|
435 | if (newSize !== currentSize) {
|
436 |
|
437 | _this2.current = newSize;
|
438 |
|
439 | jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
|
440 | }
|
441 | });
|
442 | }
|
443 | };
|
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);
|
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);
|
463 |
|
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 |
|
487 |
|
488 |
|
489 | (function(module, exports, __webpack_require__) {
|
490 |
|
491 | module.exports = __webpack_require__("./js/entries/plugins/foundation.util.mediaQuery.js");
|
492 |
|
493 |
|
494 | }),
|
495 |
|
496 | "jquery":
|
497 |
|
498 |
|
499 |
|
500 |
|
501 | (function(module, exports) {
|
502 |
|
503 | module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
|
504 |
|
505 | })
|
506 |
|
507 | });
|
508 | });
|
509 |
|
\ | No newline at end of file |