@pageboard/html 0.14.19 → 0.14.20

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/elements/accordion.js +1 -1
  2. package/elements/fieldsets.js +1 -1
  3. package/elements/form.js +2 -2
  4. package/elements/grid.js +1 -1
  5. package/elements/image.js +1 -1
  6. package/elements/input-file.js +2 -2
  7. package/elements/input-property.js +1 -1
  8. package/elements/inputs.js +5 -5
  9. package/elements/layout.js +1 -1
  10. package/elements/link.js +2 -2
  11. package/elements/menu.js +2 -2
  12. package/elements/navigation.js +1 -1
  13. package/elements/page.js +1 -1
  14. package/elements/paragraph.js +2 -2
  15. package/elements/query-tags.js +1 -1
  16. package/elements/tab.js +1 -1
  17. package/elements/table.js +1 -1
  18. package/elements/template.js +1 -1
  19. package/package.json +3 -8
  20. package/ui/card.css +3 -3
  21. package/ui/components/accordion.css +241 -0
  22. package/ui/components/accordion.js +613 -0
  23. package/ui/components/ad.css +275 -0
  24. package/ui/components/api.js +1167 -0
  25. package/ui/components/breadcrumb.css +122 -0
  26. package/ui/components/button.css +3525 -0
  27. package/ui/components/card.css +939 -0
  28. package/ui/components/checkbox.css +604 -0
  29. package/ui/components/checkbox.js +831 -0
  30. package/ui/components/colorize.js +274 -0
  31. package/ui/components/comment.css +268 -0
  32. package/ui/components/container.css +149 -0
  33. package/ui/components/dimmer.css +224 -0
  34. package/ui/components/dimmer.js +733 -0
  35. package/ui/components/divider.css +253 -0
  36. package/ui/components/dropdown.css +1448 -0
  37. package/ui/components/dropdown.js +3955 -0
  38. package/ui/components/embed.css +160 -0
  39. package/ui/components/embed.js +706 -0
  40. package/ui/components/feed.css +281 -0
  41. package/ui/components/flag.css +1035 -0
  42. package/ui/components/form.css +1011 -0
  43. package/ui/components/form.js +1706 -0
  44. package/ui/components/grid.css +1941 -0
  45. package/ui/components/header.css +719 -0
  46. package/ui/components/icon.css +4777 -0
  47. package/ui/components/image.css +310 -0
  48. package/ui/components/input.css +469 -0
  49. package/ui/components/item.css +464 -0
  50. package/ui/components/label.css +1281 -0
  51. package/ui/components/list.css +943 -0
  52. package/ui/components/loader.css +339 -0
  53. package/ui/components/menu.css +1940 -0
  54. package/ui/components/message.css +468 -0
  55. package/ui/components/modal.css +617 -0
  56. package/ui/components/modal.js +1034 -0
  57. package/ui/components/nag.css +145 -0
  58. package/ui/components/nag.js +507 -0
  59. package/ui/components/placeholder.css +229 -0
  60. package/ui/components/popup.css +640 -0
  61. package/ui/components/popup.js +1532 -0
  62. package/ui/components/progress.css +502 -0
  63. package/ui/components/progress.js +931 -0
  64. package/ui/components/rail.css +152 -0
  65. package/ui/components/rating.css +257 -0
  66. package/ui/components/rating.js +508 -0
  67. package/ui/components/reset.css +476 -0
  68. package/ui/components/reveal.css +260 -0
  69. package/ui/components/search.css +431 -0
  70. package/ui/components/search.js +1505 -0
  71. package/ui/components/segment.css +824 -0
  72. package/ui/components/shape.css +143 -0
  73. package/ui/components/shape.js +921 -0
  74. package/ui/components/sidebar.css +537 -0
  75. package/ui/components/sidebar.js +1033 -0
  76. package/ui/components/site.css +184 -0
  77. package/ui/components/site.js +487 -0
  78. package/ui/components/state.js +708 -0
  79. package/ui/components/statistic.css +534 -0
  80. package/ui/components/step.css +566 -0
  81. package/ui/components/sticky.css +73 -0
  82. package/ui/components/sticky.js +959 -0
  83. package/ui/components/tab.css +89 -0
  84. package/ui/components/tab.js +952 -0
  85. package/ui/components/table.css +1108 -0
  86. package/ui/components/transition.css +1792 -0
  87. package/ui/components/transition.js +1095 -0
  88. package/ui/components/video.css +121 -0
  89. package/ui/components/video.js +532 -0
  90. package/ui/components/visibility.js +1311 -0
  91. package/ui/components/visit.js +517 -0
  92. package/ui/item.css +2 -2
  93. package/ui/themes/default/assets/fonts/brand-icons.eot +0 -0
  94. package/ui/themes/default/assets/fonts/brand-icons.svg +1008 -0
  95. package/ui/themes/default/assets/fonts/brand-icons.ttf +0 -0
  96. package/ui/themes/default/assets/fonts/brand-icons.woff +0 -0
  97. package/ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  98. package/ui/themes/default/assets/fonts/icons.eot +0 -0
  99. package/ui/themes/default/assets/fonts/icons.otf +0 -0
  100. package/ui/themes/default/assets/fonts/icons.svg +1518 -0
  101. package/ui/themes/default/assets/fonts/icons.ttf +0 -0
  102. package/ui/themes/default/assets/fonts/icons.woff +0 -0
  103. package/ui/themes/default/assets/fonts/icons.woff2 +0 -0
  104. package/ui/themes/default/assets/fonts/outline-icons.eot +0 -0
  105. package/ui/themes/default/assets/fonts/outline-icons.svg +366 -0
  106. package/ui/themes/default/assets/fonts/outline-icons.ttf +0 -0
  107. package/ui/themes/default/assets/fonts/outline-icons.woff +0 -0
  108. package/ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  109. package/ui/themes/default/assets/images/flags.png +0 -0
@@ -0,0 +1,831 @@
1
+ /*!
2
+ * # Semantic UI 2.4.1 - Checkbox
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.checkbox = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ moduleSelector = $allModules.selector || '',
26
+
27
+ time = new Date().getTime(),
28
+ performance = [],
29
+
30
+ query = arguments[0],
31
+ methodInvoked = (typeof query == 'string'),
32
+ queryArguments = [].slice.call(arguments, 1),
33
+ returnedValue
34
+ ;
35
+
36
+ $allModules
37
+ .each(function() {
38
+ var
39
+ settings = $.extend(true, {}, $.fn.checkbox.settings, parameters),
40
+
41
+ className = settings.className,
42
+ namespace = settings.namespace,
43
+ selector = settings.selector,
44
+ error = settings.error,
45
+
46
+ eventNamespace = '.' + namespace,
47
+ moduleNamespace = 'module-' + namespace,
48
+
49
+ $module = $(this),
50
+ $label = $(this).children(selector.label),
51
+ $input = $(this).children(selector.input),
52
+ input = $input[0],
53
+
54
+ initialLoad = false,
55
+ shortcutPressed = false,
56
+ instance = $module.data(moduleNamespace),
57
+
58
+ observer,
59
+ element = this,
60
+ module
61
+ ;
62
+
63
+ module = {
64
+
65
+ initialize: function() {
66
+ module.verbose('Initializing checkbox', settings);
67
+
68
+ module.create.label();
69
+ module.bind.events();
70
+
71
+ module.set.tabbable();
72
+ module.hide.input();
73
+
74
+ module.observeChanges();
75
+ module.instantiate();
76
+ module.setup();
77
+ },
78
+
79
+ instantiate: function() {
80
+ module.verbose('Storing instance of module', module);
81
+ instance = module;
82
+ $module
83
+ .data(moduleNamespace, module)
84
+ ;
85
+ },
86
+
87
+ destroy: function() {
88
+ module.verbose('Destroying module');
89
+ module.unbind.events();
90
+ module.show.input();
91
+ $module.removeData(moduleNamespace);
92
+ },
93
+
94
+ fix: {
95
+ reference: function() {
96
+ if( $module.is(selector.input) ) {
97
+ module.debug('Behavior called on <input> adjusting invoked element');
98
+ $module = $module.closest(selector.checkbox);
99
+ module.refresh();
100
+ }
101
+ }
102
+ },
103
+
104
+ setup: function() {
105
+ module.set.initialLoad();
106
+ if( module.is.indeterminate() ) {
107
+ module.debug('Initial value is indeterminate');
108
+ module.indeterminate();
109
+ }
110
+ else if( module.is.checked() ) {
111
+ module.debug('Initial value is checked');
112
+ module.check();
113
+ }
114
+ else {
115
+ module.debug('Initial value is unchecked');
116
+ module.uncheck();
117
+ }
118
+ module.remove.initialLoad();
119
+ },
120
+
121
+ refresh: function() {
122
+ $label = $module.children(selector.label);
123
+ $input = $module.children(selector.input);
124
+ input = $input[0];
125
+ },
126
+
127
+ hide: {
128
+ input: function() {
129
+ module.verbose('Modifying <input> z-index to be unselectable');
130
+ $input.addClass(className.hidden);
131
+ }
132
+ },
133
+ show: {
134
+ input: function() {
135
+ module.verbose('Modifying <input> z-index to be selectable');
136
+ $input.removeClass(className.hidden);
137
+ }
138
+ },
139
+
140
+ observeChanges: function() {
141
+ if('MutationObserver' in window) {
142
+ observer = new MutationObserver(function(mutations) {
143
+ module.debug('DOM tree modified, updating selector cache');
144
+ module.refresh();
145
+ });
146
+ observer.observe(element, {
147
+ childList : true,
148
+ subtree : true
149
+ });
150
+ module.debug('Setting up mutation observer', observer);
151
+ }
152
+ },
153
+
154
+ attachEvents: function(selector, event) {
155
+ var
156
+ $element = $(selector)
157
+ ;
158
+ event = $.isFunction(module[event])
159
+ ? module[event]
160
+ : module.toggle
161
+ ;
162
+ if($element.length > 0) {
163
+ module.debug('Attaching checkbox events to element', selector, event);
164
+ $element
165
+ .on('click' + eventNamespace, event)
166
+ ;
167
+ }
168
+ else {
169
+ module.error(error.notFound);
170
+ }
171
+ },
172
+
173
+ event: {
174
+ click: function(event) {
175
+ var
176
+ $target = $(event.target)
177
+ ;
178
+ if( $target.is(selector.input) ) {
179
+ module.verbose('Using default check action on initialized checkbox');
180
+ return;
181
+ }
182
+ if( $target.is(selector.link) ) {
183
+ module.debug('Clicking link inside checkbox, skipping toggle');
184
+ return;
185
+ }
186
+ module.toggle();
187
+ $input.focus();
188
+ event.preventDefault();
189
+ },
190
+ keydown: function(event) {
191
+ var
192
+ key = event.which,
193
+ keyCode = {
194
+ enter : 13,
195
+ space : 32,
196
+ escape : 27
197
+ }
198
+ ;
199
+ if(key == keyCode.escape) {
200
+ module.verbose('Escape key pressed blurring field');
201
+ $input.blur();
202
+ shortcutPressed = true;
203
+ }
204
+ else if(!event.ctrlKey && ( key == keyCode.space || key == keyCode.enter) ) {
205
+ module.verbose('Enter/space key pressed, toggling checkbox');
206
+ module.toggle();
207
+ shortcutPressed = true;
208
+ }
209
+ else {
210
+ shortcutPressed = false;
211
+ }
212
+ },
213
+ keyup: function(event) {
214
+ if(shortcutPressed) {
215
+ event.preventDefault();
216
+ }
217
+ }
218
+ },
219
+
220
+ check: function() {
221
+ if( !module.should.allowCheck() ) {
222
+ return;
223
+ }
224
+ module.debug('Checking checkbox', $input);
225
+ module.set.checked();
226
+ if( !module.should.ignoreCallbacks() ) {
227
+ settings.onChecked.call(input);
228
+ settings.onChange.call(input);
229
+ }
230
+ },
231
+
232
+ uncheck: function() {
233
+ if( !module.should.allowUncheck() ) {
234
+ return;
235
+ }
236
+ module.debug('Unchecking checkbox');
237
+ module.set.unchecked();
238
+ if( !module.should.ignoreCallbacks() ) {
239
+ settings.onUnchecked.call(input);
240
+ settings.onChange.call(input);
241
+ }
242
+ },
243
+
244
+ indeterminate: function() {
245
+ if( module.should.allowIndeterminate() ) {
246
+ module.debug('Checkbox is already indeterminate');
247
+ return;
248
+ }
249
+ module.debug('Making checkbox indeterminate');
250
+ module.set.indeterminate();
251
+ if( !module.should.ignoreCallbacks() ) {
252
+ settings.onIndeterminate.call(input);
253
+ settings.onChange.call(input);
254
+ }
255
+ },
256
+
257
+ determinate: function() {
258
+ if( module.should.allowDeterminate() ) {
259
+ module.debug('Checkbox is already determinate');
260
+ return;
261
+ }
262
+ module.debug('Making checkbox determinate');
263
+ module.set.determinate();
264
+ if( !module.should.ignoreCallbacks() ) {
265
+ settings.onDeterminate.call(input);
266
+ settings.onChange.call(input);
267
+ }
268
+ },
269
+
270
+ enable: function() {
271
+ if( module.is.enabled() ) {
272
+ module.debug('Checkbox is already enabled');
273
+ return;
274
+ }
275
+ module.debug('Enabling checkbox');
276
+ module.set.enabled();
277
+ settings.onEnable.call(input);
278
+ // preserve legacy callbacks
279
+ settings.onEnabled.call(input);
280
+ },
281
+
282
+ disable: function() {
283
+ if( module.is.disabled() ) {
284
+ module.debug('Checkbox is already disabled');
285
+ return;
286
+ }
287
+ module.debug('Disabling checkbox');
288
+ module.set.disabled();
289
+ settings.onDisable.call(input);
290
+ // preserve legacy callbacks
291
+ settings.onDisabled.call(input);
292
+ },
293
+
294
+ get: {
295
+ radios: function() {
296
+ var
297
+ name = module.get.name()
298
+ ;
299
+ return $('input[name="' + name + '"]').closest(selector.checkbox);
300
+ },
301
+ otherRadios: function() {
302
+ return module.get.radios().not($module);
303
+ },
304
+ name: function() {
305
+ return $input.attr('name');
306
+ }
307
+ },
308
+
309
+ is: {
310
+ initialLoad: function() {
311
+ return initialLoad;
312
+ },
313
+ radio: function() {
314
+ return ($input.hasClass(className.radio) || $input.attr('type') == 'radio');
315
+ },
316
+ indeterminate: function() {
317
+ return $input.prop('indeterminate') !== undefined && $input.prop('indeterminate');
318
+ },
319
+ checked: function() {
320
+ return $input.prop('checked') !== undefined && $input.prop('checked');
321
+ },
322
+ disabled: function() {
323
+ return $input.prop('disabled') !== undefined && $input.prop('disabled');
324
+ },
325
+ enabled: function() {
326
+ return !module.is.disabled();
327
+ },
328
+ determinate: function() {
329
+ return !module.is.indeterminate();
330
+ },
331
+ unchecked: function() {
332
+ return !module.is.checked();
333
+ }
334
+ },
335
+
336
+ should: {
337
+ allowCheck: function() {
338
+ if(module.is.determinate() && module.is.checked() && !module.should.forceCallbacks() ) {
339
+ module.debug('Should not allow check, checkbox is already checked');
340
+ return false;
341
+ }
342
+ if(settings.beforeChecked.apply(input) === false) {
343
+ module.debug('Should not allow check, beforeChecked cancelled');
344
+ return false;
345
+ }
346
+ return true;
347
+ },
348
+ allowUncheck: function() {
349
+ if(module.is.determinate() && module.is.unchecked() && !module.should.forceCallbacks() ) {
350
+ module.debug('Should not allow uncheck, checkbox is already unchecked');
351
+ return false;
352
+ }
353
+ if(settings.beforeUnchecked.apply(input) === false) {
354
+ module.debug('Should not allow uncheck, beforeUnchecked cancelled');
355
+ return false;
356
+ }
357
+ return true;
358
+ },
359
+ allowIndeterminate: function() {
360
+ if(module.is.indeterminate() && !module.should.forceCallbacks() ) {
361
+ module.debug('Should not allow indeterminate, checkbox is already indeterminate');
362
+ return false;
363
+ }
364
+ if(settings.beforeIndeterminate.apply(input) === false) {
365
+ module.debug('Should not allow indeterminate, beforeIndeterminate cancelled');
366
+ return false;
367
+ }
368
+ return true;
369
+ },
370
+ allowDeterminate: function() {
371
+ if(module.is.determinate() && !module.should.forceCallbacks() ) {
372
+ module.debug('Should not allow determinate, checkbox is already determinate');
373
+ return false;
374
+ }
375
+ if(settings.beforeDeterminate.apply(input) === false) {
376
+ module.debug('Should not allow determinate, beforeDeterminate cancelled');
377
+ return false;
378
+ }
379
+ return true;
380
+ },
381
+ forceCallbacks: function() {
382
+ return (module.is.initialLoad() && settings.fireOnInit);
383
+ },
384
+ ignoreCallbacks: function() {
385
+ return (initialLoad && !settings.fireOnInit);
386
+ }
387
+ },
388
+
389
+ can: {
390
+ change: function() {
391
+ return !( $module.hasClass(className.disabled) || $module.hasClass(className.readOnly) || $input.prop('disabled') || $input.prop('readonly') );
392
+ },
393
+ uncheck: function() {
394
+ return (typeof settings.uncheckable === 'boolean')
395
+ ? settings.uncheckable
396
+ : !module.is.radio()
397
+ ;
398
+ }
399
+ },
400
+
401
+ set: {
402
+ initialLoad: function() {
403
+ initialLoad = true;
404
+ },
405
+ checked: function() {
406
+ module.verbose('Setting class to checked');
407
+ $module
408
+ .removeClass(className.indeterminate)
409
+ .addClass(className.checked)
410
+ ;
411
+ if( module.is.radio() ) {
412
+ module.uncheckOthers();
413
+ }
414
+ if(!module.is.indeterminate() && module.is.checked()) {
415
+ module.debug('Input is already checked, skipping input property change');
416
+ return;
417
+ }
418
+ module.verbose('Setting state to checked', input);
419
+ $input
420
+ .prop('indeterminate', false)
421
+ .prop('checked', true)
422
+ ;
423
+ module.trigger.change();
424
+ },
425
+ unchecked: function() {
426
+ module.verbose('Removing checked class');
427
+ $module
428
+ .removeClass(className.indeterminate)
429
+ .removeClass(className.checked)
430
+ ;
431
+ if(!module.is.indeterminate() && module.is.unchecked() ) {
432
+ module.debug('Input is already unchecked');
433
+ return;
434
+ }
435
+ module.debug('Setting state to unchecked');
436
+ $input
437
+ .prop('indeterminate', false)
438
+ .prop('checked', false)
439
+ ;
440
+ module.trigger.change();
441
+ },
442
+ indeterminate: function() {
443
+ module.verbose('Setting class to indeterminate');
444
+ $module
445
+ .addClass(className.indeterminate)
446
+ ;
447
+ if( module.is.indeterminate() ) {
448
+ module.debug('Input is already indeterminate, skipping input property change');
449
+ return;
450
+ }
451
+ module.debug('Setting state to indeterminate');
452
+ $input
453
+ .prop('indeterminate', true)
454
+ ;
455
+ module.trigger.change();
456
+ },
457
+ determinate: function() {
458
+ module.verbose('Removing indeterminate class');
459
+ $module
460
+ .removeClass(className.indeterminate)
461
+ ;
462
+ if( module.is.determinate() ) {
463
+ module.debug('Input is already determinate, skipping input property change');
464
+ return;
465
+ }
466
+ module.debug('Setting state to determinate');
467
+ $input
468
+ .prop('indeterminate', false)
469
+ ;
470
+ },
471
+ disabled: function() {
472
+ module.verbose('Setting class to disabled');
473
+ $module
474
+ .addClass(className.disabled)
475
+ ;
476
+ if( module.is.disabled() ) {
477
+ module.debug('Input is already disabled, skipping input property change');
478
+ return;
479
+ }
480
+ module.debug('Setting state to disabled');
481
+ $input
482
+ .prop('disabled', 'disabled')
483
+ ;
484
+ module.trigger.change();
485
+ },
486
+ enabled: function() {
487
+ module.verbose('Removing disabled class');
488
+ $module.removeClass(className.disabled);
489
+ if( module.is.enabled() ) {
490
+ module.debug('Input is already enabled, skipping input property change');
491
+ return;
492
+ }
493
+ module.debug('Setting state to enabled');
494
+ $input
495
+ .prop('disabled', false)
496
+ ;
497
+ module.trigger.change();
498
+ },
499
+ tabbable: function() {
500
+ module.verbose('Adding tabindex to checkbox');
501
+ if( $input.attr('tabindex') === undefined) {
502
+ $input.attr('tabindex', 0);
503
+ }
504
+ }
505
+ },
506
+
507
+ remove: {
508
+ initialLoad: function() {
509
+ initialLoad = false;
510
+ }
511
+ },
512
+
513
+ trigger: {
514
+ change: function() {
515
+ var
516
+ events = document.createEvent('HTMLEvents'),
517
+ inputElement = $input[0]
518
+ ;
519
+ if(inputElement) {
520
+ module.verbose('Triggering native change event');
521
+ events.initEvent('change', true, false);
522
+ inputElement.dispatchEvent(events);
523
+ }
524
+ }
525
+ },
526
+
527
+
528
+ create: {
529
+ label: function() {
530
+ if($input.prevAll(selector.label).length > 0) {
531
+ $input.prev(selector.label).detach().insertAfter($input);
532
+ module.debug('Moving existing label', $label);
533
+ }
534
+ else if( !module.has.label() ) {
535
+ $label = $('<label>').insertAfter($input);
536
+ module.debug('Creating label', $label);
537
+ }
538
+ }
539
+ },
540
+
541
+ has: {
542
+ label: function() {
543
+ return ($label.length > 0);
544
+ }
545
+ },
546
+
547
+ bind: {
548
+ events: function() {
549
+ module.verbose('Attaching checkbox events');
550
+ $module
551
+ .on('click' + eventNamespace, module.event.click)
552
+ .on('keydown' + eventNamespace, selector.input, module.event.keydown)
553
+ .on('keyup' + eventNamespace, selector.input, module.event.keyup)
554
+ ;
555
+ }
556
+ },
557
+
558
+ unbind: {
559
+ events: function() {
560
+ module.debug('Removing events');
561
+ $module
562
+ .off(eventNamespace)
563
+ ;
564
+ }
565
+ },
566
+
567
+ uncheckOthers: function() {
568
+ var
569
+ $radios = module.get.otherRadios()
570
+ ;
571
+ module.debug('Unchecking other radios', $radios);
572
+ $radios.removeClass(className.checked);
573
+ },
574
+
575
+ toggle: function() {
576
+ if( !module.can.change() ) {
577
+ if(!module.is.radio()) {
578
+ module.debug('Checkbox is read-only or disabled, ignoring toggle');
579
+ }
580
+ return;
581
+ }
582
+ if( module.is.indeterminate() || module.is.unchecked() ) {
583
+ module.debug('Currently unchecked');
584
+ module.check();
585
+ }
586
+ else if( module.is.checked() && module.can.uncheck() ) {
587
+ module.debug('Currently checked');
588
+ module.uncheck();
589
+ }
590
+ },
591
+ setting: function(name, value) {
592
+ module.debug('Changing setting', name, value);
593
+ if( $.isPlainObject(name) ) {
594
+ $.extend(true, settings, name);
595
+ }
596
+ else if(value !== undefined) {
597
+ if($.isPlainObject(settings[name])) {
598
+ $.extend(true, settings[name], value);
599
+ }
600
+ else {
601
+ settings[name] = value;
602
+ }
603
+ }
604
+ else {
605
+ return settings[name];
606
+ }
607
+ },
608
+ internal: function(name, value) {
609
+ if( $.isPlainObject(name) ) {
610
+ $.extend(true, module, name);
611
+ }
612
+ else if(value !== undefined) {
613
+ module[name] = value;
614
+ }
615
+ else {
616
+ return module[name];
617
+ }
618
+ },
619
+ debug: function() {
620
+ if(!settings.silent && settings.debug) {
621
+ if(settings.performance) {
622
+ module.performance.log(arguments);
623
+ }
624
+ else {
625
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
626
+ module.debug.apply(console, arguments);
627
+ }
628
+ }
629
+ },
630
+ verbose: function() {
631
+ if(!settings.silent && settings.verbose && settings.debug) {
632
+ if(settings.performance) {
633
+ module.performance.log(arguments);
634
+ }
635
+ else {
636
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
637
+ module.verbose.apply(console, arguments);
638
+ }
639
+ }
640
+ },
641
+ error: function() {
642
+ if(!settings.silent) {
643
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
644
+ module.error.apply(console, arguments);
645
+ }
646
+ },
647
+ performance: {
648
+ log: function(message) {
649
+ var
650
+ currentTime,
651
+ executionTime,
652
+ previousTime
653
+ ;
654
+ if(settings.performance) {
655
+ currentTime = new Date().getTime();
656
+ previousTime = time || currentTime;
657
+ executionTime = currentTime - previousTime;
658
+ time = currentTime;
659
+ performance.push({
660
+ 'Name' : message[0],
661
+ 'Arguments' : [].slice.call(message, 1) || '',
662
+ 'Element' : element,
663
+ 'Execution Time' : executionTime
664
+ });
665
+ }
666
+ clearTimeout(module.performance.timer);
667
+ module.performance.timer = setTimeout(module.performance.display, 500);
668
+ },
669
+ display: function() {
670
+ var
671
+ title = settings.name + ':',
672
+ totalTime = 0
673
+ ;
674
+ time = false;
675
+ clearTimeout(module.performance.timer);
676
+ $.each(performance, function(index, data) {
677
+ totalTime += data['Execution Time'];
678
+ });
679
+ title += ' ' + totalTime + 'ms';
680
+ if(moduleSelector) {
681
+ title += ' \'' + moduleSelector + '\'';
682
+ }
683
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
684
+ console.groupCollapsed(title);
685
+ if(console.table) {
686
+ console.table(performance);
687
+ }
688
+ else {
689
+ $.each(performance, function(index, data) {
690
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
691
+ });
692
+ }
693
+ console.groupEnd();
694
+ }
695
+ performance = [];
696
+ }
697
+ },
698
+ invoke: function(query, passedArguments, context) {
699
+ var
700
+ object = instance,
701
+ maxDepth,
702
+ found,
703
+ response
704
+ ;
705
+ passedArguments = passedArguments || queryArguments;
706
+ context = element || context;
707
+ if(typeof query == 'string' && object !== undefined) {
708
+ query = query.split(/[\. ]/);
709
+ maxDepth = query.length - 1;
710
+ $.each(query, function(depth, value) {
711
+ var camelCaseValue = (depth != maxDepth)
712
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
713
+ : query
714
+ ;
715
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
716
+ object = object[camelCaseValue];
717
+ }
718
+ else if( object[camelCaseValue] !== undefined ) {
719
+ found = object[camelCaseValue];
720
+ return false;
721
+ }
722
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
723
+ object = object[value];
724
+ }
725
+ else if( object[value] !== undefined ) {
726
+ found = object[value];
727
+ return false;
728
+ }
729
+ else {
730
+ module.error(error.method, query);
731
+ return false;
732
+ }
733
+ });
734
+ }
735
+ if ( $.isFunction( found ) ) {
736
+ response = found.apply(context, passedArguments);
737
+ }
738
+ else if(found !== undefined) {
739
+ response = found;
740
+ }
741
+ if($.isArray(returnedValue)) {
742
+ returnedValue.push(response);
743
+ }
744
+ else if(returnedValue !== undefined) {
745
+ returnedValue = [returnedValue, response];
746
+ }
747
+ else if(response !== undefined) {
748
+ returnedValue = response;
749
+ }
750
+ return found;
751
+ }
752
+ };
753
+
754
+ if(methodInvoked) {
755
+ if(instance === undefined) {
756
+ module.initialize();
757
+ }
758
+ module.invoke(query);
759
+ }
760
+ else {
761
+ if(instance !== undefined) {
762
+ instance.invoke('destroy');
763
+ }
764
+ module.initialize();
765
+ }
766
+ })
767
+ ;
768
+
769
+ return (returnedValue !== undefined)
770
+ ? returnedValue
771
+ : this
772
+ ;
773
+ };
774
+
775
+ $.fn.checkbox.settings = {
776
+
777
+ name : 'Checkbox',
778
+ namespace : 'checkbox',
779
+
780
+ silent : false,
781
+ debug : false,
782
+ verbose : true,
783
+ performance : true,
784
+
785
+ // delegated event context
786
+ uncheckable : 'auto',
787
+ fireOnInit : false,
788
+
789
+ onChange : function(){},
790
+
791
+ beforeChecked : function(){},
792
+ beforeUnchecked : function(){},
793
+ beforeDeterminate : function(){},
794
+ beforeIndeterminate : function(){},
795
+
796
+ onChecked : function(){},
797
+ onUnchecked : function(){},
798
+
799
+ onDeterminate : function() {},
800
+ onIndeterminate : function() {},
801
+
802
+ onEnable : function(){},
803
+ onDisable : function(){},
804
+
805
+ // preserve misspelled callbacks (will be removed in 3.0)
806
+ onEnabled : function(){},
807
+ onDisabled : function(){},
808
+
809
+ className : {
810
+ checked : 'checked',
811
+ indeterminate : 'indeterminate',
812
+ disabled : 'disabled',
813
+ hidden : 'hidden',
814
+ radio : 'radio',
815
+ readOnly : 'read-only'
816
+ },
817
+
818
+ error : {
819
+ method : 'The method you called is not defined'
820
+ },
821
+
822
+ selector : {
823
+ checkbox : '.ui.checkbox',
824
+ label : 'label, .box',
825
+ input : 'input[type="checkbox"], input[type="radio"]',
826
+ link : 'a[href]'
827
+ }
828
+
829
+ };
830
+
831
+ })( jQuery, window, document );