1+ ( function ( ) {
2+
3+ var Ap = Array . prototype ;
4+ var slice = Ap . slice ;
5+ var Fp = Function . prototype ;
6+
7+ if ( ! Fp . bind ) {
8+ // PhantomJS doesn't support Function.prototype.bind natively, so
9+ // polyfill it whenever this module is required.
10+ Fp . bind = function ( context ) {
11+ var func = this ;
12+ var args = slice . call ( arguments , 1 ) ;
13+
14+ function bound ( ) {
15+ var invokedAsConstructor = func . prototype && ( this instanceof func ) ;
16+ return func . apply (
17+ // Ignore the context parameter when invoking the bound function
18+ // as a constructor. Note that this includes not only constructor
19+ // invocations using the new keyword but also calls to base class
20+ // constructors such as BaseClass.call(this, ...) or super(...).
21+ ! invokedAsConstructor && context || this ,
22+ args . concat ( slice . call ( arguments ) )
23+ ) ;
24+ }
25+
26+ // The bound function must share the .prototype of the unbound
27+ // function so that any object created by one constructor will count
28+ // as an instance of both constructors.
29+ bound . prototype = func . prototype ;
30+
31+ return bound ;
32+ } ;
33+ }
34+
35+ } ) ( ) ;
36+
37+ ( function ( ) {
38+
39+ var lastTime = 0 ;
40+ var vendors = [ 'ms' , 'moz' , 'webkit' , 'o' ] ;
41+ for ( var x = 0 ; x < vendors . length && ! window . requestAnimationFrame ; ++ x ) {
42+ window . requestAnimationFrame = window [ vendors [ x ] + 'RequestAnimationFrame' ] ;
43+ window . cancelAnimationFrame = window [ vendors [ x ] + 'CancelAnimationFrame' ]
44+ || window [ vendors [ x ] + 'CancelRequestAnimationFrame' ] ;
45+ }
46+
47+ if ( ! window . requestAnimationFrame ) {
48+ window . requestAnimationFrame = function ( callback , element ) {
49+ var currTime = new Date ( ) . getTime ( ) ;
50+ var timeToCall = Math . max ( 0 , 16 - ( currTime - lastTime ) ) ;
51+ var id = window . setTimeout ( function ( ) { callback ( currTime + timeToCall ) ; } ,
52+ timeToCall ) ;
53+ lastTime = currTime + timeToCall ;
54+ return id ;
55+ } ;
56+ }
57+
58+ if ( ! window . cancelAnimationFrame ) {
59+ window . cancelAnimationFrame = function ( id ) {
60+ clearTimeout ( id ) ;
61+ } ;
62+ }
63+
64+ } ( ) ) ;
0 commit comments