|
1
|
|
|
/*jshint curly:false,forin:false*/ |
|
2
|
|
|
|
|
3
|
|
|
AnimationFrame.shim(); |
|
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
window.castor = |
|
6
|
|
|
{ |
|
7
|
|
|
_addClasses: function( el, className ) { |
|
8
|
|
|
className.split( ' ' ).forEach( function( str ) { |
|
9
|
|
|
el.classList.add( str ); |
|
10
|
|
|
}); |
|
11
|
|
|
return el; |
|
12
|
|
|
}, |
|
13
|
|
|
_removeClasses: function( el, className ) { |
|
14
|
|
|
className.split( ' ' ).forEach( function( str ) { |
|
15
|
|
|
el.classList.remove( str ); |
|
16
|
|
|
}); |
|
17
|
|
|
return el; |
|
18
|
|
|
}, |
|
19
|
|
|
_isString: function( str ) { |
|
20
|
|
|
return Object.prototype.toString.call( str ) === "[object String]"; |
|
21
|
|
|
}, |
|
22
|
|
|
_cssEventEnd: function( eventType ) { |
|
23
|
|
|
var el = document.createElement('fakeelement'); |
|
24
|
|
|
var cssEvents = { |
|
25
|
|
|
animation: { |
|
26
|
|
|
animation:'animationend', |
|
27
|
|
|
WebkitAnimation:'webkitAnimationEnd', |
|
28
|
|
|
MozAnimation:'animationend', |
|
29
|
|
|
OAnimation:'oAnimationEnd oanimationend', |
|
30
|
|
|
}, |
|
31
|
|
|
transition: { |
|
32
|
|
|
transition:'transitionend', |
|
33
|
|
|
WebkitTransition:'webkitTransitionEnd', |
|
34
|
|
|
MozTransition:'transitionend', |
|
35
|
|
|
OTransition:'oTransitionEnd otransitionend', |
|
36
|
|
|
}, |
|
37
|
|
|
}; |
|
38
|
|
|
if( cssEvents.hasOwnProperty( eventType )) { |
|
|
|
|
|
|
39
|
|
|
for( var eventEnd in cssEvents[eventType] ) { |
|
|
|
|
|
|
40
|
|
|
if( el.style[eventEnd] !== undefined ) { |
|
41
|
|
|
return cssEvents[eventType][eventEnd]; |
|
42
|
|
|
} |
|
43
|
|
|
} |
|
|
|
|
|
|
44
|
|
|
} |
|
45
|
|
|
}, |
|
46
|
|
|
// see: https://github.com/angus-c/just#just-extend |
|
47
|
|
|
_extend: function() |
|
48
|
|
|
{ |
|
49
|
|
|
var args = [].slice.call( arguments ); |
|
50
|
|
|
var deep = false; |
|
51
|
|
|
if( typeof args[0] === 'boolean' ) { |
|
52
|
|
|
deep = args.shift(); |
|
53
|
|
|
} |
|
54
|
|
|
var result = args[0]; |
|
55
|
|
|
var extenders = args.slice(1); |
|
56
|
|
|
var len = extenders.length; |
|
57
|
|
|
for( var i = 0; i < len; i++ ) { |
|
58
|
|
|
var extender = extenders[i]; |
|
59
|
|
|
for( var key in extender ) { |
|
|
|
|
|
|
60
|
|
|
var value = extender[ key ]; |
|
61
|
|
|
if( deep && value && ( typeof value == 'object' )) { |
|
62
|
|
|
var base = Array.isArray( value ) ? [] : {}; |
|
63
|
|
|
result[ key ] = this._extend( true, base, value ); |
|
64
|
|
|
} |
|
65
|
|
|
else { |
|
66
|
|
|
result[ key ] = value; |
|
67
|
|
|
} |
|
68
|
|
|
} |
|
69
|
|
|
} |
|
70
|
|
|
return result; |
|
71
|
|
|
}, |
|
72
|
|
|
}; |
|
73
|
|
|
|
This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.
To learn more about declaring variables in Javascript, see the MDN.