semantic-ui-sass 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +51 -0
  6. data/Rakefile +5 -0
  7. data/app/assets/fonts/semantic-ui/basic.icons.eot +0 -0
  8. data/app/assets/fonts/semantic-ui/basic.icons.svg +450 -0
  9. data/app/assets/fonts/semantic-ui/basic.icons.ttf +0 -0
  10. data/app/assets/fonts/semantic-ui/basic.icons.woff +0 -0
  11. data/app/assets/fonts/semantic-ui/icons.eot +0 -0
  12. data/app/assets/fonts/semantic-ui/icons.otf +0 -0
  13. data/app/assets/fonts/semantic-ui/icons.svg +399 -0
  14. data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
  15. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  16. data/app/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
  17. data/app/assets/images/semantic-ui/loader-large.gif +0 -0
  18. data/app/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
  19. data/app/assets/images/semantic-ui/loader-medium.gif +0 -0
  20. data/app/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
  21. data/app/assets/images/semantic-ui/loader-mini.gif +0 -0
  22. data/app/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
  23. data/app/assets/images/semantic-ui/loader-small.gif +0 -0
  24. data/app/assets/javascripts/semantic-ui.js +20 -0
  25. data/app/assets/javascripts/semantic-ui/accordion.js +419 -0
  26. data/app/assets/javascripts/semantic-ui/behavior/api.js +638 -0
  27. data/app/assets/javascripts/semantic-ui/behavior/colorize.js +270 -0
  28. data/app/assets/javascripts/semantic-ui/behavior/form.js +702 -0
  29. data/app/assets/javascripts/semantic-ui/behavior/state.js +725 -0
  30. data/app/assets/javascripts/semantic-ui/chatroom.js +769 -0
  31. data/app/assets/javascripts/semantic-ui/checkbox.js +344 -0
  32. data/app/assets/javascripts/semantic-ui/dimmer.js +564 -0
  33. data/app/assets/javascripts/semantic-ui/dropdown.js +724 -0
  34. data/app/assets/javascripts/semantic-ui/modal.js +553 -0
  35. data/app/assets/javascripts/semantic-ui/nag.js +545 -0
  36. data/app/assets/javascripts/semantic-ui/popup.js +727 -0
  37. data/app/assets/javascripts/semantic-ui/rating.js +403 -0
  38. data/app/assets/javascripts/semantic-ui/search.js +772 -0
  39. data/app/assets/javascripts/semantic-ui/shape.js +778 -0
  40. data/app/assets/javascripts/semantic-ui/sidebar.js +490 -0
  41. data/app/assets/javascripts/semantic-ui/tab.js +689 -0
  42. data/app/assets/javascripts/semantic-ui/transition.js +654 -0
  43. data/app/assets/javascripts/semantic-ui/video.js +457 -0
  44. data/app/assets/stylesheets/semantic-ui.scss +4 -0
  45. data/app/assets/stylesheets/semantic-ui/collections/_all.scss +6 -0
  46. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +77 -0
  47. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +569 -0
  48. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +643 -0
  49. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +1767 -0
  50. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +347 -0
  51. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +524 -0
  52. data/app/assets/stylesheets/semantic-ui/elements/_all.scss +12 -0
  53. data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +479 -0
  54. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1187 -0
  55. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +199 -0
  56. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +342 -0
  57. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +772 -0
  58. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +181 -0
  59. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +338 -0
  60. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +827 -0
  61. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +185 -0
  62. data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +352 -0
  63. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +464 -0
  64. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +293 -0
  65. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +199 -0
  66. data/app/assets/stylesheets/semantic-ui/modules/_all.scss +16 -0
  67. data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +281 -0
  68. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +481 -0
  69. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +236 -0
  70. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +548 -0
  71. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +217 -0
  72. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +173 -0
  73. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +255 -0
  74. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +179 -0
  75. data/app/assets/stylesheets/semantic-ui/modules/_reveal.scss +365 -0
  76. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +273 -0
  77. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +113 -0
  78. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +150 -0
  79. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +63 -0
  80. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +1096 -0
  81. data/app/assets/stylesheets/semantic-ui/modules/_video.scss +98 -0
  82. data/app/assets/stylesheets/semantic-ui/views/_all.scss +5 -0
  83. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +221 -0
  84. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +152 -0
  85. data/app/assets/stylesheets/semantic-ui/views/_item.scss +651 -0
  86. data/app/assets/stylesheets/semantic-ui/views/_list.scss +555 -0
  87. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +27 -0
  88. data/lib/semantic/ui/sass.rb +10 -0
  89. data/lib/semantic/ui/sass/engine.rb +13 -0
  90. data/lib/semantic/ui/sass/version.rb +8 -0
  91. data/semantic-ui-sass.gemspec +24 -0
  92. data/tasks/converter.rb +237 -0
  93. metadata +177 -0
@@ -0,0 +1,778 @@
1
+ /*
2
+ * # Semantic - Shape
3
+ * http://github.com/jlukic/semantic-ui/
4
+ *
5
+ *
6
+ * Copyright 2013 Contributors
7
+ * Released under the MIT license
8
+ * http://opensource.org/licenses/MIT
9
+ *
10
+ */
11
+
12
+ ;(function ( $, window, document, undefined ) {
13
+
14
+ $.fn.shape = function(parameters) {
15
+ var
16
+ $allModules = $(this),
17
+
18
+ moduleSelector = $allModules.selector || '',
19
+ settings = $.extend(true, {}, $.fn.shape.settings, parameters),
20
+
21
+ // internal aliases
22
+ namespace = settings.namespace,
23
+ selector = settings.selector,
24
+ error = settings.error,
25
+ className = settings.className,
26
+
27
+ // define namespaces for modules
28
+ eventNamespace = '.' + namespace,
29
+ moduleNamespace = 'module-' + namespace,
30
+
31
+ time = new Date().getTime(),
32
+ performance = [],
33
+
34
+ query = arguments[0],
35
+ methodInvoked = (typeof query == 'string'),
36
+ queryArguments = [].slice.call(arguments, 1),
37
+ invokedResponse
38
+ ;
39
+
40
+ $allModules
41
+ .each(function() {
42
+ var
43
+ // selector cache
44
+ $module = $(this),
45
+ $sides = $module.find(selector.sides),
46
+ $side = $module.find(selector.side),
47
+
48
+ // private variables
49
+ $activeSide,
50
+ $nextSide,
51
+
52
+ // standard module
53
+ element = this,
54
+ instance = $module.data(moduleNamespace),
55
+ module
56
+ ;
57
+
58
+ module = {
59
+
60
+ initialize: function() {
61
+ module.verbose('Initializing module for', element);
62
+ module.set.defaultSide();
63
+ module.instantiate();
64
+ },
65
+
66
+ instantiate: function() {
67
+ module.verbose('Storing instance of module', module);
68
+ instance = module;
69
+ $module
70
+ .data(moduleNamespace, instance)
71
+ ;
72
+ },
73
+
74
+ destroy: function() {
75
+ module.verbose('Destroying previous module for', element);
76
+ $module
77
+ .removeData(moduleNamespace)
78
+ .off(eventNamespace)
79
+ ;
80
+ },
81
+
82
+ refresh: function() {
83
+ module.verbose('Refreshing selector cache for', element);
84
+ $module = $(element);
85
+ $sides = $(this).find(selector.shape);
86
+ $side = $(this).find(selector.side);
87
+ },
88
+
89
+ repaint: function() {
90
+ module.verbose('Forcing repaint event');
91
+ var
92
+ shape = $sides.get(0) || document.createElement('div'),
93
+ fakeAssignment = shape.offsetWidth
94
+ ;
95
+ },
96
+
97
+ animate: function(propertyObject, callback) {
98
+ module.verbose('Animating box with properties', propertyObject);
99
+ callback = callback || function(event) {
100
+ module.verbose('Executing animation callback');
101
+ if(event !== undefined) {
102
+ event.stopPropagation();
103
+ }
104
+ module.reset();
105
+ module.set.active();
106
+ };
107
+ if(settings.useCSS) {
108
+ if(module.get.transitionEvent()) {
109
+ module.verbose('Starting CSS animation');
110
+ $module
111
+ .addClass(className.animating)
112
+ ;
113
+ module.set.stageSize();
114
+ module.repaint();
115
+ $module
116
+ .addClass(className.css)
117
+ ;
118
+ $activeSide
119
+ .addClass(className.hidden)
120
+ ;
121
+ $sides
122
+ .css(propertyObject)
123
+ .one(module.get.transitionEvent(), callback)
124
+ ;
125
+ }
126
+ else {
127
+ callback();
128
+ }
129
+ }
130
+ else {
131
+ // not yet supported until .animate() is extended to allow RotateX/Y
132
+ module.verbose('Starting javascript animation');
133
+ $module
134
+ .addClass(className.animating)
135
+ .removeClass(className.css)
136
+ ;
137
+ module.set.stageSize();
138
+ module.repaint();
139
+ $activeSide
140
+ .animate({
141
+ opacity: 0
142
+ }, settings.duration, settings.easing)
143
+ ;
144
+ $sides
145
+ .animate(propertyObject, settings.duration, settings.easing, callback)
146
+ ;
147
+ }
148
+ },
149
+
150
+ queue: function(method) {
151
+ module.debug('Queueing animation of', method);
152
+ $sides
153
+ .one(module.get.transitionEvent(), function() {
154
+ module.debug('Executing queued animation');
155
+ setTimeout(function(){
156
+ $module.shape(method);
157
+ }, 0);
158
+ })
159
+ ;
160
+ },
161
+
162
+ reset: function() {
163
+ module.verbose('Animating states reset');
164
+ $module
165
+ .removeClass(className.css)
166
+ .removeClass(className.animating)
167
+ .attr('style', '')
168
+ .removeAttr('style')
169
+ ;
170
+ // removeAttr style does not consistently work in safari
171
+ $sides
172
+ .attr('style', '')
173
+ .removeAttr('style')
174
+ ;
175
+ $side
176
+ .attr('style', '')
177
+ .removeAttr('style')
178
+ .removeClass(className.hidden)
179
+ ;
180
+ $nextSide
181
+ .removeClass(className.animating)
182
+ .attr('style', '')
183
+ .removeAttr('style')
184
+ ;
185
+ },
186
+
187
+ is: {
188
+ animating: function() {
189
+ return $module.hasClass(className.animating);
190
+ }
191
+ },
192
+
193
+ get: {
194
+
195
+ transform: {
196
+ up: function() {
197
+ var
198
+ translate = {
199
+ y: -(($activeSide.outerHeight() - $nextSide.outerHeight()) / 2),
200
+ z: -($activeSide.outerHeight() / 2)
201
+ }
202
+ ;
203
+ return {
204
+ transform: 'translateY(' + translate.y + 'px) translateZ('+ translate.z + 'px) rotateX(-90deg)'
205
+ };
206
+ },
207
+
208
+ down: function() {
209
+ var
210
+ translate = {
211
+ y: -(($activeSide.outerHeight() - $nextSide.outerHeight()) / 2),
212
+ z: -($activeSide.outerHeight() / 2)
213
+ }
214
+ ;
215
+ return {
216
+ transform: 'translateY(' + translate.y + 'px) translateZ('+ translate.z + 'px) rotateX(90deg)'
217
+ };
218
+ },
219
+
220
+ left: function() {
221
+ var
222
+ translate = {
223
+ x : -(($activeSide.outerWidth() - $nextSide.outerWidth()) / 2),
224
+ z : -($activeSide.outerWidth() / 2)
225
+ }
226
+ ;
227
+ return {
228
+ transform: 'translateX(' + translate.x + 'px) translateZ(' + translate.z + 'px) rotateY(90deg)'
229
+ };
230
+ },
231
+
232
+ right: function() {
233
+ var
234
+ translate = {
235
+ x : -(($activeSide.outerWidth() - $nextSide.outerWidth()) / 2),
236
+ z : -($activeSide.outerWidth() / 2)
237
+ }
238
+ ;
239
+ return {
240
+ transform: 'translateX(' + translate.x + 'px) translateZ(' + translate.z + 'px) rotateY(-90deg)'
241
+ };
242
+ },
243
+
244
+ over: function() {
245
+ var
246
+ translate = {
247
+ x : -(($activeSide.outerWidth() - $nextSide.outerWidth()) / 2)
248
+ }
249
+ ;
250
+ return {
251
+ transform: 'translateX(' + translate.x + 'px) rotateY(180deg)'
252
+ };
253
+ },
254
+
255
+ back: function() {
256
+ var
257
+ translate = {
258
+ x : -(($activeSide.outerWidth() - $nextSide.outerWidth()) / 2)
259
+ }
260
+ ;
261
+ return {
262
+ transform: 'translateX(' + translate.x + 'px) rotateY(-180deg)'
263
+ };
264
+ }
265
+ },
266
+
267
+ transitionEvent: function() {
268
+ var
269
+ element = document.createElement('element'),
270
+ transitions = {
271
+ 'transition' :'transitionend',
272
+ 'OTransition' :'oTransitionEnd',
273
+ 'MozTransition' :'transitionend',
274
+ 'WebkitTransition' :'webkitTransitionEnd'
275
+ },
276
+ transition
277
+ ;
278
+ for(transition in transitions){
279
+ if( element.style[transition] !== undefined ){
280
+ return transitions[transition];
281
+ }
282
+ }
283
+ },
284
+
285
+ nextSide: function() {
286
+ return ( $activeSide.next(selector.side).size() > 0 )
287
+ ? $activeSide.next(selector.side)
288
+ : $module.find(selector.side).first()
289
+ ;
290
+ }
291
+
292
+ },
293
+
294
+ set: {
295
+
296
+ defaultSide: function() {
297
+ $activeSide = $module.find('.' + settings.className.active);
298
+ $nextSide = ( $activeSide.next(selector.side).size() > 0 )
299
+ ? $activeSide.next(selector.side)
300
+ : $module.find(selector.side).first()
301
+ ;
302
+ module.verbose('Active side set to', $activeSide);
303
+ module.verbose('Next side set to', $nextSide);
304
+ },
305
+
306
+ stageSize: function() {
307
+ var
308
+ stage = {
309
+ width : $nextSide.outerWidth(),
310
+ height : $nextSide.outerHeight()
311
+ }
312
+ ;
313
+ module.verbose('Resizing stage to fit new content', stage);
314
+ $module
315
+ .css({
316
+ width : stage.width,
317
+ height : stage.height
318
+ })
319
+ ;
320
+ },
321
+
322
+ nextSide: function(selector) {
323
+ $nextSide = $module.find(selector);
324
+ if($nextSide.size() === 0) {
325
+ module.error(error.side);
326
+ }
327
+ module.verbose('Next side manually set to', $nextSide);
328
+ },
329
+
330
+ active: function() {
331
+ module.verbose('Setting new side to active', $nextSide);
332
+ $side
333
+ .removeClass(className.active)
334
+ ;
335
+ $nextSide
336
+ .addClass(className.active)
337
+ ;
338
+ $.proxy(settings.onChange, $nextSide)();
339
+ module.set.defaultSide();
340
+ }
341
+ },
342
+
343
+ flip: {
344
+
345
+ up: function() {
346
+ module.debug('Flipping up', $nextSide);
347
+ if( !module.is.animating() ) {
348
+ module.stage.above();
349
+ module.animate( module.get.transform.up() );
350
+ }
351
+ else {
352
+ module.queue('flip up');
353
+ }
354
+ },
355
+
356
+ down: function() {
357
+ module.debug('Flipping down', $nextSide);
358
+ if( !module.is.animating() ) {
359
+ module.stage.below();
360
+ module.animate( module.get.transform.down() );
361
+ }
362
+ else {
363
+ module.queue('flip down');
364
+ }
365
+ },
366
+
367
+ left: function() {
368
+ module.debug('Flipping left', $nextSide);
369
+ if( !module.is.animating() ) {
370
+ module.stage.left();
371
+ module.animate(module.get.transform.left() );
372
+ }
373
+ else {
374
+ module.queue('flip left');
375
+ }
376
+ },
377
+
378
+ right: function() {
379
+ module.debug('Flipping right', $nextSide);
380
+ if( !module.is.animating() ) {
381
+ module.stage.right();
382
+ module.animate(module.get.transform.right() );
383
+ }
384
+ else {
385
+ module.queue('flip right');
386
+ }
387
+ },
388
+
389
+ over: function() {
390
+ module.debug('Flipping over', $nextSide);
391
+ if( !module.is.animating() ) {
392
+ module.stage.behind();
393
+ module.animate(module.get.transform.over() );
394
+ }
395
+ else {
396
+ module.queue('flip over');
397
+ }
398
+ },
399
+
400
+ back: function() {
401
+ module.debug('Flipping back', $nextSide);
402
+ if( !module.is.animating() ) {
403
+ module.stage.behind();
404
+ module.animate(module.get.transform.back() );
405
+ }
406
+ else {
407
+ module.queue('flip back');
408
+ }
409
+ }
410
+
411
+ },
412
+
413
+ stage: {
414
+
415
+ above: function() {
416
+ var
417
+ box = {
418
+ origin : (($activeSide.outerHeight() - $nextSide.outerHeight()) / 2),
419
+ depth : {
420
+ active : ($nextSide.outerHeight() / 2),
421
+ next : ($activeSide.outerHeight() / 2)
422
+ }
423
+ }
424
+ ;
425
+ module.verbose('Setting the initial animation position as above', $nextSide, box);
426
+ $activeSide
427
+ .css({
428
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
429
+ })
430
+ ;
431
+ $nextSide
432
+ .addClass(className.animating)
433
+ .css({
434
+ 'display' : 'block',
435
+ 'top' : box.origin + 'px',
436
+ 'transform' : 'rotateX(90deg) translateZ(' + box.depth.next + 'px)'
437
+ })
438
+ ;
439
+ },
440
+
441
+ below: function() {
442
+ var
443
+ box = {
444
+ origin : (($activeSide.outerHeight() - $nextSide.outerHeight()) / 2),
445
+ depth : {
446
+ active : ($nextSide.outerHeight() / 2),
447
+ next : ($activeSide.outerHeight() / 2)
448
+ }
449
+ }
450
+ ;
451
+ module.verbose('Setting the initial animation position as below', $nextSide, box);
452
+ $activeSide
453
+ .css({
454
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
455
+ })
456
+ ;
457
+ $nextSide
458
+ .addClass(className.animating)
459
+ .css({
460
+ 'display' : 'block',
461
+ 'top' : box.origin + 'px',
462
+ 'transform' : 'rotateX(-90deg) translateZ(' + box.depth.next + 'px)'
463
+ })
464
+ ;
465
+ },
466
+
467
+ left: function() {
468
+ var
469
+ box = {
470
+ origin : ( ( $activeSide.outerWidth() - $nextSide.outerWidth() ) / 2),
471
+ depth : {
472
+ active : ($nextSide.outerWidth() / 2),
473
+ next : ($activeSide.outerWidth() / 2)
474
+ }
475
+ }
476
+ ;
477
+ module.verbose('Setting the initial animation position as left', $nextSide, box);
478
+ $activeSide
479
+ .css({
480
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
481
+ })
482
+ ;
483
+ $nextSide
484
+ .addClass(className.animating)
485
+ .css({
486
+ 'display' : 'block',
487
+ 'left' : box.origin + 'px',
488
+ 'transform' : 'rotateY(-90deg) translateZ(' + box.depth.next + 'px)'
489
+ })
490
+ ;
491
+ },
492
+
493
+ right: function() {
494
+ var
495
+ box = {
496
+ origin : ( ( $activeSide.outerWidth() - $nextSide.outerWidth() ) / 2),
497
+ depth : {
498
+ active : ($nextSide.outerWidth() / 2),
499
+ next : ($activeSide.outerWidth() / 2)
500
+ }
501
+ }
502
+ ;
503
+ module.verbose('Setting the initial animation position as left', $nextSide, box);
504
+ $activeSide
505
+ .css({
506
+ 'transform' : 'rotateY(0deg) translateZ(' + box.depth.active + 'px)'
507
+ })
508
+ ;
509
+ $nextSide
510
+ .addClass(className.animating)
511
+ .css({
512
+ 'display' : 'block',
513
+ 'left' : box.origin + 'px',
514
+ 'transform' : 'rotateY(90deg) translateZ(' + box.depth.next + 'px)'
515
+ })
516
+ ;
517
+ },
518
+
519
+ behind: function() {
520
+ var
521
+ box = {
522
+ origin : ( ( $activeSide.outerWidth() - $nextSide.outerWidth() ) / 2),
523
+ depth : {
524
+ active : ($nextSide.outerWidth() / 2),
525
+ next : ($activeSide.outerWidth() / 2)
526
+ }
527
+ }
528
+ ;
529
+ module.verbose('Setting the initial animation position as behind', $nextSide, box);
530
+ $activeSide
531
+ .css({
532
+ 'transform' : 'rotateY(0deg)'
533
+ })
534
+ ;
535
+ $nextSide
536
+ .addClass(className.animating)
537
+ .css({
538
+ 'display' : 'block',
539
+ 'left' : box.origin + 'px',
540
+ 'transform' : 'rotateY(-180deg)'
541
+ })
542
+ ;
543
+ }
544
+ },
545
+ setting: function(name, value) {
546
+ if(value !== undefined) {
547
+ if( $.isPlainObject(name) ) {
548
+ $.extend(true, settings, name);
549
+ }
550
+ else {
551
+ settings[name] = value;
552
+ }
553
+ }
554
+ else {
555
+ return settings[name];
556
+ }
557
+ },
558
+ internal: function(name, value) {
559
+ if(value !== undefined) {
560
+ if( $.isPlainObject(name) ) {
561
+ $.extend(true, module, name);
562
+ }
563
+ else {
564
+ module[name] = value;
565
+ }
566
+ }
567
+ else {
568
+ return module[name];
569
+ }
570
+ },
571
+ debug: function() {
572
+ if(settings.debug) {
573
+ if(settings.performance) {
574
+ module.performance.log(arguments);
575
+ }
576
+ else {
577
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
578
+ module.debug.apply(console, arguments);
579
+ }
580
+ }
581
+ },
582
+ verbose: function() {
583
+ if(settings.verbose && settings.debug) {
584
+ if(settings.performance) {
585
+ module.performance.log(arguments);
586
+ }
587
+ else {
588
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
589
+ module.verbose.apply(console, arguments);
590
+ }
591
+ }
592
+ },
593
+ error: function() {
594
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
595
+ module.error.apply(console, arguments);
596
+ },
597
+ performance: {
598
+ log: function(message) {
599
+ var
600
+ currentTime,
601
+ executionTime,
602
+ previousTime
603
+ ;
604
+ if(settings.performance) {
605
+ currentTime = new Date().getTime();
606
+ previousTime = time || currentTime;
607
+ executionTime = currentTime - previousTime;
608
+ time = currentTime;
609
+ performance.push({
610
+ 'Element' : element,
611
+ 'Name' : message[0],
612
+ 'Arguments' : [].slice.call(message, 1) || '',
613
+ 'Execution Time' : executionTime
614
+ });
615
+ }
616
+ clearTimeout(module.performance.timer);
617
+ module.performance.timer = setTimeout(module.performance.display, 100);
618
+ },
619
+ display: function() {
620
+ var
621
+ title = settings.name + ':',
622
+ totalTime = 0
623
+ ;
624
+ time = false;
625
+ clearTimeout(module.performance.timer);
626
+ $.each(performance, function(index, data) {
627
+ totalTime += data['Execution Time'];
628
+ });
629
+ title += ' ' + totalTime + 'ms';
630
+ if(moduleSelector) {
631
+ title += ' \'' + moduleSelector + '\'';
632
+ }
633
+ if($allModules.size() > 1) {
634
+ title += ' ' + '(' + $allModules.size() + ')';
635
+ }
636
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
637
+ console.groupCollapsed(title);
638
+ if(console.table) {
639
+ console.table(performance);
640
+ }
641
+ else {
642
+ $.each(performance, function(index, data) {
643
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
644
+ });
645
+ }
646
+ console.groupEnd();
647
+ }
648
+ performance = [];
649
+ }
650
+ },
651
+ invoke: function(query, passedArguments, context) {
652
+ var
653
+ maxDepth,
654
+ found,
655
+ response
656
+ ;
657
+ passedArguments = passedArguments || queryArguments;
658
+ context = element || context;
659
+ if(typeof query == 'string' && instance !== undefined) {
660
+ query = query.split(/[\. ]/);
661
+ maxDepth = query.length - 1;
662
+ $.each(query, function(depth, value) {
663
+ var camelCaseValue = (depth != maxDepth)
664
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
665
+ : query
666
+ ;
667
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
668
+ instance = instance[value];
669
+ }
670
+ else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
671
+ instance = instance[camelCaseValue];
672
+ }
673
+ else if( instance[value] !== undefined ) {
674
+ found = instance[value];
675
+ return false;
676
+ }
677
+ else if( instance[camelCaseValue] !== undefined ) {
678
+ found = instance[camelCaseValue];
679
+ return false;
680
+ }
681
+ else {
682
+ module.error(error.method);
683
+ return false;
684
+ }
685
+ });
686
+ }
687
+ if ( $.isFunction( found ) ) {
688
+ response = found.apply(context, passedArguments);
689
+ }
690
+ else if(found !== undefined) {
691
+ response = found;
692
+ }
693
+ if($.isArray(invokedResponse)) {
694
+ invokedResponse.push(response);
695
+ }
696
+ else if(typeof invokedResponse == 'string') {
697
+ invokedResponse = [invokedResponse, response];
698
+ }
699
+ else if(response !== undefined) {
700
+ invokedResponse = response;
701
+ }
702
+ return found;
703
+ }
704
+ };
705
+
706
+ if(methodInvoked) {
707
+ if(instance === undefined) {
708
+ module.initialize();
709
+ }
710
+ module.invoke(query);
711
+ }
712
+ else {
713
+ if(instance !== undefined) {
714
+ module.destroy();
715
+ }
716
+ module.initialize();
717
+ }
718
+ })
719
+ ;
720
+
721
+ return (invokedResponse !== undefined)
722
+ ? invokedResponse
723
+ : this
724
+ ;
725
+ };
726
+
727
+ $.fn.shape.settings = {
728
+
729
+ // module info
730
+ name : 'Shape',
731
+
732
+ // debug content outputted to console
733
+ debug : true,
734
+
735
+ // verbose debug output
736
+ verbose : true,
737
+
738
+ // performance data output
739
+ performance: true,
740
+
741
+ // event namespace
742
+ namespace : 'shape',
743
+
744
+ // callback occurs on side change
745
+ beforeChange : function() {},
746
+ onChange : function() {},
747
+
748
+ // use css animation (currently only true is supported)
749
+ useCSS : true,
750
+
751
+ // animation duration (useful only with future js animations)
752
+ duration : 1000,
753
+ easing : 'easeInOutQuad',
754
+
755
+ // possible errors
756
+ error: {
757
+ side : 'You tried to switch to a side that does not exist.',
758
+ method : 'The method you called is not defined'
759
+ },
760
+
761
+ // classnames used
762
+ className : {
763
+ css : 'css',
764
+ animating : 'animating',
765
+ hidden : 'hidden',
766
+ active : 'active'
767
+ },
768
+
769
+ // selectors used
770
+ selector : {
771
+ sides : '.sides',
772
+ side : '.side'
773
+ }
774
+
775
+ };
776
+
777
+
778
+ })( jQuery, window , document );