vue_crud 0.1.9.5 → 0.1.9.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/lib/generators/vue_crud/example_generator.rb +12 -0
  3. data/lib/generators/vue_crud/install_generator.rb +1 -1
  4. data/lib/generators/vue_crud/pace_generator.rb +11 -0
  5. data/lib/generators/vue_crud/semantic_generator.rb +12 -0
  6. data/lib/generators/vue_crud/templates/assets/images/semantic-ui/flags.png +0 -0
  7. data/lib/generators/vue_crud/templates/assets/javascripts/pace.min.js +1 -0
  8. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/checkbox.js +831 -0
  9. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/dimmer.js +708 -0
  10. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/dropdown.js +3741 -0
  11. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/modal.js +913 -0
  12. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/site.js +487 -0
  13. data/lib/generators/vue_crud/templates/assets/javascripts/semantic-ui/transition.js +1089 -0
  14. data/lib/generators/vue_crud/templates/assets/javascripts/vue.js +7402 -0
  15. data/lib/generators/vue_crud/templates/assets/stylesheets/pace.min.css +1 -0
  16. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/.DS_Store +0 -0
  17. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/.DS_Store +0 -0
  18. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_all.scss +7 -0
  19. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +124 -0
  20. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_form.scss +1706 -0
  21. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_grid.scss +84 -0
  22. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_grid_bk.scss +2032 -0
  23. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_menu.scss +2021 -0
  24. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_message.scss +482 -0
  25. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_mixins.scss +3 -0
  26. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/_table.scss +1108 -0
  27. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/.DS_Store +0 -0
  28. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_clearfix.scss +1 -0
  29. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_grid-framework.scss +1 -0
  30. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/collections/mixins/_grid.scss +1 -0
  31. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_all.scss +15 -0
  32. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_button.scss +3470 -0
  33. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_container.scss +148 -0
  34. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_divider.scss +262 -0
  35. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_flag.scss +1031 -0
  36. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_header.scss +721 -0
  37. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_icon.scss +3148 -0
  38. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_image.scss +306 -0
  39. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_input.scss +517 -0
  40. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_label.scss +1314 -0
  41. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_list.scss +951 -0
  42. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_loader.scss +349 -0
  43. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_rail.scss +152 -0
  44. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_reveal.scss +307 -0
  45. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_segment.scss +799 -0
  46. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/elements/_step.scss +646 -0
  47. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_all.scss +3 -0
  48. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_reset.scss +424 -0
  49. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_site.scss +163 -0
  50. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/globals/_variables.scss +32 -0
  51. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_accordion.scss +256 -0
  52. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_all.scss +17 -0
  53. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_checkbox.scss +627 -0
  54. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_dimmer.scss +199 -0
  55. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_dropdown.scss +1425 -0
  56. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_embed.scss +167 -0
  57. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_modal.scss +509 -0
  58. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_nag.scss +147 -0
  59. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_popup.scss +764 -0
  60. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_progress.scss +516 -0
  61. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_rating.scss +265 -0
  62. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_search.scss +409 -0
  63. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_shape.scss +157 -0
  64. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_sidebar.scss +644 -0
  65. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_sticky.scss +78 -0
  66. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_tab.scss +91 -0
  67. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_transition.scss +1981 -0
  68. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/modules/_video.scss +125 -0
  69. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_ad.scss +276 -0
  70. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_all.scss +6 -0
  71. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_card.scss +685 -0
  72. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_comment.scss +270 -0
  73. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_feed.scss +300 -0
  74. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_item.scss +481 -0
  75. data/lib/generators/vue_crud/templates/assets/stylesheets/semantic-ui/views/_statistic.scss +583 -0
  76. data/lib/generators/vue_crud/templates/example/user.rb +10 -0
  77. data/lib/generators/vue_crud/templates/example/users/index.html.erb +154 -0
  78. data/lib/generators/vue_crud/templates/example/users/index.json.jbuilder +15 -0
  79. data/lib/generators/vue_crud/templates/example/users/show.json.jbuilder +11 -0
  80. data/lib/generators/vue_crud/templates/example/users_controller.rb +85 -0
  81. data/lib/generators/vue_crud/vuejs_generator.rb +10 -0
  82. data/lib/vue_crud/version.rb +1 -1
  83. data/vendor/assets/javascripts/vue_crud.js +24 -3
  84. data/vendor/assets/stylesheets/vue_crud.css +0 -2
  85. metadata +80 -6
  86. data/vue_crud-0.1.5.gem +0 -0
  87. data/vue_crud-0.1.6.gem +0 -0
  88. data/vue_crud-0.1.7.gem +0 -0
  89. data/vue_crud-0.1.8.gem +0 -0
  90. data/vue_crud-0.1.9.gem +0 -0
@@ -0,0 +1,1089 @@
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() {
616
+ if(settings.displayType) {
617
+ return settings.displayType;
618
+ }
619
+ if($module.data(metadata.displayType) === undefined) {
620
+ // create fake element to determine display state
621
+ module.can.transition(true);
622
+ }
623
+ return $module.data(metadata.displayType);
624
+ },
625
+ userStyle: function(style) {
626
+ style = style || $module.attr('style') || '';
627
+ return style.replace(/display.*?;/, '');
628
+ },
629
+ transitionExists: function(animation) {
630
+ return $.fn.transition.exists[animation];
631
+ },
632
+ animationStartEvent: function() {
633
+ var
634
+ element = document.createElement('div'),
635
+ animations = {
636
+ 'animation' :'animationstart',
637
+ 'OAnimation' :'oAnimationStart',
638
+ 'MozAnimation' :'mozAnimationStart',
639
+ 'WebkitAnimation' :'webkitAnimationStart'
640
+ },
641
+ animation
642
+ ;
643
+ for(animation in animations){
644
+ if( element.style[animation] !== undefined ){
645
+ return animations[animation];
646
+ }
647
+ }
648
+ return false;
649
+ },
650
+ animationEndEvent: function() {
651
+ var
652
+ element = document.createElement('div'),
653
+ animations = {
654
+ 'animation' :'animationend',
655
+ 'OAnimation' :'oAnimationEnd',
656
+ 'MozAnimation' :'mozAnimationEnd',
657
+ 'WebkitAnimation' :'webkitAnimationEnd'
658
+ },
659
+ animation
660
+ ;
661
+ for(animation in animations){
662
+ if( element.style[animation] !== undefined ){
663
+ return animations[animation];
664
+ }
665
+ }
666
+ return false;
667
+ }
668
+
669
+ },
670
+
671
+ can: {
672
+ transition: function(forced) {
673
+ var
674
+ animation = settings.animation,
675
+ transitionExists = module.get.transitionExists(animation),
676
+ elementClass,
677
+ tagName,
678
+ $clone,
679
+ currentAnimation,
680
+ inAnimation,
681
+ directionExists,
682
+ displayType
683
+ ;
684
+ if( transitionExists === undefined || forced) {
685
+ module.verbose('Determining whether animation exists');
686
+ elementClass = $module.attr('class');
687
+ tagName = $module.prop('tagName');
688
+
689
+ $clone = $('<' + tagName + ' />').addClass( elementClass ).insertAfter($module);
690
+ currentAnimation = $clone
691
+ .addClass(animation)
692
+ .removeClass(className.inward)
693
+ .removeClass(className.outward)
694
+ .addClass(className.animating)
695
+ .addClass(className.transition)
696
+ .css('animationName')
697
+ ;
698
+ inAnimation = $clone
699
+ .addClass(className.inward)
700
+ .css('animationName')
701
+ ;
702
+ displayType = $clone
703
+ .attr('class', elementClass)
704
+ .removeAttr('style')
705
+ .removeClass(className.hidden)
706
+ .removeClass(className.visible)
707
+ .show()
708
+ .css('display')
709
+ ;
710
+ module.verbose('Determining final display state', displayType);
711
+ module.save.displayType(displayType);
712
+
713
+ $clone.remove();
714
+ if(currentAnimation != inAnimation) {
715
+ module.debug('Direction exists for animation', animation);
716
+ directionExists = true;
717
+ }
718
+ else if(currentAnimation == 'none' || !currentAnimation) {
719
+ module.debug('No animation defined in css', animation);
720
+ return;
721
+ }
722
+ else {
723
+ module.debug('Static animation found', animation, displayType);
724
+ directionExists = false;
725
+ }
726
+ module.save.transitionExists(animation, directionExists);
727
+ }
728
+ return (transitionExists !== undefined)
729
+ ? transitionExists
730
+ : directionExists
731
+ ;
732
+ },
733
+ animate: function() {
734
+ // can transition does not return a value if animation does not exist
735
+ return (module.can.transition() !== undefined);
736
+ }
737
+ },
738
+
739
+ is: {
740
+ animating: function() {
741
+ return $module.hasClass(className.animating);
742
+ },
743
+ inward: function() {
744
+ return $module.hasClass(className.inward);
745
+ },
746
+ outward: function() {
747
+ return $module.hasClass(className.outward);
748
+ },
749
+ looping: function() {
750
+ return $module.hasClass(className.looping);
751
+ },
752
+ occurring: function(animation) {
753
+ animation = animation || settings.animation;
754
+ animation = '.' + animation.replace(' ', '.');
755
+ return ( $module.filter(animation).length > 0 );
756
+ },
757
+ visible: function() {
758
+ return $module.is(':visible');
759
+ },
760
+ hidden: function() {
761
+ return $module.css('visibility') === 'hidden';
762
+ },
763
+ supported: function() {
764
+ return(animationEnd !== false);
765
+ }
766
+ },
767
+
768
+ hide: function() {
769
+ module.verbose('Hiding element');
770
+ if( module.is.animating() ) {
771
+ module.reset();
772
+ }
773
+ element.blur(); // IE will trigger focus change if element is not blurred before hiding
774
+ module.remove.display();
775
+ module.remove.visible();
776
+ module.set.hidden();
777
+ module.force.hidden();
778
+ settings.onHide.call(element);
779
+ settings.onComplete.call(element);
780
+ // module.repaint();
781
+ },
782
+
783
+ show: function(display) {
784
+ module.verbose('Showing element', display);
785
+ module.remove.hidden();
786
+ module.set.visible();
787
+ module.force.visible();
788
+ settings.onShow.call(element);
789
+ settings.onComplete.call(element);
790
+ // module.repaint();
791
+ },
792
+
793
+ toggle: function() {
794
+ if( module.is.visible() ) {
795
+ module.hide();
796
+ }
797
+ else {
798
+ module.show();
799
+ }
800
+ },
801
+
802
+ stop: function() {
803
+ module.debug('Stopping current animation');
804
+ $module.triggerHandler(animationEnd);
805
+ },
806
+
807
+ stopAll: function() {
808
+ module.debug('Stopping all animation');
809
+ module.remove.queueCallback();
810
+ $module.triggerHandler(animationEnd);
811
+ },
812
+
813
+ clear: {
814
+ queue: function() {
815
+ module.debug('Clearing animation queue');
816
+ module.remove.queueCallback();
817
+ }
818
+ },
819
+
820
+ enable: function() {
821
+ module.verbose('Starting animation');
822
+ $module.removeClass(className.disabled);
823
+ },
824
+
825
+ disable: function() {
826
+ module.debug('Stopping animation');
827
+ $module.addClass(className.disabled);
828
+ },
829
+
830
+ setting: function(name, value) {
831
+ module.debug('Changing setting', name, value);
832
+ if( $.isPlainObject(name) ) {
833
+ $.extend(true, settings, name);
834
+ }
835
+ else if(value !== undefined) {
836
+ if($.isPlainObject(settings[name])) {
837
+ $.extend(true, settings[name], value);
838
+ }
839
+ else {
840
+ settings[name] = value;
841
+ }
842
+ }
843
+ else {
844
+ return settings[name];
845
+ }
846
+ },
847
+ internal: function(name, value) {
848
+ if( $.isPlainObject(name) ) {
849
+ $.extend(true, module, name);
850
+ }
851
+ else if(value !== undefined) {
852
+ module[name] = value;
853
+ }
854
+ else {
855
+ return module[name];
856
+ }
857
+ },
858
+ debug: function() {
859
+ if(!settings.silent && settings.debug) {
860
+ if(settings.performance) {
861
+ module.performance.log(arguments);
862
+ }
863
+ else {
864
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
865
+ module.debug.apply(console, arguments);
866
+ }
867
+ }
868
+ },
869
+ verbose: function() {
870
+ if(!settings.silent && settings.verbose && settings.debug) {
871
+ if(settings.performance) {
872
+ module.performance.log(arguments);
873
+ }
874
+ else {
875
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
876
+ module.verbose.apply(console, arguments);
877
+ }
878
+ }
879
+ },
880
+ error: function() {
881
+ if(!settings.silent) {
882
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
883
+ module.error.apply(console, arguments);
884
+ }
885
+ },
886
+ performance: {
887
+ log: function(message) {
888
+ var
889
+ currentTime,
890
+ executionTime,
891
+ previousTime
892
+ ;
893
+ if(settings.performance) {
894
+ currentTime = new Date().getTime();
895
+ previousTime = time || currentTime;
896
+ executionTime = currentTime - previousTime;
897
+ time = currentTime;
898
+ performance.push({
899
+ 'Name' : message[0],
900
+ 'Arguments' : [].slice.call(message, 1) || '',
901
+ 'Element' : element,
902
+ 'Execution Time' : executionTime
903
+ });
904
+ }
905
+ clearTimeout(module.performance.timer);
906
+ module.performance.timer = setTimeout(module.performance.display, 500);
907
+ },
908
+ display: function() {
909
+ var
910
+ title = settings.name + ':',
911
+ totalTime = 0
912
+ ;
913
+ time = false;
914
+ clearTimeout(module.performance.timer);
915
+ $.each(performance, function(index, data) {
916
+ totalTime += data['Execution Time'];
917
+ });
918
+ title += ' ' + totalTime + 'ms';
919
+ if(moduleSelector) {
920
+ title += ' \'' + moduleSelector + '\'';
921
+ }
922
+ if($allModules.length > 1) {
923
+ title += ' ' + '(' + $allModules.length + ')';
924
+ }
925
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
926
+ console.groupCollapsed(title);
927
+ if(console.table) {
928
+ console.table(performance);
929
+ }
930
+ else {
931
+ $.each(performance, function(index, data) {
932
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
933
+ });
934
+ }
935
+ console.groupEnd();
936
+ }
937
+ performance = [];
938
+ }
939
+ },
940
+ // modified for transition to return invoke success
941
+ invoke: function(query, passedArguments, context) {
942
+ var
943
+ object = instance,
944
+ maxDepth,
945
+ found,
946
+ response
947
+ ;
948
+ passedArguments = passedArguments || queryArguments;
949
+ context = element || context;
950
+ if(typeof query == 'string' && object !== undefined) {
951
+ query = query.split(/[\. ]/);
952
+ maxDepth = query.length - 1;
953
+ $.each(query, function(depth, value) {
954
+ var camelCaseValue = (depth != maxDepth)
955
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
956
+ : query
957
+ ;
958
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
959
+ object = object[camelCaseValue];
960
+ }
961
+ else if( object[camelCaseValue] !== undefined ) {
962
+ found = object[camelCaseValue];
963
+ return false;
964
+ }
965
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
966
+ object = object[value];
967
+ }
968
+ else if( object[value] !== undefined ) {
969
+ found = object[value];
970
+ return false;
971
+ }
972
+ else {
973
+ return false;
974
+ }
975
+ });
976
+ }
977
+ if ( $.isFunction( found ) ) {
978
+ response = found.apply(context, passedArguments);
979
+ }
980
+ else if(found !== undefined) {
981
+ response = found;
982
+ }
983
+
984
+ if($.isArray(returnedValue)) {
985
+ returnedValue.push(response);
986
+ }
987
+ else if(returnedValue !== undefined) {
988
+ returnedValue = [returnedValue, response];
989
+ }
990
+ else if(response !== undefined) {
991
+ returnedValue = response;
992
+ }
993
+ return (found !== undefined)
994
+ ? found
995
+ : false
996
+ ;
997
+ }
998
+ };
999
+ module.initialize();
1000
+ })
1001
+ ;
1002
+ return (returnedValue !== undefined)
1003
+ ? returnedValue
1004
+ : this
1005
+ ;
1006
+ };
1007
+
1008
+ // Records if CSS transition is available
1009
+ $.fn.transition.exists = {};
1010
+
1011
+ $.fn.transition.settings = {
1012
+
1013
+ // module info
1014
+ name : 'Transition',
1015
+
1016
+ // hide all output from this component regardless of other settings
1017
+ silent : false,
1018
+
1019
+ // debug content outputted to console
1020
+ debug : false,
1021
+
1022
+ // verbose debug output
1023
+ verbose : false,
1024
+
1025
+ // performance data output
1026
+ performance : true,
1027
+
1028
+ // event namespace
1029
+ namespace : 'transition',
1030
+
1031
+ // delay between animations in group
1032
+ interval : 0,
1033
+
1034
+ // whether group animations should be reversed
1035
+ reverse : 'auto',
1036
+
1037
+ // animation callback event
1038
+ onStart : function() {},
1039
+ onComplete : function() {},
1040
+ onShow : function() {},
1041
+ onHide : function() {},
1042
+
1043
+ // whether timeout should be used to ensure callback fires in cases animationend does not
1044
+ useFailSafe : true,
1045
+
1046
+ // delay in ms for fail safe
1047
+ failSafeDelay : 100,
1048
+
1049
+ // whether EXACT animation can occur twice in a row
1050
+ allowRepeats : false,
1051
+
1052
+ // Override final display type on visible
1053
+ displayType : false,
1054
+
1055
+ // animation duration
1056
+ animation : 'fade',
1057
+ duration : false,
1058
+
1059
+ // new animations will occur after previous ones
1060
+ queue : true,
1061
+
1062
+ metadata : {
1063
+ displayType: 'display'
1064
+ },
1065
+
1066
+ className : {
1067
+ animating : 'animating',
1068
+ disabled : 'disabled',
1069
+ hidden : 'hidden',
1070
+ inward : 'in',
1071
+ loading : 'loading',
1072
+ looping : 'looping',
1073
+ outward : 'out',
1074
+ transition : 'transition',
1075
+ visible : 'visible'
1076
+ },
1077
+
1078
+ // possible errors
1079
+ error: {
1080
+ noAnimation : 'Element is no longer attached to DOM. Unable to animate. Use silent setting to surpress this warning in production.',
1081
+ repeated : 'That animation is already occurring, cancelling repeated animation',
1082
+ method : 'The method you called is not defined',
1083
+ support : 'This browser does not support CSS animations'
1084
+ }
1085
+
1086
+ };
1087
+
1088
+
1089
+ })( jQuery, window, document );