fomantic-ui-sass 2.9.0 → 2.9.2

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