@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,1033 @@
1
+ /*!
2
+ * # Semantic UI 2.4.1 - Sidebar
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.sidebar = function(parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $html = $('html'),
28
+ $head = $('head'),
29
+
30
+ moduleSelector = $allModules.selector || '',
31
+
32
+ time = new Date().getTime(),
33
+ performance = [],
34
+
35
+ query = arguments[0],
36
+ methodInvoked = (typeof query == 'string'),
37
+ queryArguments = [].slice.call(arguments, 1),
38
+
39
+ requestAnimationFrame = window.requestAnimationFrame
40
+ || window.mozRequestAnimationFrame
41
+ || window.webkitRequestAnimationFrame
42
+ || window.msRequestAnimationFrame
43
+ || function(callback) { setTimeout(callback, 0); },
44
+
45
+ returnedValue
46
+ ;
47
+
48
+ $allModules
49
+ .each(function() {
50
+ var
51
+ settings = ( $.isPlainObject(parameters) )
52
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
53
+ : $.extend({}, $.fn.sidebar.settings),
54
+
55
+ selector = settings.selector,
56
+ className = settings.className,
57
+ namespace = settings.namespace,
58
+ regExp = settings.regExp,
59
+ error = settings.error,
60
+
61
+ eventNamespace = '.' + namespace,
62
+ moduleNamespace = 'module-' + namespace,
63
+
64
+ $module = $(this),
65
+ $context = $(settings.context),
66
+
67
+ $sidebars = $module.children(selector.sidebar),
68
+ $fixed = $context.children(selector.fixed),
69
+ $pusher = $context.children(selector.pusher),
70
+ $style,
71
+
72
+ element = this,
73
+ instance = $module.data(moduleNamespace),
74
+
75
+ elementNamespace,
76
+ id,
77
+ currentScroll,
78
+ transitionEvent,
79
+
80
+ module
81
+ ;
82
+
83
+ module = {
84
+
85
+ initialize: function() {
86
+ module.debug('Initializing sidebar', parameters);
87
+
88
+ module.create.id();
89
+
90
+ transitionEvent = module.get.transitionEvent();
91
+
92
+ // avoids locking rendering if initialized in onReady
93
+ if(settings.delaySetup) {
94
+ requestAnimationFrame(module.setup.layout);
95
+ }
96
+ else {
97
+ module.setup.layout();
98
+ }
99
+
100
+ requestAnimationFrame(function() {
101
+ module.setup.cache();
102
+ });
103
+
104
+ module.instantiate();
105
+ },
106
+
107
+ instantiate: function() {
108
+ module.verbose('Storing instance of module', module);
109
+ instance = module;
110
+ $module
111
+ .data(moduleNamespace, module)
112
+ ;
113
+ },
114
+
115
+ create: {
116
+ id: function() {
117
+ id = (Math.random().toString(16) + '000000000').substr(2,8);
118
+ elementNamespace = '.' + id;
119
+ module.verbose('Creating unique id for element', id);
120
+ }
121
+ },
122
+
123
+ destroy: function() {
124
+ module.verbose('Destroying previous module for', $module);
125
+ $module
126
+ .off(eventNamespace)
127
+ .removeData(moduleNamespace)
128
+ ;
129
+ if(module.is.ios()) {
130
+ module.remove.ios();
131
+ }
132
+ // bound by uuid
133
+ $context.off(elementNamespace);
134
+ $window.off(elementNamespace);
135
+ $document.off(elementNamespace);
136
+ },
137
+
138
+ event: {
139
+ clickaway: function(event) {
140
+ var
141
+ clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
142
+ clickedContext = ($context.is(event.target))
143
+ ;
144
+ if(clickedInPusher) {
145
+ module.verbose('User clicked on dimmed page');
146
+ module.hide();
147
+ }
148
+ if(clickedContext) {
149
+ module.verbose('User clicked on dimmable context (scaled out page)');
150
+ module.hide();
151
+ }
152
+ },
153
+ touch: function(event) {
154
+ //event.stopPropagation();
155
+ },
156
+ containScroll: function(event) {
157
+ if(element.scrollTop <= 0) {
158
+ element.scrollTop = 1;
159
+ }
160
+ if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
161
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
162
+ }
163
+ },
164
+ scroll: function(event) {
165
+ if( $(event.target).closest(selector.sidebar).length === 0 ) {
166
+ event.preventDefault();
167
+ }
168
+ }
169
+ },
170
+
171
+ bind: {
172
+ clickaway: function() {
173
+ module.verbose('Adding clickaway events to context', $context);
174
+ if(settings.closable) {
175
+ $context
176
+ .on('click' + elementNamespace, module.event.clickaway)
177
+ .on('touchend' + elementNamespace, module.event.clickaway)
178
+ ;
179
+ }
180
+ },
181
+ scrollLock: function() {
182
+ if(settings.scrollLock) {
183
+ module.debug('Disabling page scroll');
184
+ $window
185
+ .on('DOMMouseScroll' + elementNamespace, module.event.scroll)
186
+ ;
187
+ }
188
+ module.verbose('Adding events to contain sidebar scroll');
189
+ $document
190
+ .on('touchmove' + elementNamespace, module.event.touch)
191
+ ;
192
+ $module
193
+ .on('scroll' + eventNamespace, module.event.containScroll)
194
+ ;
195
+ }
196
+ },
197
+ unbind: {
198
+ clickaway: function() {
199
+ module.verbose('Removing clickaway events from context', $context);
200
+ $context.off(elementNamespace);
201
+ },
202
+ scrollLock: function() {
203
+ module.verbose('Removing scroll lock from page');
204
+ $document.off(elementNamespace);
205
+ $window.off(elementNamespace);
206
+ $module.off('scroll' + eventNamespace);
207
+ }
208
+ },
209
+
210
+ add: {
211
+ inlineCSS: function() {
212
+ var
213
+ width = module.cache.width || $module.outerWidth(),
214
+ height = module.cache.height || $module.outerHeight(),
215
+ isRTL = module.is.rtl(),
216
+ direction = module.get.direction(),
217
+ distance = {
218
+ left : width,
219
+ right : -width,
220
+ top : height,
221
+ bottom : -height
222
+ },
223
+ style
224
+ ;
225
+
226
+ if(isRTL){
227
+ module.verbose('RTL detected, flipping widths');
228
+ distance.left = -width;
229
+ distance.right = width;
230
+ }
231
+
232
+ style = '<style>';
233
+
234
+ if(direction === 'left' || direction === 'right') {
235
+ module.debug('Adding CSS rules for animation distance', width);
236
+ style += ''
237
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
238
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
239
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
240
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
241
+ + ' }'
242
+ ;
243
+ }
244
+ else if(direction === 'top' || direction == 'bottom') {
245
+ style += ''
246
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
247
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
248
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
249
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
250
+ + ' }'
251
+ ;
252
+ }
253
+
254
+ /* IE is only browser not to create context with transforms */
255
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
256
+ if( module.is.ie() ) {
257
+ if(direction === 'left' || direction === 'right') {
258
+ module.debug('Adding CSS rules for animation distance', width);
259
+ style += ''
260
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
261
+ + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
262
+ + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
263
+ + ' }'
264
+ ;
265
+ }
266
+ else if(direction === 'top' || direction == 'bottom') {
267
+ style += ''
268
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher:after {'
269
+ + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
270
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
271
+ + ' }'
272
+ ;
273
+ }
274
+ /* opposite sides visible forces content overlay */
275
+ style += ''
276
+ + ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after,'
277
+ + ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {'
278
+ + ' -webkit-transform: translate3d(0px, 0, 0);'
279
+ + ' transform: translate3d(0px, 0, 0);'
280
+ + ' }'
281
+ ;
282
+ }
283
+ style += '</style>';
284
+ $style = $(style)
285
+ .appendTo($head)
286
+ ;
287
+ module.debug('Adding sizing css to head', $style);
288
+ }
289
+ },
290
+
291
+ refresh: function() {
292
+ module.verbose('Refreshing selector cache');
293
+ $context = $(settings.context);
294
+ $sidebars = $context.children(selector.sidebar);
295
+ $pusher = $context.children(selector.pusher);
296
+ $fixed = $context.children(selector.fixed);
297
+ module.clear.cache();
298
+ },
299
+
300
+ refreshSidebars: function() {
301
+ module.verbose('Refreshing other sidebars');
302
+ $sidebars = $context.children(selector.sidebar);
303
+ },
304
+
305
+ repaint: function() {
306
+ module.verbose('Forcing repaint event');
307
+ element.style.display = 'none';
308
+ var ignored = element.offsetHeight;
309
+ element.scrollTop = element.scrollTop;
310
+ element.style.display = '';
311
+ },
312
+
313
+ setup: {
314
+ cache: function() {
315
+ module.cache = {
316
+ width : $module.outerWidth(),
317
+ height : $module.outerHeight(),
318
+ rtl : ($module.css('direction') == 'rtl')
319
+ };
320
+ },
321
+ layout: function() {
322
+ if( $context.children(selector.pusher).length === 0 ) {
323
+ module.debug('Adding wrapper element for sidebar');
324
+ module.error(error.pusher);
325
+ $pusher = $('<div class="pusher" />');
326
+ $context
327
+ .children()
328
+ .not(selector.omitted)
329
+ .not($sidebars)
330
+ .wrapAll($pusher)
331
+ ;
332
+ module.refresh();
333
+ }
334
+ if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
335
+ module.debug('Moved sidebar to correct parent element');
336
+ module.error(error.movedSidebar, element);
337
+ $module.detach().prependTo($context);
338
+ module.refresh();
339
+ }
340
+ module.clear.cache();
341
+ module.set.pushable();
342
+ module.set.direction();
343
+ }
344
+ },
345
+
346
+ attachEvents: function(selector, event) {
347
+ var
348
+ $toggle = $(selector)
349
+ ;
350
+ event = $.isFunction(module[event])
351
+ ? module[event]
352
+ : module.toggle
353
+ ;
354
+ if($toggle.length > 0) {
355
+ module.debug('Attaching sidebar events to element', selector, event);
356
+ $toggle
357
+ .on('click' + eventNamespace, event)
358
+ ;
359
+ }
360
+ else {
361
+ module.error(error.notFound, selector);
362
+ }
363
+ },
364
+
365
+ show: function(callback) {
366
+ callback = $.isFunction(callback)
367
+ ? callback
368
+ : function(){}
369
+ ;
370
+ if(module.is.hidden()) {
371
+ module.refreshSidebars();
372
+ if(settings.overlay) {
373
+ module.error(error.overlay);
374
+ settings.transition = 'overlay';
375
+ }
376
+ module.refresh();
377
+ if(module.othersActive()) {
378
+ module.debug('Other sidebars currently visible');
379
+ if(settings.exclusive) {
380
+ // if not overlay queue animation after hide
381
+ if(settings.transition != 'overlay') {
382
+ module.hideOthers(module.show);
383
+ return;
384
+ }
385
+ else {
386
+ module.hideOthers();
387
+ }
388
+ }
389
+ else {
390
+ settings.transition = 'overlay';
391
+ }
392
+ }
393
+ module.pushPage(function() {
394
+ callback.call(element);
395
+ settings.onShow.call(element);
396
+ });
397
+ settings.onChange.call(element);
398
+ settings.onVisible.call(element);
399
+ }
400
+ else {
401
+ module.debug('Sidebar is already visible');
402
+ }
403
+ },
404
+
405
+ hide: function(callback) {
406
+ callback = $.isFunction(callback)
407
+ ? callback
408
+ : function(){}
409
+ ;
410
+ if(module.is.visible() || module.is.animating()) {
411
+ module.debug('Hiding sidebar', callback);
412
+ module.refreshSidebars();
413
+ module.pullPage(function() {
414
+ callback.call(element);
415
+ settings.onHidden.call(element);
416
+ });
417
+ settings.onChange.call(element);
418
+ settings.onHide.call(element);
419
+ }
420
+ },
421
+
422
+ othersAnimating: function() {
423
+ return ($sidebars.not($module).filter('.' + className.animating).length > 0);
424
+ },
425
+ othersVisible: function() {
426
+ return ($sidebars.not($module).filter('.' + className.visible).length > 0);
427
+ },
428
+ othersActive: function() {
429
+ return(module.othersVisible() || module.othersAnimating());
430
+ },
431
+
432
+ hideOthers: function(callback) {
433
+ var
434
+ $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
435
+ sidebarCount = $otherSidebars.length,
436
+ callbackCount = 0
437
+ ;
438
+ callback = callback || function(){};
439
+ $otherSidebars
440
+ .sidebar('hide', function() {
441
+ callbackCount++;
442
+ if(callbackCount == sidebarCount) {
443
+ callback();
444
+ }
445
+ })
446
+ ;
447
+ },
448
+
449
+ toggle: function() {
450
+ module.verbose('Determining toggled direction');
451
+ if(module.is.hidden()) {
452
+ module.show();
453
+ }
454
+ else {
455
+ module.hide();
456
+ }
457
+ },
458
+
459
+ pushPage: function(callback) {
460
+ var
461
+ transition = module.get.transition(),
462
+ $transition = (transition === 'overlay' || module.othersActive())
463
+ ? $module
464
+ : $pusher,
465
+ animate,
466
+ dim,
467
+ transitionEnd
468
+ ;
469
+ callback = $.isFunction(callback)
470
+ ? callback
471
+ : function(){}
472
+ ;
473
+ if(settings.transition == 'scale down') {
474
+ module.scrollToTop();
475
+ }
476
+ module.set.transition(transition);
477
+ module.repaint();
478
+ animate = function() {
479
+ module.bind.clickaway();
480
+ module.add.inlineCSS();
481
+ module.set.animating();
482
+ module.set.visible();
483
+ };
484
+ dim = function() {
485
+ module.set.dimmed();
486
+ };
487
+ transitionEnd = function(event) {
488
+ if( event.target == $transition[0] ) {
489
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
490
+ module.remove.animating();
491
+ module.bind.scrollLock();
492
+ callback.call(element);
493
+ }
494
+ };
495
+ $transition.off(transitionEvent + elementNamespace);
496
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
497
+ requestAnimationFrame(animate);
498
+ if(settings.dimPage && !module.othersVisible()) {
499
+ requestAnimationFrame(dim);
500
+ }
501
+ },
502
+
503
+ pullPage: function(callback) {
504
+ var
505
+ transition = module.get.transition(),
506
+ $transition = (transition == 'overlay' || module.othersActive())
507
+ ? $module
508
+ : $pusher,
509
+ animate,
510
+ transitionEnd
511
+ ;
512
+ callback = $.isFunction(callback)
513
+ ? callback
514
+ : function(){}
515
+ ;
516
+ module.verbose('Removing context push state', module.get.direction());
517
+
518
+ module.unbind.clickaway();
519
+ module.unbind.scrollLock();
520
+
521
+ animate = function() {
522
+ module.set.transition(transition);
523
+ module.set.animating();
524
+ module.remove.visible();
525
+ if(settings.dimPage && !module.othersVisible()) {
526
+ $pusher.removeClass(className.dimmed);
527
+ }
528
+ };
529
+ transitionEnd = function(event) {
530
+ if( event.target == $transition[0] ) {
531
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
532
+ module.remove.animating();
533
+ module.remove.transition();
534
+ module.remove.inlineCSS();
535
+ if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) {
536
+ module.scrollBack();
537
+ }
538
+ callback.call(element);
539
+ }
540
+ };
541
+ $transition.off(transitionEvent + elementNamespace);
542
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
543
+ requestAnimationFrame(animate);
544
+ },
545
+
546
+ scrollToTop: function() {
547
+ module.verbose('Scrolling to top of page to avoid animation issues');
548
+ currentScroll = $(window).scrollTop();
549
+ $module.scrollTop(0);
550
+ window.scrollTo(0, 0);
551
+ },
552
+
553
+ scrollBack: function() {
554
+ module.verbose('Scrolling back to original page position');
555
+ window.scrollTo(0, currentScroll);
556
+ },
557
+
558
+ clear: {
559
+ cache: function() {
560
+ module.verbose('Clearing cached dimensions');
561
+ module.cache = {};
562
+ }
563
+ },
564
+
565
+ set: {
566
+
567
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
568
+ // (This is no longer necessary in latest iOS)
569
+ ios: function() {
570
+ $html.addClass(className.ios);
571
+ },
572
+
573
+ // container
574
+ pushed: function() {
575
+ $context.addClass(className.pushed);
576
+ },
577
+ pushable: function() {
578
+ $context.addClass(className.pushable);
579
+ },
580
+
581
+ // pusher
582
+ dimmed: function() {
583
+ $pusher.addClass(className.dimmed);
584
+ },
585
+
586
+ // sidebar
587
+ active: function() {
588
+ $module.addClass(className.active);
589
+ },
590
+ animating: function() {
591
+ $module.addClass(className.animating);
592
+ },
593
+ transition: function(transition) {
594
+ transition = transition || module.get.transition();
595
+ $module.addClass(transition);
596
+ },
597
+ direction: function(direction) {
598
+ direction = direction || module.get.direction();
599
+ $module.addClass(className[direction]);
600
+ },
601
+ visible: function() {
602
+ $module.addClass(className.visible);
603
+ },
604
+ overlay: function() {
605
+ $module.addClass(className.overlay);
606
+ }
607
+ },
608
+ remove: {
609
+
610
+ inlineCSS: function() {
611
+ module.debug('Removing inline css styles', $style);
612
+ if($style && $style.length > 0) {
613
+ $style.remove();
614
+ }
615
+ },
616
+
617
+ // ios scroll on html not document
618
+ ios: function() {
619
+ $html.removeClass(className.ios);
620
+ },
621
+
622
+ // context
623
+ pushed: function() {
624
+ $context.removeClass(className.pushed);
625
+ },
626
+ pushable: function() {
627
+ $context.removeClass(className.pushable);
628
+ },
629
+
630
+ // sidebar
631
+ active: function() {
632
+ $module.removeClass(className.active);
633
+ },
634
+ animating: function() {
635
+ $module.removeClass(className.animating);
636
+ },
637
+ transition: function(transition) {
638
+ transition = transition || module.get.transition();
639
+ $module.removeClass(transition);
640
+ },
641
+ direction: function(direction) {
642
+ direction = direction || module.get.direction();
643
+ $module.removeClass(className[direction]);
644
+ },
645
+ visible: function() {
646
+ $module.removeClass(className.visible);
647
+ },
648
+ overlay: function() {
649
+ $module.removeClass(className.overlay);
650
+ }
651
+ },
652
+
653
+ get: {
654
+ direction: function() {
655
+ if($module.hasClass(className.top)) {
656
+ return className.top;
657
+ }
658
+ else if($module.hasClass(className.right)) {
659
+ return className.right;
660
+ }
661
+ else if($module.hasClass(className.bottom)) {
662
+ return className.bottom;
663
+ }
664
+ return className.left;
665
+ },
666
+ transition: function() {
667
+ var
668
+ direction = module.get.direction(),
669
+ transition
670
+ ;
671
+ transition = ( module.is.mobile() )
672
+ ? (settings.mobileTransition == 'auto')
673
+ ? settings.defaultTransition.mobile[direction]
674
+ : settings.mobileTransition
675
+ : (settings.transition == 'auto')
676
+ ? settings.defaultTransition.computer[direction]
677
+ : settings.transition
678
+ ;
679
+ module.verbose('Determined transition', transition);
680
+ return transition;
681
+ },
682
+ transitionEvent: function() {
683
+ var
684
+ element = document.createElement('element'),
685
+ transitions = {
686
+ 'transition' :'transitionend',
687
+ 'OTransition' :'oTransitionEnd',
688
+ 'MozTransition' :'transitionend',
689
+ 'WebkitTransition' :'webkitTransitionEnd'
690
+ },
691
+ transition
692
+ ;
693
+ for(transition in transitions){
694
+ if( element.style[transition] !== undefined ){
695
+ return transitions[transition];
696
+ }
697
+ }
698
+ }
699
+ },
700
+
701
+ is: {
702
+
703
+ ie: function() {
704
+ var
705
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
706
+ isIE = ('ActiveXObject' in window)
707
+ ;
708
+ return (isIE11 || isIE);
709
+ },
710
+
711
+ ios: function() {
712
+ var
713
+ userAgent = navigator.userAgent,
714
+ isIOS = userAgent.match(regExp.ios),
715
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
716
+ ;
717
+ if(isIOS && !isMobileChrome) {
718
+ module.verbose('Browser was found to be iOS', userAgent);
719
+ return true;
720
+ }
721
+ else {
722
+ return false;
723
+ }
724
+ },
725
+ mobile: function() {
726
+ var
727
+ userAgent = navigator.userAgent,
728
+ isMobile = userAgent.match(regExp.mobile)
729
+ ;
730
+ if(isMobile) {
731
+ module.verbose('Browser was found to be mobile', userAgent);
732
+ return true;
733
+ }
734
+ else {
735
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
736
+ return false;
737
+ }
738
+ },
739
+ hidden: function() {
740
+ return !module.is.visible();
741
+ },
742
+ visible: function() {
743
+ return $module.hasClass(className.visible);
744
+ },
745
+ // alias
746
+ open: function() {
747
+ return module.is.visible();
748
+ },
749
+ closed: function() {
750
+ return module.is.hidden();
751
+ },
752
+ vertical: function() {
753
+ return $module.hasClass(className.top);
754
+ },
755
+ animating: function() {
756
+ return $context.hasClass(className.animating);
757
+ },
758
+ rtl: function () {
759
+ if(module.cache.rtl === undefined) {
760
+ module.cache.rtl = ($module.css('direction') == 'rtl');
761
+ }
762
+ return module.cache.rtl;
763
+ }
764
+ },
765
+
766
+ setting: function(name, value) {
767
+ module.debug('Changing setting', name, value);
768
+ if( $.isPlainObject(name) ) {
769
+ $.extend(true, settings, name);
770
+ }
771
+ else if(value !== undefined) {
772
+ if($.isPlainObject(settings[name])) {
773
+ $.extend(true, settings[name], value);
774
+ }
775
+ else {
776
+ settings[name] = value;
777
+ }
778
+ }
779
+ else {
780
+ return settings[name];
781
+ }
782
+ },
783
+ internal: function(name, value) {
784
+ if( $.isPlainObject(name) ) {
785
+ $.extend(true, module, name);
786
+ }
787
+ else if(value !== undefined) {
788
+ module[name] = value;
789
+ }
790
+ else {
791
+ return module[name];
792
+ }
793
+ },
794
+ debug: function() {
795
+ if(!settings.silent && settings.debug) {
796
+ if(settings.performance) {
797
+ module.performance.log(arguments);
798
+ }
799
+ else {
800
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
801
+ module.debug.apply(console, arguments);
802
+ }
803
+ }
804
+ },
805
+ verbose: function() {
806
+ if(!settings.silent && settings.verbose && settings.debug) {
807
+ if(settings.performance) {
808
+ module.performance.log(arguments);
809
+ }
810
+ else {
811
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
812
+ module.verbose.apply(console, arguments);
813
+ }
814
+ }
815
+ },
816
+ error: function() {
817
+ if(!settings.silent) {
818
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
819
+ module.error.apply(console, arguments);
820
+ }
821
+ },
822
+ performance: {
823
+ log: function(message) {
824
+ var
825
+ currentTime,
826
+ executionTime,
827
+ previousTime
828
+ ;
829
+ if(settings.performance) {
830
+ currentTime = new Date().getTime();
831
+ previousTime = time || currentTime;
832
+ executionTime = currentTime - previousTime;
833
+ time = currentTime;
834
+ performance.push({
835
+ 'Name' : message[0],
836
+ 'Arguments' : [].slice.call(message, 1) || '',
837
+ 'Element' : element,
838
+ 'Execution Time' : executionTime
839
+ });
840
+ }
841
+ clearTimeout(module.performance.timer);
842
+ module.performance.timer = setTimeout(module.performance.display, 500);
843
+ },
844
+ display: function() {
845
+ var
846
+ title = settings.name + ':',
847
+ totalTime = 0
848
+ ;
849
+ time = false;
850
+ clearTimeout(module.performance.timer);
851
+ $.each(performance, function(index, data) {
852
+ totalTime += data['Execution Time'];
853
+ });
854
+ title += ' ' + totalTime + 'ms';
855
+ if(moduleSelector) {
856
+ title += ' \'' + moduleSelector + '\'';
857
+ }
858
+ if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
859
+ console.groupCollapsed(title);
860
+ if(console.table) {
861
+ console.table(performance);
862
+ }
863
+ else {
864
+ $.each(performance, function(index, data) {
865
+ console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
866
+ });
867
+ }
868
+ console.groupEnd();
869
+ }
870
+ performance = [];
871
+ }
872
+ },
873
+ invoke: function(query, passedArguments, context) {
874
+ var
875
+ object = instance,
876
+ maxDepth,
877
+ found,
878
+ response
879
+ ;
880
+ passedArguments = passedArguments || queryArguments;
881
+ context = element || context;
882
+ if(typeof query == 'string' && object !== undefined) {
883
+ query = query.split(/[\. ]/);
884
+ maxDepth = query.length - 1;
885
+ $.each(query, function(depth, value) {
886
+ var camelCaseValue = (depth != maxDepth)
887
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
888
+ : query
889
+ ;
890
+ if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
891
+ object = object[camelCaseValue];
892
+ }
893
+ else if( object[camelCaseValue] !== undefined ) {
894
+ found = object[camelCaseValue];
895
+ return false;
896
+ }
897
+ else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
898
+ object = object[value];
899
+ }
900
+ else if( object[value] !== undefined ) {
901
+ found = object[value];
902
+ return false;
903
+ }
904
+ else {
905
+ module.error(error.method, query);
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
+
930
+ if(methodInvoked) {
931
+ if(instance === undefined) {
932
+ module.initialize();
933
+ }
934
+ module.invoke(query);
935
+ }
936
+ else {
937
+ if(instance !== undefined) {
938
+ module.invoke('destroy');
939
+ }
940
+ module.initialize();
941
+ }
942
+ });
943
+
944
+ return (returnedValue !== undefined)
945
+ ? returnedValue
946
+ : this
947
+ ;
948
+ };
949
+
950
+ $.fn.sidebar.settings = {
951
+
952
+ name : 'Sidebar',
953
+ namespace : 'sidebar',
954
+
955
+ silent : false,
956
+ debug : false,
957
+ verbose : false,
958
+ performance : true,
959
+
960
+ transition : 'auto',
961
+ mobileTransition : 'auto',
962
+
963
+ defaultTransition : {
964
+ computer: {
965
+ left : 'uncover',
966
+ right : 'uncover',
967
+ top : 'overlay',
968
+ bottom : 'overlay'
969
+ },
970
+ mobile: {
971
+ left : 'uncover',
972
+ right : 'uncover',
973
+ top : 'overlay',
974
+ bottom : 'overlay'
975
+ }
976
+ },
977
+
978
+ context : 'body',
979
+ exclusive : false,
980
+ closable : true,
981
+ dimPage : true,
982
+ scrollLock : false,
983
+ returnScroll : false,
984
+ delaySetup : false,
985
+
986
+ duration : 500,
987
+
988
+ onChange : function(){},
989
+ onShow : function(){},
990
+ onHide : function(){},
991
+
992
+ onHidden : function(){},
993
+ onVisible : function(){},
994
+
995
+ className : {
996
+ active : 'active',
997
+ animating : 'animating',
998
+ dimmed : 'dimmed',
999
+ ios : 'ios',
1000
+ pushable : 'pushable',
1001
+ pushed : 'pushed',
1002
+ right : 'right',
1003
+ top : 'top',
1004
+ left : 'left',
1005
+ bottom : 'bottom',
1006
+ visible : 'visible'
1007
+ },
1008
+
1009
+ selector: {
1010
+ fixed : '.fixed',
1011
+ omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1012
+ pusher : '.pusher',
1013
+ sidebar : '.ui.sidebar'
1014
+ },
1015
+
1016
+ regExp: {
1017
+ ios : /(iPad|iPhone|iPod)/g,
1018
+ mobileChrome : /(CriOS)/g,
1019
+ mobile : /Mobile|iP(hone|od|ad)|Android|BlackBerry|IEMobile|Kindle|NetFront|Silk-Accelerated|(hpw|web)OS|Fennec|Minimo|Opera M(obi|ini)|Blazer|Dolfin|Dolphin|Skyfire|Zune/g
1020
+ },
1021
+
1022
+ error : {
1023
+ method : 'The method you called is not defined.',
1024
+ pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1025
+ movedSidebar : 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1026
+ overlay : 'The overlay setting is no longer supported, use animation: overlay',
1027
+ notFound : 'There were no elements that matched the specified selector'
1028
+ }
1029
+
1030
+ };
1031
+
1032
+
1033
+ })( jQuery, window, document );