PageSourceSearch

https://www.flysaa.com/o/saa-airways-theme/airways-legacy/js/vendor/matchmedia.addListener.js

js flysaa.com collected 2026-10-01 11:29:31 UTC 2,284 bytes, 76 lines download raw bytes

vendor: 2,284 bytes, lines 1-76
1/*! matchMedia() polyfill addListener/removeListener extension. Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license */
2(function( w ){
3	"use strict";
4	// Bail out for browsers that have addListener support
5	if (w.matchMedia && w.matchMedia('all').addListener) {
6		return false;
7	}
8
9	var localMatchMedia = w.matchMedia,
10		hasMediaQueries = localMatchMedia('only all').matches,
11		isListening     = false,
12		timeoutID       = 0,    // setTimeout for debouncing 'handleChange'
13		queries         = [],   // Contains each 'mql' and associated 'listeners' if 'addListener' is used
14		handleChange    = function(evt) {
15			// Debounce
16			w.clearTimeout(timeoutID);
17
18			timeoutID = w.setTimeout(function() {
19				for (var i = 0, il = queries.length; i < il; i++) {
20					var mql         = queries[i].mql,
21						listeners   = queries[i].listeners || [],
22						matches     = localMatchMedia(mql.media).matches;
23
24					// Update mql.matches value and call listeners
25					// Fire listeners only if transitioning to or from matched state
26					if (matches !== mql.matches) {
27						mql.matches = matches;
28
29						for (var j = 0, jl = listeners.length; j < jl; j++) {
30							listeners[j].call(w, mql);
31						}
32					}
33				}
34			}, 30);
35		};
36
37	w.matchMedia = function(media) {
38		var mql         = localMatchMedia(media),
39			listeners   = [],
40			index       = 0;
41
42		mql.addListener = function(listener) {
43			// Changes would not occur to css media type so return now (Affects IE <= 8)
44			if (!hasMediaQueries) {
45				return;
46			}
47
48			// Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8)
49			// There should only ever be 1 resize listener running for performance
50			if (!isListening) {
51				isListening = true;
52				w.addEventListener('resize', handleChange, true);
53			}
54
55			// Push object only if it has not been pushed already
56			if (index === 0) {
57				index = queries.push({
58					mql         : mql,
59					listeners   : listeners
60				});
61			}
62
63			listeners.push(listener);
64		};
65
66		mql.removeListener = function(listener) {
67			for (var i = 0, il = listeners.length; i < il; i++){
68				if (listeners[i] === listener){
69					listeners.splice(i, 1);
70				}
71			}
72		};
73
74		return mql;
75	};
76}( this ));

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.