Subversion Repositories wimsdev

Rev

Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

  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) { // webpackBootstrap
  12. /******/        // The module cache
  13. /******/        var installedModules = {};
  14. /******/
  15. /******/        // The require function
  16. /******/        function __webpack_require__(moduleId) {
  17. /******/
  18. /******/                // Check if module is in cache
  19. /******/                if(installedModules[moduleId]) {
  20. /******/                        return installedModules[moduleId].exports;
  21. /******/                }
  22. /******/                // Create a new module (and put it into the cache)
  23. /******/                var module = installedModules[moduleId] = {
  24. /******/                        i: moduleId,
  25. /******/                        l: false,
  26. /******/                        exports: {}
  27. /******/                };
  28. /******/
  29. /******/                // Execute the module function
  30. /******/                modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  31. /******/
  32. /******/                // Flag the module as loaded
  33. /******/                module.l = true;
  34. /******/
  35. /******/                // Return the exports of the module
  36. /******/                return module.exports;
  37. /******/        }
  38. /******/
  39. /******/
  40. /******/        // expose the modules object (__webpack_modules__)
  41. /******/        __webpack_require__.m = modules;
  42. /******/
  43. /******/        // expose the module cache
  44. /******/        __webpack_require__.c = installedModules;
  45. /******/
  46. /******/        // define getter function for harmony exports
  47. /******/        __webpack_require__.d = function(exports, name, getter) {
  48. /******/                if(!__webpack_require__.o(exports, name)) {
  49. /******/                        Object.defineProperty(exports, name, { enumerable: true, get: getter });
  50. /******/                }
  51. /******/        };
  52. /******/
  53. /******/        // define __esModule on exports
  54. /******/        __webpack_require__.r = function(exports) {
  55. /******/                if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  56. /******/                        Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  57. /******/                }
  58. /******/                Object.defineProperty(exports, '__esModule', { value: true });
  59. /******/        };
  60. /******/
  61. /******/        // create a fake namespace object
  62. /******/        // mode & 1: value is a module id, require it
  63. /******/        // mode & 2: merge all properties of value into the ns
  64. /******/        // mode & 4: return value when already ns object
  65. /******/        // mode & 8|1: behave like require
  66. /******/        __webpack_require__.t = function(value, mode) {
  67. /******/                if(mode & 1) value = __webpack_require__(value);
  68. /******/                if(mode & 8) return value;
  69. /******/                if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  70. /******/                var ns = Object.create(null);
  71. /******/                __webpack_require__.r(ns);
  72. /******/                Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  73. /******/                if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  74. /******/                return ns;
  75. /******/        };
  76. /******/
  77. /******/        // getDefaultExport function for compatibility with non-harmony modules
  78. /******/        __webpack_require__.n = function(module) {
  79. /******/                var getter = module && module.__esModule ?
  80. /******/                        function getDefault() { return module['default']; } :
  81. /******/                        function getModuleExports() { return module; };
  82. /******/                __webpack_require__.d(getter, 'a', getter);
  83. /******/                return getter;
  84. /******/        };
  85. /******/
  86. /******/        // Object.prototype.hasOwnProperty.call
  87. /******/        __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  88. /******/
  89. /******/        // __webpack_public_path__
  90. /******/        __webpack_require__.p = "";
  91. /******/
  92. /******/
  93. /******/        // Load entry module and return exports
  94. /******/        return __webpack_require__(__webpack_require__.s = 24);
  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.  
  152.  // Default set of media queries
  153.  
  154. var defaultQueries = {
  155.   'default': 'only screen',
  156.   landscape: 'only screen and (orientation: landscape)',
  157.   portrait: 'only screen and (orientation: portrait)',
  158.   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)'
  159. }; // matchMedia() polyfill - Test a CSS media type/query in JS.
  160. // Authors & copyright(c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. MIT license
  161.  
  162. /* eslint-disable */
  163.  
  164. window.matchMedia || (window.matchMedia = function () {
  165.   "use strict"; // For browsers that support matchMedium api such as IE 9 and webkit
  166.  
  167.   var styleMedia = window.styleMedia || window.media; // For those that don't support matchMedium
  168.  
  169.   if (!styleMedia) {
  170.     var style = document.createElement('style'),
  171.         script = document.getElementsByTagName('script')[0],
  172.         info = null;
  173.     style.type = 'text/css';
  174.     style.id = 'matchmediajs-test';
  175.  
  176.     if (!script) {
  177.       document.head.appendChild(style);
  178.     } else {
  179.       script.parentNode.insertBefore(style, script);
  180.     } // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
  181.  
  182.  
  183.     info = 'getComputedStyle' in window && window.getComputedStyle(style, null) || style.currentStyle;
  184.     styleMedia = {
  185.       matchMedium: function matchMedium(media) {
  186.         var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }'; // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
  187.  
  188.         if (style.styleSheet) {
  189.           style.styleSheet.cssText = text;
  190.         } else {
  191.           style.textContent = text;
  192.         } // Test if media query is true or false
  193.  
  194.  
  195.         return info.width === '1px';
  196.       }
  197.     };
  198.   }
  199.  
  200.   return function (media) {
  201.     return {
  202.       matches: styleMedia.matchMedium(media || 'all'),
  203.       media: media || 'all'
  204.     };
  205.   };
  206. }());
  207. /* eslint-enable */
  208.  
  209. var MediaQuery = {
  210.   queries: [],
  211.   current: '',
  212.  
  213.   /**
  214.    * Initializes the media query helper, by extracting the breakpoint list from the CSS and activating the breakpoint watcher.
  215.    * @function
  216.    * @private
  217.    */
  218.   _init: function _init() {
  219.     var self = this;
  220.     var $meta = jquery__WEBPACK_IMPORTED_MODULE_0___default()('meta.foundation-mq');
  221.  
  222.     if (!$meta.length) {
  223.       jquery__WEBPACK_IMPORTED_MODULE_0___default()('<meta class="foundation-mq">').appendTo(document.head);
  224.     }
  225.  
  226.     var extractedStyles = jquery__WEBPACK_IMPORTED_MODULE_0___default()('.foundation-mq').css('font-family');
  227.     var namedQueries;
  228.     namedQueries = parseStyleToObject(extractedStyles);
  229.  
  230.     for (var key in namedQueries) {
  231.       if (namedQueries.hasOwnProperty(key)) {
  232.         self.queries.push({
  233.           name: key,
  234.           value: "only screen and (min-width: ".concat(namedQueries[key], ")")
  235.         });
  236.       }
  237.     }
  238.  
  239.     this.current = this._getCurrentSize();
  240.  
  241.     this._watcher();
  242.   },
  243.  
  244.   /**
  245.    * Checks if the screen is at least as wide as a breakpoint.
  246.    * @function
  247.    * @param {String} size - Name of the breakpoint to check.
  248.    * @returns {Boolean} `true` if the breakpoint matches, `false` if it's smaller.
  249.    */
  250.   atLeast: function atLeast(size) {
  251.     var query = this.get(size);
  252.  
  253.     if (query) {
  254.       return window.matchMedia(query).matches;
  255.     }
  256.  
  257.     return false;
  258.   },
  259.  
  260.   /**
  261.    * Checks if the screen matches to a breakpoint.
  262.    * @function
  263.    * @param {String} size - Name of the breakpoint to check, either 'small only' or 'small'. Omitting 'only' falls back to using atLeast() method.
  264.    * @returns {Boolean} `true` if the breakpoint matches, `false` if it does not.
  265.    */
  266.   is: function is(size) {
  267.     size = size.trim().split(' ');
  268.  
  269.     if (size.length > 1 && size[1] === 'only') {
  270.       if (size[0] === this._getCurrentSize()) return true;
  271.     } else {
  272.       return this.atLeast(size[0]);
  273.     }
  274.  
  275.     return false;
  276.   },
  277.  
  278.   /**
  279.    * Gets the media query of a breakpoint.
  280.    * @function
  281.    * @param {String} size - Name of the breakpoint to get.
  282.    * @returns {String|null} - The media query of the breakpoint, or `null` if the breakpoint doesn't exist.
  283.    */
  284.   get: function get(size) {
  285.     for (var i in this.queries) {
  286.       if (this.queries.hasOwnProperty(i)) {
  287.         var query = this.queries[i];
  288.         if (size === query.name) return query.value;
  289.       }
  290.     }
  291.  
  292.     return null;
  293.   },
  294.  
  295.   /**
  296.    * Gets the current breakpoint name by testing every breakpoint and returning the last one to match (the biggest one).
  297.    * @function
  298.    * @private
  299.    * @returns {String} Name of the current breakpoint.
  300.    */
  301.   _getCurrentSize: function _getCurrentSize() {
  302.     var matched;
  303.  
  304.     for (var i = 0; i < this.queries.length; i++) {
  305.       var query = this.queries[i];
  306.  
  307.       if (window.matchMedia(query.value).matches) {
  308.         matched = query;
  309.       }
  310.     }
  311.  
  312.     if (_typeof(matched) === 'object') {
  313.       return matched.name;
  314.     } else {
  315.       return matched;
  316.     }
  317.   },
  318.  
  319.   /**
  320.    * Activates the breakpoint watcher, which fires an event on the window whenever the breakpoint changes.
  321.    * @function
  322.    * @private
  323.    */
  324.   _watcher: function _watcher() {
  325.     var _this = this;
  326.  
  327.     jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).off('resize.zf.mediaquery').on('resize.zf.mediaquery', function () {
  328.       var newSize = _this._getCurrentSize(),
  329.           currentSize = _this.current;
  330.  
  331.       if (newSize !== currentSize) {
  332.         // Change the current media query
  333.         _this.current = newSize; // Broadcast the media query change on the window
  334.  
  335.         jquery__WEBPACK_IMPORTED_MODULE_0___default()(window).trigger('changed.zf.mediaquery', [newSize, currentSize]);
  336.       }
  337.     });
  338.   }
  339. }; // Thank you: https://github.com/sindresorhus/query-string
  340.  
  341. function parseStyleToObject(str) {
  342.   var styleObject = {};
  343.  
  344.   if (typeof str !== 'string') {
  345.     return styleObject;
  346.   }
  347.  
  348.   str = str.trim().slice(1, -1); // browsers re-quote string style values
  349.  
  350.   if (!str) {
  351.     return styleObject;
  352.   }
  353.  
  354.   styleObject = str.split('&').reduce(function (ret, param) {
  355.     var parts = param.replace(/\+/g, ' ').split('=');
  356.     var key = parts[0];
  357.     var val = parts[1];
  358.     key = decodeURIComponent(key); // missing `=` should be `null`:
  359.     // http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
  360.  
  361.     val = typeof val === 'undefined' ? null : decodeURIComponent(val);
  362.  
  363.     if (!ret.hasOwnProperty(key)) {
  364.       ret[key] = val;
  365.     } else if (Array.isArray(ret[key])) {
  366.       ret[key].push(val);
  367.     } else {
  368.       ret[key] = [ret[key], val];
  369.     }
  370.  
  371.     return ret;
  372.   }, {});
  373.   return styleObject;
  374. }
  375.  
  376.  
  377.  
  378. /***/ }),
  379.  
  380. /***/ 24:
  381. /*!****************************************************************!*\
  382.   !*** multi ./js/entries/plugins/foundation.util.mediaQuery.js ***!
  383.   \****************************************************************/
  384. /*! no static exports found */
  385. /***/ (function(module, exports, __webpack_require__) {
  386.  
  387. module.exports = __webpack_require__(/*! /Users/ncoden/Documents/Documents/Projects/Programmation/Web/2016/Foundation/foundation-sites/js/entries/plugins/foundation.util.mediaQuery.js */"./js/entries/plugins/foundation.util.mediaQuery.js");
  388.  
  389.  
  390. /***/ }),
  391.  
  392. /***/ "jquery":
  393. /*!********************************************************************************************!*\
  394.   !*** external {"root":["jQuery"],"amd":"jquery","commonjs":"jquery","commonjs2":"jquery"} ***!
  395.   \********************************************************************************************/
  396. /*! no static exports found */
  397. /***/ (function(module, exports) {
  398.  
  399. module.exports = __WEBPACK_EXTERNAL_MODULE_jquery__;
  400.  
  401. /***/ })
  402.  
  403. /******/ });
  404. });
  405. //# sourceMappingURL=foundation.util.mediaQuery.js.map