fomantic-ui-sass 2.9.0 → 2.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
- data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
- data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
- data/app/assets/javascripts/semantic-ui/accordion.js +569 -596
- data/app/assets/javascripts/semantic-ui/api.js +1158 -1180
- data/app/assets/javascripts/semantic-ui/calendar.js +1935 -1810
- data/app/assets/javascripts/semantic-ui/checkbox.js +843 -842
- data/app/assets/javascripts/semantic-ui/dimmer.js +707 -738
- data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4237
- data/app/assets/javascripts/semantic-ui/embed.js +646 -676
- data/app/assets/javascripts/semantic-ui/flyout.js +1515 -1466
- data/app/assets/javascripts/semantic-ui/form.js +2023 -2005
- data/app/assets/javascripts/semantic-ui/modal.js +1545 -1487
- data/app/assets/javascripts/semantic-ui/nag.js +521 -527
- data/app/assets/javascripts/semantic-ui/popup.js +1457 -1457
- data/app/assets/javascripts/semantic-ui/progress.js +970 -998
- data/app/assets/javascripts/semantic-ui/rating.js +508 -524
- data/app/assets/javascripts/semantic-ui/search.js +1521 -1535
- data/app/assets/javascripts/semantic-ui/shape.js +784 -811
- data/app/assets/javascripts/semantic-ui/sidebar.js +1062 -1100
- data/app/assets/javascripts/semantic-ui/site.js +437 -477
- data/app/assets/javascripts/semantic-ui/slider.js +1311 -1312
- data/app/assets/javascripts/semantic-ui/state.js +639 -658
- data/app/assets/javascripts/semantic-ui/sticky.js +848 -902
- data/app/assets/javascripts/semantic-ui/tab.js +903 -967
- data/app/assets/javascripts/semantic-ui/toast.js +911 -885
- data/app/assets/javascripts/semantic-ui/transition.js +1049 -1078
- data/app/assets/javascripts/semantic-ui/visibility.js +1214 -1246
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +246 -341
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +185 -331
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +272 -433
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +127 -199
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +549 -776
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +711 -1123
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +9 -8
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +45 -63
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +3556 -3556
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +272 -270
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +120 -144
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +667 -747
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +358 -276
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +361 -412
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +51 -72
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +69 -157
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +24 -44
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +17 -22
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +46 -85
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +150 -226
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +79 -152
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +10 -15
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +30 -43
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +37 -55
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +26 -29
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +122 -193
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +55 -174
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +254 -388
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +20 -31
- data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +97 -143
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +122 -156
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +426 -204
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +83 -124
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +71 -100
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +105 -208
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +93 -121
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +12 -16
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +71 -149
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +36 -47
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +221 -367
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +43 -61
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +37 -59
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +86 -133
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +77 -118
- data/lib/fomantic/ui/sass/version.rb +2 -2
- data/tasks/converter.rb +1 -1
- metadata +17 -1
@@ -1,1114 +1,1085 @@
|
|
1
1
|
/*!
|
2
2
|
* # Fomantic-UI - Transition
|
3
|
-
*
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
6
6
|
* Released under the MIT license
|
7
|
-
*
|
7
|
+
* https://opensource.org/licenses/MIT
|
8
8
|
*
|
9
9
|
*/
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
'use strict';
|
14
|
-
|
15
|
-
$.isFunction = $.isFunction || function(obj) {
|
16
|
-
return typeof obj === "function" && typeof obj.nodeType !== "number";
|
17
|
-
};
|
18
|
-
|
19
|
-
window = (typeof window != 'undefined' && window.Math == Math)
|
20
|
-
? window
|
21
|
-
: (typeof self != 'undefined' && self.Math == Math)
|
22
|
-
? self
|
23
|
-
: Function('return this')()
|
24
|
-
;
|
25
|
-
|
26
|
-
$.fn.transition = function() {
|
27
|
-
var
|
28
|
-
$allModules = $(this),
|
29
|
-
moduleSelector = $allModules.selector || '',
|
30
|
-
|
31
|
-
time = new Date().getTime(),
|
32
|
-
performance = [],
|
33
|
-
|
34
|
-
moduleArguments = arguments,
|
35
|
-
query = moduleArguments[0],
|
36
|
-
queryArguments = [].slice.call(arguments, 1),
|
37
|
-
methodInvoked = (typeof query === 'string'),
|
38
|
-
|
39
|
-
returnedValue
|
40
|
-
;
|
41
|
-
$allModules
|
42
|
-
.each(function(index) {
|
43
|
-
var
|
44
|
-
$module = $(this),
|
45
|
-
element = this,
|
46
|
-
|
47
|
-
// set at run time
|
48
|
-
settings,
|
49
|
-
instance,
|
50
|
-
|
51
|
-
error,
|
52
|
-
className,
|
53
|
-
metadata,
|
54
|
-
animationEnd,
|
55
|
-
|
56
|
-
moduleNamespace,
|
57
|
-
eventNamespace,
|
58
|
-
module
|
59
|
-
;
|
60
|
-
|
61
|
-
module = {
|
62
|
-
|
63
|
-
initialize: function() {
|
64
|
-
|
65
|
-
// get full settings
|
66
|
-
settings = module.get.settings.apply(element, moduleArguments);
|
67
|
-
|
68
|
-
// shorthand
|
69
|
-
className = settings.className;
|
70
|
-
error = settings.error;
|
71
|
-
metadata = settings.metadata;
|
72
|
-
|
73
|
-
// define namespace
|
74
|
-
eventNamespace = '.' + settings.namespace;
|
75
|
-
moduleNamespace = 'module-' + settings.namespace;
|
76
|
-
instance = $module.data(moduleNamespace) || module;
|
77
|
-
|
78
|
-
// get vendor specific events
|
79
|
-
animationEnd = module.get.animationEndEvent();
|
80
|
-
|
81
|
-
if(methodInvoked) {
|
82
|
-
methodInvoked = module.invoke(query);
|
83
|
-
}
|
84
|
-
|
85
|
-
// method not invoked, lets run an animation
|
86
|
-
if(methodInvoked === false) {
|
87
|
-
module.verbose('Converted arguments into settings object', settings);
|
88
|
-
if(settings.interval) {
|
89
|
-
module.delay(settings.interval);
|
90
|
-
}
|
91
|
-
else {
|
92
|
-
module.animate();
|
93
|
-
}
|
94
|
-
module.instantiate();
|
95
|
-
}
|
96
|
-
},
|
97
|
-
|
98
|
-
instantiate: function() {
|
99
|
-
module.verbose('Storing instance of module', module);
|
100
|
-
instance = module;
|
101
|
-
$module
|
102
|
-
.data(moduleNamespace, instance)
|
103
|
-
;
|
104
|
-
},
|
105
|
-
|
106
|
-
destroy: function() {
|
107
|
-
module.verbose('Destroying previous module for', element);
|
108
|
-
$module
|
109
|
-
.removeData(moduleNamespace)
|
110
|
-
;
|
111
|
-
},
|
112
|
-
|
113
|
-
refresh: function() {
|
114
|
-
module.verbose('Refreshing display type on next animation');
|
115
|
-
delete module.displayType;
|
116
|
-
},
|
117
|
-
|
118
|
-
forceRepaint: function() {
|
119
|
-
module.verbose('Forcing element repaint');
|
120
|
-
var
|
121
|
-
$parentElement = $module.parent(),
|
122
|
-
$nextElement = $module.next()
|
123
|
-
;
|
124
|
-
if($nextElement.length === 0) {
|
125
|
-
$module.detach().appendTo($parentElement);
|
126
|
-
}
|
127
|
-
else {
|
128
|
-
$module.detach().insertBefore($nextElement);
|
129
|
-
}
|
130
|
-
},
|
131
|
-
|
132
|
-
repaint: function() {
|
133
|
-
module.verbose('Repainting element');
|
134
|
-
var
|
135
|
-
fakeAssignment = element.offsetWidth
|
136
|
-
;
|
137
|
-
},
|
11
|
+
(function ($, window, document) {
|
12
|
+
'use strict';
|
138
13
|
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
shouldReverse,
|
143
|
-
delay
|
144
|
-
;
|
145
|
-
if(!direction) {
|
146
|
-
direction = module.can.transition()
|
147
|
-
? module.get.direction()
|
148
|
-
: 'static'
|
149
|
-
;
|
150
|
-
}
|
151
|
-
interval = (interval !== undefined)
|
152
|
-
? interval
|
153
|
-
: settings.interval
|
154
|
-
;
|
155
|
-
shouldReverse = (settings.reverse == 'auto' && direction == className.outward);
|
156
|
-
delay = (shouldReverse || settings.reverse === true)
|
157
|
-
? ($allModules.length - index) * interval
|
158
|
-
: index * interval
|
159
|
-
;
|
160
|
-
module.debug('Delaying animation by', delay);
|
161
|
-
setTimeout(module.animate, delay);
|
162
|
-
},
|
14
|
+
function isFunction(obj) {
|
15
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
|
+
}
|
163
17
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
module.error(error.support);
|
168
|
-
return false;
|
169
|
-
}
|
170
|
-
module.debug('Preparing animation', settings.animation);
|
171
|
-
if(module.is.animating()) {
|
172
|
-
if(settings.queue) {
|
173
|
-
if(!settings.allowRepeats && module.has.direction() && module.is.occurring() && module.queuing !== true) {
|
174
|
-
module.debug('Animation is currently occurring, preventing queueing same animation', settings.animation);
|
175
|
-
}
|
176
|
-
else {
|
177
|
-
module.queue(settings.animation);
|
178
|
-
}
|
179
|
-
return false;
|
180
|
-
}
|
181
|
-
else if(!settings.allowRepeats && module.is.occurring()) {
|
182
|
-
module.debug('Animation is already occurring, will not execute repeated animation', settings.animation);
|
183
|
-
return false;
|
184
|
-
}
|
185
|
-
else {
|
186
|
-
module.debug('New animation started, completing previous early', settings.animation);
|
187
|
-
instance.complete();
|
188
|
-
}
|
189
|
-
}
|
190
|
-
if( module.can.animate() ) {
|
191
|
-
module.set.animating(settings.animation);
|
192
|
-
}
|
193
|
-
else {
|
194
|
-
module.error(error.noAnimation, settings.animation, element);
|
195
|
-
}
|
196
|
-
},
|
18
|
+
window = window !== undefined && window.Math === Math
|
19
|
+
? window
|
20
|
+
: globalThis;
|
197
21
|
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
module.remove.animating();
|
203
|
-
},
|
22
|
+
$.fn.transition = function () {
|
23
|
+
var
|
24
|
+
$allModules = $(this),
|
25
|
+
moduleSelector = $allModules.selector || '',
|
204
26
|
|
205
|
-
|
206
|
-
|
207
|
-
module.queuing = true;
|
208
|
-
$module
|
209
|
-
.one(animationEnd + '.queue' + eventNamespace, function() {
|
210
|
-
module.queuing = false;
|
211
|
-
module.repaint();
|
212
|
-
module.animate.apply(this, settings);
|
213
|
-
})
|
214
|
-
;
|
215
|
-
},
|
27
|
+
time = Date.now(),
|
28
|
+
performance = [],
|
216
29
|
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
module.debug('Animation complete', settings.animation);
|
222
|
-
module.remove.completeCallback();
|
223
|
-
module.remove.failSafe();
|
224
|
-
if(!module.is.looping()) {
|
225
|
-
if( module.is.outward() ) {
|
226
|
-
module.verbose('Animation is outward, hiding element');
|
227
|
-
module.restore.conditions();
|
228
|
-
module.hide();
|
229
|
-
}
|
230
|
-
else if( module.is.inward() ) {
|
231
|
-
module.verbose('Animation is outward, showing element');
|
232
|
-
module.restore.conditions();
|
233
|
-
module.show();
|
234
|
-
}
|
235
|
-
else {
|
236
|
-
module.verbose('Static animation completed');
|
237
|
-
module.restore.conditions();
|
238
|
-
settings.onComplete.call(element);
|
239
|
-
}
|
240
|
-
}
|
241
|
-
},
|
30
|
+
moduleArguments = arguments,
|
31
|
+
query = moduleArguments[0],
|
32
|
+
queryArguments = [].slice.call(arguments, 1),
|
33
|
+
methodInvoked = typeof query === 'string',
|
242
34
|
|
243
|
-
|
244
|
-
|
35
|
+
returnedValue
|
36
|
+
;
|
37
|
+
$allModules.each(function (index) {
|
245
38
|
var
|
246
|
-
|
247
|
-
|
248
|
-
displayType = module.get.displayType(),
|
249
|
-
overrideStyle = userStyle + 'display: ' + displayType + ' !important;',
|
250
|
-
inlineDisplay = $module[0].style.display,
|
251
|
-
mustStayHidden = !displayType || (inlineDisplay === 'none' && settings.skipInlineHidden) || $module[0].tagName.match(/(script|link|style)/i)
|
252
|
-
;
|
253
|
-
if (mustStayHidden){
|
254
|
-
module.remove.transition();
|
255
|
-
return false;
|
256
|
-
}
|
257
|
-
module.verbose('Overriding default display to show element', displayType);
|
258
|
-
$module
|
259
|
-
.attr('style', overrideStyle)
|
260
|
-
;
|
261
|
-
return true;
|
262
|
-
},
|
263
|
-
hidden: function() {
|
264
|
-
var
|
265
|
-
style = $module.attr('style'),
|
266
|
-
currentDisplay = $module.css('display'),
|
267
|
-
emptyStyle = (style === undefined || style === '')
|
268
|
-
;
|
269
|
-
if(currentDisplay !== 'none' && !module.is.hidden()) {
|
270
|
-
module.verbose('Overriding default display to hide element');
|
271
|
-
$module
|
272
|
-
.css('display', 'none')
|
273
|
-
;
|
274
|
-
}
|
275
|
-
else if(emptyStyle) {
|
276
|
-
$module
|
277
|
-
.removeAttr('style')
|
278
|
-
;
|
279
|
-
}
|
280
|
-
}
|
281
|
-
},
|
39
|
+
$module = $(this),
|
40
|
+
element = this,
|
282
41
|
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
hasDirection = false
|
287
|
-
;
|
288
|
-
animation = animation || settings.animation;
|
289
|
-
if(typeof animation === 'string') {
|
290
|
-
animation = animation.split(' ');
|
291
|
-
$.each(animation, function(index, word){
|
292
|
-
if(word === className.inward || word === className.outward) {
|
293
|
-
hasDirection = true;
|
294
|
-
}
|
295
|
-
});
|
296
|
-
}
|
297
|
-
return hasDirection;
|
298
|
-
},
|
299
|
-
inlineDisplay: function() {
|
300
|
-
var
|
301
|
-
style = $module.attr('style') || ''
|
302
|
-
;
|
303
|
-
return Array.isArray(style.match(/display.*?;/, ''));
|
304
|
-
}
|
305
|
-
},
|
42
|
+
// set at run time
|
43
|
+
settings,
|
44
|
+
instance,
|
306
45
|
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
// determine exact animation
|
313
|
-
animation = animation || settings.animation;
|
314
|
-
var animationClass = module.get.animationClass(animation);
|
315
|
-
|
316
|
-
// save animation class in cache to restore class names
|
317
|
-
module.save.animation(animationClass);
|
318
|
-
|
319
|
-
if(module.force.visible()) {
|
320
|
-
module.remove.hidden();
|
321
|
-
module.remove.direction();
|
322
|
-
|
323
|
-
module.start.animation(animationClass);
|
324
|
-
}
|
325
|
-
},
|
326
|
-
duration: function(animationName, duration) {
|
327
|
-
duration = duration || settings.duration;
|
328
|
-
duration = (typeof duration == 'number')
|
329
|
-
? duration + 'ms'
|
330
|
-
: duration
|
331
|
-
;
|
332
|
-
if(duration || duration === 0) {
|
333
|
-
module.verbose('Setting animation duration', duration);
|
334
|
-
$module
|
335
|
-
.css({
|
336
|
-
'animation-duration': duration
|
337
|
-
})
|
338
|
-
;
|
339
|
-
}
|
340
|
-
},
|
341
|
-
direction: function(direction) {
|
342
|
-
direction = direction || module.get.direction();
|
343
|
-
if(direction == className.inward) {
|
344
|
-
module.set.inward();
|
345
|
-
}
|
346
|
-
else {
|
347
|
-
module.set.outward();
|
348
|
-
}
|
349
|
-
},
|
350
|
-
looping: function() {
|
351
|
-
module.debug('Transition set to loop');
|
352
|
-
$module
|
353
|
-
.addClass(className.looping)
|
354
|
-
;
|
355
|
-
},
|
356
|
-
hidden: function() {
|
357
|
-
$module
|
358
|
-
.addClass(className.transition)
|
359
|
-
.addClass(className.hidden)
|
360
|
-
;
|
361
|
-
},
|
362
|
-
inward: function() {
|
363
|
-
module.debug('Setting direction to inward');
|
364
|
-
$module
|
365
|
-
.removeClass(className.outward)
|
366
|
-
.addClass(className.inward)
|
367
|
-
;
|
368
|
-
},
|
369
|
-
outward: function() {
|
370
|
-
module.debug('Setting direction to outward');
|
371
|
-
$module
|
372
|
-
.removeClass(className.inward)
|
373
|
-
.addClass(className.outward)
|
374
|
-
;
|
375
|
-
},
|
376
|
-
visible: function() {
|
377
|
-
$module
|
378
|
-
.addClass(className.transition)
|
379
|
-
.addClass(className.visible)
|
380
|
-
;
|
381
|
-
}
|
382
|
-
},
|
46
|
+
error,
|
47
|
+
className,
|
48
|
+
metadata,
|
49
|
+
animationEnd,
|
383
50
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
module.debug('Starting tween', animationClass);
|
388
|
-
$module
|
389
|
-
.addClass(animationClass)
|
390
|
-
.one(animationEnd + '.complete' + eventNamespace, module.complete)
|
51
|
+
moduleNamespace,
|
52
|
+
eventNamespace,
|
53
|
+
module
|
391
54
|
;
|
392
|
-
if(settings.useFailSafe) {
|
393
|
-
module.add.failSafe();
|
394
|
-
}
|
395
|
-
module.set.duration(settings.duration);
|
396
|
-
settings.onStart.call(element);
|
397
|
-
}
|
398
|
-
},
|
399
55
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
56
|
+
module = {
|
57
|
+
|
58
|
+
initialize: function () {
|
59
|
+
// get full settings
|
60
|
+
settings = module.get.settings.apply(element, moduleArguments);
|
61
|
+
|
62
|
+
// shorthand
|
63
|
+
className = settings.className;
|
64
|
+
error = settings.error;
|
65
|
+
metadata = settings.metadata;
|
66
|
+
|
67
|
+
// define namespace
|
68
|
+
eventNamespace = '.' + settings.namespace;
|
69
|
+
moduleNamespace = 'module-' + settings.namespace;
|
70
|
+
instance = $module.data(moduleNamespace) || module;
|
71
|
+
|
72
|
+
// get vendor specific events
|
73
|
+
animationEnd = module.get.animationEndEvent();
|
74
|
+
|
75
|
+
if (methodInvoked) {
|
76
|
+
methodInvoked = module.invoke(query);
|
77
|
+
}
|
78
|
+
|
79
|
+
// method not invoked, lets run an animation
|
80
|
+
if (methodInvoked === false) {
|
81
|
+
module.verbose('Converted arguments into settings object', settings);
|
82
|
+
if (settings.interval) {
|
83
|
+
module.delay(settings.interval);
|
84
|
+
} else {
|
85
|
+
module.animate();
|
86
|
+
}
|
87
|
+
module.instantiate();
|
88
|
+
}
|
89
|
+
},
|
90
|
+
|
91
|
+
instantiate: function () {
|
92
|
+
module.verbose('Storing instance of module', module);
|
93
|
+
instance = module;
|
94
|
+
$module
|
95
|
+
.data(moduleNamespace, instance)
|
96
|
+
;
|
97
|
+
},
|
98
|
+
|
99
|
+
destroy: function () {
|
100
|
+
module.verbose('Destroying previous module for', element);
|
101
|
+
$module
|
102
|
+
.removeData(moduleNamespace)
|
103
|
+
;
|
104
|
+
},
|
105
|
+
|
106
|
+
refresh: function () {
|
107
|
+
module.verbose('Refreshing display type on next animation');
|
108
|
+
delete module.displayType;
|
109
|
+
},
|
110
|
+
|
111
|
+
forceRepaint: function () {
|
112
|
+
module.verbose('Forcing element repaint');
|
113
|
+
var
|
114
|
+
$parentElement = $module.parent(),
|
115
|
+
$nextElement = $module.next()
|
116
|
+
;
|
117
|
+
if ($nextElement.length === 0) {
|
118
|
+
$module.detach().appendTo($parentElement);
|
119
|
+
} else {
|
120
|
+
$module.detach().insertBefore($nextElement);
|
121
|
+
}
|
122
|
+
},
|
123
|
+
|
124
|
+
repaint: function () {
|
125
|
+
module.verbose('Repainting element');
|
126
|
+
var
|
127
|
+
fakeAssignment = element.offsetWidth
|
128
|
+
;
|
129
|
+
},
|
130
|
+
|
131
|
+
delay: function (interval) {
|
132
|
+
var
|
133
|
+
direction = module.get.animationDirection(),
|
134
|
+
shouldReverse,
|
135
|
+
delay
|
136
|
+
;
|
137
|
+
if (!direction) {
|
138
|
+
direction = module.can.transition()
|
139
|
+
? module.get.direction()
|
140
|
+
: 'static';
|
141
|
+
}
|
142
|
+
interval = interval !== undefined
|
143
|
+
? interval
|
144
|
+
: settings.interval;
|
145
|
+
shouldReverse = settings.reverse === 'auto' && direction === className.outward;
|
146
|
+
delay = shouldReverse || settings.reverse === true
|
147
|
+
? ($allModules.length - index) * interval
|
148
|
+
: index * interval;
|
149
|
+
module.debug('Delaying animation by', delay);
|
150
|
+
setTimeout(module.animate, delay);
|
151
|
+
},
|
152
|
+
|
153
|
+
animate: function (overrideSettings) {
|
154
|
+
settings = overrideSettings || settings;
|
155
|
+
if (!module.is.supported()) {
|
156
|
+
module.error(error.support);
|
157
|
+
|
158
|
+
return false;
|
159
|
+
}
|
160
|
+
module.debug('Preparing animation', settings.animation);
|
161
|
+
if (module.is.animating()) {
|
162
|
+
if (settings.queue) {
|
163
|
+
if (!settings.allowRepeats && module.has.direction() && module.is.occurring() && module.queuing !== true) {
|
164
|
+
module.debug('Animation is currently occurring, preventing queueing same animation', settings.animation);
|
165
|
+
} else {
|
166
|
+
module.queue(settings.animation);
|
167
|
+
}
|
168
|
+
|
169
|
+
return false;
|
170
|
+
}
|
171
|
+
if (!settings.allowRepeats && module.is.occurring()) {
|
172
|
+
module.debug('Animation is already occurring, will not execute repeated animation', settings.animation);
|
173
|
+
|
174
|
+
return false;
|
175
|
+
}
|
176
|
+
|
177
|
+
module.debug('New animation started, completing previous early', settings.animation);
|
178
|
+
instance.complete();
|
179
|
+
}
|
180
|
+
if (module.can.animate()) {
|
181
|
+
module.set.animating(settings.animation);
|
182
|
+
} else {
|
183
|
+
module.error(error.noAnimation, settings.animation, element);
|
184
|
+
}
|
185
|
+
},
|
186
|
+
|
187
|
+
reset: function () {
|
188
|
+
module.debug('Resetting animation to beginning conditions');
|
189
|
+
module.remove.animationCallbacks();
|
190
|
+
module.restore.conditions();
|
191
|
+
module.remove.animating();
|
192
|
+
},
|
193
|
+
|
194
|
+
queue: function (animation) {
|
195
|
+
module.debug('Queueing animation of', animation);
|
196
|
+
module.queuing = true;
|
197
|
+
$module
|
198
|
+
.one(animationEnd + '.queue' + eventNamespace, function () {
|
199
|
+
module.queuing = false;
|
200
|
+
module.repaint();
|
201
|
+
module.animate.apply(this, settings);
|
202
|
+
})
|
203
|
+
;
|
204
|
+
},
|
205
|
+
|
206
|
+
complete: function (event) {
|
207
|
+
if (event && event.target === element) {
|
208
|
+
event.stopPropagation();
|
209
|
+
}
|
210
|
+
module.debug('Animation complete', settings.animation);
|
211
|
+
module.remove.completeCallback();
|
212
|
+
module.remove.failSafe();
|
213
|
+
if (!module.is.looping()) {
|
214
|
+
if (module.is.outward()) {
|
215
|
+
module.verbose('Animation is outward, hiding element');
|
216
|
+
module.restore.conditions();
|
217
|
+
module.hide();
|
218
|
+
} else if (module.is.inward()) {
|
219
|
+
module.verbose('Animation is outward, showing element');
|
220
|
+
module.restore.conditions();
|
221
|
+
module.show();
|
222
|
+
} else {
|
223
|
+
module.verbose('Static animation completed');
|
224
|
+
module.restore.conditions();
|
225
|
+
settings.onComplete.call(element);
|
226
|
+
}
|
227
|
+
}
|
228
|
+
},
|
229
|
+
|
230
|
+
force: {
|
231
|
+
visible: function () {
|
232
|
+
var
|
233
|
+
style = $module.attr('style'),
|
234
|
+
userStyle = module.get.userStyle(style),
|
235
|
+
displayType = module.get.displayType(),
|
236
|
+
overrideStyle = userStyle + 'display: ' + displayType + ' !important;',
|
237
|
+
inlineDisplay = $module[0].style.display,
|
238
|
+
mustStayHidden = !displayType || (inlineDisplay === 'none' && settings.skipInlineHidden) || $module[0].tagName.match(/(script|link|style)/i)
|
239
|
+
;
|
240
|
+
if (mustStayHidden) {
|
241
|
+
module.remove.transition();
|
242
|
+
|
243
|
+
return false;
|
244
|
+
}
|
245
|
+
module.verbose('Overriding default display to show element', displayType);
|
246
|
+
$module
|
247
|
+
.attr('style', overrideStyle)
|
248
|
+
;
|
249
|
+
|
250
|
+
return true;
|
251
|
+
},
|
252
|
+
hidden: function () {
|
253
|
+
var
|
254
|
+
style = $module.attr('style'),
|
255
|
+
currentDisplay = $module.css('display'),
|
256
|
+
emptyStyle = style === undefined || style === ''
|
257
|
+
;
|
258
|
+
if (currentDisplay !== 'none' && !module.is.hidden()) {
|
259
|
+
module.verbose('Overriding default display to hide element');
|
260
|
+
$module
|
261
|
+
.css('display', 'none')
|
262
|
+
;
|
263
|
+
} else if (emptyStyle) {
|
264
|
+
$module
|
265
|
+
.removeAttr('style')
|
266
|
+
;
|
267
|
+
}
|
268
|
+
},
|
269
|
+
},
|
270
|
+
|
271
|
+
has: {
|
272
|
+
direction: function (animation) {
|
273
|
+
var
|
274
|
+
hasDirection = false
|
275
|
+
;
|
276
|
+
animation = animation || settings.animation;
|
277
|
+
if (typeof animation === 'string') {
|
278
|
+
animation = animation.split(' ');
|
279
|
+
$.each(animation, function (index, word) {
|
280
|
+
if (word === className.inward || word === className.outward) {
|
281
|
+
hasDirection = true;
|
282
|
+
}
|
283
|
+
});
|
284
|
+
}
|
285
|
+
|
286
|
+
return hasDirection;
|
287
|
+
},
|
288
|
+
inlineDisplay: function () {
|
289
|
+
var
|
290
|
+
style = $module.attr('style') || ''
|
291
|
+
;
|
292
|
+
|
293
|
+
return Array.isArray(style.match(/display.*?;/, ''));
|
294
|
+
},
|
295
|
+
},
|
296
|
+
|
297
|
+
set: {
|
298
|
+
animating: function (animation) {
|
299
|
+
// remove previous callbacks
|
300
|
+
module.remove.completeCallback();
|
301
|
+
|
302
|
+
// determine exact animation
|
303
|
+
animation = animation || settings.animation;
|
304
|
+
var animationClass = module.get.animationClass(animation);
|
305
|
+
|
306
|
+
// save animation class in cache to restore class names
|
307
|
+
module.save.animation(animationClass);
|
308
|
+
|
309
|
+
if (module.force.visible()) {
|
310
|
+
module.remove.hidden();
|
311
|
+
module.remove.direction();
|
312
|
+
|
313
|
+
module.start.animation(animationClass);
|
314
|
+
}
|
315
|
+
},
|
316
|
+
duration: function (animationName, duration) {
|
317
|
+
duration = duration || settings.duration;
|
318
|
+
duration = typeof duration === 'number'
|
319
|
+
? duration + 'ms'
|
320
|
+
: duration;
|
321
|
+
if (duration || duration === 0) {
|
322
|
+
module.verbose('Setting animation duration', duration);
|
323
|
+
$module
|
324
|
+
.css({
|
325
|
+
'animation-duration': duration,
|
326
|
+
})
|
327
|
+
;
|
328
|
+
}
|
329
|
+
},
|
330
|
+
direction: function (direction) {
|
331
|
+
direction = direction || module.get.direction();
|
332
|
+
if (direction === className.inward) {
|
333
|
+
module.set.inward();
|
334
|
+
} else {
|
335
|
+
module.set.outward();
|
336
|
+
}
|
337
|
+
},
|
338
|
+
looping: function () {
|
339
|
+
module.debug('Transition set to loop');
|
340
|
+
$module
|
341
|
+
.addClass(className.looping)
|
342
|
+
;
|
343
|
+
},
|
344
|
+
hidden: function () {
|
345
|
+
$module
|
346
|
+
.addClass(className.transition)
|
347
|
+
.addClass(className.hidden)
|
348
|
+
;
|
349
|
+
},
|
350
|
+
inward: function () {
|
351
|
+
module.debug('Setting direction to inward');
|
352
|
+
$module
|
353
|
+
.removeClass(className.outward)
|
354
|
+
.addClass(className.inward)
|
355
|
+
;
|
356
|
+
},
|
357
|
+
outward: function () {
|
358
|
+
module.debug('Setting direction to outward');
|
359
|
+
$module
|
360
|
+
.removeClass(className.inward)
|
361
|
+
.addClass(className.outward)
|
362
|
+
;
|
363
|
+
},
|
364
|
+
visible: function () {
|
365
|
+
$module
|
366
|
+
.addClass(className.transition)
|
367
|
+
.addClass(className.visible)
|
368
|
+
;
|
369
|
+
},
|
370
|
+
},
|
371
|
+
|
372
|
+
start: {
|
373
|
+
animation: function (animationClass) {
|
374
|
+
animationClass = animationClass || module.get.animationClass();
|
375
|
+
module.debug('Starting tween', animationClass);
|
376
|
+
$module
|
377
|
+
.addClass(animationClass)
|
378
|
+
.one(animationEnd + '.complete' + eventNamespace, module.complete)
|
379
|
+
;
|
380
|
+
if (settings.useFailSafe) {
|
381
|
+
module.add.failSafe();
|
382
|
+
}
|
383
|
+
module.set.duration(settings.duration);
|
384
|
+
settings.onStart.call(element);
|
385
|
+
},
|
386
|
+
},
|
387
|
+
|
388
|
+
save: {
|
389
|
+
animation: function (animation) {
|
390
|
+
if (!module.cache) {
|
391
|
+
module.cache = {};
|
392
|
+
}
|
393
|
+
module.cache.animation = animation;
|
394
|
+
},
|
395
|
+
displayType: function (displayType) {
|
396
|
+
if (displayType !== 'none') {
|
397
|
+
$module.data(metadata.displayType, displayType);
|
398
|
+
}
|
399
|
+
},
|
400
|
+
transitionExists: function (animation, exists) {
|
401
|
+
$.fn.transition.exists[animation] = exists;
|
402
|
+
module.verbose('Saving existence of transition', animation, exists);
|
403
|
+
},
|
404
|
+
},
|
405
|
+
|
406
|
+
restore: {
|
407
|
+
conditions: function () {
|
408
|
+
var
|
409
|
+
animation = module.get.currentAnimation()
|
410
|
+
;
|
411
|
+
if (animation) {
|
412
|
+
$module
|
413
|
+
.removeClass(animation)
|
414
|
+
;
|
415
|
+
module.verbose('Removing animation class', module.cache);
|
416
|
+
}
|
417
|
+
module.remove.duration();
|
418
|
+
},
|
419
|
+
},
|
420
|
+
|
421
|
+
add: {
|
422
|
+
failSafe: function () {
|
423
|
+
var
|
424
|
+
duration = module.get.duration()
|
425
|
+
;
|
426
|
+
module.timer = setTimeout(function () {
|
427
|
+
$module.triggerHandler(animationEnd);
|
428
|
+
}, duration + settings.failSafeDelay);
|
429
|
+
module.verbose('Adding fail safe timer', module.timer);
|
430
|
+
},
|
431
|
+
},
|
432
|
+
|
433
|
+
remove: {
|
434
|
+
animating: function () {
|
435
|
+
$module.removeClass(className.animating);
|
436
|
+
},
|
437
|
+
animationCallbacks: function () {
|
438
|
+
module.remove.queueCallback();
|
439
|
+
module.remove.completeCallback();
|
440
|
+
},
|
441
|
+
queueCallback: function () {
|
442
|
+
$module.off('.queue' + eventNamespace);
|
443
|
+
},
|
444
|
+
completeCallback: function () {
|
445
|
+
$module.off('.complete' + eventNamespace);
|
446
|
+
},
|
447
|
+
display: function () {
|
448
|
+
$module.css('display', '');
|
449
|
+
},
|
450
|
+
direction: function () {
|
451
|
+
$module
|
452
|
+
.removeClass(className.inward)
|
453
|
+
.removeClass(className.outward)
|
454
|
+
;
|
455
|
+
},
|
456
|
+
duration: function () {
|
457
|
+
$module
|
458
|
+
.css('animation-duration', '')
|
459
|
+
;
|
460
|
+
},
|
461
|
+
failSafe: function () {
|
462
|
+
module.verbose('Removing fail safe timer', module.timer);
|
463
|
+
if (module.timer) {
|
464
|
+
clearTimeout(module.timer);
|
465
|
+
}
|
466
|
+
},
|
467
|
+
hidden: function () {
|
468
|
+
$module.removeClass(className.hidden);
|
469
|
+
},
|
470
|
+
visible: function () {
|
471
|
+
$module.removeClass(className.visible);
|
472
|
+
},
|
473
|
+
looping: function () {
|
474
|
+
module.debug('Transitions are no longer looping');
|
475
|
+
if (module.is.looping()) {
|
476
|
+
module.reset();
|
477
|
+
$module
|
478
|
+
.removeClass(className.looping)
|
479
|
+
;
|
480
|
+
}
|
481
|
+
},
|
482
|
+
transition: function () {
|
483
|
+
$module
|
484
|
+
.removeClass(className.transition)
|
485
|
+
.removeClass(className.visible)
|
486
|
+
.removeClass(className.hidden)
|
487
|
+
;
|
488
|
+
},
|
489
|
+
},
|
490
|
+
get: {
|
491
|
+
settings: function (animation, duration, onComplete) {
|
492
|
+
if (typeof animation === 'object') { // single settings object
|
493
|
+
return $.extend(true, {}, $.fn.transition.settings, animation);
|
494
|
+
}
|
495
|
+
if (typeof onComplete === 'function') { // all arguments provided
|
496
|
+
return $.extend({}, $.fn.transition.settings, {
|
497
|
+
animation: animation,
|
498
|
+
onComplete: onComplete,
|
499
|
+
duration: duration,
|
500
|
+
});
|
501
|
+
}
|
502
|
+
if (typeof duration === 'string' || typeof duration === 'number') { // only duration provided
|
503
|
+
return $.extend({}, $.fn.transition.settings, {
|
504
|
+
animation: animation,
|
505
|
+
duration: duration,
|
506
|
+
});
|
507
|
+
}
|
508
|
+
if (typeof duration === 'object') { // duration is actually settings object
|
509
|
+
return $.extend({}, $.fn.transition.settings, duration, {
|
510
|
+
animation: animation,
|
511
|
+
});
|
512
|
+
}
|
513
|
+
if (typeof duration === 'function') { // duration is actually callback
|
514
|
+
return $.extend({}, $.fn.transition.settings, {
|
515
|
+
animation: animation,
|
516
|
+
onComplete: duration,
|
517
|
+
});
|
518
|
+
}
|
519
|
+
|
520
|
+
// only animation provided
|
521
|
+
return $.extend({}, $.fn.transition.settings, {
|
522
|
+
animation: animation,
|
523
|
+
});
|
524
|
+
},
|
525
|
+
animationClass: function (animation) {
|
526
|
+
var
|
527
|
+
animationClass = animation || settings.animation,
|
528
|
+
directionClass = module.can.transition() && !module.has.direction()
|
529
|
+
? module.get.direction() + ' '
|
530
|
+
: ''
|
531
|
+
;
|
532
|
+
|
533
|
+
return className.animating + ' '
|
534
|
+
+ className.transition + ' '
|
535
|
+
+ directionClass
|
536
|
+
+ animationClass;
|
537
|
+
},
|
538
|
+
currentAnimation: function () {
|
539
|
+
return module.cache && module.cache.animation !== undefined
|
540
|
+
? module.cache.animation
|
541
|
+
: false;
|
542
|
+
},
|
543
|
+
currentDirection: function () {
|
544
|
+
return module.is.inward()
|
545
|
+
? className.inward
|
546
|
+
: className.outward;
|
547
|
+
},
|
548
|
+
direction: function () {
|
549
|
+
return module.is.hidden() || !module.is.visible()
|
550
|
+
? className.inward
|
551
|
+
: className.outward;
|
552
|
+
},
|
553
|
+
animationDirection: function (animation) {
|
554
|
+
var
|
555
|
+
direction
|
556
|
+
;
|
557
|
+
animation = animation || settings.animation;
|
558
|
+
if (typeof animation === 'string') {
|
559
|
+
animation = animation.split(' ');
|
560
|
+
// search animation name for out/in class
|
561
|
+
$.each(animation, function (index, word) {
|
562
|
+
if (word === className.inward) {
|
563
|
+
direction = className.inward;
|
564
|
+
} else if (word === className.outward) {
|
565
|
+
direction = className.outward;
|
566
|
+
}
|
567
|
+
});
|
568
|
+
}
|
569
|
+
// return found direction
|
570
|
+
if (direction) {
|
571
|
+
return direction;
|
572
|
+
}
|
573
|
+
|
574
|
+
return false;
|
575
|
+
},
|
576
|
+
duration: function (duration) {
|
577
|
+
duration = duration || settings.duration;
|
578
|
+
if (duration === false) {
|
579
|
+
duration = $module.css('animation-duration') || 0;
|
580
|
+
}
|
581
|
+
|
582
|
+
return typeof duration === 'string'
|
583
|
+
? (duration.indexOf('ms') > -1
|
584
|
+
? parseFloat(duration)
|
585
|
+
: parseFloat(duration) * 1000)
|
586
|
+
: duration;
|
587
|
+
},
|
588
|
+
displayType: function (shouldDetermine) {
|
589
|
+
shouldDetermine = shouldDetermine !== undefined
|
590
|
+
? shouldDetermine
|
591
|
+
: true;
|
592
|
+
if (settings.displayType) {
|
593
|
+
return settings.displayType;
|
594
|
+
}
|
595
|
+
if (shouldDetermine && $module.data(metadata.displayType) === undefined) {
|
596
|
+
var currentDisplay = $module.css('display');
|
597
|
+
if (currentDisplay === '' || currentDisplay === 'none') {
|
598
|
+
// create fake element to determine display state
|
599
|
+
module.can.transition(true);
|
600
|
+
} else {
|
601
|
+
module.save.displayType(currentDisplay);
|
602
|
+
}
|
603
|
+
}
|
604
|
+
|
605
|
+
return $module.data(metadata.displayType);
|
606
|
+
},
|
607
|
+
userStyle: function (style) {
|
608
|
+
style = style || $module.attr('style') || '';
|
609
|
+
|
610
|
+
return style.replace(/display.*?;/, '');
|
611
|
+
},
|
612
|
+
transitionExists: function (animation) {
|
613
|
+
return $.fn.transition.exists[animation];
|
614
|
+
},
|
615
|
+
animationStartEvent: function () {
|
616
|
+
var
|
617
|
+
element = document.createElement('div'),
|
618
|
+
animations = {
|
619
|
+
animation: 'animationstart',
|
620
|
+
OAnimation: 'oAnimationStart',
|
621
|
+
MozAnimation: 'mozAnimationStart',
|
622
|
+
WebkitAnimation: 'webkitAnimationStart',
|
623
|
+
},
|
624
|
+
animation
|
625
|
+
;
|
626
|
+
for (animation in animations) {
|
627
|
+
if (element.style[animation] !== undefined) {
|
628
|
+
return animations[animation];
|
629
|
+
}
|
630
|
+
}
|
631
|
+
|
632
|
+
return false;
|
633
|
+
},
|
634
|
+
animationEndEvent: function () {
|
635
|
+
var
|
636
|
+
element = document.createElement('div'),
|
637
|
+
animations = {
|
638
|
+
animation: 'animationend',
|
639
|
+
OAnimation: 'oAnimationEnd',
|
640
|
+
MozAnimation: 'mozAnimationEnd',
|
641
|
+
WebkitAnimation: 'webkitAnimationEnd',
|
642
|
+
},
|
643
|
+
animation
|
644
|
+
;
|
645
|
+
for (animation in animations) {
|
646
|
+
if (element.style[animation] !== undefined) {
|
647
|
+
return animations[animation];
|
648
|
+
}
|
649
|
+
}
|
650
|
+
|
651
|
+
return false;
|
652
|
+
},
|
653
|
+
|
654
|
+
},
|
655
|
+
|
656
|
+
can: {
|
657
|
+
transition: function (forced) {
|
658
|
+
var
|
659
|
+
animation = settings.animation,
|
660
|
+
transitionExists = module.get.transitionExists(animation),
|
661
|
+
displayType = module.get.displayType(false),
|
662
|
+
elementClass,
|
663
|
+
tagName,
|
664
|
+
$clone,
|
665
|
+
currentAnimation,
|
666
|
+
inAnimation,
|
667
|
+
directionExists
|
668
|
+
;
|
669
|
+
if (transitionExists === undefined || forced) {
|
670
|
+
module.verbose('Determining whether animation exists');
|
671
|
+
elementClass = $module.attr('class');
|
672
|
+
tagName = $module.prop('tagName');
|
673
|
+
|
674
|
+
$clone = $('<' + tagName + ' />').addClass(elementClass).insertAfter($module);
|
675
|
+
currentAnimation = $clone
|
676
|
+
.addClass(animation)
|
677
|
+
.removeClass(className.inward)
|
678
|
+
.removeClass(className.outward)
|
679
|
+
.addClass(className.animating)
|
680
|
+
.addClass(className.transition)
|
681
|
+
.css('animationName')
|
682
|
+
;
|
683
|
+
$clone.detach().insertAfter($module);
|
684
|
+
inAnimation = $clone
|
685
|
+
.addClass(className.inward)
|
686
|
+
.css('animationName')
|
687
|
+
;
|
688
|
+
if (!displayType) {
|
689
|
+
$clone.detach().insertAfter($module);
|
690
|
+
displayType = $clone
|
691
|
+
.attr('class', elementClass)
|
692
|
+
.removeAttr('style')
|
693
|
+
.removeClass(className.hidden)
|
694
|
+
.removeClass(className.visible)
|
695
|
+
.show()
|
696
|
+
.css('display')
|
697
|
+
;
|
698
|
+
module.verbose('Determining final display state', displayType);
|
699
|
+
module.save.displayType(displayType);
|
700
|
+
}
|
701
|
+
|
702
|
+
$clone.remove();
|
703
|
+
if (currentAnimation !== inAnimation) {
|
704
|
+
module.debug('Direction exists for animation', animation);
|
705
|
+
directionExists = true;
|
706
|
+
} else if (currentAnimation === 'none' || !currentAnimation) {
|
707
|
+
module.debug('No animation defined in css', animation);
|
708
|
+
|
709
|
+
return;
|
710
|
+
} else {
|
711
|
+
module.debug('Static animation found', animation, displayType);
|
712
|
+
directionExists = false;
|
713
|
+
}
|
714
|
+
module.save.transitionExists(animation, directionExists);
|
715
|
+
}
|
716
|
+
|
717
|
+
return transitionExists !== undefined
|
718
|
+
? transitionExists
|
719
|
+
: directionExists;
|
720
|
+
},
|
721
|
+
animate: function () {
|
722
|
+
// can transition does not return a value if animation does not exist
|
723
|
+
return module.can.transition() !== undefined;
|
724
|
+
},
|
725
|
+
},
|
726
|
+
|
727
|
+
is: {
|
728
|
+
animating: function () {
|
729
|
+
return $module.hasClass(className.animating);
|
730
|
+
},
|
731
|
+
inward: function () {
|
732
|
+
return $module.hasClass(className.inward);
|
733
|
+
},
|
734
|
+
outward: function () {
|
735
|
+
return $module.hasClass(className.outward);
|
736
|
+
},
|
737
|
+
looping: function () {
|
738
|
+
return $module.hasClass(className.looping);
|
739
|
+
},
|
740
|
+
occurring: function (animation) {
|
741
|
+
animation = animation || settings.animation;
|
742
|
+
animation = '.' + animation.replace(' ', '.');
|
743
|
+
|
744
|
+
return $module.filter(animation).length > 0;
|
745
|
+
},
|
746
|
+
visible: function () {
|
747
|
+
return $module.is(':visible');
|
748
|
+
},
|
749
|
+
hidden: function () {
|
750
|
+
return $module.css('visibility') === 'hidden';
|
751
|
+
},
|
752
|
+
supported: function () {
|
753
|
+
return animationEnd !== false;
|
754
|
+
},
|
755
|
+
},
|
756
|
+
|
757
|
+
hide: function () {
|
758
|
+
if (settings.onHide.call(element) === false) {
|
759
|
+
module.verbose('Hide callback returned false cancelling hide');
|
760
|
+
|
761
|
+
return false;
|
762
|
+
}
|
763
|
+
module.verbose('Hiding element');
|
764
|
+
if (module.is.animating()) {
|
765
|
+
module.reset();
|
766
|
+
}
|
767
|
+
element.blur(); // IE will trigger focus change if element is not blurred before hiding
|
768
|
+
module.remove.display();
|
769
|
+
module.remove.visible();
|
770
|
+
settings.onBeforeHide.call(element, module.hideNow);
|
771
|
+
},
|
772
|
+
|
773
|
+
hideNow: function () {
|
774
|
+
module.set.hidden();
|
775
|
+
module.force.hidden();
|
776
|
+
settings.onHidden.call(element);
|
777
|
+
settings.onComplete.call(element);
|
778
|
+
},
|
779
|
+
|
780
|
+
show: function (display) {
|
781
|
+
if (module.force.visible() && settings.onShow.call(element) !== false) {
|
782
|
+
module.verbose('Showing element', display);
|
783
|
+
module.remove.hidden();
|
784
|
+
settings.onBeforeShow.call(element, module.showNow);
|
785
|
+
}
|
786
|
+
},
|
787
|
+
|
788
|
+
showNow: function () {
|
789
|
+
module.set.visible();
|
790
|
+
settings.onVisible.call(element);
|
791
|
+
settings.onComplete.call(element);
|
792
|
+
},
|
793
|
+
|
794
|
+
toggle: function () {
|
795
|
+
if (module.is.visible()) {
|
796
|
+
module.hide();
|
797
|
+
} else {
|
798
|
+
module.show();
|
799
|
+
}
|
800
|
+
},
|
801
|
+
|
802
|
+
stop: function () {
|
803
|
+
module.debug('Stopping current animation');
|
804
|
+
$module.triggerHandler(animationEnd);
|
805
|
+
},
|
806
|
+
|
807
|
+
stopAll: function () {
|
808
|
+
module.debug('Stopping all animation');
|
809
|
+
module.remove.queueCallback();
|
810
|
+
$module.triggerHandler(animationEnd);
|
811
|
+
},
|
812
|
+
|
813
|
+
clear: {
|
814
|
+
queue: function () {
|
815
|
+
module.debug('Clearing animation queue');
|
816
|
+
module.remove.queueCallback();
|
817
|
+
},
|
818
|
+
},
|
819
|
+
|
820
|
+
enable: function () {
|
821
|
+
module.verbose('Starting animation');
|
822
|
+
$module.removeClass(className.disabled);
|
823
|
+
},
|
824
|
+
|
825
|
+
disable: function () {
|
826
|
+
module.debug('Stopping animation');
|
827
|
+
$module.addClass(className.disabled);
|
828
|
+
},
|
829
|
+
|
830
|
+
setting: function (name, value) {
|
831
|
+
module.debug('Changing setting', name, value);
|
832
|
+
if ($.isPlainObject(name)) {
|
833
|
+
$.extend(true, settings, name);
|
834
|
+
} else if (value !== undefined) {
|
835
|
+
if ($.isPlainObject(settings[name])) {
|
836
|
+
$.extend(true, settings[name], value);
|
837
|
+
} else {
|
838
|
+
settings[name] = value;
|
839
|
+
}
|
840
|
+
} else {
|
841
|
+
return settings[name];
|
842
|
+
}
|
843
|
+
},
|
844
|
+
internal: function (name, value) {
|
845
|
+
if ($.isPlainObject(name)) {
|
846
|
+
$.extend(true, module, name);
|
847
|
+
} else if (value !== undefined) {
|
848
|
+
module[name] = value;
|
849
|
+
} else {
|
850
|
+
return module[name];
|
851
|
+
}
|
852
|
+
},
|
853
|
+
debug: function () {
|
854
|
+
if (!settings.silent && settings.debug) {
|
855
|
+
if (settings.performance) {
|
856
|
+
module.performance.log(arguments);
|
857
|
+
} else {
|
858
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
859
|
+
module.debug.apply(console, arguments);
|
860
|
+
}
|
861
|
+
}
|
862
|
+
},
|
863
|
+
verbose: function () {
|
864
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
865
|
+
if (settings.performance) {
|
866
|
+
module.performance.log(arguments);
|
867
|
+
} else {
|
868
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
869
|
+
module.verbose.apply(console, arguments);
|
870
|
+
}
|
871
|
+
}
|
872
|
+
},
|
873
|
+
error: function () {
|
874
|
+
if (!settings.silent) {
|
875
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
876
|
+
module.error.apply(console, arguments);
|
877
|
+
}
|
878
|
+
},
|
879
|
+
performance: {
|
880
|
+
log: function (message) {
|
881
|
+
var
|
882
|
+
currentTime,
|
883
|
+
executionTime,
|
884
|
+
previousTime
|
885
|
+
;
|
886
|
+
if (settings.performance) {
|
887
|
+
currentTime = Date.now();
|
888
|
+
previousTime = time || currentTime;
|
889
|
+
executionTime = currentTime - previousTime;
|
890
|
+
time = currentTime;
|
891
|
+
performance.push({
|
892
|
+
Name: message[0],
|
893
|
+
Arguments: [].slice.call(message, 1) || '',
|
894
|
+
Element: element,
|
895
|
+
'Execution Time': executionTime,
|
896
|
+
});
|
897
|
+
}
|
898
|
+
clearTimeout(module.performance.timer);
|
899
|
+
module.performance.timer = setTimeout(module.performance.display, 500);
|
900
|
+
},
|
901
|
+
display: function () {
|
902
|
+
var
|
903
|
+
title = settings.name + ':',
|
904
|
+
totalTime = 0
|
905
|
+
;
|
906
|
+
time = false;
|
907
|
+
clearTimeout(module.performance.timer);
|
908
|
+
$.each(performance, function (index, data) {
|
909
|
+
totalTime += data['Execution Time'];
|
910
|
+
});
|
911
|
+
title += ' ' + totalTime + 'ms';
|
912
|
+
if (moduleSelector) {
|
913
|
+
title += ' \'' + moduleSelector + '\'';
|
914
|
+
}
|
915
|
+
if ($allModules.length > 1) {
|
916
|
+
title += ' (' + $allModules.length + ')';
|
917
|
+
}
|
918
|
+
if (performance.length > 0) {
|
919
|
+
console.groupCollapsed(title);
|
920
|
+
if (console.table) {
|
921
|
+
console.table(performance);
|
922
|
+
} else {
|
923
|
+
$.each(performance, function (index, data) {
|
924
|
+
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
925
|
+
});
|
926
|
+
}
|
927
|
+
console.groupEnd();
|
928
|
+
}
|
929
|
+
performance = [];
|
930
|
+
},
|
931
|
+
},
|
932
|
+
// modified for transition to return invoke success
|
933
|
+
invoke: function (query, passedArguments, context) {
|
934
|
+
var
|
935
|
+
object = instance,
|
936
|
+
maxDepth,
|
937
|
+
found,
|
938
|
+
response
|
939
|
+
;
|
940
|
+
passedArguments = passedArguments || queryArguments;
|
941
|
+
context = context || element;
|
942
|
+
if (typeof query === 'string' && object !== undefined) {
|
943
|
+
query = query.split(/[ .]/);
|
944
|
+
maxDepth = query.length - 1;
|
945
|
+
$.each(query, function (depth, value) {
|
946
|
+
var camelCaseValue = depth !== maxDepth
|
947
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
948
|
+
: query
|
949
|
+
;
|
950
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
951
|
+
object = object[camelCaseValue];
|
952
|
+
} else if (object[camelCaseValue] !== undefined) {
|
953
|
+
found = object[camelCaseValue];
|
954
|
+
|
955
|
+
return false;
|
956
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
957
|
+
object = object[value];
|
958
|
+
} else if (object[value] !== undefined) {
|
959
|
+
found = object[value];
|
960
|
+
|
961
|
+
return false;
|
962
|
+
} else {
|
963
|
+
module.error(error.method, query);
|
964
|
+
|
965
|
+
return false;
|
966
|
+
}
|
967
|
+
});
|
968
|
+
}
|
969
|
+
if (isFunction(found)) {
|
970
|
+
response = found.apply(context, passedArguments);
|
971
|
+
} else if (found !== undefined) {
|
972
|
+
response = found;
|
973
|
+
}
|
974
|
+
|
975
|
+
if (Array.isArray(returnedValue)) {
|
976
|
+
returnedValue.push(response);
|
977
|
+
} else if (returnedValue !== undefined) {
|
978
|
+
returnedValue = [returnedValue, response];
|
979
|
+
} else if (response !== undefined) {
|
980
|
+
returnedValue = response;
|
981
|
+
}
|
982
|
+
|
983
|
+
return found !== undefined
|
984
|
+
? found
|
985
|
+
: false;
|
986
|
+
},
|
987
|
+
};
|
988
|
+
module.initialize();
|
989
|
+
});
|
990
|
+
|
991
|
+
return returnedValue !== undefined
|
992
|
+
? returnedValue
|
993
|
+
: this;
|
994
|
+
};
|
995
|
+
|
996
|
+
// Records if CSS transition is available
|
997
|
+
$.fn.transition.exists = {};
|
998
|
+
|
999
|
+
$.fn.transition.settings = {
|
1000
|
+
|
1001
|
+
// module info
|
1002
|
+
name: 'Transition',
|
1003
|
+
|
1004
|
+
// hide all output from this component regardless of other settings
|
1005
|
+
silent: false,
|
1006
|
+
|
1007
|
+
// debug content outputted to console
|
1008
|
+
debug: false,
|
1009
|
+
|
1010
|
+
// verbose debug output
|
1011
|
+
verbose: false,
|
1012
|
+
|
1013
|
+
// performance data output
|
1014
|
+
performance: true,
|
1015
|
+
|
1016
|
+
// event namespace
|
1017
|
+
namespace: 'transition',
|
1018
|
+
|
1019
|
+
// delay between animations in group
|
1020
|
+
interval: 0,
|
1021
|
+
|
1022
|
+
// whether group animations should be reversed
|
1023
|
+
reverse: 'auto',
|
1024
|
+
|
1025
|
+
// animation callback event
|
1026
|
+
onStart: function () {},
|
1027
|
+
onComplete: function () {},
|
1028
|
+
onShow: function () {},
|
1029
|
+
onBeforeShow: function (callback) {
|
1030
|
+
callback.call(this);
|
416
1031
|
},
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
;
|
423
|
-
if(animation) {
|
424
|
-
$module
|
425
|
-
.removeClass(animation)
|
426
|
-
;
|
427
|
-
module.verbose('Removing animation class', module.cache);
|
428
|
-
}
|
429
|
-
module.remove.duration();
|
430
|
-
}
|
1032
|
+
onVisible: function () {},
|
1033
|
+
onHide: function () {},
|
1034
|
+
onHidden: function () {},
|
1035
|
+
onBeforeHide: function (callback) {
|
1036
|
+
callback.call(this);
|
431
1037
|
},
|
432
1038
|
|
433
|
-
|
434
|
-
|
435
|
-
var
|
436
|
-
duration = module.get.duration()
|
437
|
-
;
|
438
|
-
module.timer = setTimeout(function() {
|
439
|
-
$module.triggerHandler(animationEnd);
|
440
|
-
}, duration + settings.failSafeDelay);
|
441
|
-
module.verbose('Adding fail safe timer', module.timer);
|
442
|
-
}
|
443
|
-
},
|
1039
|
+
// whether timeout should be used to ensure callback fires in cases animationend does not
|
1040
|
+
useFailSafe: true,
|
444
1041
|
|
445
|
-
|
446
|
-
|
447
|
-
$module.removeClass(className.animating);
|
448
|
-
},
|
449
|
-
animationCallbacks: function() {
|
450
|
-
module.remove.queueCallback();
|
451
|
-
module.remove.completeCallback();
|
452
|
-
},
|
453
|
-
queueCallback: function() {
|
454
|
-
$module.off('.queue' + eventNamespace);
|
455
|
-
},
|
456
|
-
completeCallback: function() {
|
457
|
-
$module.off('.complete' + eventNamespace);
|
458
|
-
},
|
459
|
-
display: function() {
|
460
|
-
$module.css('display', '');
|
461
|
-
},
|
462
|
-
direction: function() {
|
463
|
-
$module
|
464
|
-
.removeClass(className.inward)
|
465
|
-
.removeClass(className.outward)
|
466
|
-
;
|
467
|
-
},
|
468
|
-
duration: function() {
|
469
|
-
$module
|
470
|
-
.css('animation-duration', '')
|
471
|
-
;
|
472
|
-
},
|
473
|
-
failSafe: function() {
|
474
|
-
module.verbose('Removing fail safe timer', module.timer);
|
475
|
-
if(module.timer) {
|
476
|
-
clearTimeout(module.timer);
|
477
|
-
}
|
478
|
-
},
|
479
|
-
hidden: function() {
|
480
|
-
$module.removeClass(className.hidden);
|
481
|
-
},
|
482
|
-
visible: function() {
|
483
|
-
$module.removeClass(className.visible);
|
484
|
-
},
|
485
|
-
looping: function() {
|
486
|
-
module.debug('Transitions are no longer looping');
|
487
|
-
if( module.is.looping() ) {
|
488
|
-
module.reset();
|
489
|
-
$module
|
490
|
-
.removeClass(className.looping)
|
491
|
-
;
|
492
|
-
}
|
493
|
-
},
|
494
|
-
transition: function() {
|
495
|
-
$module
|
496
|
-
.removeClass(className.transition)
|
497
|
-
.removeClass(className.visible)
|
498
|
-
.removeClass(className.hidden)
|
499
|
-
;
|
500
|
-
}
|
501
|
-
},
|
502
|
-
get: {
|
503
|
-
settings: function(animation, duration, onComplete) {
|
504
|
-
// single settings object
|
505
|
-
if(typeof animation == 'object') {
|
506
|
-
return $.extend(true, {}, $.fn.transition.settings, animation);
|
507
|
-
}
|
508
|
-
// all arguments provided
|
509
|
-
else if(typeof onComplete == 'function') {
|
510
|
-
return $.extend({}, $.fn.transition.settings, {
|
511
|
-
animation : animation,
|
512
|
-
onComplete : onComplete,
|
513
|
-
duration : duration
|
514
|
-
});
|
515
|
-
}
|
516
|
-
// only duration provided
|
517
|
-
else if(typeof duration == 'string' || typeof duration == 'number') {
|
518
|
-
return $.extend({}, $.fn.transition.settings, {
|
519
|
-
animation : animation,
|
520
|
-
duration : duration
|
521
|
-
});
|
522
|
-
}
|
523
|
-
// duration is actually settings object
|
524
|
-
else if(typeof duration == 'object') {
|
525
|
-
return $.extend({}, $.fn.transition.settings, duration, {
|
526
|
-
animation : animation
|
527
|
-
});
|
528
|
-
}
|
529
|
-
// duration is actually callback
|
530
|
-
else if(typeof duration == 'function') {
|
531
|
-
return $.extend({}, $.fn.transition.settings, {
|
532
|
-
animation : animation,
|
533
|
-
onComplete : duration
|
534
|
-
});
|
535
|
-
}
|
536
|
-
// only animation provided
|
537
|
-
else {
|
538
|
-
return $.extend({}, $.fn.transition.settings, {
|
539
|
-
animation : animation
|
540
|
-
});
|
541
|
-
}
|
542
|
-
},
|
543
|
-
animationClass: function(animation) {
|
544
|
-
var
|
545
|
-
animationClass = animation || settings.animation,
|
546
|
-
directionClass = (module.can.transition() && !module.has.direction())
|
547
|
-
? module.get.direction() + ' '
|
548
|
-
: ''
|
549
|
-
;
|
550
|
-
return className.animating + ' '
|
551
|
-
+ className.transition + ' '
|
552
|
-
+ directionClass
|
553
|
-
+ animationClass
|
554
|
-
;
|
555
|
-
},
|
556
|
-
currentAnimation: function() {
|
557
|
-
return (module.cache && module.cache.animation !== undefined)
|
558
|
-
? module.cache.animation
|
559
|
-
: false
|
560
|
-
;
|
561
|
-
},
|
562
|
-
currentDirection: function() {
|
563
|
-
return module.is.inward()
|
564
|
-
? className.inward
|
565
|
-
: className.outward
|
566
|
-
;
|
567
|
-
},
|
568
|
-
direction: function() {
|
569
|
-
return module.is.hidden() || !module.is.visible()
|
570
|
-
? className.inward
|
571
|
-
: className.outward
|
572
|
-
;
|
573
|
-
},
|
574
|
-
animationDirection: function(animation) {
|
575
|
-
var
|
576
|
-
direction
|
577
|
-
;
|
578
|
-
animation = animation || settings.animation;
|
579
|
-
if(typeof animation === 'string') {
|
580
|
-
animation = animation.split(' ');
|
581
|
-
// search animation name for out/in class
|
582
|
-
$.each(animation, function(index, word){
|
583
|
-
if(word === className.inward) {
|
584
|
-
direction = className.inward;
|
585
|
-
}
|
586
|
-
else if(word === className.outward) {
|
587
|
-
direction = className.outward;
|
588
|
-
}
|
589
|
-
});
|
590
|
-
}
|
591
|
-
// return found direction
|
592
|
-
if(direction) {
|
593
|
-
return direction;
|
594
|
-
}
|
595
|
-
return false;
|
596
|
-
},
|
597
|
-
duration: function(duration) {
|
598
|
-
duration = duration || settings.duration;
|
599
|
-
if(duration === false) {
|
600
|
-
duration = $module.css('animation-duration') || 0;
|
601
|
-
}
|
602
|
-
return (typeof duration === 'string')
|
603
|
-
? (duration.indexOf('ms') > -1)
|
604
|
-
? parseFloat(duration)
|
605
|
-
: parseFloat(duration) * 1000
|
606
|
-
: duration
|
607
|
-
;
|
608
|
-
},
|
609
|
-
displayType: function(shouldDetermine) {
|
610
|
-
shouldDetermine = (shouldDetermine !== undefined)
|
611
|
-
? shouldDetermine
|
612
|
-
: true
|
613
|
-
;
|
614
|
-
if(settings.displayType) {
|
615
|
-
return settings.displayType;
|
616
|
-
}
|
617
|
-
if(shouldDetermine && $module.data(metadata.displayType) === undefined) {
|
618
|
-
var currentDisplay = $module.css('display');
|
619
|
-
if(currentDisplay === '' || currentDisplay === 'none'){
|
620
|
-
// create fake element to determine display state
|
621
|
-
module.can.transition(true);
|
622
|
-
} else {
|
623
|
-
module.save.displayType(currentDisplay);
|
624
|
-
}
|
625
|
-
}
|
626
|
-
return $module.data(metadata.displayType);
|
627
|
-
},
|
628
|
-
userStyle: function(style) {
|
629
|
-
style = style || $module.attr('style') || '';
|
630
|
-
return style.replace(/display.*?;/, '');
|
631
|
-
},
|
632
|
-
transitionExists: function(animation) {
|
633
|
-
return $.fn.transition.exists[animation];
|
634
|
-
},
|
635
|
-
animationStartEvent: function() {
|
636
|
-
var
|
637
|
-
element = document.createElement('div'),
|
638
|
-
animations = {
|
639
|
-
'animation' :'animationstart',
|
640
|
-
'OAnimation' :'oAnimationStart',
|
641
|
-
'MozAnimation' :'mozAnimationStart',
|
642
|
-
'WebkitAnimation' :'webkitAnimationStart'
|
643
|
-
},
|
644
|
-
animation
|
645
|
-
;
|
646
|
-
for(animation in animations){
|
647
|
-
if( element.style[animation] !== undefined ){
|
648
|
-
return animations[animation];
|
649
|
-
}
|
650
|
-
}
|
651
|
-
return false;
|
652
|
-
},
|
653
|
-
animationEndEvent: function() {
|
654
|
-
var
|
655
|
-
element = document.createElement('div'),
|
656
|
-
animations = {
|
657
|
-
'animation' :'animationend',
|
658
|
-
'OAnimation' :'oAnimationEnd',
|
659
|
-
'MozAnimation' :'mozAnimationEnd',
|
660
|
-
'WebkitAnimation' :'webkitAnimationEnd'
|
661
|
-
},
|
662
|
-
animation
|
663
|
-
;
|
664
|
-
for(animation in animations){
|
665
|
-
if( element.style[animation] !== undefined ){
|
666
|
-
return animations[animation];
|
667
|
-
}
|
668
|
-
}
|
669
|
-
return false;
|
670
|
-
}
|
1042
|
+
// delay in ms for fail safe
|
1043
|
+
failSafeDelay: 100,
|
671
1044
|
|
672
|
-
|
1045
|
+
// whether EXACT animation can occur twice in a row
|
1046
|
+
allowRepeats: false,
|
673
1047
|
|
674
|
-
|
675
|
-
|
676
|
-
var
|
677
|
-
animation = settings.animation,
|
678
|
-
transitionExists = module.get.transitionExists(animation),
|
679
|
-
displayType = module.get.displayType(false),
|
680
|
-
elementClass,
|
681
|
-
tagName,
|
682
|
-
$clone,
|
683
|
-
currentAnimation,
|
684
|
-
inAnimation,
|
685
|
-
directionExists
|
686
|
-
;
|
687
|
-
if( transitionExists === undefined || forced) {
|
688
|
-
module.verbose('Determining whether animation exists');
|
689
|
-
elementClass = $module.attr('class');
|
690
|
-
tagName = $module.prop('tagName');
|
691
|
-
|
692
|
-
$clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module);
|
693
|
-
currentAnimation = $clone
|
694
|
-
.addClass(animation)
|
695
|
-
.removeClass(className.inward)
|
696
|
-
.removeClass(className.outward)
|
697
|
-
.addClass(className.animating)
|
698
|
-
.addClass(className.transition)
|
699
|
-
.css('animationName')
|
700
|
-
;
|
701
|
-
$clone.detach().insertAfter($module);
|
702
|
-
inAnimation = $clone
|
703
|
-
.addClass(className.inward)
|
704
|
-
.css('animationName')
|
705
|
-
;
|
706
|
-
if(!displayType) {
|
707
|
-
$clone.detach().insertAfter($module);
|
708
|
-
displayType = $clone
|
709
|
-
.attr('class', elementClass)
|
710
|
-
.removeAttr('style')
|
711
|
-
.removeClass(className.hidden)
|
712
|
-
.removeClass(className.visible)
|
713
|
-
.show()
|
714
|
-
.css('display')
|
715
|
-
;
|
716
|
-
module.verbose('Determining final display state', displayType);
|
717
|
-
module.save.displayType(displayType);
|
718
|
-
}
|
719
|
-
|
720
|
-
$clone.remove();
|
721
|
-
if(currentAnimation != inAnimation) {
|
722
|
-
module.debug('Direction exists for animation', animation);
|
723
|
-
directionExists = true;
|
724
|
-
}
|
725
|
-
else if(currentAnimation == 'none' || !currentAnimation) {
|
726
|
-
module.debug('No animation defined in css', animation);
|
727
|
-
return;
|
728
|
-
}
|
729
|
-
else {
|
730
|
-
module.debug('Static animation found', animation, displayType);
|
731
|
-
directionExists = false;
|
732
|
-
}
|
733
|
-
module.save.transitionExists(animation, directionExists);
|
734
|
-
}
|
735
|
-
return (transitionExists !== undefined)
|
736
|
-
? transitionExists
|
737
|
-
: directionExists
|
738
|
-
;
|
739
|
-
},
|
740
|
-
animate: function() {
|
741
|
-
// can transition does not return a value if animation does not exist
|
742
|
-
return (module.can.transition() !== undefined);
|
743
|
-
}
|
744
|
-
},
|
1048
|
+
// Override final display type on visible
|
1049
|
+
displayType: false,
|
745
1050
|
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
},
|
750
|
-
inward: function() {
|
751
|
-
return $module.hasClass(className.inward);
|
752
|
-
},
|
753
|
-
outward: function() {
|
754
|
-
return $module.hasClass(className.outward);
|
755
|
-
},
|
756
|
-
looping: function() {
|
757
|
-
return $module.hasClass(className.looping);
|
758
|
-
},
|
759
|
-
occurring: function(animation) {
|
760
|
-
animation = animation || settings.animation;
|
761
|
-
animation = '.' + animation.replace(' ', '.');
|
762
|
-
return ( $module.filter(animation).length > 0 );
|
763
|
-
},
|
764
|
-
visible: function() {
|
765
|
-
return $module.is(':visible');
|
766
|
-
},
|
767
|
-
hidden: function() {
|
768
|
-
return $module.css('visibility') === 'hidden';
|
769
|
-
},
|
770
|
-
supported: function() {
|
771
|
-
return(animationEnd !== false);
|
772
|
-
}
|
773
|
-
},
|
1051
|
+
// animation duration
|
1052
|
+
animation: 'fade',
|
1053
|
+
duration: false,
|
774
1054
|
|
775
|
-
|
776
|
-
|
777
|
-
module.verbose('Hide callback returned false cancelling hide');
|
778
|
-
return false;
|
779
|
-
}
|
780
|
-
module.verbose('Hiding element');
|
781
|
-
if( module.is.animating() ) {
|
782
|
-
module.reset();
|
783
|
-
}
|
784
|
-
element.blur(); // IE will trigger focus change if element is not blurred before hiding
|
785
|
-
module.remove.display();
|
786
|
-
module.remove.visible();
|
787
|
-
settings.onBeforeHide.call(element, module.hideNow);
|
788
|
-
},
|
1055
|
+
// new animations will occur after previous ones
|
1056
|
+
queue: true,
|
789
1057
|
|
790
|
-
|
791
|
-
|
792
|
-
module.force.hidden();
|
793
|
-
settings.onHidden.call(element);
|
794
|
-
settings.onComplete.call(element);
|
795
|
-
},
|
796
|
-
|
797
|
-
show: function(display) {
|
798
|
-
if(module.force.visible() && settings.onShow.call(element) !== false) {
|
799
|
-
module.verbose('Showing element', display);
|
800
|
-
module.remove.hidden();
|
801
|
-
settings.onBeforeShow.call(element, module.showNow);
|
802
|
-
}
|
803
|
-
},
|
804
|
-
|
805
|
-
showNow: function(){
|
806
|
-
module.set.visible();
|
807
|
-
settings.onVisible.call(element);
|
808
|
-
settings.onComplete.call(element);
|
809
|
-
},
|
810
|
-
|
811
|
-
toggle: function() {
|
812
|
-
if( module.is.visible() ) {
|
813
|
-
module.hide();
|
814
|
-
}
|
815
|
-
else {
|
816
|
-
module.show();
|
817
|
-
}
|
818
|
-
},
|
819
|
-
|
820
|
-
stop: function() {
|
821
|
-
module.debug('Stopping current animation');
|
822
|
-
$module.triggerHandler(animationEnd);
|
823
|
-
},
|
824
|
-
|
825
|
-
stopAll: function() {
|
826
|
-
module.debug('Stopping all animation');
|
827
|
-
module.remove.queueCallback();
|
828
|
-
$module.triggerHandler(animationEnd);
|
829
|
-
},
|
1058
|
+
// whether initially inline hidden objects should be skipped for transition
|
1059
|
+
skipInlineHidden: false,
|
830
1060
|
|
831
|
-
|
832
|
-
|
833
|
-
module.debug('Clearing animation queue');
|
834
|
-
module.remove.queueCallback();
|
835
|
-
}
|
1061
|
+
metadata: {
|
1062
|
+
displayType: 'display',
|
836
1063
|
},
|
837
1064
|
|
838
|
-
|
839
|
-
|
840
|
-
|
1065
|
+
className: {
|
1066
|
+
animating: 'animating',
|
1067
|
+
disabled: 'disabled',
|
1068
|
+
hidden: 'hidden',
|
1069
|
+
inward: 'in',
|
1070
|
+
loading: 'loading',
|
1071
|
+
looping: 'looping',
|
1072
|
+
outward: 'out',
|
1073
|
+
transition: 'transition',
|
1074
|
+
visible: 'visible',
|
841
1075
|
},
|
842
1076
|
|
843
|
-
|
844
|
-
|
845
|
-
|
1077
|
+
// possible errors
|
1078
|
+
error: {
|
1079
|
+
noAnimation: 'Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.',
|
1080
|
+
method: 'The method you called is not defined',
|
1081
|
+
support: 'This browser does not support CSS animations',
|
846
1082
|
},
|
847
1083
|
|
848
|
-
|
849
|
-
|
850
|
-
if( $.isPlainObject(name) ) {
|
851
|
-
$.extend(true, settings, name);
|
852
|
-
}
|
853
|
-
else if(value !== undefined) {
|
854
|
-
if($.isPlainObject(settings[name])) {
|
855
|
-
$.extend(true, settings[name], value);
|
856
|
-
}
|
857
|
-
else {
|
858
|
-
settings[name] = value;
|
859
|
-
}
|
860
|
-
}
|
861
|
-
else {
|
862
|
-
return settings[name];
|
863
|
-
}
|
864
|
-
},
|
865
|
-
internal: function(name, value) {
|
866
|
-
if( $.isPlainObject(name) ) {
|
867
|
-
$.extend(true, module, name);
|
868
|
-
}
|
869
|
-
else if(value !== undefined) {
|
870
|
-
module[name] = value;
|
871
|
-
}
|
872
|
-
else {
|
873
|
-
return module[name];
|
874
|
-
}
|
875
|
-
},
|
876
|
-
debug: function() {
|
877
|
-
if(!settings.silent && settings.debug) {
|
878
|
-
if(settings.performance) {
|
879
|
-
module.performance.log(arguments);
|
880
|
-
}
|
881
|
-
else {
|
882
|
-
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
883
|
-
module.debug.apply(console, arguments);
|
884
|
-
}
|
885
|
-
}
|
886
|
-
},
|
887
|
-
verbose: function() {
|
888
|
-
if(!settings.silent && settings.verbose && settings.debug) {
|
889
|
-
if(settings.performance) {
|
890
|
-
module.performance.log(arguments);
|
891
|
-
}
|
892
|
-
else {
|
893
|
-
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
894
|
-
module.verbose.apply(console, arguments);
|
895
|
-
}
|
896
|
-
}
|
897
|
-
},
|
898
|
-
error: function() {
|
899
|
-
if(!settings.silent) {
|
900
|
-
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
901
|
-
module.error.apply(console, arguments);
|
902
|
-
}
|
903
|
-
},
|
904
|
-
performance: {
|
905
|
-
log: function(message) {
|
906
|
-
var
|
907
|
-
currentTime,
|
908
|
-
executionTime,
|
909
|
-
previousTime
|
910
|
-
;
|
911
|
-
if(settings.performance) {
|
912
|
-
currentTime = new Date().getTime();
|
913
|
-
previousTime = time || currentTime;
|
914
|
-
executionTime = currentTime - previousTime;
|
915
|
-
time = currentTime;
|
916
|
-
performance.push({
|
917
|
-
'Name' : message[0],
|
918
|
-
'Arguments' : [].slice.call(message, 1) || '',
|
919
|
-
'Element' : element,
|
920
|
-
'Execution Time' : executionTime
|
921
|
-
});
|
922
|
-
}
|
923
|
-
clearTimeout(module.performance.timer);
|
924
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
925
|
-
},
|
926
|
-
display: function() {
|
927
|
-
var
|
928
|
-
title = settings.name + ':',
|
929
|
-
totalTime = 0
|
930
|
-
;
|
931
|
-
time = false;
|
932
|
-
clearTimeout(module.performance.timer);
|
933
|
-
$.each(performance, function(index, data) {
|
934
|
-
totalTime += data['Execution Time'];
|
935
|
-
});
|
936
|
-
title += ' ' + totalTime + 'ms';
|
937
|
-
if(moduleSelector) {
|
938
|
-
title += ' \'' + moduleSelector + '\'';
|
939
|
-
}
|
940
|
-
if($allModules.length > 1) {
|
941
|
-
title += ' ' + '(' + $allModules.length + ')';
|
942
|
-
}
|
943
|
-
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
944
|
-
console.groupCollapsed(title);
|
945
|
-
if(console.table) {
|
946
|
-
console.table(performance);
|
947
|
-
}
|
948
|
-
else {
|
949
|
-
$.each(performance, function(index, data) {
|
950
|
-
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
951
|
-
});
|
952
|
-
}
|
953
|
-
console.groupEnd();
|
954
|
-
}
|
955
|
-
performance = [];
|
956
|
-
}
|
957
|
-
},
|
958
|
-
// modified for transition to return invoke success
|
959
|
-
invoke: function(query, passedArguments, context) {
|
960
|
-
var
|
961
|
-
object = instance,
|
962
|
-
maxDepth,
|
963
|
-
found,
|
964
|
-
response
|
965
|
-
;
|
966
|
-
passedArguments = passedArguments || queryArguments;
|
967
|
-
context = context || element;
|
968
|
-
if(typeof query == 'string' && object !== undefined) {
|
969
|
-
query = query.split(/[\. ]/);
|
970
|
-
maxDepth = query.length - 1;
|
971
|
-
$.each(query, function(depth, value) {
|
972
|
-
var camelCaseValue = (depth != maxDepth)
|
973
|
-
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
974
|
-
: query
|
975
|
-
;
|
976
|
-
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
977
|
-
object = object[camelCaseValue];
|
978
|
-
}
|
979
|
-
else if( object[camelCaseValue] !== undefined ) {
|
980
|
-
found = object[camelCaseValue];
|
981
|
-
return false;
|
982
|
-
}
|
983
|
-
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
984
|
-
object = object[value];
|
985
|
-
}
|
986
|
-
else if( object[value] !== undefined ) {
|
987
|
-
found = object[value];
|
988
|
-
return false;
|
989
|
-
}
|
990
|
-
else {
|
991
|
-
return false;
|
992
|
-
}
|
993
|
-
});
|
994
|
-
}
|
995
|
-
if ( $.isFunction( found ) ) {
|
996
|
-
response = found.apply(context, passedArguments);
|
997
|
-
}
|
998
|
-
else if(found !== undefined) {
|
999
|
-
response = found;
|
1000
|
-
}
|
1001
|
-
|
1002
|
-
if(Array.isArray(returnedValue)) {
|
1003
|
-
returnedValue.push(response);
|
1004
|
-
}
|
1005
|
-
else if(returnedValue !== undefined) {
|
1006
|
-
returnedValue = [returnedValue, response];
|
1007
|
-
}
|
1008
|
-
else if(response !== undefined) {
|
1009
|
-
returnedValue = response;
|
1010
|
-
}
|
1011
|
-
return (found !== undefined)
|
1012
|
-
? found
|
1013
|
-
: false
|
1014
|
-
;
|
1015
|
-
}
|
1016
|
-
};
|
1017
|
-
module.initialize();
|
1018
|
-
})
|
1019
|
-
;
|
1020
|
-
return (returnedValue !== undefined)
|
1021
|
-
? returnedValue
|
1022
|
-
: this
|
1023
|
-
;
|
1024
|
-
};
|
1025
|
-
|
1026
|
-
// Records if CSS transition is available
|
1027
|
-
$.fn.transition.exists = {};
|
1028
|
-
|
1029
|
-
$.fn.transition.settings = {
|
1030
|
-
|
1031
|
-
// module info
|
1032
|
-
name : 'Transition',
|
1033
|
-
|
1034
|
-
// hide all output from this component regardless of other settings
|
1035
|
-
silent : false,
|
1036
|
-
|
1037
|
-
// debug content outputted to console
|
1038
|
-
debug : false,
|
1039
|
-
|
1040
|
-
// verbose debug output
|
1041
|
-
verbose : false,
|
1042
|
-
|
1043
|
-
// performance data output
|
1044
|
-
performance : true,
|
1045
|
-
|
1046
|
-
// event namespace
|
1047
|
-
namespace : 'transition',
|
1048
|
-
|
1049
|
-
// delay between animations in group
|
1050
|
-
interval : 0,
|
1051
|
-
|
1052
|
-
// whether group animations should be reversed
|
1053
|
-
reverse : 'auto',
|
1054
|
-
|
1055
|
-
// animation callback event
|
1056
|
-
onStart : function() {},
|
1057
|
-
onComplete : function() {},
|
1058
|
-
onShow : function() {},
|
1059
|
-
onBeforeShow : function(callback) {callback.call(this)},
|
1060
|
-
onVisible : function() {},
|
1061
|
-
onHide : function() {},
|
1062
|
-
onHidden : function() {},
|
1063
|
-
onBeforeHide : function(callback) {callback.call(this)},
|
1064
|
-
|
1065
|
-
// whether timeout should be used to ensure callback fires in cases animationend does not
|
1066
|
-
useFailSafe : true,
|
1067
|
-
|
1068
|
-
// delay in ms for fail safe
|
1069
|
-
failSafeDelay : 100,
|
1070
|
-
|
1071
|
-
// whether EXACT animation can occur twice in a row
|
1072
|
-
allowRepeats : false,
|
1073
|
-
|
1074
|
-
// Override final display type on visible
|
1075
|
-
displayType : false,
|
1076
|
-
|
1077
|
-
// animation duration
|
1078
|
-
animation : 'fade',
|
1079
|
-
duration : false,
|
1080
|
-
|
1081
|
-
// new animations will occur after previous ones
|
1082
|
-
queue : true,
|
1083
|
-
|
1084
|
-
// whether initially inline hidden objects should be skipped for transition
|
1085
|
-
skipInlineHidden: false,
|
1086
|
-
|
1087
|
-
metadata : {
|
1088
|
-
displayType: 'display'
|
1089
|
-
},
|
1090
|
-
|
1091
|
-
className : {
|
1092
|
-
animating : 'animating',
|
1093
|
-
disabled : 'disabled',
|
1094
|
-
hidden : 'hidden',
|
1095
|
-
inward : 'in',
|
1096
|
-
loading : 'loading',
|
1097
|
-
looping : 'looping',
|
1098
|
-
outward : 'out',
|
1099
|
-
transition : 'transition',
|
1100
|
-
visible : 'visible'
|
1101
|
-
},
|
1102
|
-
|
1103
|
-
// possible errors
|
1104
|
-
error: {
|
1105
|
-
noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production.',
|
1106
|
-
repeated : 'That animation is already occurring, cancelling repeated animation',
|
1107
|
-
method : 'The method you called is not defined',
|
1108
|
-
support : 'This browser does not support CSS animations'
|
1109
|
-
}
|
1110
|
-
|
1111
|
-
};
|
1112
|
-
|
1113
|
-
|
1114
|
-
})( jQuery, window, document );
|
1084
|
+
};
|
1085
|
+
})(jQuery, window, document);
|