fomantic-ui-sass 2.8.8.1 → 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/CHANGELOG.md +4 -0
- 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.eot +0 -0
- data/app/assets/fonts/semantic-ui/brand-icons.svg +41 -6
- data/app/assets/fonts/semantic-ui/brand-icons.ttf +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.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +245 -7
- data/app/assets/fonts/semantic-ui/icons.ttf +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.eot +0 -0
- data/app/assets/fonts/semantic-ui/outline-icons.svg +2 -2
- data/app/assets/fonts/semantic-ui/outline-icons.ttf +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 -590
- data/app/assets/javascripts/semantic-ui/api.js +1153 -1116
- data/app/assets/javascripts/semantic-ui/calendar.js +1941 -1698
- data/app/assets/javascripts/semantic-ui/checkbox.js +862 -854
- data/app/assets/javascripts/semantic-ui/dimmer.js +697 -713
- data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4192
- data/app/assets/javascripts/semantic-ui/embed.js +646 -672
- data/app/assets/javascripts/semantic-ui/flyout.js +1579 -0
- data/app/assets/javascripts/semantic-ui/form.js +2024 -2000
- data/app/assets/javascripts/semantic-ui/modal.js +1546 -1384
- data/app/assets/javascripts/semantic-ui/nag.js +521 -527
- data/app/assets/javascripts/semantic-ui/popup.js +1457 -1463
- data/app/assets/javascripts/semantic-ui/progress.js +970 -995
- data/app/assets/javascripts/semantic-ui/rating.js +508 -520
- data/app/assets/javascripts/semantic-ui/search.js +1521 -1508
- data/app/assets/javascripts/semantic-ui/shape.js +784 -811
- data/app/assets/javascripts/semantic-ui/sidebar.js +1061 -1002
- data/app/assets/javascripts/semantic-ui/site.js +437 -477
- data/app/assets/javascripts/semantic-ui/slider.js +1311 -1297
- data/app/assets/javascripts/semantic-ui/state.js +639 -658
- data/app/assets/javascripts/semantic-ui/sticky.js +848 -891
- data/app/assets/javascripts/semantic-ui/tab.js +895 -941
- data/app/assets/javascripts/semantic-ui/toast.js +911 -851
- data/app/assets/javascripts/semantic-ui/transition.js +1049 -1073
- 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 +389 -407
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +203 -345
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +372 -501
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +154 -226
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +2065 -880
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +867 -1232
- data/app/assets/stylesheets/semantic-ui/elements/_container.scss +101 -6
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +75 -93
- data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +11148 -9190
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1037 -929
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +124 -146
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +2728 -2759
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +982 -163
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +432 -479
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +80 -101
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +452 -540
- data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +56 -76
- 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 +263 -255
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +106 -179
- data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +14 -18
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +132 -48
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +196 -74
- data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +43 -29
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +210 -280
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +78 -182
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +339 -423
- data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +24 -35
- data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +546 -0
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +150 -153
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +530 -310
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +88 -168
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +73 -102
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +126 -215
- data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +110 -138
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +16 -20
- data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +111 -141
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +39 -50
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +949 -458
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +44 -62
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +50 -72
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +89 -136
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +78 -119
- data/lib/fomantic/ui/sass/version.rb +2 -2
- data/tasks/converter.rb +1 -1
- metadata +21 -3
@@ -1,1109 +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.animate);
|
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) * settings.interval
|
158
|
-
: index * settings.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
|
-
},
|
306
|
-
|
307
|
-
set: {
|
308
|
-
animating: function(animation) {
|
309
|
-
// remove previous callbacks
|
310
|
-
module.remove.completeCallback();
|
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
|
-
},
|
383
|
-
|
384
|
-
start: {
|
385
|
-
animation: function(animationClass) {
|
386
|
-
animationClass = animationClass || module.get.animationClass();
|
387
|
-
module.debug('Starting tween', animationClass);
|
388
|
-
$module
|
389
|
-
.addClass(animationClass)
|
390
|
-
.one(animationEnd + '.complete' + eventNamespace, module.complete)
|
391
|
-
;
|
392
|
-
if(settings.useFailSafe) {
|
393
|
-
module.add.failSafe();
|
394
|
-
}
|
395
|
-
module.set.duration(settings.duration);
|
396
|
-
settings.onStart.call(element);
|
397
|
-
}
|
398
|
-
},
|
399
|
-
|
400
|
-
save: {
|
401
|
-
animation: function(animation) {
|
402
|
-
if(!module.cache) {
|
403
|
-
module.cache = {};
|
404
|
-
}
|
405
|
-
module.cache.animation = animation;
|
406
|
-
},
|
407
|
-
displayType: function(displayType) {
|
408
|
-
if(displayType !== 'none') {
|
409
|
-
$module.data(metadata.displayType, displayType);
|
410
|
-
}
|
411
|
-
},
|
412
|
-
transitionExists: function(animation, exists) {
|
413
|
-
$.fn.transition.exists[animation] = exists;
|
414
|
-
module.verbose('Saving existence of transition', animation, exists);
|
415
|
-
}
|
416
|
-
},
|
417
|
-
|
418
|
-
restore: {
|
419
|
-
conditions: function() {
|
420
|
-
var
|
421
|
-
animation = module.get.currentAnimation()
|
422
|
-
;
|
423
|
-
if(animation) {
|
424
|
-
$module
|
425
|
-
.removeClass(animation)
|
426
|
-
;
|
427
|
-
module.verbose('Removing animation class', module.cache);
|
428
|
-
}
|
429
|
-
module.remove.duration();
|
430
|
-
}
|
431
|
-
},
|
42
|
+
// set at run time
|
43
|
+
settings,
|
44
|
+
instance,
|
432
45
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
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
|
-
},
|
46
|
+
error,
|
47
|
+
className,
|
48
|
+
metadata,
|
49
|
+
animationEnd,
|
444
50
|
|
445
|
-
|
446
|
-
|
447
|
-
|
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
|
51
|
+
moduleNamespace,
|
52
|
+
eventNamespace,
|
53
|
+
module
|
560
54
|
;
|
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
|
-
}
|
671
55
|
|
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);
|
672
1031
|
},
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
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
|
-
inAnimation = $clone
|
702
|
-
.addClass(className.inward)
|
703
|
-
.css('animationName')
|
704
|
-
;
|
705
|
-
if(!displayType) {
|
706
|
-
displayType = $clone
|
707
|
-
.attr('class', elementClass)
|
708
|
-
.removeAttr('style')
|
709
|
-
.removeClass(className.hidden)
|
710
|
-
.removeClass(className.visible)
|
711
|
-
.show()
|
712
|
-
.css('display')
|
713
|
-
;
|
714
|
-
module.verbose('Determining final display state', displayType);
|
715
|
-
module.save.displayType(displayType);
|
716
|
-
}
|
717
|
-
|
718
|
-
$clone.remove();
|
719
|
-
if(currentAnimation != inAnimation) {
|
720
|
-
module.debug('Direction exists for animation', animation);
|
721
|
-
directionExists = true;
|
722
|
-
}
|
723
|
-
else if(currentAnimation == 'none' || !currentAnimation) {
|
724
|
-
module.debug('No animation defined in css', animation);
|
725
|
-
return;
|
726
|
-
}
|
727
|
-
else {
|
728
|
-
module.debug('Static animation found', animation, displayType);
|
729
|
-
directionExists = false;
|
730
|
-
}
|
731
|
-
module.save.transitionExists(animation, directionExists);
|
732
|
-
}
|
733
|
-
return (transitionExists !== undefined)
|
734
|
-
? transitionExists
|
735
|
-
: directionExists
|
736
|
-
;
|
737
|
-
},
|
738
|
-
animate: function() {
|
739
|
-
// can transition does not return a value if animation does not exist
|
740
|
-
return (module.can.transition() !== undefined);
|
741
|
-
}
|
1032
|
+
onVisible: function () {},
|
1033
|
+
onHide: function () {},
|
1034
|
+
onHidden: function () {},
|
1035
|
+
onBeforeHide: function (callback) {
|
1036
|
+
callback.call(this);
|
742
1037
|
},
|
743
1038
|
|
744
|
-
|
745
|
-
|
746
|
-
return $module.hasClass(className.animating);
|
747
|
-
},
|
748
|
-
inward: function() {
|
749
|
-
return $module.hasClass(className.inward);
|
750
|
-
},
|
751
|
-
outward: function() {
|
752
|
-
return $module.hasClass(className.outward);
|
753
|
-
},
|
754
|
-
looping: function() {
|
755
|
-
return $module.hasClass(className.looping);
|
756
|
-
},
|
757
|
-
occurring: function(animation) {
|
758
|
-
animation = animation || settings.animation;
|
759
|
-
animation = '.' + animation.replace(' ', '.');
|
760
|
-
return ( $module.filter(animation).length > 0 );
|
761
|
-
},
|
762
|
-
visible: function() {
|
763
|
-
return $module.is(':visible');
|
764
|
-
},
|
765
|
-
hidden: function() {
|
766
|
-
return $module.css('visibility') === 'hidden';
|
767
|
-
},
|
768
|
-
supported: function() {
|
769
|
-
return(animationEnd !== false);
|
770
|
-
}
|
771
|
-
},
|
1039
|
+
// whether timeout should be used to ensure callback fires in cases animationend does not
|
1040
|
+
useFailSafe: true,
|
772
1041
|
|
773
|
-
|
774
|
-
|
775
|
-
if( module.is.animating() ) {
|
776
|
-
module.reset();
|
777
|
-
}
|
778
|
-
element.blur(); // IE will trigger focus change if element is not blurred before hiding
|
779
|
-
module.remove.display();
|
780
|
-
module.remove.visible();
|
781
|
-
if($.isFunction(settings.onBeforeHide)){
|
782
|
-
settings.onBeforeHide.call(element,function(){
|
783
|
-
module.hideNow();
|
784
|
-
});
|
785
|
-
} else {
|
786
|
-
module.hideNow();
|
787
|
-
}
|
1042
|
+
// delay in ms for fail safe
|
1043
|
+
failSafeDelay: 100,
|
788
1044
|
|
789
|
-
|
1045
|
+
// whether EXACT animation can occur twice in a row
|
1046
|
+
allowRepeats: false,
|
790
1047
|
|
791
|
-
|
792
|
-
|
793
|
-
module.force.hidden();
|
794
|
-
settings.onHide.call(element);
|
795
|
-
settings.onComplete.call(element);
|
796
|
-
// module.repaint();
|
797
|
-
},
|
1048
|
+
// Override final display type on visible
|
1049
|
+
displayType: false,
|
798
1050
|
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
module.remove.hidden();
|
803
|
-
module.set.visible();
|
804
|
-
settings.onShow.call(element);
|
805
|
-
settings.onComplete.call(element);
|
806
|
-
// module.repaint();
|
807
|
-
}
|
808
|
-
},
|
1051
|
+
// animation duration
|
1052
|
+
animation: 'fade',
|
1053
|
+
duration: false,
|
809
1054
|
|
810
|
-
|
811
|
-
|
812
|
-
module.hide();
|
813
|
-
}
|
814
|
-
else {
|
815
|
-
module.show();
|
816
|
-
}
|
817
|
-
},
|
1055
|
+
// new animations will occur after previous ones
|
1056
|
+
queue: true,
|
818
1057
|
|
819
|
-
|
820
|
-
|
821
|
-
$module.triggerHandler(animationEnd);
|
822
|
-
},
|
823
|
-
|
824
|
-
stopAll: function() {
|
825
|
-
module.debug('Stopping all animation');
|
826
|
-
module.remove.queueCallback();
|
827
|
-
$module.triggerHandler(animationEnd);
|
828
|
-
},
|
1058
|
+
// whether initially inline hidden objects should be skipped for transition
|
1059
|
+
skipInlineHidden: false,
|
829
1060
|
|
830
|
-
|
831
|
-
|
832
|
-
module.debug('Clearing animation queue');
|
833
|
-
module.remove.queueCallback();
|
834
|
-
}
|
1061
|
+
metadata: {
|
1062
|
+
displayType: 'display',
|
835
1063
|
},
|
836
1064
|
|
837
|
-
|
838
|
-
|
839
|
-
|
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',
|
840
1075
|
},
|
841
1076
|
|
842
|
-
|
843
|
-
|
844
|
-
|
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',
|
845
1082
|
},
|
846
1083
|
|
847
|
-
|
848
|
-
|
849
|
-
if( $.isPlainObject(name) ) {
|
850
|
-
$.extend(true, settings, name);
|
851
|
-
}
|
852
|
-
else if(value !== undefined) {
|
853
|
-
if($.isPlainObject(settings[name])) {
|
854
|
-
$.extend(true, settings[name], value);
|
855
|
-
}
|
856
|
-
else {
|
857
|
-
settings[name] = value;
|
858
|
-
}
|
859
|
-
}
|
860
|
-
else {
|
861
|
-
return settings[name];
|
862
|
-
}
|
863
|
-
},
|
864
|
-
internal: function(name, value) {
|
865
|
-
if( $.isPlainObject(name) ) {
|
866
|
-
$.extend(true, module, name);
|
867
|
-
}
|
868
|
-
else if(value !== undefined) {
|
869
|
-
module[name] = value;
|
870
|
-
}
|
871
|
-
else {
|
872
|
-
return module[name];
|
873
|
-
}
|
874
|
-
},
|
875
|
-
debug: function() {
|
876
|
-
if(!settings.silent && settings.debug) {
|
877
|
-
if(settings.performance) {
|
878
|
-
module.performance.log(arguments);
|
879
|
-
}
|
880
|
-
else {
|
881
|
-
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
882
|
-
module.debug.apply(console, arguments);
|
883
|
-
}
|
884
|
-
}
|
885
|
-
},
|
886
|
-
verbose: function() {
|
887
|
-
if(!settings.silent && settings.verbose && settings.debug) {
|
888
|
-
if(settings.performance) {
|
889
|
-
module.performance.log(arguments);
|
890
|
-
}
|
891
|
-
else {
|
892
|
-
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
893
|
-
module.verbose.apply(console, arguments);
|
894
|
-
}
|
895
|
-
}
|
896
|
-
},
|
897
|
-
error: function() {
|
898
|
-
if(!settings.silent) {
|
899
|
-
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
900
|
-
module.error.apply(console, arguments);
|
901
|
-
}
|
902
|
-
},
|
903
|
-
performance: {
|
904
|
-
log: function(message) {
|
905
|
-
var
|
906
|
-
currentTime,
|
907
|
-
executionTime,
|
908
|
-
previousTime
|
909
|
-
;
|
910
|
-
if(settings.performance) {
|
911
|
-
currentTime = new Date().getTime();
|
912
|
-
previousTime = time || currentTime;
|
913
|
-
executionTime = currentTime - previousTime;
|
914
|
-
time = currentTime;
|
915
|
-
performance.push({
|
916
|
-
'Name' : message[0],
|
917
|
-
'Arguments' : [].slice.call(message, 1) || '',
|
918
|
-
'Element' : element,
|
919
|
-
'Execution Time' : executionTime
|
920
|
-
});
|
921
|
-
}
|
922
|
-
clearTimeout(module.performance.timer);
|
923
|
-
module.performance.timer = setTimeout(module.performance.display, 500);
|
924
|
-
},
|
925
|
-
display: function() {
|
926
|
-
var
|
927
|
-
title = settings.name + ':',
|
928
|
-
totalTime = 0
|
929
|
-
;
|
930
|
-
time = false;
|
931
|
-
clearTimeout(module.performance.timer);
|
932
|
-
$.each(performance, function(index, data) {
|
933
|
-
totalTime += data['Execution Time'];
|
934
|
-
});
|
935
|
-
title += ' ' + totalTime + 'ms';
|
936
|
-
if(moduleSelector) {
|
937
|
-
title += ' \'' + moduleSelector + '\'';
|
938
|
-
}
|
939
|
-
if($allModules.length > 1) {
|
940
|
-
title += ' ' + '(' + $allModules.length + ')';
|
941
|
-
}
|
942
|
-
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
943
|
-
console.groupCollapsed(title);
|
944
|
-
if(console.table) {
|
945
|
-
console.table(performance);
|
946
|
-
}
|
947
|
-
else {
|
948
|
-
$.each(performance, function(index, data) {
|
949
|
-
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
|
950
|
-
});
|
951
|
-
}
|
952
|
-
console.groupEnd();
|
953
|
-
}
|
954
|
-
performance = [];
|
955
|
-
}
|
956
|
-
},
|
957
|
-
// modified for transition to return invoke success
|
958
|
-
invoke: function(query, passedArguments, context) {
|
959
|
-
var
|
960
|
-
object = instance,
|
961
|
-
maxDepth,
|
962
|
-
found,
|
963
|
-
response
|
964
|
-
;
|
965
|
-
passedArguments = passedArguments || queryArguments;
|
966
|
-
context = element || context;
|
967
|
-
if(typeof query == 'string' && object !== undefined) {
|
968
|
-
query = query.split(/[\. ]/);
|
969
|
-
maxDepth = query.length - 1;
|
970
|
-
$.each(query, function(depth, value) {
|
971
|
-
var camelCaseValue = (depth != maxDepth)
|
972
|
-
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
973
|
-
: query
|
974
|
-
;
|
975
|
-
if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
|
976
|
-
object = object[camelCaseValue];
|
977
|
-
}
|
978
|
-
else if( object[camelCaseValue] !== undefined ) {
|
979
|
-
found = object[camelCaseValue];
|
980
|
-
return false;
|
981
|
-
}
|
982
|
-
else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
|
983
|
-
object = object[value];
|
984
|
-
}
|
985
|
-
else if( object[value] !== undefined ) {
|
986
|
-
found = object[value];
|
987
|
-
return false;
|
988
|
-
}
|
989
|
-
else {
|
990
|
-
return false;
|
991
|
-
}
|
992
|
-
});
|
993
|
-
}
|
994
|
-
if ( $.isFunction( found ) ) {
|
995
|
-
response = found.apply(context, passedArguments);
|
996
|
-
}
|
997
|
-
else if(found !== undefined) {
|
998
|
-
response = found;
|
999
|
-
}
|
1000
|
-
|
1001
|
-
if(Array.isArray(returnedValue)) {
|
1002
|
-
returnedValue.push(response);
|
1003
|
-
}
|
1004
|
-
else if(returnedValue !== undefined) {
|
1005
|
-
returnedValue = [returnedValue, response];
|
1006
|
-
}
|
1007
|
-
else if(response !== undefined) {
|
1008
|
-
returnedValue = response;
|
1009
|
-
}
|
1010
|
-
return (found !== undefined)
|
1011
|
-
? found
|
1012
|
-
: false
|
1013
|
-
;
|
1014
|
-
}
|
1015
|
-
};
|
1016
|
-
module.initialize();
|
1017
|
-
})
|
1018
|
-
;
|
1019
|
-
return (returnedValue !== undefined)
|
1020
|
-
? returnedValue
|
1021
|
-
: this
|
1022
|
-
;
|
1023
|
-
};
|
1024
|
-
|
1025
|
-
// Records if CSS transition is available
|
1026
|
-
$.fn.transition.exists = {};
|
1027
|
-
|
1028
|
-
$.fn.transition.settings = {
|
1029
|
-
|
1030
|
-
// module info
|
1031
|
-
name : 'Transition',
|
1032
|
-
|
1033
|
-
// hide all output from this component regardless of other settings
|
1034
|
-
silent : false,
|
1035
|
-
|
1036
|
-
// debug content outputted to console
|
1037
|
-
debug : false,
|
1038
|
-
|
1039
|
-
// verbose debug output
|
1040
|
-
verbose : false,
|
1041
|
-
|
1042
|
-
// performance data output
|
1043
|
-
performance : true,
|
1044
|
-
|
1045
|
-
// event namespace
|
1046
|
-
namespace : 'transition',
|
1047
|
-
|
1048
|
-
// delay between animations in group
|
1049
|
-
interval : 0,
|
1050
|
-
|
1051
|
-
// whether group animations should be reversed
|
1052
|
-
reverse : 'auto',
|
1053
|
-
|
1054
|
-
// animation callback event
|
1055
|
-
onStart : function() {},
|
1056
|
-
onComplete : function() {},
|
1057
|
-
onShow : function() {},
|
1058
|
-
onHide : function() {},
|
1059
|
-
|
1060
|
-
// whether timeout should be used to ensure callback fires in cases animationend does not
|
1061
|
-
useFailSafe : true,
|
1062
|
-
|
1063
|
-
// delay in ms for fail safe
|
1064
|
-
failSafeDelay : 100,
|
1065
|
-
|
1066
|
-
// whether EXACT animation can occur twice in a row
|
1067
|
-
allowRepeats : false,
|
1068
|
-
|
1069
|
-
// Override final display type on visible
|
1070
|
-
displayType : false,
|
1071
|
-
|
1072
|
-
// animation duration
|
1073
|
-
animation : 'fade',
|
1074
|
-
duration : false,
|
1075
|
-
|
1076
|
-
// new animations will occur after previous ones
|
1077
|
-
queue : true,
|
1078
|
-
|
1079
|
-
// whether initially inline hidden objects should be skipped for transition
|
1080
|
-
skipInlineHidden: false,
|
1081
|
-
|
1082
|
-
metadata : {
|
1083
|
-
displayType: 'display'
|
1084
|
-
},
|
1085
|
-
|
1086
|
-
className : {
|
1087
|
-
animating : 'animating',
|
1088
|
-
disabled : 'disabled',
|
1089
|
-
hidden : 'hidden',
|
1090
|
-
inward : 'in',
|
1091
|
-
loading : 'loading',
|
1092
|
-
looping : 'looping',
|
1093
|
-
outward : 'out',
|
1094
|
-
transition : 'transition',
|
1095
|
-
visible : 'visible'
|
1096
|
-
},
|
1097
|
-
|
1098
|
-
// possible errors
|
1099
|
-
error: {
|
1100
|
-
noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.',
|
1101
|
-
repeated : 'That animation is already occurring, cancelling repeated animation',
|
1102
|
-
method : 'The method you called is not defined',
|
1103
|
-
support : 'This browser does not support CSS animations'
|
1104
|
-
}
|
1105
|
-
|
1106
|
-
};
|
1107
|
-
|
1108
|
-
|
1109
|
-
})( jQuery, window, document );
|
1084
|
+
};
|
1085
|
+
})(jQuery, window, document);
|