summaryrefslogtreecommitdiff
path: root/frontend/gamma/js/Zepto/fx.js
Unidiff
Diffstat (limited to 'frontend/gamma/js/Zepto/fx.js') (more/less context) (ignore whitespace changes)
-rw-r--r--frontend/gamma/js/Zepto/fx.js102
1 files changed, 0 insertions, 102 deletions
diff --git a/frontend/gamma/js/Zepto/fx.js b/frontend/gamma/js/Zepto/fx.js
deleted file mode 100644
index 575449a..0000000
--- a/frontend/gamma/js/Zepto/fx.js
+++ b/dev/null
@@ -1,102 +0,0 @@
1// Zepto.js
2// (c) 2010-2012 Thomas Fuchs
3// Zepto.js may be freely distributed under the MIT license.
4
5;(function($, undefined){
6 var prefix = '', eventPrefix, endEventName, endAnimationName,
7 vendors = { Webkit: 'webkit', Moz: '', O: 'o', ms: 'MS' },
8 document = window.document, testEl = document.createElement('div'),
9 supportedTransforms = /^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i,
10 transform,
11 transitionProperty, transitionDuration, transitionTiming,
12 animationName, animationDuration, animationTiming,
13 cssReset = {}
14
15 function dasherize(str) { return downcase(str.replace(/([a-z])([A-Z])/, '$1-$2')) }
16 function downcase(str) { return str.toLowerCase() }
17 function normalizeEvent(name) { return eventPrefix ? eventPrefix + name : downcase(name) }
18
19 $.each(vendors, function(vendor, event){
20 if (testEl.style[vendor + 'TransitionProperty'] !== undefined) {
21 prefix = '-' + downcase(vendor) + '-'
22 eventPrefix = event
23 return false
24 }
25 })
26
27 transform = prefix + 'transform'
28 cssReset[transitionProperty = prefix + 'transition-property'] =
29 cssReset[transitionDuration = prefix + 'transition-duration'] =
30 cssReset[transitionTiming = prefix + 'transition-timing-function'] =
31 cssReset[animationName = prefix + 'animation-name'] =
32 cssReset[animationDuration = prefix + 'animation-duration'] =
33 cssReset[animationTiming = prefix + 'animation-timing-function'] = ''
34
35 $.fx = {
36 off: (eventPrefix === undefined && testEl.style.transitionProperty === undefined),
37 speeds: { _default: 400, fast: 200, slow: 600 },
38 cssPrefix: prefix,
39 transitionEnd: normalizeEvent('TransitionEnd'),
40 animationEnd: normalizeEvent('AnimationEnd')
41 }
42
43 $.fn.animate = function(properties, duration, ease, callback){
44 if ($.isObject(duration))
45 ease = duration.easing, callback = duration.complete, duration = duration.duration
46 if (duration) duration = (typeof duration == 'number' ? duration :
47 ($.fx.speeds[duration] || $.fx.speeds._default)) / 1000
48 return this.anim(properties, duration, ease, callback)
49 }
50
51 $.fn.anim = function(properties, duration, ease, callback){
52 var key, cssValues = {}, cssProperties, transforms = '',
53 that = this, wrappedCallback, endEvent = $.fx.transitionEnd
54
55 if (duration === undefined) duration = 0.4
56 if ($.fx.off) duration = 0
57
58 if (typeof properties == 'string') {
59 // keyframe animation
60 cssValues[animationName] = properties
61 cssValues[animationDuration] = duration + 's'
62 cssValues[animationTiming] = (ease || 'linear')
63 endEvent = $.fx.animationEnd
64 } else {
65 cssProperties = []
66 // CSS transitions
67 for (key in properties)
68 if (supportedTransforms.test(key)) transforms += key + '(' + properties[key] + ') '
69 else cssValues[key] = properties[key], cssProperties.push(dasherize(key))
70
71 if (transforms) cssValues[transform] = transforms, cssProperties.push(transform)
72 if (duration > 0 && typeof properties === 'object') {
73 cssValues[transitionProperty] = cssProperties.join(', ')
74 cssValues[transitionDuration] = duration + 's'
75 cssValues[transitionTiming] = (ease || 'linear')
76 }
77 }
78
79 wrappedCallback = function(event){
80 if (typeof event !== 'undefined') {
81 if (event.target !== event.currentTarget) return // makes sure the event didn't bubble from "below"
82 $(event.target).unbind(endEvent, arguments.callee)
83 }
84 $(this).css(cssReset)
85 callback && callback.call(this)
86 }
87 if (duration > 0) this.bind(endEvent, wrappedCallback)
88
89 // trigger page reflow so new elements can animate
90 this.size() && this.get(0).clientLeft
91
92 this.css(cssValues)
93
94 if (duration <= 0) setTimeout(function() {
95 that.each(function(){ wrappedCallback.call(this) })
96 }, 0)
97
98 return this
99 }
100
101 testEl = null
102})(Zepto)