foundation-sites
Version:
The most advanced responsive front-end framework in the world.
3 lines (2 loc) • 6.41 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("./foundation.core"),require("jquery")):"function"==typeof define&&define.amd?define(["./foundation.core","jquery"],t):"object"==typeof exports?exports["foundation.util.mediaQuery"]=t(require("./foundation.core"),require("jquery")):(e.__FOUNDATION_EXTERNAL__=e.__FOUNDATION_EXTERNAL__||{},e.__FOUNDATION_EXTERNAL__["foundation.util.mediaQuery"]=t(e.__FOUNDATION_EXTERNAL__["foundation.core"],e.jQuery))}(window,function(n,r){return o={"./foundation.core":function(e,t){e.exports=n},"./js/entries/plugins/foundation.util.mediaQuery.js":function(e,t,n){"use strict";n.r(t);var r=n("./foundation.core");n.d(t,"Foundation",function(){return r.Foundation});var i=n("./js/foundation.util.mediaQuery.js");n.d(t,"MediaQuery",function(){return i.MediaQuery}),r.Foundation.MediaQuery=i.MediaQuery,r.Foundation.MediaQuery._init()},"./js/foundation.util.mediaQuery.js":function(e,t,n){"use strict";n.r(t),n.d(t,"MediaQuery",function(){return d});var r,i,o,t=n("jquery"),u=n.n(t);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],u=!0,a=!1;try{for(n=n.call(e);!(u=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);u=!0);}catch(e){a=!0,i=e}finally{try{u||null==n.return||n.return()}finally{if(a)throw i}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return c(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?c(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function c(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}window.matchMedia||(window.matchMedia=((o=window.styleMedia||window.media)||(r=document.createElement("style"),t=document.getElementsByTagName("script")[0],i=null,r.type="text/css",r.id="matchmediajs-test",t?t.parentNode.insertBefore(r,t):document.head.appendChild(r),i="getComputedStyle"in window&&window.getComputedStyle(r,null)||r.currentStyle,o={matchMedium:function(e){e="@media "+e+"{ #matchmediajs-test { width: 1px; } }";return r.styleSheet?r.styleSheet.cssText=e:r.textContent=e,"1px"===i.width}}),function(e){return{matches:o.matchMedium(e||"all"),media:e||"all"}}));var d={queries:[],current:"",_init:function(){if(!0===this.isInitialized)return this;this.isInitialized=!0;u()("meta.foundation-mq").length||u()('<meta class="foundation-mq" name="foundation-mq" content>').appendTo(document.head);var e,t,n,r=u()(".foundation-mq").css("font-family");for(n in t={},e="string"==typeof(r=r)&&(r=r.trim().slice(1,-1))?t=r.split("&").reduce(function(e,t){var n=t.replace(/\+/g," ").split("="),t=n[0],n=n[1],t=decodeURIComponent(t),n=void 0===n?null:decodeURIComponent(n);return e.hasOwnProperty(t)?Array.isArray(e[t])?e[t].push(n):e[t]=[e[t],n]:e[t]=n,e},{}):t,this.queries=[],e)e.hasOwnProperty(n)&&this.queries.push({name:n,value:"only screen and (min-width: ".concat(e[n],")")});this.current=this._getCurrentSize(),this._watcher()},_reInit:function(){this.isInitialized=!1,this._init()},atLeast:function(e){e=this.get(e);return!!e&&window.matchMedia(e).matches},only:function(e){return e===this._getCurrentSize()},upTo:function(e){e=this.next(e);return!e||!this.atLeast(e)},is:function(e){var t=s(e.trim().split(" ").filter(function(e){return!!e.length}),2),n=t[0],t=t[1],t=void 0===t?"":t;if("only"===t)return this.only(n);if(!t||"up"===t)return this.atLeast(n);if("down"===t)return this.upTo(n);throw new Error('\n Invalid breakpoint passed to MediaQuery.is().\n Expected a breakpoint name formatted like "<size> <modifier>", got "'.concat(e,'".\n '))},get:function(e){for(var t in this.queries)if(this.queries.hasOwnProperty(t)){t=this.queries[t];if(e===t.name)return t.value}return null},next:function(t){var n=this,e=this.queries.findIndex(function(e){return n._getQueryName(e)===t});if(-1===e)throw new Error('\n Unknown breakpoint "'.concat(t,'" passed to MediaQuery.next().\n Ensure it is present in your Sass "$breakpoints" setting.\n '));e=this.queries[e+1];return e?e.name:null},_getQueryName:function(e){if("string"==typeof e)return e;if("object"===a(e))return e.name;throw new TypeError('\n Invalid value passed to MediaQuery._getQueryName().\n Expected a breakpoint name (String) or a breakpoint query (Object), got "'.concat(e,'" (').concat(a(e),")\n "))},_getCurrentSize:function(){for(var e,t=0;t<this.queries.length;t++){var n=this.queries[t];window.matchMedia(n.value).matches&&(e=n)}return e&&this._getQueryName(e)},_watcher:function(){var n=this;u()(window).on("resize.zf.trigger",function(){var e=n._getCurrentSize(),t=n.current;e!==t&&(n.current=e,u()(window).trigger("changed.zf.mediaquery",[e,t]))})}}},24:function(e,t,n){e.exports=n("./js/entries/plugins/foundation.util.mediaQuery.js")},jquery:function(e,t){e.exports=r}},u={},i.m=o,i.c=u,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=24);function i(e){if(u[e])return u[e].exports;var t=u[e]={i:e,l:!1,exports:{}};return o[e].call(t.exports,t,t.exports,i),t.l=!0,t.exports}var o,u});
//# sourceMappingURL=foundation.util.mediaQuery.min.js.map