123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("./foundation.core"), require("jquery"));
- else if(typeof define === 'function' && define.amd)
- define(["./foundation.core", "jquery"], factory);
- else if(typeof exports === 'object')
- exports["foundation.util.mediaQuery"] = factory(require("./foundation.core"), require("jquery"));
- else
- root["__FOUNDATION_EXTERNAL__"] = root["__FOUNDATION_EXTERNAL__"] || {}, root["__FOUNDATION_EXTERNAL__"]["foundation.util.mediaQuery"] = factory(root["__FOUNDATION_EXTERNAL__"]["foundation.core"], root["jQuery"]);
- })(window, function(__WEBPACK_EXTERNAL_MODULE__foundation_core__, __WEBPACK_EXTERNAL_MODULE_jquery__) {
- return (function(modules) {
-
- var installedModules = {};
-
- function __webpack_require__(moduleId) {
-
- if(installedModules[moduleId]) {
- return installedModules[moduleId].exports;
- }
-
- var module = installedModules[moduleId] = {
- i: moduleId,
- l: false,
- exports: {}
- };
-
- modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
-
- module.l = true;
-
- return module.exports;
- }
-
- __webpack_require__.m = modules;
-
- __webpack_require__.c = installedModules;
-
- __webpack_require__.d = function(exports, name, getter) {
- if(!__webpack_require__.o(exports, name)) {
- Object.defineProperty(exports, name, { enumerable: true, get: getter });
- }
- };
-
- __webpack_require__.r = function(exports) {
- if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- }
- Object.defineProperty(exports, '__esModule', { value: true });
- };
-
-
-
-
-
- __webpack_require__.t = function(value, mode) {
- if(mode & 1) value = __webpack_require__(value);
- if(mode & 8) return value;
- if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
- var ns = Object.create(null);
- __webpack_require__.r(ns);
- Object.defineProperty(ns, 'default', { enumerable: true, value: value });
- if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
- return ns;
- };
-
- __webpack_require__.n = function(module) {
- var getter = module && module.__esModule ?
- function getDefault() { return module['default']; } :
- function getModuleExports() { return module; };
- __webpack_require__.d(getter, 'a', getter);
- return getter;
- };
-
- __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
-
- __webpack_require__.p = "";
-
- return __webpack_require__(__webpack_require__.s = 24);
- })
- ({
- "./foundation.core":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE__foundation_core__;
- }),
- "./js/entries/plugins/foundation.util.mediaQuery.js":
- (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- var _foundation_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "./foundation.core");
- var _foundation_core__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(_foundation_core__WEBPACK_IMPORTED_MODULE_0__);
- __webpack_require__.d(__webpack_exports__, "Foundation", function() { return _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"]; });
- var _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__( "./js/foundation.util.mediaQuery.js");
- __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"]; });
- _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].MediaQuery = _foundation_util_mediaQuery__WEBPACK_IMPORTED_MODULE_1__["MediaQuery"];
- _foundation_core__WEBPACK_IMPORTED_MODULE_0__["Foundation"].MediaQuery._init();
- }),
- "./js/foundation.util.mediaQuery.js":
- (function(module, __webpack_exports__, __webpack_require__) {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- __webpack_require__.d(__webpack_exports__, "MediaQuery", function() { return MediaQuery; });
- var jquery__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__( "jquery");
- var jquery__WEBPACK_IMPORTED_MODULE_0___default = __webpack_require__.n(jquery__WEBPACK_IMPORTED_MODULE_0__);
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance"); }
- 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; }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
-
- var defaultQueries = {
- 'default': 'only screen',
- landscape: 'only screen and (orientation: landscape)',
- portrait: 'only screen and (orientation: portrait)',
- 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)'
- };
- window.matchMedia || (window.matchMedia = function () {
- "use strict";
- var styleMedia = window.styleMedia || window.media;
- if (!styleMedia) {
- var style = document.createElement('style'),
- script = document.getElementsByTagName('script')[0],
- info = null;
- style.type = 'text/css';
- style.id = 'matchmediajs-test';
- if (!script) {
- document.head.appendChild(style);
- } else {
- script.parentNode.insertBefore(style, script);
- }
- info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle;
- styleMedia = {
- matchMedium: function matchMedium(media) {
- var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
- if (style.styleSheet) {
- style.styleSheet.cssText = text;
- } else {
- style.textContent = text;
- }
- return info.width === '1px';
- }
- };
- }
- return function (media) {
- return {
- matches: styleMedia.matchMedium(media || 'all'),
- media: media || 'all'
- };
- };
- }());
- var MediaQuery = {
- queries: [],
- current: '',
-
- _init: function _init() {
-
- if (this.isInitialized === true) {
- return;
- } else {
- this.isInitialized = true;
- }
- var self = this;
- var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('meta.foundation-mq');
- if (!$meta.length) {
- jquery__WEBPACK_IMPORTED_MODULE_0___default()('<meta class="foundation-mq">').appendTo(document.head);
- }
- var extractedStyles = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.foundation-mq').css('font-family');
- var namedQueries;
- namedQueries = parseStyleToObject(extractedStyles);
- self.queries = [];
- for (var key in namedQueries) {
- if (namedQueries.hasOwnProperty(key)) {
- self.queries.push({
- name: key,
- value: "only screen and (min-width: ".concat(namedQueries[key], ")")
- });
- }
- }
- this.current = this._getCurrentSize();
- this._watcher();
- },
-
- _reInit: function _reInit() {
- this.isInitialized = false;
- this._init();
- },
-
- atLeast: function atLeast(size) {
- var query = this.get(size);
- if (query) {
- return window.matchMedia(query).matches;
- }
- return false;
- },
-
- only: function only(size) {
- return size === this._getCurrentSize();
- },
-
- upTo: function upTo(size) {
- var nextSize = this.next(size);
-
- if (nextSize) {
- return !this.atLeast(nextSize);
- }
-
- return true;
- },
-
- is: function is(size) {
- var parts = size.trim().split(' ').filter(function (p) {
- return !!p.length;
- });
- var _parts = _slicedToArray(parts, 2),
- bpSize = _parts[0],
- _parts$ = _parts[1],
- bpModifier = _parts$ === void 0 ? '' : _parts$;
- if (bpModifier === 'only') {
- return this.only(bpSize);
- }
- if (!bpModifier || bpModifier === 'up') {
- return this.atLeast(bpSize);
- }
- if (bpModifier === 'down') {
- return this.upTo(bpSize);
- }
- throw new Error("\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like \"<size> <modifier>\", got \"".concat(size, "\".\n "));
- },
-
- get: function get(size) {
- for (var i in this.queries) {
- if (this.queries.hasOwnProperty(i)) {
- var query = this.queries[i];
- if (size === query.name) return query.value;
- }
- }
- return null;
- },
-
- next: function next(size) {
- var _this = this;
- var queryIndex = this.queries.findIndex(function (q) {
- return _this._getQueryName(q) === size;
- });
- if (queryIndex === -1) {
- throw new Error("\n Unknown breakpoint \"".concat(size, "\" passed to MediaQuery.next().\n Ensure it is present in your Sass \"$breakpoints\" setting.\n "));
- }
- var nextQuery = this.queries[queryIndex + 1];
- return nextQuery ? nextQuery.name : null;
- },
-
- _getQueryName: function _getQueryName(value) {
- if (typeof value === 'string') return value;
- if (_typeof(value) === 'object') return value.name;
- 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 "));
- },
-
- _getCurrentSize: function _getCurrentSize() {
- var matched;
- for (var i = 0; i < this.queries.length; i++) {
- var query = this.queries[i];
- if (window.matchMedia(query.value).matches) {
- matched = query;
- }
- }
- return matched && this._getQueryName(matched);
- },
-
- _watcher: function _watcher() {
- var _this2 = this;
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () {
- var newSize = _this2._getCurrentSize(),
- currentSize = _this2.current;
- if (newSize !== currentSize) {
-
- _this2.current = newSize;
- jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
- }
- });
- }
- };
- function parseStyleToObject(str) {
- var styleObject = {};
- if (typeof str !== 'string') {
- return styleObject;
- }
- str = str.trim().slice(1, -1);
- if (!str) {
- return styleObject;
- }
- styleObject = str.split('&').reduce(function (ret, param) {
- var parts = param.replace(/\+/g, ' ').split('=');
- var key = parts[0];
- var val = parts[1];
- key = decodeURIComponent(key);
-
- val = typeof val === 'undefined' ? null : decodeURIComponent(val);
- if (!ret.hasOwnProperty(key)) {
- ret[key] = val;
- } else if (Array.isArray(ret[key])) {
- ret[key].push(val);
- } else {
- ret[key] = [ret[key], val];
- }
- return ret;
- }, {});
- return styleObject;
- }
- }),
- 24:
- (function(module, exports, __webpack_require__) {
- module.exports = __webpack_require__("./js/entries/plugins/foundation.util.mediaQuery.js");
- }),
- "jquery":
- (function(module, exports) {
- module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
- })
- });
- });
|