vendor: 9,863 bytes, lines 1-316
1/*! 2 * enquire.js v2.1.6 - Awesome Media Queries in JavaScript 3 * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/enquire.js 4 * License: MIT */ 5 6 7(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.enquire = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ 8var QueryHandler = require(3); 9var each = require(4).each; 10 11/** 12 * Represents a single media query, manages it's state and registered handlers for this query 13 * 14 * @constructor 15 * @param {string} query the media query string 16 * @param {boolean} [isUnconditional=false] whether the media query should run regardless of whether the conditions are met. Primarily for helping older browsers deal with mobile-first design 17 */ 18function MediaQuery(query, isUnconditional) { 19 this.query = query; 20 this.isUnconditional = isUnconditional; 21 this.handlers = []; 22 this.mql = window.matchMedia(query); 23 24 var self = this; 25 this.listener = function(mql) { 26 // Chrome passes an MediaQueryListEvent object, while other browsers pass MediaQueryList directly 27 self.mql = mql.currentTarget || mql; 28 self.assess(); 29 }; 30 this.mql.addListener(this.listener); 31} 32 33MediaQuery.prototype = { 34 35 constuctor : MediaQuery, 36 37 /** 38 * add a handler for this query, triggering if already active 39 * 40 * @param {object} handler 41 * @param {function} handler.match callback for when query is activated 42 * @param {function} [handler.unmatch] callback for when query is deactivated 43 * @param {function} [handler.setup] callback for immediate execution when a query handler is registered 44 * @param {boolean} [handler.deferSetup=false] should the setup callback be deferred until the first time the handler is matched? 45 */ 46 addHandler : function(handler) { 47 var qh = new QueryHandler(handler); 48 this.handlers.push(qh); 49 50 this.matches() && qh.on(); 51 }, 52 53 /** 54 * removes the given handler from the collection, and calls it's destroy methods 55 * 56 * @param {object || function} handler the handler to remove 57 */ 58 removeHandler : function(handler) { 59 var handlers = this.handlers; 60 each(handlers, function(h, i) { 61 if(h.equals(handler)) { 62 h.destroy(); 63 return !handlers.splice(i,1); //remove from array and exit each early 64 } 65 }); 66 }, 67 68 /** 69 * Determine whether the media query should be considered a match 70 * 71 * @return {Boolean} true if media query can be considered a match, false otherwise 72 */ 73 matches : function() { 74 return this.mql.matches || this.isUnconditional; 75 }, 76 77 /** 78 * Clears all handlers and unbinds events 79 */ 80 clear : function() { 81 each(this.handlers, function(handler) { 82 handler.destroy(); 83 }); 84 this.mql.removeListener(this.listener); 85 this.handlers.length = 0; //clear array 86 }, 87 88 /* 89 * Assesses the query, turning on all handlers if it matches, turning them off if it doesn't match 90 */ 91 assess : function() { 92 var action = this.matches() ? 'on' : 'off'; 93 94 each(this.handlers, function(handler) { 95 handler[action](); 96 }); 97 } 98}; 99 100module.exports = MediaQuery; 101 102},{"3":3,"4":4}],2:[function(require,module,exports){ 103var MediaQuery = require(1); 104var Util = require(4); 105var each = Util.each; 106var isFunction = Util.isFunction; 107var isArray = Util.isArray; 108 109/** 110 * Allows for registration of query handlers. 111 * Manages the query handler's state and is responsible for wiring up browser events 112 * 113 * @constructor 114 */ 115function MediaQueryDispatch () { 116 if(!window.matchMedia) { 117 throw new Error('matchMedia not present, legacy browsers require a polyfill'); 118 } 119 120 this.queries = {}; 121 this.browserIsIncapable = !window.matchMedia('only all').matches; 122} 123 124MediaQueryDispatch.prototype = { 125 126 constructor : MediaQueryDispatch, 127 128 /** 129 * Registers a handler for the given media query 130 * 131 * @param {string} q the media query 132 * @param {object || Array || Function} options either a single query handler object, a function, or an array of query handlers 133 * @param {function} options.match fired when query matched 134 * @param {function} [options.unmatch] fired when a query is no longer matched 135 * @param {function} [options.setup] fired when handler first triggered 136 * @param {boolean} [options.deferSetup=false] whether setup should be run immediately or deferred until query is first matched 137 * @param {boolean} [shouldDegrade=false] whether this particular media query should always run on incapable browsers 138 */ 139 register : function(q, options, shouldDegrade) { 140 var queries = this.queries, 141 isUnconditional = shouldDegrade && this.browserIsIncapable; 142 143 if(!queries[q]) { 144 queries[q] = new MediaQuery(q, isUnconditional); 145 } 146 147 //normalise to object in an array 148 if(isFunction(options)) { 149 options = { match : options }; 150 } 151 if(!isArray(options)) { 152 options = [options]; 153 } 154 each(options, function(handler) { 155 if (isFunction(handler)) { 156 handler = { match : handler }; 157 } 158 queries[q].addHandler(handler); 159 }); 160 161 return this; 162 }, 163 164 /** 165 * unregisters a query and all it's handlers, or a specific handler for a query 166 * 167 * @param {string} q the media query to target 168 * @param {object || function} [handler] specific handler to unregister 169 */ 170 unregister : function(q, handler) { 171 var query = this.queries[q]; 172 173 if(query) { 174 if(handler) { 175 query.removeHandler(handler); 176 } 177 else { 178 query.clear(); 179 delete this.queries[q]; 180 } 181 } 182 183 return this; 184 } 185}; 186 187module.exports = MediaQueryDispatch; 188 189},{"1":1,"4":4}],3:[function(require,module,exports){ 190/** 191 * Delegate to handle a media query being matched and unmatched. 192 * 193 * @param {object} options 194 * @param {function} options.match callback for when the media query is matched 195 * @param {function} [options.unmatch] callback for when the media query is unmatched 196 * @param {function} [options.setup] one-time callback triggered the first time a query is matched 197 * @param {boolean} [options.deferSetup=false] should the setup callback be run immediately, rather than first time query is matched? 198 * @constructor 199 */ 200function QueryHandler(options) { 201 this.options = options; 202 !options.deferSetup && this.setup(); 203} 204 205QueryHandler.prototype = { 206 207 constructor : QueryHandler, 208 209 /** 210 * coordinates setup of the handler 211 * 212 * @function 213 */ 214 setup : function() { 215 if(this.options.setup) { 216 this.options.setup(); 217 } 218 this.initialised = true; 219 }, 220 221 /** 222 * coordinates setup and triggering of the handler 223 * 224 * @function 225 */ 226 on : function() { 227 !this.initialised && this.setup(); 228 this.options.match && this.options.match(); 229 }, 230 231 /** 232 * coordinates the unmatch event for the handler 233 * 234 * @function 235 */ 236 off : function() { 237 this.options.unmatch && this.options.unmatch(); 238 }, 239 240 /** 241 * called when a handler is to be destroyed. 242 * delegates to the destroy or unmatch callbacks, depending on availability. 243 * 244 * @function 245 */ 246 destroy : function() { 247 this.options.destroy ? this.options.destroy() : this.off(); 248 }, 249 250 /** 251 * determines equality by reference. 252 * if object is supplied compare options, if function, compare match callback 253 * 254 * @function 255 * @param {object || function} [target] the target for comparison 256 */ 257 equals : function(target) { 258 return this.options === target || this.options.match === target; 259 } 260 261}; 262 263module.exports = QueryHandler; 264 265},{}],4:[function(require,module,exports){ 266/** 267 * Helper function for iterating over a collection 268 * 269 * @param collection 270 * @param fn 271 */ 272function each(collection, fn) { 273 var i = 0, 274 length = collection.length, 275 cont; 276 277 for(i; i < length; i++) { 278 cont = fn(collection[i], i); 279 if(cont === false) { 280 break; //allow early exit 281 } 282 } 283} 284 285/** 286 * Helper function for determining whether target object is an array 287 * 288 * @param target the object under test 289 * @return {Boolean} true if array, false otherwise 290 */ 291function isArray(target) { 292 return Object.prototype.toString.apply(target) === '[object Array]'; 293} 294 295/** 296 * Helper function for determining whether target object is a function 297 * 298 * @param target the object under test 299 * @return {Boolean} true if function, false otherwise 300 */ 301function isFunction(target) { 302 return typeof target === 'function'; 303} 304 305module.exports = { 306 isFunction : isFunction, 307 isArray : isArray, 308 each : each 309}; 310 311},{}],5:[function(require,module,exports){ 312var MediaQueryDispatch = require(2); 313module.exports = new MediaQueryDispatch(); 314 315},{"2":2}]},{},[5])(5) 316});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.