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