PageSourceSearch

https://www.escapadenature-sansvoiture.fr/modules/mod_jmslideshow/assets/js/ios6fix.js

js escapadenature-sansvoiture.fr collected 2026-10-07 03:39:50 UTC 3,678 bytes, 110 lines download raw bytes

1(function (window) {
2    // This library re-implements setTimeout, setInterval, clearTimeout, clearInterval for iOS6.
3    // iOS6 suffers from a bug that kills timers that are created while a page is scrolling.
4    // This library fixes that problem by recreating timers after scrolling finishes (with interval correction).
5    // This code is free to use by anyone (MIT, blabla).
6    // Original Author: [email protected]
7    var timeouts = {};
8    var intervals = {};
9    var orgSetTimeout = window.setTimeout;
10    var orgSetInterval = window.setInterval;
11    var orgClearTimeout = window.clearTimeout;
12    var orgClearInterval = window.clearInterval;
13    // To prevent errors if loaded on older IE.
14    if (!window.addEventListener) return false;
15    function createTimer(set, map, args) {
16        var id, cb = args[0],
17            repeat = (set === orgSetInterval);
18
19        function callback() {
20            if (cb) {
21                cb.apply(window, arguments);
22                if (!repeat) {
23                    delete map[id];
24                    cb = null;
25                }
26            }
27        }
28        args[0] = callback;
29        id = set.apply(window, args);
30        map[id] = {
31            args: args,
32            created: Date.now(),
33            cb: cb,
34            id: id
35        };
36        return id;
37    }
38
39    function resetTimer(set, clear, map, virtualId, correctInterval) {
40        var timer = map[virtualId];
41        if (!timer) {
42            return;
43        }
44        var repeat = (set === orgSetInterval);
45        // cleanup
46        clear(timer.id);
47        // reduce the interval (arg 1 in the args array)
48        if (!repeat) {
49            var interval = timer.args[1];
50            var reduction = Date.now() - timer.created;
51            if (reduction < 0) {
52                reduction = 0;
53            }
54            interval -= reduction;
55            if (interval < 0) {
56                interval = 0;
57            }
58            timer.args[1] = interval;
59        }
60        // recreate
61        function callback() {
62            if (timer.cb) {
63                timer.cb.apply(window, arguments);
64                if (!repeat) {
65                    delete map[virtualId];
66                    timer.cb = null;
67                }
68            }
69        }
70        timer.args[0] = callback;
71        timer.created = Date.now();
72        timer.id = set.apply(window, timer.args);
73    }
74    window.setTimeout = function () {
75        return createTimer(orgSetTimeout, timeouts, arguments);
76    };
77    window.setInterval = function () {
78        return createTimer(orgSetInterval, intervals, arguments);
79    };
80    window.clearTimeout = function (id) {
81        var timer = timeouts[id];
82        if (timer) {
83            delete timeouts[id];
84            orgClearTimeout(timer.id);
85        }
86    };
87    window.clearInterval = function (id) {
88        var timer = intervals[id];
89        if (timer) {
90            delete intervals[id];
91            orgClearInterval(timer.id);
92        }
93    };
94    //check and add listener on the top window if loaded on frameset/iframe
95    var win = window;
96    while (win.location != win.parent.location) {
97        win = win.parent;
98    }
99    win.addEventListener('scroll', function () {
100        // recreate the timers using adjusted intervals
101        // we cannot know how long the scroll-freeze lasted, so we cannot take that into account
102        var virtualId;
103        for (virtualId in timeouts) {
104            resetTimer(orgSetTimeout, orgClearTimeout, timeouts, virtualId);
105        }
106        for (virtualId in intervals) {
107            resetTimer(orgSetInterval, orgClearInterval, intervals, virtualId);
108        }
109    });
110}(window));

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.