fomantic-ui-sass 2.6.4

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