PageSourceSearch

https://ozero-garda.ru/wp-content/themes/maxilla-pro/js/polyfills.js?ver=1.0

js ozero-garda.ru collected 2026-10-08 00:01:33 UTC 7,616 bytes, 222 lines download raw bytes

vendor: 6,682 bytes, lines 1-191
1/*!
2 * requestAnimationFrame polyfill
3 * http://paulirish.com/2011/requestanimationframe-for-smart-animating/
4 * http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
5 * Test a CSS media type/query in JS.
6 * Authors Erik Moller. fixes from Paul Irish and Tino Zijdel
7 * MIT license
8 */
9
10(function() {
11    var lastTime = 0;
12    var vendors = ['ms', 'moz', 'webkit', 'o'];
13    for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
14        window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
15        window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
16                                   || window[vendors[x]+'CancelRequestAnimationFrame'];
17    }
18
19    if (!window.requestAnimationFrame)
20        window.requestAnimationFrame = function(callback, element) {
21            var currTime = new Date().getTime();
22            var timeToCall = Math.max(0, 16 - (currTime - lastTime));
23            var id = window.setTimeout(function() { callback(currTime + timeToCall); },
24              timeToCall);
25            lastTime = currTime + timeToCall;
26            return id;
27        };
28
29    if (!window.cancelAnimationFrame)
30        window.cancelAnimationFrame = function(id) {
31            clearTimeout(id);
32        };
33}());
34
35/*!
36 * matchMedia() polyfill
37 * https://github.com/paulirish/matchMedia.js
38 * Test a CSS media type/query in JS.
39 * Authors & copyright (c) 2012: Scott Jehl, Paul Irish, Nicholas Zakas, David Knight. Dual MIT/BSD license
40 */
41
42window.matchMedia || (window.matchMedia = function() {
43    "use strict";
44
45    // For browsers that support matchMedium api such as IE 9 and webkit
46    var styleMedia = (window.styleMedia || window.media);
47
48    // For those that don't support matchMedium
49    if (!styleMedia) {
50        var style       = document.createElement('style'),
51            script      = document.getElementsByTagName('script')[0],
52            info        = null;
53
54        style.type  = 'text/css';
55        style.id    = 'matchmediajs-test';
56
57        script.parentNode.insertBefore(style, script);
58
59        // 'style.currentStyle' is used by IE <= 8 and 'window.getComputedStyle' for all other browsers
60        info = ('getComputedStyle' in window) && window.getComputedStyle(style, null) || style.currentStyle;
61
62        styleMedia = {
63            matchMedium: function(media) {
64                var text = '@media ' + media + '{ #matchmediajs-test { width: 1px; } }';
65
66                // 'style.styleSheet' is used by IE <= 8 and 'style.textContent' for all other browsers
67                if (style.styleSheet) {
68                    style.styleSheet.cssText = text;
69                } else {
70                    style.textContent = text;
71                }
72
73                // Test if media query is true or false
74                return info.width === '1px';
75            }
76        };
77    }
78
79    return function(media) {
80        return {
81            matches: styleMedia.matchMedium(media || 'all'),
82            media: media || 'all'
83        };
84    };
85}());
86
87/*!
88 * matchMedia() polyfill addListener/removeListener extension.
89 * https://github.com/paulirish/matchMedia.js
90 * Test a CSS media type/query in JS.
91 * Author & copyright (c) 2012: Scott Jehl. Dual MIT/BSD license
92 */
93
94(function(){
95    // Bail out for browsers that have addListener support
96    if (window.matchMedia && window.matchMedia('all').addListener) {
97        return false;
98    }
99
100    var localMatchMedia = window.matchMedia,
101        hasMediaQueries = localMatchMedia('only all').matches,
102        isListening     = false,
103        timeoutID       = 0,    // setTimeout for debouncing 'handleChange'
104        queries         = [],   // Contains each 'mql' and associated 'listeners' if 'addListener' is used
105        handleChange    = function(evt) {
106            // Debounce
107            clearTimeout(timeoutID);
108
109            timeoutID = setTimeout(function() {
110                for (var i = 0, il = queries.length; i < il; i++) {
111                    var mql         = queries[i].mql,
112                        listeners   = queries[i].listeners || [],
113                        matches     = localMatchMedia(mql.media).matches;
114
115                    // Update mql.matches value and call listeners
116                    // Fire listeners only if transitioning to or from matched state
117                    if (matches !== mql.matches) {
118                        mql.matches = matches;
119
120                        for (var j = 0, jl = listeners.length; j < jl; j++) {
121                            listeners[j].call(window, mql);
122                        }
123                    }
124                }
125            }, 30);
126        };
127
128    window.matchMedia = function(media) {
129        var mql         = localMatchMedia(media),
130            listeners   = [],
131            index       = 0;
132
133        mql.addListener = function(listener) {
134            // Changes would not occur to css media type so return now (Affects IE <= 8)
135            if (!hasMediaQueries) {
136                return;
137            }
138
139            // Set up 'resize' listener for browsers that support CSS3 media queries (Not for IE <= 8)
140            // There should only ever be 1 resize listener running for performance
141            if (!isListening) {
142                isListening = true;
143                window.addEventListener('resize', handleChange, true);
144            }
145
146            // Push object only if it has not been pushed already
147            if (index === 0) {
148                index = queries.push({
149                    mql         : mql,
150                    listeners   : listeners
151                });
152            }
153
154            listeners.push(listener);
155        };
156
157        mql.removeListener = function(listener) {
158            for (var i = 0, il = listeners.length; i < il; i++){
159                if (listeners[i] === listener){
160                    listeners.splice(i, 1);
161                }
162            }
163        };
164
165        return mql;
166    };
167}());
168
169
170/*!
171 * Minimal classList shim for IE 9
172 * https://gist.github.com/devongovett/1381839
173 * By Devon Govett
174 * MIT LICENSE
175 */
176
177if (!("classList" in document.documentElement) && Object.defineProperty && typeof HTMLElement !== 'undefined') {
178    Object.defineProperty(HTMLElement.prototype, 'classList', {
179        get: function() {
180            var self = this;
181            function update(fn) {
182                return function(value) {
183                    var classes = self.className.split(/\s+/),
184                        index = classes.indexOf(value);
185
186                    fn(classes, index, value);
187                    self.className = classes.join(" ");
188                }
189            }
190
191            var ret = {
vendor: 934 bytes, lines 192-222
192                add: update(function(classes, index, value) {
193                    ~index || classes.push(value);
194                }),
195
196                remove: update(function(classes, index) {
197                    ~index && classes.splice(index, 1);
198                }),
199
200                toggle: update(function(classes, index, value) {
201                    ~index ? classes.splice(index, 1) : classes.push(value);
202                }),
203
204                contains: function(value) {
205                    return !!~self.className.split(/\s+/).indexOf(value);
206                },
207
208                item: function(i) {
209                    return self.className.split(/\s+/)[i] || null;
210                }
211            };
212
213            Object.defineProperty(ret, 'length', {
214                get: function() {
215                    return self.className.split(/\s+/).length;
216                }
217            });
218
219            return ret;
220        }
221    });
222}

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.