PageSourceSearch

https://1812battles.com/js/jquery.raf.js

js 1812battles.com collected 2026-09-30 12:58:18 UTC 1,688 bytes, 61 lines download raw bytes

1/*!
2 * requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
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 * MIT license
6 */
7
8(function() {
9  var lastTime = 0;
10  var vendors = ['ms', 'moz', 'webkit', 'o'];
11  for (var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
12    window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
13    window.cancelAnimationFrame  = window[vendors[x]+'CancelAnimationFrame'] 
14                                || window[vendors[x]+'CancelRequestAnimationFrame'];
15  }
16
17  if (!window.requestAnimationFrame)
18    window.requestAnimationFrame = function(callback, element) {
19        var currTime = new Date().getTime();
20        var timeToCall = Math.max(0, 16 - (currTime - lastTime));
21        var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
22        lastTime = currTime + timeToCall;
23        return id;
24    };
25
26  if (!window.cancelAnimationFrame)
27    window.cancelAnimationFrame = function(id) {
28        clearTimeout(id);
29    };
30}());
31
32/*!
33 * jQuery requestAnimationFrame Shim
34 * customized for our purposes here.
35 */
36
37(function($) {
38  
39  var animating;
40
41  function raf() {
42    if (animating) {
43      requestAnimationFrame(raf);
44      jQuery.fx.tick();
45    }
46  }
47
48  if (requestAnimationFrame) {
49    jQuery.fx.timer = function(timer) {
50      if (timer() && jQuery.timers.push(timer) && !animating) {
51        animating = true;
52        raf();
53      }
54    };
55    jQuery.fx.stop = function() {
56      animating = false;
57    }
58  }
59
60})(jQuery);
61

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.