@pageboard/html 0.14.19 → 0.14.21

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 (110) 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 +12 -13
  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/layout.css +1 -1
  94. package/ui/themes/default/assets/fonts/brand-icons.eot +0 -0
  95. package/ui/themes/default/assets/fonts/brand-icons.svg +1008 -0
  96. package/ui/themes/default/assets/fonts/brand-icons.ttf +0 -0
  97. package/ui/themes/default/assets/fonts/brand-icons.woff +0 -0
  98. package/ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
  99. package/ui/themes/default/assets/fonts/icons.eot +0 -0
  100. package/ui/themes/default/assets/fonts/icons.otf +0 -0
  101. package/ui/themes/default/assets/fonts/icons.svg +1518 -0
  102. package/ui/themes/default/assets/fonts/icons.ttf +0 -0
  103. package/ui/themes/default/assets/fonts/icons.woff +0 -0
  104. package/ui/themes/default/assets/fonts/icons.woff2 +0 -0
  105. package/ui/themes/default/assets/fonts/outline-icons.eot +0 -0
  106. package/ui/themes/default/assets/fonts/outline-icons.svg +366 -0
  107. package/ui/themes/default/assets/fonts/outline-icons.ttf +0 -0
  108. package/ui/themes/default/assets/fonts/outline-icons.woff +0 -0
  109. package/ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
  110. package/ui/themes/default/assets/images/flags.png +0 -0
@@ -0,0 +1,1034 @@
1
+ /*!
2
+ * # Semantic UI 2.4.1 - Modal
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.modal = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $body = $('body'),
28
+
29
+ moduleSelector = $allModules.selector || '',
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
+
38
+ requestAnimationFrame = window.requestAnimationFrame
39
+ || window.mozRequestAnimationFrame
40
+ || window.webkitRequestAnimationFrame
41
+ || window.msRequestAnimationFrame
42
+ || function(callback) { setTimeout(callback, 0); },
43
+
44
+ returnedValue
45
+ ;
46
+
47
+ $allModules
48
+ .each(function() {
49
+ var
50
+ settings = ( $.isPlainObject(parameters) )
51
+ ? $.extend(true, {}, $.fn.modal.settings, parameters)
52
+ : $.extend({}, $.fn.modal.settings),
53
+
54
+ selector = settings.selector,
55
+ className = settings.className,
56
+ namespace = settings.namespace,
57
+ error = settings.error,
58
+
59
+ eventNamespace = '.' + namespace,
60
+ moduleNamespace = 'module-' + namespace,
61
+
62
+ $module = $(this),
63
+ $context = $(settings.context),
64
+ $close = $module.find(selector.close),
65
+
66
+ $allModals,
67
+ $otherModals,
68
+ $focusedElement,
69
+ $dimmable,
70
+ $dimmer,
71
+
72
+ element = this,
73
+ instance = $module.data(moduleNamespace),
74
+
75
+ ignoreRepeatedEvents = false,
76
+
77
+ elementEventNamespace,
78
+ id,
79
+ observer,
80
+ module
81
+ ;
82
+ module = {
83
+
84
+ initialize: function() {
85
+ module.verbose('Initializing dimmer', $context);
86
+
87
+ module.create.id();
88
+ module.create.dimmer();
89
+ module.refreshModals();
90
+
91
+ module.bind.events();
92
+ if(settings.observeChanges) {
93
+ module.observeChanges();
94
+ }
95
+ module.instantiate();
96
+ },
97
+
98
+ instantiate: function() {
99
+ module.verbose('Storing instance of modal');
100
+ instance = module;
101
+ $module
102
+ .data(moduleNamespace, instance)
103
+ ;
104
+ },
105
+
106
+ create: {
107
+ dimmer: function() {
108
+ var
109
+ defaultSettings = {
110
+ debug : settings.debug,
111
+ variation : settings.centered
112
+ ? false
113
+ : 'top aligned',
114
+ dimmerName : 'modals'
115
+ },
116
+ dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
117
+ ;
118
+ if($.fn.dimmer === undefined) {
119
+ module.error(error.dimmer);
120
+ return;
121
+ }
122
+ module.debug('Creating dimmer');
123
+ $dimmable = $context.dimmer(dimmerSettings);
124
+ if(settings.detachable) {
125
+ module.verbose('Modal is detachable, moving content into dimmer');
126
+ $dimmable.dimmer('add content', $module);
127
+ }
128
+ else {
129
+ module.set.undetached();
130
+ }
131
+ $dimmer = $dimmable.dimmer('get dimmer');
132
+ },
133
+ id: function() {
134
+ id = (Math.random().toString(16) + '000000000').substr(2, 8);
135
+ elementEventNamespace = '.' + id;
136
+ module.verbose('Creating unique id for element', id);
137
+ }
138
+ },
139
+
140
+ destroy: function() {
141
+ module.verbose('Destroying previous modal');
142
+ $module
143
+ .removeData(moduleNamespace)
144
+ .off(eventNamespace)
145
+ ;
146
+ $window.off(elementEventNamespace);
147
+ $dimmer.off(elementEventNamespace);
148
+ $close.off(eventNamespace);
149
+ $context.dimmer('destroy');
150
+ },
151
+
152
+ observeChanges: function() {
153
+ if('MutationObserver' in window) {
154
+ observer = new MutationObserver(function(mutations) {
155
+ module.debug('DOM tree modified, refreshing');
156
+ module.refresh();
157
+ });
158
+ observer.observe(element, {
159
+ childList : true,
160
+ subtree : true
161
+ });
162
+ module.debug('Setting up mutation observer', observer);
163
+ }
164
+ },
165
+
166
+ refresh: function() {
167
+ module.remove.scrolling();
168
+ module.cacheSizes();
169
+ if(!module.can.useFlex()) {
170
+ module.set.modalOffset();
171
+ }
172
+ module.set.screenHeight();
173
+ module.set.type();
174
+ },
175
+
176
+ refreshModals: function() {
177
+ $otherModals = $module.siblings(selector.modal);
178
+ $allModals = $otherModals.add($module);
179
+ },
180
+
181
+ attachEvents: function(selector, event) {
182
+ var
183
+ $toggle = $(selector)
184
+ ;
185
+ event = $.isFunction(module[event])
186
+ ? module[event]
187
+ : module.toggle
188
+ ;
189
+ if($toggle.length > 0) {
190
+ module.debug('Attaching modal events to element', selector, event);
191
+ $toggle
192
+ .off(eventNamespace)
193
+ .on('click' + eventNamespace, event)
194
+ ;
195
+ }
196
+ else {
197
+ module.error(error.notFound, selector);
198
+ }
199
+ },
200
+
201
+ bind: {
202
+ events: function() {
203
+ module.verbose('Attaching events');
204
+ $module
205
+ .on('click' + eventNamespace, selector.close, module.event.close)
206
+ .on('click' + eventNamespace, selector.approve, module.event.approve)
207
+ .on('click' + eventNamespace, selector.deny, module.event.deny)
208
+ ;
209
+ $window
210
+ .on('resize' + elementEventNamespace, module.event.resize)
211
+ ;
212
+ },
213
+ scrollLock: function() {
214
+ // touch events default to passive, due to changes in chrome to optimize mobile perf
215
+ $dimmable.get(0).addEventListener('touchmove', module.event.preventScroll, { passive: false });
216
+ }
217
+ },
218
+
219
+ unbind: {
220
+ scrollLock: function() {
221
+ $dimmable.get(0).removeEventListener('touchmove', module.event.preventScroll, { passive: false });
222
+ }
223
+ },
224
+
225
+ get: {
226
+ id: function() {
227
+ return (Math.random().toString(16) + '000000000').substr(2, 8);
228
+ }
229
+ },
230
+
231
+ event: {
232
+ approve: function() {
233
+ if(ignoreRepeatedEvents || settings.onApprove.call(element, $(this)) === false) {
234
+ module.verbose('Approve callback returned false cancelling hide');
235
+ return;
236
+ }
237
+ ignoreRepeatedEvents = true;
238
+ module.hide(function() {
239
+ ignoreRepeatedEvents = false;
240
+ });
241
+ },
242
+ preventScroll: function(event) {
243
+ event.preventDefault();
244
+ },
245
+ deny: function() {
246
+ if(ignoreRepeatedEvents || settings.onDeny.call(element, $(this)) === false) {
247
+ module.verbose('Deny callback returned false cancelling hide');
248
+ return;
249
+ }
250
+ ignoreRepeatedEvents = true;
251
+ module.hide(function() {
252
+ ignoreRepeatedEvents = false;
253
+ });
254
+ },
255
+ close: function() {
256
+ module.hide();
257
+ },
258
+ click: function(event) {
259
+ if(!settings.closable) {
260
+ module.verbose('Dimmer clicked but closable setting is disabled');
261
+ return;
262
+ }
263
+ var
264
+ $target = $(event.target),
265
+ isInModal = ($target.closest(selector.modal).length > 0),
266
+ isInDOM = $.contains(document.documentElement, event.target)
267
+ ;
268
+ if(!isInModal && isInDOM && module.is.active()) {
269
+ module.debug('Dimmer clicked, hiding all modals');
270
+ module.remove.clickaway();
271
+ if(settings.allowMultiple) {
272
+ module.hide();
273
+ }
274
+ else {
275
+ module.hideAll();
276
+ }
277
+ }
278
+ },
279
+ debounce: function(method, delay) {
280
+ clearTimeout(module.timer);
281
+ module.timer = setTimeout(method, delay);
282
+ },
283
+ keyboard: function(event) {
284
+ var
285
+ keyCode = event.which,
286
+ escapeKey = 27
287
+ ;
288
+ if(keyCode == escapeKey) {
289
+ if(settings.closable) {
290
+ module.debug('Escape key pressed hiding modal');
291
+ module.hide();
292
+ }
293
+ else {
294
+ module.debug('Escape key pressed, but closable is set to false');
295
+ }
296
+ event.preventDefault();
297
+ }
298
+ },
299
+ resize: function() {
300
+ if( $dimmable.dimmer('is active') && ( module.is.animating() || module.is.active() ) ) {
301
+ requestAnimationFrame(module.refresh);
302
+ }
303
+ }
304
+ },
305
+
306
+ toggle: function() {
307
+ if( module.is.active() || module.is.animating() ) {
308
+ module.hide();
309
+ }
310
+ else {
311
+ module.show();
312
+ }
313
+ },
314
+
315
+ show: function(callback) {
316
+ callback = $.isFunction(callback)
317
+ ? callback
318
+ : function(){}
319
+ ;
320
+ module.refreshModals();
321
+ module.set.dimmerSettings();
322
+ module.set.dimmerStyles();
323
+
324
+ module.showModal(callback);
325
+ },
326
+
327
+ hide: function(callback) {
328
+ callback = $.isFunction(callback)
329
+ ? callback
330
+ : function(){}
331
+ ;
332
+ module.refreshModals();
333
+ module.hideModal(callback);
334
+ },
335
+
336
+ showModal: function(callback) {
337
+ callback = $.isFunction(callback)
338
+ ? callback
339
+ : function(){}
340
+ ;
341
+ if( module.is.animating() || !module.is.active() ) {
342
+ module.showDimmer();
343
+ module.cacheSizes();
344
+ if(module.can.useFlex()) {
345
+ module.remove.legacy();
346
+ }
347
+ else {
348
+ module.set.legacy();
349
+ module.set.modalOffset();
350
+ module.debug('Using non-flex legacy modal positioning.');
351
+ }
352
+ module.set.screenHeight();
353
+ module.set.type();
354
+ module.set.clickaway();
355
+
356
+ if( !settings.allowMultiple && module.others.active() ) {
357
+ module.hideOthers(module.showModal);
358
+ }
359
+ else {
360
+ if(settings.allowMultiple && settings.detachable) {
361
+ $module.detach().appendTo($dimmer);
362
+ }
363
+ settings.onShow.call(element);
364
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
365
+ module.debug('Showing modal with css animations');
366
+ $module
367
+ .transition({
368
+ debug : settings.debug,
369
+ animation : settings.transition + ' in',
370
+ queue : settings.queue,
371
+ duration : settings.duration,
372
+ useFailSafe : true,
373
+ onComplete : function() {
374
+ settings.onVisible.apply(element);
375
+ if(settings.keyboardShortcuts) {
376
+ module.add.keyboardShortcuts();
377
+ }
378
+ module.save.focus();
379
+ module.set.active();
380
+ if(settings.autofocus) {
381
+ module.set.autofocus();
382
+ }
383
+ callback();
384
+ }
385
+ })
386
+ ;
387
+ }
388
+ else {
389
+ module.error(error.noTransition);
390
+ }
391
+ }
392
+ }
393
+ else {
394
+ module.debug('Modal is already visible');
395
+ }
396
+ },
397
+
398
+ hideModal: function(callback, keepDimmed) {
399
+ callback = $.isFunction(callback)
400
+ ? callback
401
+ : function(){}
402
+ ;
403
+ module.debug('Hiding modal');
404
+ if(settings.onHide.call(element, $(this)) === false) {
405
+ module.verbose('Hide callback returned false cancelling hide');
406
+ return;
407
+ }
408
+
409
+ if( module.is.animating() || module.is.active() ) {
410
+ if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
411
+ module.remove.active();
412
+ $module
413
+ .transition({
414
+ debug : settings.debug,
415
+ animation : settings.transition + ' out',
416
+ queue : settings.queue,
417
+ duration : settings.duration,
418
+ useFailSafe : true,
419
+ onStart : function() {
420
+ if(!module.others.active() && !keepDimmed) {
421
+ module.hideDimmer();
422
+ }
423
+ if(settings.keyboardShortcuts) {
424
+ module.remove.keyboardShortcuts();
425
+ }
426
+ },
427
+ onComplete : function() {
428
+ settings.onHidden.call(element);
429
+ module.remove.dimmerStyles();
430
+ module.restore.focus();
431
+ callback();
432
+ }
433
+ })
434
+ ;
435
+ }
436
+ else {
437
+ module.error(error.noTransition);
438
+ }
439
+ }
440
+ },
441
+
442
+ showDimmer: function() {
443
+ if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
444
+ module.debug('Showing dimmer');
445
+ $dimmable.dimmer('show');
446
+ }
447
+ else {
448
+ module.debug('Dimmer already visible');
449
+ }
450
+ },
451
+
452
+ hideDimmer: function() {
453
+ if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
454
+ module.unbind.scrollLock();
455
+ $dimmable.dimmer('hide', function() {
456
+ module.remove.clickaway();
457
+ module.remove.screenHeight();
458
+ });
459
+ }
460
+ else {
461
+ module.debug('Dimmer is not visible cannot hide');
462
+ return;
463
+ }
464
+ },
465
+
466
+ hideAll: function(callback) {
467
+ var
468
+ $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
469
+ ;
470
+ callback = $.isFunction(callback)
471
+ ? callback
472
+ : function(){}
473
+ ;
474
+ if( $visibleModals.length > 0 ) {
475
+ module.debug('Hiding all visible modals');
476
+ module.hideDimmer();
477
+ $visibleModals
478
+ .modal('hide modal', callback)
479
+ ;
480
+ }
481
+ },
482
+
483
+ hideOthers: function(callback) {
484
+ var
485
+ $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
486
+ ;
487
+ callback = $.isFunction(callback)
488
+ ? callback
489
+ : function(){}
490
+ ;
491
+ if( $visibleModals.length > 0 ) {
492
+ module.debug('Hiding other modals', $otherModals);
493
+ $visibleModals
494
+ .modal('hide modal', callback, true)
495
+ ;
496
+ }
497
+ },
498
+
499
+ others: {
500
+ active: function() {
501
+ return ($otherModals.filter('.' + className.active).length > 0);
502
+ },
503
+ animating: function() {
504
+ return ($otherModals.filter('.' + className.animating).length > 0);
505
+ }
506
+ },
507
+
508
+
509
+ add: {
510
+ keyboardShortcuts: function() {
511
+ module.verbose('Adding keyboard shortcuts');
512
+ $document
513
+ .on('keyup' + eventNamespace, module.event.keyboard)
514
+ ;
515
+ }
516
+ },
517
+
518
+ save: {
519
+ focus: function() {
520
+ var
521
+ $activeElement = $(document.activeElement),
522
+ inCurrentModal = $activeElement.closest($module).length > 0
523
+ ;
524
+ if(!inCurrentModal) {
525
+ $focusedElement = $(document.activeElement).blur();
526
+ }
527
+ }
528
+ },
529
+
530
+ restore: {
531
+ focus: function() {
532
+ if($focusedElement && $focusedElement.length > 0) {
533
+ $focusedElement.focus();
534
+ }
535
+ }
536
+ },
537
+
538
+ remove: {
539
+ active: function() {
540
+ $module.removeClass(className.active);
541
+ },
542
+ legacy: function() {
543
+ $module.removeClass(className.legacy);
544
+ },
545
+ clickaway: function() {
546
+ $dimmer
547
+ .off('click' + elementEventNamespace)
548
+ ;
549
+ },
550
+ dimmerStyles: function() {
551
+ $dimmer.removeClass(className.inverted);
552
+ $dimmable.removeClass(className.blurring);
553
+ },
554
+ bodyStyle: function() {
555
+ if($body.attr('style') === '') {
556
+ module.verbose('Removing style attribute');
557
+ $body.removeAttr('style');
558
+ }
559
+ },
560
+ screenHeight: function() {
561
+ module.debug('Removing page height');
562
+ $body
563
+ .css('height', '')
564
+ ;
565
+ },
566
+ keyboardShortcuts: function() {
567
+ module.verbose('Removing keyboard shortcuts');
568
+ $document
569
+ .off('keyup' + eventNamespace)
570
+ ;
571
+ },
572
+ scrolling: function() {
573
+ $dimmable.removeClass(className.scrolling);
574
+ $module.removeClass(className.scrolling);
575
+ }
576
+ },
577
+
578
+ cacheSizes: function() {
579
+ $module.addClass(className.loading);
580
+ var
581
+ scrollHeight = $module.prop('scrollHeight'),
582
+ modalWidth = $module.outerWidth(),
583
+ modalHeight = $module.outerHeight()
584
+ ;
585
+ if(module.cache === undefined || modalHeight !== 0) {
586
+ module.cache = {
587
+ pageHeight : $(document).outerHeight(),
588
+ width : modalWidth,
589
+ height : modalHeight + settings.offset,
590
+ scrollHeight : scrollHeight + settings.offset,
591
+ contextHeight : (settings.context == 'body')
592
+ ? $(window).height()
593
+ : $dimmable.height(),
594
+ };
595
+ module.cache.topOffset = -(module.cache.height / 2);
596
+ }
597
+ $module.removeClass(className.loading);
598
+ module.debug('Caching modal and container sizes', module.cache);
599
+ },
600
+
601
+ can: {
602
+ useFlex: function() {
603
+ return (settings.useFlex == 'auto')
604
+ ? settings.detachable && !module.is.ie()
605
+ : settings.useFlex
606
+ ;
607
+ },
608
+ fit: function() {
609
+ var
610
+ contextHeight = module.cache.contextHeight,
611
+ verticalCenter = module.cache.contextHeight / 2,
612
+ topOffset = module.cache.topOffset,
613
+ scrollHeight = module.cache.scrollHeight,
614
+ height = module.cache.height,
615
+ paddingHeight = settings.padding,
616
+ startPosition = (verticalCenter + topOffset)
617
+ ;
618
+ return (scrollHeight > height)
619
+ ? (startPosition + scrollHeight + paddingHeight < contextHeight)
620
+ : (height + (paddingHeight * 2) < contextHeight)
621
+ ;
622
+ }
623
+ },
624
+
625
+ is: {
626
+ active: function() {
627
+ return $module.hasClass(className.active);
628
+ },
629
+ ie: function() {
630
+ var
631
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
632
+ isIE = ('ActiveXObject' in window)
633
+ ;
634
+ return (isIE11 || isIE);
635
+ },
636
+ animating: function() {
637
+ return $module.transition('is supported')
638
+ ? $module.transition('is animating')
639
+ : $module.is(':visible')
640
+ ;
641
+ },
642
+ scrolling: function() {
643
+ return $dimmable.hasClass(className.scrolling);
644
+ },
645
+ modernBrowser: function() {
646
+ // appName for IE11 reports 'Netscape' can no longer use
647
+ return !(window.ActiveXObject || 'ActiveXObject' in window);
648
+ }
649
+ },
650
+
651
+ set: {
652
+ autofocus: function() {
653
+ var
654
+ $inputs = $module.find('[tabindex], :input').filter(':visible'),
655
+ $autofocus = $inputs.filter('[autofocus]'),
656
+ $input = ($autofocus.length > 0)
657
+ ? $autofocus.first()
658
+ : $inputs.first()
659
+ ;
660
+ if($input.length > 0) {
661
+ $input.focus();
662
+ }
663
+ },
664
+ clickaway: function() {
665
+ $dimmer
666
+ .on('click' + elementEventNamespace, module.event.click)
667
+ ;
668
+ },
669
+ dimmerSettings: function() {
670
+ if($.fn.dimmer === undefined) {
671
+ module.error(error.dimmer);
672
+ return;
673
+ }
674
+ var
675
+ defaultSettings = {
676
+ debug : settings.debug,
677
+ dimmerName : 'modals',
678
+ closable : 'auto',
679
+ useFlex : module.can.useFlex(),
680
+ variation : settings.centered
681
+ ? false
682
+ : 'top aligned',
683
+ duration : {
684
+ show : settings.duration,
685
+ hide : settings.duration
686
+ }
687
+ },
688
+ dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
689
+ ;
690
+ if(settings.inverted) {
691
+ dimmerSettings.variation = (dimmerSettings.variation !== undefined)
692
+ ? dimmerSettings.variation + ' inverted'
693
+ : 'inverted'
694
+ ;
695
+ }
696
+ $context.dimmer('setting', dimmerSettings);
697
+ },
698
+ dimmerStyles: function() {
699
+ if(settings.inverted) {
700
+ $dimmer.addClass(className.inverted);
701
+ }
702
+ else {
703
+ $dimmer.removeClass(className.inverted);
704
+ }
705
+ if(settings.blurring) {
706
+ $dimmable.addClass(className.blurring);
707
+ }
708
+ else {
709
+ $dimmable.removeClass(className.blurring);
710
+ }
711
+ },
712
+ modalOffset: function() {
713
+ var
714
+ width = module.cache.width,
715
+ height = module.cache.height
716
+ ;
717
+ $module
718
+ .css({
719
+ marginTop: (settings.centered && module.can.fit())
720
+ ? -(height / 2)
721
+ : 0,
722
+ marginLeft: -(width / 2)
723
+ })
724
+ ;
725
+ module.verbose('Setting modal offset for legacy mode');
726
+ },
727
+ screenHeight: function() {
728
+ if( module.can.fit() ) {
729
+ $body.css('height', '');
730
+ }
731
+ else {
732
+ module.debug('Modal is taller than page content, resizing page height');
733
+ $body
734
+ .css('height', module.cache.height + (settings.padding * 2) )
735
+ ;
736
+ }
737
+ },
738
+ active: function() {
739
+ $module.addClass(className.active);
740
+ },
741
+ scrolling: function() {
742
+ $dimmable.addClass(className.scrolling);
743
+ $module.addClass(className.scrolling);
744
+ module.unbind.scrollLock();
745
+ },
746
+ legacy: function() {
747
+ $module.addClass(className.legacy);
748
+ },
749
+ type: function() {
750
+ if(module.can.fit()) {
751
+ module.verbose('Modal fits on screen');
752
+ if(!module.others.active() && !module.others.animating()) {
753
+ module.remove.scrolling();
754
+ module.bind.scrollLock();
755
+ }
756
+ }
757
+ else {
758
+ module.verbose('Modal cannot fit on screen setting to scrolling');
759
+ module.set.scrolling();
760
+ }
761
+ },
762
+ undetached: function() {
763
+ $dimmable.addClass(className.undetached);
764
+ }
765
+ },
766
+
767
+ setting: function(name, value) {
768
+ module.debug('Changing setting', name, value);
769
+ if( $.isPlainObject(name) ) {
770
+ $.extend(true, settings, name);
771
+ }
772
+ else if(value !== undefined) {
773
+ if($.isPlainObject(settings[name])) {
774
+ $.extend(true, settings[name], value);
775
+ }
776
+ else {
777
+ settings[name] = value;
778
+ }
779
+ }
780
+ else {
781
+ return settings[name];
782
+ }
783
+ },
784
+ internal: function(name, value) {
785
+ if( $.isPlainObject(name) ) {
786
+ $.extend(true, module, name);
787
+ }
788
+ else if(value !== undefined) {
789
+ module[name] = value;
790
+ }
791
+ else {
792
+ return module[name];
793
+ }
794
+ },
795
+ debug: function() {
796
+ if(!settings.silent && settings.debug) {
797
+ if(settings.performance) {
798
+ module.performance.log(arguments);
799
+ }
800
+ else {
801
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
802
+ module.debug.apply(console, arguments);
803
+ }
804
+ }
805
+ },
806
+ verbose: function() {
807
+ if(!settings.silent && settings.verbose && settings.debug) {
808
+ if(settings.performance) {
809
+ module.performance.log(arguments);
810
+ }
811
+ else {
812
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
813
+ module.verbose.apply(console, arguments);
814
+ }
815
+ }
816
+ },
817
+ error: function() {
818
+ if(!settings.silent) {
819
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
820
+ module.error.apply(console, arguments);
821
+ }
822
+ },
823
+ performance: {
824
+ log: function(message) {
825
+ var
826
+ currentTime,
827
+ executionTime,
828
+ previousTime
829
+ ;
830
+ if(settings.performance) {
831
+ currentTime = new Date().getTime();
832
+ previousTime = time || currentTime;
833
+ executionTime = currentTime - previousTime;
834
+ time = currentTime;
835
+ performance.push({
836
+ 'Name' : message[0],
837
+ 'Arguments' : [].slice.call(message, 1) || '',
838
+ 'Element' : element,
839
+ 'Execution Time' : executionTime
840
+ });
841
+ }
842
+ clearTimeout(module.performance.timer);
843
+ module.performance.timer = setTimeout(module.performance.display, 500);
844
+ },
845
+ display: function() {
846
+ var
847
+ title = settings.name + ':',
848
+ totalTime = 0
849
+ ;
850
+ time = false;
851
+ clearTimeout(module.performance.timer);
852
+ $.each(performance, function(index, data) {
853
+ totalTime += data['Execution Time'];
854
+ });
855
+ title += ' ' + totalTime + 'ms';
856
+ if(moduleSelector) {
857
+ title += ' \'' + moduleSelector + '\'';
858
+ }
859
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
860
+ console.groupCollapsed(title);
861
+ if(console.table) {
862
+ console.table(performance);
863
+ }
864
+ else {
865
+ $.each(performance, function(index, data) {
866
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
867
+ });
868
+ }
869
+ console.groupEnd();
870
+ }
871
+ performance = [];
872
+ }
873
+ },
874
+ invoke: function(query, passedArguments, context) {
875
+ var
876
+ object = instance,
877
+ maxDepth,
878
+ found,
879
+ response
880
+ ;
881
+ passedArguments = passedArguments || queryArguments;
882
+ context = element || context;
883
+ if(typeof query == 'string' && object !== undefined) {
884
+ query = query.split(/[\. ]/);
885
+ maxDepth = query.length - 1;
886
+ $.each(query, function(depth, value) {
887
+ var camelCaseValue = (depth != maxDepth)
888
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
889
+ : query
890
+ ;
891
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
892
+ object = object[camelCaseValue];
893
+ }
894
+ else if( object[camelCaseValue] !== undefined ) {
895
+ found = object[camelCaseValue];
896
+ return false;
897
+ }
898
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
899
+ object = object[value];
900
+ }
901
+ else if( object[value] !== undefined ) {
902
+ found = object[value];
903
+ return false;
904
+ }
905
+ else {
906
+ return false;
907
+ }
908
+ });
909
+ }
910
+ if ( $.isFunction( found ) ) {
911
+ response = found.apply(context, passedArguments);
912
+ }
913
+ else if(found !== undefined) {
914
+ response = found;
915
+ }
916
+ if($.isArray(returnedValue)) {
917
+ returnedValue.push(response);
918
+ }
919
+ else if(returnedValue !== undefined) {
920
+ returnedValue = [returnedValue, response];
921
+ }
922
+ else if(response !== undefined) {
923
+ returnedValue = response;
924
+ }
925
+ return found;
926
+ }
927
+ };
928
+
929
+ if(methodInvoked) {
930
+ if(instance === undefined) {
931
+ module.initialize();
932
+ }
933
+ module.invoke(query);
934
+ }
935
+ else {
936
+ if(instance !== undefined) {
937
+ instance.invoke('destroy');
938
+ }
939
+ module.initialize();
940
+ }
941
+ })
942
+ ;
943
+
944
+ return (returnedValue !== undefined)
945
+ ? returnedValue
946
+ : this
947
+ ;
948
+ };
949
+
950
+ $.fn.modal.settings = {
951
+
952
+ name : 'Modal',
953
+ namespace : 'modal',
954
+
955
+ useFlex : 'auto',
956
+ offset : 0,
957
+
958
+ silent : false,
959
+ debug : false,
960
+ verbose : false,
961
+ performance : true,
962
+
963
+ observeChanges : false,
964
+
965
+ allowMultiple : false,
966
+ detachable : true,
967
+ closable : true,
968
+ autofocus : true,
969
+
970
+ inverted : false,
971
+ blurring : false,
972
+
973
+ centered : true,
974
+
975
+ dimmerSettings : {
976
+ closable : false,
977
+ useCSS : true
978
+ },
979
+
980
+ // whether to use keyboard shortcuts
981
+ keyboardShortcuts: true,
982
+
983
+ context : 'body',
984
+
985
+ queue : false,
986
+ duration : 500,
987
+ transition : 'scale',
988
+
989
+ // padding with edge of page
990
+ padding : 50,
991
+
992
+ // called before show animation
993
+ onShow : function(){},
994
+
995
+ // called after show animation
996
+ onVisible : function(){},
997
+
998
+ // called before hide animation
999
+ onHide : function(){ return true; },
1000
+
1001
+ // called after hide animation
1002
+ onHidden : function(){},
1003
+
1004
+ // called after approve selector match
1005
+ onApprove : function(){ return true; },
1006
+
1007
+ // called after deny selector match
1008
+ onDeny : function(){ return true; },
1009
+
1010
+ selector : {
1011
+ close : '> .close',
1012
+ approve : '.actions .positive, .actions .approve, .actions .ok',
1013
+ deny : '.actions .negative, .actions .deny, .actions .cancel',
1014
+ modal : '.ui.modal'
1015
+ },
1016
+ error : {
1017
+ dimmer : 'UI Dimmer, a required component is not included in this page',
1018
+ method : 'The method you called is not defined.',
1019
+ notFound : 'The element you specified could not be found'
1020
+ },
1021
+ className : {
1022
+ active : 'active',
1023
+ animating : 'animating',
1024
+ blurring : 'blurring',
1025
+ inverted : 'inverted',
1026
+ legacy : 'legacy',
1027
+ loading : 'loading',
1028
+ scrolling : 'scrolling',
1029
+ undetached : 'undetached'
1030
+ }
1031
+ };
1032
+
1033
+
1034
+ })( jQuery, window, document );