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,724 @@
1
+ /*
2
+ * # Semantic - Dropdown
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.dropdown = function(parameters) {
15
+ var
16
+ $allModules = $(this),
17
+ $document = $(document),
18
+
19
+ settings = ( $.isPlainObject(parameters) )
20
+ ? $.extend(true, {}, $.fn.dropdown.settings, parameters)
21
+ : $.fn.dropdown.settings,
22
+
23
+ className = settings.className,
24
+ metadata = settings.metadata,
25
+ namespace = settings.namespace,
26
+ selector = settings.selector,
27
+ error = settings.error,
28
+
29
+ eventNamespace = '.' + namespace,
30
+ dropdownNamespace = 'module-' + namespace,
31
+ dropdownSelector = $allModules.selector || '',
32
+
33
+ time = new Date().getTime(),
34
+ performance = [],
35
+
36
+ query = arguments[0],
37
+ methodInvoked = (typeof query == 'string'),
38
+ queryArguments = [].slice.call(arguments, 1),
39
+ invokedResponse
40
+ ;
41
+
42
+ $allModules
43
+ .each(function() {
44
+ var
45
+ $module = $(this),
46
+ $item = $module.find(selector.item),
47
+ $text = $module.find(selector.text),
48
+ $input = $module.find(selector.input),
49
+
50
+ $menu = $module.children(selector.menu),
51
+
52
+ isTouchDevice = ('ontouchstart' in document.documentElement),
53
+
54
+ element = this,
55
+ instance = $module.data(dropdownNamespace),
56
+ module
57
+ ;
58
+
59
+ module = {
60
+
61
+ initialize: function() {
62
+ module.debug('Initializing dropdown', settings);
63
+ if(isTouchDevice) {
64
+ $module
65
+ .on('touchstart' + eventNamespace, module.event.test.toggle)
66
+ ;
67
+ }
68
+ else if(settings.on == 'click') {
69
+ $module
70
+ .on('click' + eventNamespace, module.event.test.toggle)
71
+ ;
72
+ }
73
+ else if(settings.on == 'hover') {
74
+ $module
75
+ .on('mouseenter' + eventNamespace, module.delay.show)
76
+ .on('mouseleave' + eventNamespace, module.delay.hide)
77
+ ;
78
+ }
79
+ else {
80
+ $module
81
+ .on(settings.on + eventNamespace, module.toggle)
82
+ ;
83
+ }
84
+ if(settings.action == 'updateForm') {
85
+ module.set.selected();
86
+ }
87
+ $item
88
+ .on('mouseenter' + eventNamespace, module.event.item.mouseenter)
89
+ .on('mouseleave' + eventNamespace, module.event.item.mouseleave)
90
+ .on(module.get.selectEvent() + eventNamespace, module.event.item.click)
91
+ ;
92
+ module.instantiate();
93
+ },
94
+
95
+ instantiate: function() {
96
+ module.verbose('Storing instance of dropdown', module);
97
+ $module
98
+ .data(dropdownNamespace, module)
99
+ ;
100
+ },
101
+
102
+ destroy: function() {
103
+ module.verbose('Destroying previous dropdown for', $module);
104
+ $item
105
+ .off(eventNamespace)
106
+ ;
107
+ $module
108
+ .off(eventNamespace)
109
+ .removeData(dropdownNamespace)
110
+ ;
111
+ },
112
+
113
+ event: {
114
+
115
+ stopPropagation: function(event) {
116
+ event.stopPropagation();
117
+ },
118
+
119
+ test: {
120
+ toggle: function(event) {
121
+ module.determine.intent(event, module.toggle);
122
+ event.stopImmediatePropagation();
123
+ },
124
+ hide: function(event) {
125
+ module.determine.intent(event, module.hide);
126
+ event.stopPropagation();
127
+ }
128
+ },
129
+
130
+ item: {
131
+
132
+ mouseenter: function(event) {
133
+ var
134
+ $currentMenu = $(this).find(selector.menu),
135
+ $otherMenus = $(this).siblings(selector.item).children(selector.menu)
136
+ ;
137
+ if( $currentMenu.size() > 0 ) {
138
+ clearTimeout(module.itemTimer);
139
+ module.itemTimer = setTimeout(function() {
140
+ module.animate.hide(false, $otherMenus);
141
+ module.verbose('Showing sub-menu', $currentMenu);
142
+ module.animate.show(false, $currentMenu);
143
+ }, settings.delay.show * 2);
144
+ }
145
+ },
146
+
147
+ mouseleave: function(event) {
148
+ var
149
+ $currentMenu = $(this).find(selector.menu)
150
+ ;
151
+ if($currentMenu.size() > 0) {
152
+ clearTimeout(module.itemTimer);
153
+ module.itemTimer = setTimeout(function() {
154
+ module.verbose('Hiding sub-menu', $currentMenu);
155
+ module.animate.hide(false, $currentMenu);
156
+ }, settings.delay.hide);
157
+ }
158
+ },
159
+
160
+ click: function (event) {
161
+ var
162
+ $choice = $(this),
163
+ text = $choice.data(metadata.text) || $choice.text(),
164
+ value = $choice.data(metadata.value) || text.toLowerCase()
165
+ ;
166
+ if( $choice.find(selector.menu).size() === 0 ) {
167
+ module.verbose('Adding active state to selected item');
168
+ $item
169
+ .removeClass(className.active)
170
+ ;
171
+ $choice
172
+ .addClass(className.active)
173
+ ;
174
+ module.determine.selectAction(text, value);
175
+ $.proxy(settings.onChange, element)(value, text);
176
+ event.stopPropagation();
177
+ }
178
+ }
179
+
180
+ },
181
+
182
+ resetStyle: function() {
183
+ $(this).removeAttr('style');
184
+ }
185
+
186
+ },
187
+
188
+ determine: {
189
+ selectAction: function(text, value) {
190
+ module.verbose('Determining action', settings.action);
191
+ if(settings.action == 'auto') {
192
+ if(module.is.selection()) {
193
+ module.debug('Selection dropdown used updating form', text, value);
194
+ module.updateForm(text, value);
195
+ }
196
+ else {
197
+ module.debug('No action specified hiding dropdown', text, value);
198
+ module.hide();
199
+ }
200
+ }
201
+ else if( $.isFunction( module[settings.action] ) ) {
202
+ module.verbose('Triggering preset action', settings.action, text, value);
203
+ module[ settings.action ](text, value);
204
+ }
205
+ else if( $.isFunction(settings.action) ) {
206
+ module.verbose('Triggering user action', settings.action, text, value);
207
+ settings.action(text, value);
208
+ }
209
+ else {
210
+ module.error(error.action);
211
+ }
212
+ },
213
+ intent: function(event, callback) {
214
+ module.debug('Determining whether event occurred in dropdown', event.target);
215
+ callback = callback || function(){};
216
+ if( $(event.target).closest($menu).size() === 0 ) {
217
+ module.verbose('Triggering event', callback);
218
+ callback();
219
+ }
220
+ else {
221
+ module.verbose('Event occurred in dropdown, canceling callback');
222
+ }
223
+ }
224
+ },
225
+
226
+ bind: {
227
+ intent: function() {
228
+ module.verbose('Binding hide intent event to document');
229
+ $document
230
+ .on(module.get.selectEvent(), module.event.test.hide)
231
+ ;
232
+ }
233
+ },
234
+
235
+ unbind: {
236
+ intent: function() {
237
+ module.verbose('Removing hide intent event from document');
238
+ $document
239
+ .off(module.get.selectEvent())
240
+ ;
241
+ }
242
+ },
243
+
244
+ nothing: function() {},
245
+
246
+ changeText: function(text, value) {
247
+ module.set.text(text);
248
+ module.hide();
249
+ },
250
+
251
+ updateForm: function(text, value) {
252
+ module.set.text(text);
253
+ module.set.value(value);
254
+ module.hide();
255
+ },
256
+
257
+ get: {
258
+ selectEvent: function() {
259
+ return (isTouchDevice)
260
+ ? 'touchstart'
261
+ : 'click'
262
+ ;
263
+ },
264
+ text: function() {
265
+ return $text.text();
266
+ },
267
+ value: function() {
268
+ return $input.val();
269
+ },
270
+ item: function(value) {
271
+ var
272
+ $selectedItem
273
+ ;
274
+ value = value || $input.val();
275
+ $item
276
+ .each(function() {
277
+ if( $(this).data(metadata.value) == value ) {
278
+ $selectedItem = $(this);
279
+ }
280
+ })
281
+ ;
282
+ return $selectedItem || false;
283
+ }
284
+ },
285
+
286
+ set: {
287
+ text: function(text) {
288
+ module.debug('Changing text', text, $text);
289
+ $text.removeClass(className.placeholder);
290
+ $text.text(text);
291
+ },
292
+ value: function(value) {
293
+ module.debug('Adding selected value to hidden input', value, $input);
294
+ $input.val(value);
295
+ },
296
+ active: function() {
297
+ $module.addClass(className.active);
298
+ },
299
+ visible: function() {
300
+ $module.addClass(className.visible);
301
+ },
302
+ selected: function(value) {
303
+ var
304
+ $selectedItem = module.get.item(value),
305
+ selectedText
306
+ ;
307
+ if($selectedItem) {
308
+ module.debug('Setting selected menu item to', $selectedItem);
309
+ selectedText = $selectedItem.data(metadata.text) || $selectedItem.text();
310
+ $item
311
+ .removeClass(className.active)
312
+ ;
313
+ $selectedItem
314
+ .addClass(className.active)
315
+ ;
316
+ module.set.text(selectedText);
317
+ }
318
+ }
319
+ },
320
+
321
+ remove: {
322
+ active: function() {
323
+ $module.removeClass(className.active);
324
+ },
325
+ visible: function() {
326
+ $module.removeClass(className.visible);
327
+ }
328
+ },
329
+
330
+ is: {
331
+ selection: function() {
332
+ return $module.hasClass(className.selection);
333
+ },
334
+ visible: function($subMenu) {
335
+ return ($subMenu)
336
+ ? $subMenu.is(':animated, :visible')
337
+ : $menu.is(':animated, :visible')
338
+ ;
339
+ },
340
+ hidden: function($subMenu) {
341
+ return ($subMenu)
342
+ ? $subMenu.is(':not(:animated, :visible)')
343
+ : $menu.is(':not(:animated, :visible)')
344
+ ;
345
+ }
346
+ },
347
+
348
+ can: {
349
+ click: function() {
350
+ return (isTouchDevice || settings.on == 'click');
351
+ },
352
+ show: function() {
353
+ return !$module.hasClass(className.disabled);
354
+ }
355
+ },
356
+
357
+ animate: {
358
+ show: function(callback, $subMenu) {
359
+ var
360
+ $currentMenu = $subMenu || $menu
361
+ ;
362
+ callback = callback || function(){};
363
+ if( module.is.hidden($currentMenu) ) {
364
+ module.verbose('Doing menu show animation', $currentMenu);
365
+ if(settings.transition == 'none') {
366
+ callback();
367
+ }
368
+ else if($.fn.transition !== undefined) {
369
+ $currentMenu.transition({
370
+ animation : settings.transition + ' in',
371
+ duration : settings.duration,
372
+ complete : callback,
373
+ queue : false
374
+ });
375
+ }
376
+ else if(settings.transition == 'slide down') {
377
+ $currentMenu
378
+ .hide()
379
+ .clearQueue()
380
+ .children()
381
+ .clearQueue()
382
+ .css('opacity', 0)
383
+ .delay(50)
384
+ .animate({
385
+ opacity : 1
386
+ }, settings.duration, 'easeOutQuad', module.event.resetStyle)
387
+ .end()
388
+ .slideDown(100, 'easeOutQuad', function() {
389
+ $.proxy(module.event.resetStyle, this)();
390
+ callback();
391
+ })
392
+ ;
393
+ }
394
+ else if(settings.transition == 'fade') {
395
+ $currentMenu
396
+ .hide()
397
+ .clearQueue()
398
+ .fadeIn(settings.duration, function() {
399
+ $.proxy(module.event.resetStyle, this)();
400
+ callback();
401
+ })
402
+ ;
403
+ }
404
+ else {
405
+ module.error(error.transition);
406
+ }
407
+ }
408
+ },
409
+ hide: function(callback, $subMenu) {
410
+ var
411
+ $currentMenu = $subMenu || $menu
412
+ ;
413
+ callback = callback || function(){};
414
+ if(module.is.visible($currentMenu) ) {
415
+ module.verbose('Doing menu hide animation', $currentMenu);
416
+ if($.fn.transition !== undefined) {
417
+ $currentMenu.transition({
418
+ animation : settings.transition + ' out',
419
+ duration : settings.duration,
420
+ complete : callback,
421
+ queue : false
422
+ });
423
+ }
424
+ else if(settings.transition == 'none') {
425
+ callback();
426
+ }
427
+ else if(settings.transition == 'slide down') {
428
+ $currentMenu
429
+ .show()
430
+ .clearQueue()
431
+ .children()
432
+ .clearQueue()
433
+ .css('opacity', 1)
434
+ .animate({
435
+ opacity : 0
436
+ }, 100, 'easeOutQuad', module.event.resetStyle)
437
+ .end()
438
+ .delay(50)
439
+ .slideUp(100, 'easeOutQuad', function() {
440
+ $.proxy(module.event.resetStyle, this)();
441
+ callback();
442
+ })
443
+ ;
444
+ }
445
+ else if(settings.transition == 'fade') {
446
+ $currentMenu
447
+ .show()
448
+ .clearQueue()
449
+ .fadeOut(150, function() {
450
+ $.proxy(module.event.resetStyle, this)();
451
+ callback();
452
+ })
453
+ ;
454
+ }
455
+ else {
456
+ module.error(error.transition);
457
+ }
458
+ }
459
+ }
460
+ },
461
+
462
+ show: function() {
463
+ module.debug('Checking if dropdown can show');
464
+ if( module.is.hidden() ) {
465
+ module.hideOthers();
466
+ module.set.active();
467
+ module.animate.show(module.set.visible);
468
+ if( module.can.click() ) {
469
+ module.bind.intent();
470
+ }
471
+ $.proxy(settings.onShow, element)();
472
+ }
473
+ },
474
+
475
+ hide: function() {
476
+ if( module.is.visible() ) {
477
+ module.debug('Hiding dropdown');
478
+ if( module.can.click() ) {
479
+ module.unbind.intent();
480
+ }
481
+ module.remove.active();
482
+ module.animate.hide(module.remove.visible);
483
+ $.proxy(settings.onHide, element)();
484
+ }
485
+ },
486
+
487
+ delay: {
488
+ show: function() {
489
+ module.verbose('Delaying show event to ensure user intent');
490
+ clearTimeout(module.timer);
491
+ module.timer = setTimeout(module.show, settings.delay.show);
492
+ },
493
+ hide: function() {
494
+ module.verbose('Delaying hide event to ensure user intent');
495
+ clearTimeout(module.timer);
496
+ module.timer = setTimeout(module.hide, settings.delay.hide);
497
+ }
498
+ },
499
+
500
+ hideOthers: function() {
501
+ module.verbose('Finding other dropdowns to hide');
502
+ $allModules
503
+ .not($module)
504
+ .has(selector.menu + ':visible')
505
+ .dropdown('hide')
506
+ ;
507
+ },
508
+
509
+ toggle: function() {
510
+ module.verbose('Toggling menu visibility');
511
+ if( module.is.hidden() ) {
512
+ module.show();
513
+ }
514
+ else {
515
+ module.hide();
516
+ }
517
+ },
518
+
519
+ setting: function(name, value) {
520
+ if(value !== undefined) {
521
+ if( $.isPlainObject(name) ) {
522
+ $.extend(true, settings, name);
523
+ }
524
+ else {
525
+ settings[name] = value;
526
+ }
527
+ }
528
+ else {
529
+ return settings[name];
530
+ }
531
+ },
532
+ internal: function(name, value) {
533
+ if(value !== undefined) {
534
+ if( $.isPlainObject(name) ) {
535
+ $.extend(true, module, name);
536
+ }
537
+ else {
538
+ module[name] = value;
539
+ }
540
+ }
541
+ else {
542
+ return module[name];
543
+ }
544
+ },
545
+ debug: function() {
546
+ if(settings.debug) {
547
+ if(settings.performance) {
548
+ module.performance.log(arguments);
549
+ }
550
+ else {
551
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
552
+ module.debug.apply(console, arguments);
553
+ }
554
+ }
555
+ },
556
+ verbose: function() {
557
+ if(settings.verbose && settings.debug) {
558
+ if(settings.performance) {
559
+ module.performance.log(arguments);
560
+ }
561
+ else {
562
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
563
+ module.verbose.apply(console, arguments);
564
+ }
565
+ }
566
+ },
567
+ error: function() {
568
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
569
+ module.error.apply(console, arguments);
570
+ },
571
+ performance: {
572
+ log: function(message) {
573
+ var
574
+ currentTime,
575
+ executionTime,
576
+ previousTime
577
+ ;
578
+ if(settings.performance) {
579
+ currentTime = new Date().getTime();
580
+ previousTime = time || currentTime;
581
+ executionTime = currentTime - previousTime;
582
+ time = currentTime;
583
+ performance.push({
584
+ 'Element' : element,
585
+ 'Name' : message[0],
586
+ 'Arguments' : [].slice.call(message, 1) || '',
587
+ 'Execution Time' : executionTime
588
+ });
589
+ }
590
+ clearTimeout(module.performance.timer);
591
+ module.performance.timer = setTimeout(module.performance.display, 100);
592
+ },
593
+ display: function() {
594
+ var
595
+ title = settings.name + ':',
596
+ totalTime = 0
597
+ ;
598
+ time = false;
599
+ clearTimeout(module.performance.timer);
600
+ $.each(performance, function(index, data) {
601
+ totalTime += data['Execution Time'];
602
+ });
603
+ title += ' ' + totalTime + 'ms';
604
+ if(dropdownSelector) {
605
+ title += ' \'' + dropdownSelector + '\'';
606
+ }
607
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
608
+ console.groupCollapsed(title);
609
+ if(console.table) {
610
+ console.table(performance);
611
+ }
612
+ else {
613
+ $.each(performance, function(index, data) {
614
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
615
+ });
616
+ }
617
+ console.groupEnd();
618
+ }
619
+ performance = [];
620
+ }
621
+ },
622
+ invoke: function(query, passedArguments, context) {
623
+ var
624
+ maxDepth,
625
+ found
626
+ ;
627
+ passedArguments = passedArguments || queryArguments;
628
+ context = element || context;
629
+ if(typeof query == 'string' && instance !== undefined) {
630
+ query = query.split(/[\. ]/);
631
+ maxDepth = query.length - 1;
632
+ $.each(query, function(depth, value) {
633
+ if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
634
+ instance = instance[value];
635
+ }
636
+ else if( instance[value] !== undefined ) {
637
+ found = instance[value];
638
+ }
639
+ else {
640
+ module.error(error.method);
641
+ }
642
+ });
643
+ }
644
+ if ( $.isFunction( found ) ) {
645
+ return found.apply(context, passedArguments);
646
+ }
647
+ return found || false;
648
+ }
649
+ };
650
+
651
+ if(methodInvoked) {
652
+ if(instance === undefined) {
653
+ module.initialize();
654
+ }
655
+ module.invoke(query);
656
+ }
657
+ else {
658
+ if(instance !== undefined) {
659
+ module.destroy();
660
+ }
661
+ module.initialize();
662
+ }
663
+ })
664
+ ;
665
+
666
+ return (invokedResponse)
667
+ ? invokedResponse
668
+ : this
669
+ ;
670
+ };
671
+
672
+ $.fn.dropdown.settings = {
673
+
674
+ name : 'Dropdown',
675
+ namespace : 'dropdown',
676
+
677
+ verbose : true,
678
+ debug : true,
679
+ performance : true,
680
+
681
+ on : 'click',
682
+ action : 'auto',
683
+
684
+ delay: {
685
+ show: 200,
686
+ hide: 300
687
+ },
688
+
689
+ transition : 'slide down',
690
+ duration : 250,
691
+
692
+ onChange : function(){},
693
+ onShow : function(){},
694
+ onHide : function(){},
695
+
696
+ error : {
697
+ action : 'You called a dropdown action that was not defined',
698
+ method : 'The method you called is not defined.',
699
+ transition : 'The requested transition was not found'
700
+ },
701
+
702
+ metadata: {
703
+ text : 'text',
704
+ value : 'value'
705
+ },
706
+
707
+ selector : {
708
+ menu : '.menu',
709
+ item : '.menu > .item',
710
+ text : '> .text',
711
+ input : '> input[type="hidden"]'
712
+ },
713
+
714
+ className : {
715
+ active : 'active',
716
+ placeholder : 'default',
717
+ disabled : 'disabled',
718
+ visible : 'visible',
719
+ selection : 'selection'
720
+ }
721
+
722
+ };
723
+
724
+ })( jQuery, window , document );