fomantic-ui-sass 2.9.0 → 2.9.1

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 (103) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/fonts/semantic-ui/Lato-Bold.woff +0 -0
  3. data/app/assets/fonts/semantic-ui/Lato-Bold.woff2 +0 -0
  4. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff +0 -0
  5. data/app/assets/fonts/semantic-ui/Lato-BoldItalic.woff2 +0 -0
  6. data/app/assets/fonts/semantic-ui/Lato-Italic.woff +0 -0
  7. data/app/assets/fonts/semantic-ui/Lato-Italic.woff2 +0 -0
  8. data/app/assets/fonts/semantic-ui/Lato-Regular.woff +0 -0
  9. data/app/assets/fonts/semantic-ui/Lato-Regular.woff2 +0 -0
  10. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff +0 -0
  11. data/app/assets/fonts/semantic-ui/LatoLatin-Bold.woff2 +0 -0
  12. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff +0 -0
  13. data/app/assets/fonts/semantic-ui/LatoLatin-BoldItalic.woff2 +0 -0
  14. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff +0 -0
  15. data/app/assets/fonts/semantic-ui/LatoLatin-Italic.woff2 +0 -0
  16. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff +0 -0
  17. data/app/assets/fonts/semantic-ui/LatoLatin-Regular.woff2 +0 -0
  18. data/app/assets/fonts/semantic-ui/brand-icons.woff +0 -0
  19. data/app/assets/fonts/semantic-ui/brand-icons.woff2 +0 -0
  20. data/app/assets/fonts/semantic-ui/icons.woff +0 -0
  21. data/app/assets/fonts/semantic-ui/icons.woff2 +0 -0
  22. data/app/assets/fonts/semantic-ui/outline-icons.woff +0 -0
  23. data/app/assets/fonts/semantic-ui/outline-icons.woff2 +0 -0
  24. data/app/assets/javascripts/semantic-ui/accordion.js +569 -596
  25. data/app/assets/javascripts/semantic-ui/api.js +1158 -1180
  26. data/app/assets/javascripts/semantic-ui/calendar.js +1935 -1810
  27. data/app/assets/javascripts/semantic-ui/checkbox.js +843 -842
  28. data/app/assets/javascripts/semantic-ui/dimmer.js +707 -738
  29. data/app/assets/javascripts/semantic-ui/dropdown.js +4196 -4237
  30. data/app/assets/javascripts/semantic-ui/embed.js +646 -676
  31. data/app/assets/javascripts/semantic-ui/flyout.js +1515 -1466
  32. data/app/assets/javascripts/semantic-ui/form.js +2023 -2005
  33. data/app/assets/javascripts/semantic-ui/modal.js +1545 -1487
  34. data/app/assets/javascripts/semantic-ui/nag.js +521 -527
  35. data/app/assets/javascripts/semantic-ui/popup.js +1457 -1457
  36. data/app/assets/javascripts/semantic-ui/progress.js +970 -998
  37. data/app/assets/javascripts/semantic-ui/rating.js +508 -524
  38. data/app/assets/javascripts/semantic-ui/search.js +1521 -1535
  39. data/app/assets/javascripts/semantic-ui/shape.js +784 -811
  40. data/app/assets/javascripts/semantic-ui/sidebar.js +1062 -1100
  41. data/app/assets/javascripts/semantic-ui/site.js +437 -477
  42. data/app/assets/javascripts/semantic-ui/slider.js +1311 -1312
  43. data/app/assets/javascripts/semantic-ui/state.js +639 -658
  44. data/app/assets/javascripts/semantic-ui/sticky.js +848 -902
  45. data/app/assets/javascripts/semantic-ui/tab.js +903 -967
  46. data/app/assets/javascripts/semantic-ui/toast.js +911 -885
  47. data/app/assets/javascripts/semantic-ui/transition.js +1049 -1078
  48. data/app/assets/javascripts/semantic-ui/visibility.js +1214 -1246
  49. data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +7 -7
  50. data/app/assets/stylesheets/semantic-ui/collections/_form.scss +246 -341
  51. data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +185 -331
  52. data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +272 -433
  53. data/app/assets/stylesheets/semantic-ui/collections/_message.scss +127 -199
  54. data/app/assets/stylesheets/semantic-ui/collections/_table.scss +549 -776
  55. data/app/assets/stylesheets/semantic-ui/elements/_button.scss +711 -1123
  56. data/app/assets/stylesheets/semantic-ui/elements/_container.scss +9 -8
  57. data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +45 -63
  58. data/app/assets/stylesheets/semantic-ui/elements/_emoji.scss +3556 -3556
  59. data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +272 -270
  60. data/app/assets/stylesheets/semantic-ui/elements/_header.scss +120 -144
  61. data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +667 -747
  62. data/app/assets/stylesheets/semantic-ui/elements/_image.scss +41 -65
  63. data/app/assets/stylesheets/semantic-ui/elements/_input.scss +358 -276
  64. data/app/assets/stylesheets/semantic-ui/elements/_label.scss +361 -412
  65. data/app/assets/stylesheets/semantic-ui/elements/_list.scss +51 -72
  66. data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +69 -157
  67. data/app/assets/stylesheets/semantic-ui/elements/_placeholder.scss +24 -44
  68. data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +17 -22
  69. data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +46 -85
  70. data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +150 -226
  71. data/app/assets/stylesheets/semantic-ui/elements/_step.scss +79 -152
  72. data/app/assets/stylesheets/semantic-ui/elements/_text.scss +33 -33
  73. data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +10 -15
  74. data/app/assets/stylesheets/semantic-ui/globals/_site.scss +30 -43
  75. data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +37 -55
  76. data/app/assets/stylesheets/semantic-ui/modules/_calendar.scss +26 -29
  77. data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +122 -193
  78. data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +55 -174
  79. data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +254 -388
  80. data/app/assets/stylesheets/semantic-ui/modules/_embed.scss +20 -31
  81. data/app/assets/stylesheets/semantic-ui/modules/_flyout.scss +97 -143
  82. data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +122 -156
  83. data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +55 -65
  84. data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +426 -204
  85. data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +108 -213
  86. data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +83 -124
  87. data/app/assets/stylesheets/semantic-ui/modules/_search.scss +71 -100
  88. data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +16 -32
  89. data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +105 -208
  90. data/app/assets/stylesheets/semantic-ui/modules/_slider.scss +93 -121
  91. data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +3 -7
  92. data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +12 -16
  93. data/app/assets/stylesheets/semantic-ui/modules/_toast.scss +71 -149
  94. data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +371 -1282
  95. data/app/assets/stylesheets/semantic-ui/views/_ad.scss +36 -47
  96. data/app/assets/stylesheets/semantic-ui/views/_card.scss +221 -367
  97. data/app/assets/stylesheets/semantic-ui/views/_comment.scss +43 -61
  98. data/app/assets/stylesheets/semantic-ui/views/_feed.scss +37 -59
  99. data/app/assets/stylesheets/semantic-ui/views/_item.scss +86 -133
  100. data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +77 -118
  101. data/lib/fomantic/ui/sass/version.rb +2 -2
  102. data/tasks/converter.rb +1 -1
  103. metadata +17 -1
@@ -1,1133 +1,1095 @@
1
1
  /*!
2
2
  * # Fomantic-UI - Sidebar
3
- * http://github.com/fomantic/Fomantic-UI/
3
+ * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
6
6
  * Released under the MIT license
7
- * http://opensource.org/licenses/MIT
7
+ * https://opensource.org/licenses/MIT
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
11
+ (function ($, window, document) {
12
+ 'use strict';
12
13
 
13
- 'use strict';
14
-
15
- $.isFunction = $.isFunction || function(obj) {
16
- return typeof obj === "function" && typeof obj.nodeType !== "number";
17
- };
18
-
19
- window = (typeof window != 'undefined' && window.Math == Math)
20
- ? window
21
- : (typeof self != 'undefined' && self.Math == Math)
22
- ? self
23
- : Function('return this')()
24
- ;
25
-
26
- $.fn.sidebar = function(parameters) {
27
- var
28
- $allModules = $(this),
29
- $window = $(window),
30
- $document = $(document),
31
- $body = $('body'),
32
- $html = $('html'),
33
- $head = $('head'),
34
-
35
- moduleSelector = $allModules.selector || '',
36
-
37
- time = new Date().getTime(),
38
- performance = [],
39
-
40
- query = arguments[0],
41
- methodInvoked = (typeof query == 'string'),
42
- queryArguments = [].slice.call(arguments, 1),
43
-
44
- requestAnimationFrame = window.requestAnimationFrame
45
- || window.mozRequestAnimationFrame
46
- || window.webkitRequestAnimationFrame
47
- || window.msRequestAnimationFrame
48
- || function(callback) { setTimeout(callback, 0); },
49
-
50
- returnedValue
51
- ;
52
-
53
- $allModules
54
- .each(function() {
55
- var
56
- settings = ( $.isPlainObject(parameters) )
57
- ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
58
- : $.extend({}, $.fn.sidebar.settings),
59
-
60
- selector = settings.selector,
61
- className = settings.className,
62
- namespace = settings.namespace,
63
- regExp = settings.regExp,
64
- error = settings.error,
65
-
66
- eventNamespace = '.' + namespace,
67
- moduleNamespace = 'module-' + namespace,
68
-
69
- $module = $(this),
70
- $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
71
- isBody = $context[0] === $body[0],
72
-
73
- $sidebars = $module.children(selector.sidebar),
74
- $fixed = $context.children(selector.fixed),
75
- $pusher = $context.children(selector.pusher),
76
- $style,
77
-
78
- element = this,
79
- instance = $module.data(moduleNamespace),
80
-
81
- elementNamespace,
82
- id,
83
- currentScroll,
84
- transitionEvent,
85
- initialBodyMargin = '',
86
- tempBodyMargin = '',
87
- hadScrollbar = false,
88
-
89
- module
90
- ;
91
-
92
- module = {
93
-
94
- initialize: function() {
95
- module.debug('Initializing sidebar', parameters);
96
-
97
- module.create.id();
98
-
99
- transitionEvent = module.get.transitionEvent();
100
-
101
- // avoids locking rendering if initialized in onReady
102
- if(settings.delaySetup) {
103
- requestAnimationFrame(module.setup.layout);
104
- }
105
- else {
106
- module.setup.layout();
107
- }
108
-
109
- requestAnimationFrame(function() {
110
- module.setup.cache();
111
- });
112
-
113
- module.instantiate();
114
- },
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
115
17
 
116
- instantiate: function() {
117
- module.verbose('Storing instance of module', module);
118
- instance = module;
119
- $module
120
- .data(moduleNamespace, module)
121
- ;
122
- },
18
+ window = window !== undefined && window.Math === Math
19
+ ? window
20
+ : globalThis;
123
21
 
124
- create: {
125
- id: function() {
126
- id = (Math.random().toString(16) + '000000000').slice(2, 10);
127
- elementNamespace = '.' + id;
128
- module.verbose('Creating unique id for element', id);
129
- }
130
- },
22
+ $.fn.sidebar = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $body = $('body'),
28
+ $html = $('html'),
29
+ $head = $('head'),
131
30
 
132
- destroy: function() {
133
- module.verbose('Destroying previous module for', $module);
134
- $module
135
- .off(eventNamespace)
136
- .removeData(moduleNamespace)
137
- ;
138
- if(module.is.ios()) {
139
- module.remove.ios();
140
- }
141
- // bound by uuid
142
- $context.off(elementNamespace);
143
- $window.off(elementNamespace);
144
- $document.off(elementNamespace);
145
- },
31
+ moduleSelector = $allModules.selector || '',
146
32
 
147
- event: {
148
- clickaway: function(event) {
149
- if(settings.closable){
150
- var
151
- clickedInPusher = ($pusher.find(event.target).length > 0 || $pusher.is(event.target)),
152
- clickedContext = ($context.is(event.target))
153
- ;
154
- if(clickedInPusher) {
155
- module.verbose('User clicked on dimmed page');
156
- module.hide();
157
- }
158
- if(clickedContext) {
159
- module.verbose('User clicked on dimmable context (scaled out page)');
160
- module.hide();
161
- }
162
- }
163
- },
164
- touch: function(event) {
165
- //event.stopPropagation();
166
- },
167
- containScroll: function(event) {
168
- if(element.scrollTop <= 0) {
169
- element.scrollTop = 1;
170
- }
171
- if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
172
- element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
173
- }
174
- },
175
- scroll: function(event) {
176
- if( $(event.target).closest(selector.sidebar).length === 0 ) {
177
- event.preventDefault();
178
- }
179
- }
180
- },
33
+ time = Date.now(),
34
+ performance = [],
181
35
 
182
- bind: {
183
- clickaway: function() {
184
- module.verbose('Adding clickaway events to context', $context);
185
- $context
186
- .on('click' + elementNamespace, module.event.clickaway)
187
- .on('touchend' + elementNamespace, module.event.clickaway)
188
- ;
189
- },
190
- scrollLock: function() {
191
- if(settings.scrollLock) {
192
- module.debug('Disabling page scroll');
193
- hadScrollbar = module.has.scrollbar();
194
- if(hadScrollbar) {
195
- module.save.bodyMargin();
196
- module.set.bodyMargin();
197
- }
198
- $context.addClass(className.locked);
199
- }
200
- module.verbose('Adding events to contain sidebar scroll');
201
- $document
202
- .on('touchmove' + elementNamespace, module.event.touch)
203
- ;
204
- $module
205
- .on('scroll' + eventNamespace, module.event.containScroll)
206
- ;
207
- }
208
- },
209
- unbind: {
210
- clickaway: function() {
211
- module.verbose('Removing clickaway events from context', $context);
212
- $context.off(elementNamespace);
213
- },
214
- scrollLock: function() {
215
- module.verbose('Removing scroll lock from page');
216
- if(hadScrollbar) {
217
- module.restore.bodyMargin();
218
- }
219
- $context.removeClass(className.locked);
220
- $document.off(elementNamespace);
221
- $module.off('scroll' + eventNamespace);
222
- }
223
- },
224
-
225
- add: {
226
- inlineCSS: function() {
227
- var
228
- width = module.cache.width || $module.outerWidth(),
229
- height = module.cache.height || $module.outerHeight(),
230
- isRTL = module.is.rtl(),
231
- direction = module.get.direction(),
232
- distance = {
233
- left : width,
234
- right : -width,
235
- top : height,
236
- bottom : -height
237
- },
238
- style
239
- ;
240
-
241
- if(isRTL){
242
- module.verbose('RTL detected, flipping widths');
243
- distance.left = -width;
244
- distance.right = width;
245
- }
36
+ query = arguments[0],
37
+ methodInvoked = typeof query === 'string',
38
+ queryArguments = [].slice.call(arguments, 1),
246
39
 
247
- style = '<style>';
248
-
249
- if(direction === 'left' || direction === 'right') {
250
- module.debug('Adding CSS rules for animation distance', width);
251
- style += ''
252
- + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
253
- + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
254
- + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
255
- + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
256
- + ' }'
257
- ;
258
- }
259
- else if(direction === 'top' || direction == 'bottom') {
260
- style += ''
261
- + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
262
- + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
263
- + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
264
- + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
265
- + ' }'
266
- ;
267
- }
40
+ returnedValue;
268
41
 
269
- /* IE is only browser not to create context with transforms */
270
- /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
271
- if( module.is.ie() ) {
272
- if(direction === 'left' || direction === 'right') {
273
- module.debug('Adding CSS rules for animation distance', width);
274
- style += ''
275
- + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher::after {'
276
- + ' -webkit-transform: translate3d('+ distance[direction] + 'px, 0, 0);'
277
- + ' transform: translate3d('+ distance[direction] + 'px, 0, 0);'
278
- + ' }'
279
- ;
280
- }
281
- else if(direction === 'top' || direction == 'bottom') {
282
- style += ''
283
- + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher::after {'
284
- + ' -webkit-transform: translate3d(0, ' + distance[direction] + 'px, 0);'
285
- + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
286
- + ' }'
287
- ;
288
- }
289
- /* opposite sides visible forces content overlay */
290
- style += ''
291
- + ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher::after,'
292
- + ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher::after {'
293
- + ' -webkit-transform: translate3d(0, 0, 0);'
294
- + ' transform: translate3d(0, 0, 0);'
295
- + ' }'
296
- ;
297
- }
298
- style += '</style>';
299
- $style = $(style)
300
- .appendTo($head)
42
+ $allModules.each(function () {
43
+ var
44
+ settings = $.isPlainObject(parameters)
45
+ ? $.extend(true, {}, $.fn.sidebar.settings, parameters)
46
+ : $.extend({}, $.fn.sidebar.settings),
47
+
48
+ selector = settings.selector,
49
+ className = settings.className,
50
+ namespace = settings.namespace,
51
+ regExp = settings.regExp,
52
+ error = settings.error,
53
+
54
+ eventNamespace = '.' + namespace,
55
+ moduleNamespace = 'module-' + namespace,
56
+
57
+ $module = $(this),
58
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
59
+ isBody = $context[0] === $body[0],
60
+
61
+ $sidebars = $module.children(selector.sidebar),
62
+ $fixed = $context.children(selector.fixed),
63
+ $pusher = $context.children(selector.pusher),
64
+ $style,
65
+
66
+ element = this,
67
+ instance = $module.data(moduleNamespace),
68
+
69
+ elementNamespace,
70
+ id,
71
+ currentScroll,
72
+ transitionEvent,
73
+ initialBodyMargin = '',
74
+ tempBodyMargin = '',
75
+ hadScrollbar = false,
76
+
77
+ module
301
78
  ;
302
- module.debug('Adding sizing css to head', $style);
303
- }
304
- },
305
-
306
- refresh: function() {
307
- module.verbose('Refreshing selector cache');
308
- $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
309
- module.refreshSidebars();
310
- $pusher = $context.children(selector.pusher);
311
- $fixed = $context.children(selector.fixed);
312
- module.clear.cache();
313
- },
314
79
 
315
- refreshSidebars: function() {
316
- module.verbose('Refreshing other sidebars');
317
- $sidebars = $context.children(selector.sidebar);
318
- },
319
-
320
- repaint: function() {
321
- module.verbose('Forcing repaint event');
322
- element.style.display = 'none';
323
- var ignored = element.offsetHeight;
324
- element.scrollTop = element.scrollTop;
325
- element.style.display = '';
326
- },
327
-
328
- setup: {
329
- cache: function() {
330
- module.cache = {
331
- width : $module.outerWidth(),
332
- height : $module.outerHeight()
80
+ module = {
81
+
82
+ initialize: function () {
83
+ module.debug('Initializing sidebar', parameters);
84
+
85
+ module.create.id();
86
+
87
+ transitionEvent = module.get.transitionEvent();
88
+
89
+ // avoids locking rendering if initialized in onReady
90
+ if (settings.delaySetup) {
91
+ requestAnimationFrame(module.setup.layout);
92
+ } else {
93
+ module.setup.layout();
94
+ }
95
+
96
+ requestAnimationFrame(function () {
97
+ module.setup.cache();
98
+ });
99
+
100
+ module.instantiate();
101
+ },
102
+
103
+ instantiate: function () {
104
+ module.verbose('Storing instance of module', module);
105
+ instance = module;
106
+ $module
107
+ .data(moduleNamespace, module)
108
+ ;
109
+ },
110
+
111
+ create: {
112
+ id: function () {
113
+ id = (Math.random().toString(16) + '000000000').slice(2, 10);
114
+ elementNamespace = '.' + id;
115
+ module.verbose('Creating unique id for element', id);
116
+ },
117
+ },
118
+
119
+ destroy: function () {
120
+ module.verbose('Destroying previous module for', $module);
121
+ $module
122
+ .off(eventNamespace)
123
+ .removeData(moduleNamespace)
124
+ ;
125
+ if (module.is.ios()) {
126
+ module.remove.ios();
127
+ }
128
+ // bound by uuid
129
+ $context.off(elementNamespace);
130
+ $window.off(elementNamespace);
131
+ $document.off(elementNamespace);
132
+ },
133
+
134
+ event: {
135
+ clickaway: function (event) {
136
+ if (settings.closable) {
137
+ var
138
+ clickedInPusher = $pusher.find(event.target).length > 0 || $pusher.is(event.target),
139
+ clickedContext = $context.is(event.target)
140
+ ;
141
+ if (clickedInPusher) {
142
+ module.verbose('User clicked on dimmed page');
143
+ module.hide();
144
+ }
145
+ if (clickedContext) {
146
+ module.verbose('User clicked on dimmable context (scaled out page)');
147
+ module.hide();
148
+ }
149
+ }
150
+ },
151
+ touch: function (event) {
152
+ // event.stopPropagation();
153
+ },
154
+ containScroll: function (event) {
155
+ if (element.scrollTop <= 0) {
156
+ element.scrollTop = 1;
157
+ }
158
+ if ((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
159
+ element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
160
+ }
161
+ },
162
+ scroll: function (event) {
163
+ if ($(event.target).closest(selector.sidebar).length === 0) {
164
+ event.preventDefault();
165
+ }
166
+ },
167
+ },
168
+
169
+ bind: {
170
+ clickaway: function () {
171
+ module.verbose('Adding clickaway events to context', $context);
172
+ $context
173
+ .on('click' + elementNamespace, module.event.clickaway)
174
+ .on('touchend' + elementNamespace, module.event.clickaway)
175
+ ;
176
+ },
177
+ scrollLock: function () {
178
+ if (settings.scrollLock) {
179
+ module.debug('Disabling page scroll');
180
+ hadScrollbar = module.has.scrollbar();
181
+ if (hadScrollbar) {
182
+ module.save.bodyMargin();
183
+ module.set.bodyMargin();
184
+ }
185
+ $context.addClass(className.locked);
186
+ }
187
+ module.verbose('Adding events to contain sidebar scroll');
188
+ $document
189
+ .on('touchmove' + elementNamespace, module.event.touch)
190
+ ;
191
+ $module
192
+ .on('scroll' + eventNamespace, module.event.containScroll)
193
+ ;
194
+ },
195
+ },
196
+ unbind: {
197
+ clickaway: function () {
198
+ module.verbose('Removing clickaway events from context', $context);
199
+ $context.off(elementNamespace);
200
+ },
201
+ scrollLock: function () {
202
+ module.verbose('Removing scroll lock from page');
203
+ if (hadScrollbar) {
204
+ module.restore.bodyMargin();
205
+ }
206
+ $context.removeClass(className.locked);
207
+ $document.off(elementNamespace);
208
+ $module.off('scroll' + eventNamespace);
209
+ },
210
+ },
211
+
212
+ add: {
213
+ inlineCSS: function () {
214
+ var
215
+ width = module.cache.width || $module.outerWidth(),
216
+ height = module.cache.height || $module.outerHeight(),
217
+ isRTL = module.is.rtl(),
218
+ direction = module.get.direction(),
219
+ distance = {
220
+ left: width,
221
+ right: -width,
222
+ top: height,
223
+ bottom: -height,
224
+ },
225
+ style
226
+ ;
227
+
228
+ if (isRTL) {
229
+ module.verbose('RTL detected, flipping widths');
230
+ distance.left = -width;
231
+ distance.right = width;
232
+ }
233
+
234
+ style = '<style>';
235
+
236
+ if (direction === 'left' || direction === 'right') {
237
+ module.debug('Adding CSS rules for animation distance', width);
238
+ style += ''
239
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
240
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
241
+ + ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
242
+ + ' }';
243
+ } else if (direction === 'top' || direction === 'bottom') {
244
+ style += ''
245
+ + ' .ui.visible.' + direction + '.sidebar ~ .fixed,'
246
+ + ' .ui.visible.' + direction + '.sidebar ~ .pusher {'
247
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
248
+ + ' }';
249
+ }
250
+
251
+ /* IE is only browser not to create context with transforms */
252
+ /* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
253
+ if (module.is.ie()) {
254
+ if (direction === 'left' || direction === 'right') {
255
+ module.debug('Adding CSS rules for animation distance', width);
256
+ style += ''
257
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher::after {'
258
+ + ' transform: translate3d(' + distance[direction] + 'px, 0, 0);'
259
+ + ' }';
260
+ } else if (direction === 'top' || direction === 'bottom') {
261
+ style += ''
262
+ + ' body.pushable > .ui.visible.' + direction + '.sidebar ~ .pusher::after {'
263
+ + ' transform: translate3d(0, ' + distance[direction] + 'px, 0);'
264
+ + ' }';
265
+ }
266
+ /* opposite sides visible forces content overlay */
267
+ style += ''
268
+ + ' body.pushable > .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher::after,'
269
+ + ' body.pushable > .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher::after {'
270
+ + ' transform: translate3d(0, 0, 0);'
271
+ + ' }';
272
+ }
273
+ style += '</style>';
274
+ $style = $(style)
275
+ .appendTo($head)
276
+ ;
277
+ module.debug('Adding sizing css to head', $style);
278
+ },
279
+ },
280
+
281
+ refresh: function () {
282
+ module.verbose('Refreshing selector cache');
283
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body;
284
+ module.refreshSidebars();
285
+ $pusher = $context.children(selector.pusher);
286
+ $fixed = $context.children(selector.fixed);
287
+ module.clear.cache();
288
+ },
289
+
290
+ refreshSidebars: function () {
291
+ module.verbose('Refreshing other sidebars');
292
+ $sidebars = $context.children(selector.sidebar);
293
+ },
294
+
295
+ repaint: function () {
296
+ module.verbose('Forcing repaint event');
297
+ element.style.display = 'none';
298
+ var ignored = element.offsetHeight;
299
+ element.scrollTop = element.scrollTop; // eslint-disable-line no-self-assign
300
+ element.style.display = '';
301
+ },
302
+
303
+ setup: {
304
+ cache: function () {
305
+ module.cache = {
306
+ width: $module.outerWidth(),
307
+ height: $module.outerHeight(),
308
+ };
309
+ },
310
+ layout: function () {
311
+ if ($context.children(selector.pusher).length === 0) {
312
+ module.debug('Adding wrapper element for sidebar');
313
+ module.error(error.pusher);
314
+ $pusher = $('<div class="pusher" />');
315
+ $context
316
+ .children()
317
+ .not(selector.omitted)
318
+ .not($sidebars)
319
+ .wrapAll($pusher)
320
+ ;
321
+ module.refresh();
322
+ }
323
+ if ($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
324
+ module.debug('Moved sidebar to correct parent element');
325
+ module.error(error.movedSidebar, element);
326
+ $module.detach().prependTo($context);
327
+ module.refresh();
328
+ }
329
+ module.clear.cache();
330
+ module.set.pushable();
331
+ module.set.direction();
332
+ },
333
+ },
334
+
335
+ attachEvents: function (selector, event) {
336
+ var
337
+ $toggle = $(selector)
338
+ ;
339
+ event = isFunction(module[event])
340
+ ? module[event]
341
+ : module.toggle;
342
+ if ($toggle.length > 0) {
343
+ module.debug('Attaching sidebar events to element', selector, event);
344
+ $toggle
345
+ .on('click' + eventNamespace, event)
346
+ ;
347
+ } else {
348
+ module.error(error.notFound, selector);
349
+ }
350
+ },
351
+ can: {
352
+ leftBodyScrollbar: function () {
353
+ if (module.cache.leftBodyScrollbar === undefined) {
354
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
355
+ }
356
+
357
+ return module.cache.leftBodyScrollbar;
358
+ },
359
+ },
360
+ save: {
361
+ bodyMargin: function () {
362
+ initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
363
+ var
364
+ bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, ''), 10),
365
+ bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
366
+ ;
367
+ tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
368
+ },
369
+ },
370
+ show: function (callback) {
371
+ callback = isFunction(callback)
372
+ ? callback
373
+ : function () {};
374
+ if (module.is.hidden()) {
375
+ if (settings.onShow.call(element) === false) {
376
+ module.verbose('Show callback returned false cancelling show');
377
+
378
+ return;
379
+ }
380
+ if (settings.overlay) {
381
+ module.error(error.overlay);
382
+ settings.transition = 'overlay';
383
+ }
384
+ module.refresh();
385
+ if (module.othersActive()) {
386
+ module.debug('Other sidebars currently visible');
387
+ if (settings.exclusive) {
388
+ // if not overlay queue animation after hide
389
+ if (settings.transition !== 'overlay') {
390
+ module.hideOthers(module.show);
391
+
392
+ return;
393
+ }
394
+
395
+ module.hideOthers();
396
+ } else {
397
+ settings.transition = 'overlay';
398
+ }
399
+ }
400
+ module.set.dimmerStyles();
401
+ module.pushPage(function () {
402
+ callback.call(element);
403
+ settings.onVisible.call(element);
404
+ });
405
+ settings.onChange.call(element);
406
+ } else {
407
+ module.debug('Sidebar is already visible');
408
+ }
409
+ },
410
+
411
+ hide: function (callback) {
412
+ callback = isFunction(callback)
413
+ ? callback
414
+ : function () {};
415
+ if ((module.is.visible() || module.is.animating()) && settings.onHide.call(element) !== false) {
416
+ module.debug('Hiding sidebar', callback);
417
+ module.refreshSidebars();
418
+ module.pullPage(function () {
419
+ callback.call(element);
420
+ settings.onHidden.call(element);
421
+ });
422
+ settings.onChange.call(element);
423
+ }
424
+ },
425
+
426
+ othersAnimating: function () {
427
+ return $sidebars.not($module).filter('.' + className.animating).length > 0;
428
+ },
429
+ othersVisible: function () {
430
+ return $sidebars.not($module).filter('.' + className.visible).length > 0;
431
+ },
432
+ othersActive: function () {
433
+ return module.othersVisible() || module.othersAnimating();
434
+ },
435
+
436
+ hideOthers: function (callback) {
437
+ var
438
+ $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
439
+ sidebarCount = $otherSidebars.length,
440
+ callbackCount = 0
441
+ ;
442
+ callback = callback || function () {};
443
+ $otherSidebars
444
+ .sidebar('hide', function () {
445
+ callbackCount++;
446
+ if (callbackCount === sidebarCount) {
447
+ callback();
448
+ }
449
+ })
450
+ ;
451
+ },
452
+
453
+ toggle: function () {
454
+ module.verbose('Determining toggled direction');
455
+ if (module.is.hidden()) {
456
+ module.show();
457
+ } else {
458
+ module.hide();
459
+ }
460
+ },
461
+
462
+ pushPage: function (callback) {
463
+ var
464
+ transition = module.get.transition(),
465
+ $transition = transition === 'overlay' || module.othersActive()
466
+ ? $module
467
+ : $pusher,
468
+ animate,
469
+ dim,
470
+ transitionEnd
471
+ ;
472
+ callback = isFunction(callback)
473
+ ? callback
474
+ : function () {};
475
+ if (settings.returnScroll) {
476
+ currentScroll = (isBody ? $window : $context).scrollTop();
477
+ }
478
+ if (settings.transition === 'scale down') {
479
+ module.scrollToTop();
480
+ }
481
+ module.bind.scrollLock();
482
+ module.set.transition(transition);
483
+ module.repaint();
484
+ animate = function () {
485
+ module.bind.clickaway();
486
+ module.add.inlineCSS();
487
+ module.set.animating();
488
+ module.set.visible();
489
+ };
490
+ dim = function () {
491
+ module.set.dimmed();
492
+ };
493
+ transitionEnd = function (event) {
494
+ if (event.target === $transition[0]) {
495
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
496
+ module.remove.animating();
497
+ callback.call(element);
498
+ }
499
+ };
500
+ $transition.off(transitionEvent + elementNamespace);
501
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
502
+ requestAnimationFrame(animate);
503
+ if (settings.dimPage && !module.othersVisible()) {
504
+ requestAnimationFrame(dim);
505
+ }
506
+ },
507
+
508
+ pullPage: function (callback) {
509
+ var
510
+ transition = module.get.transition(),
511
+ $transition = transition === 'overlay' || module.othersActive()
512
+ ? $module
513
+ : $pusher,
514
+ animate,
515
+ transitionEnd
516
+ ;
517
+ callback = isFunction(callback)
518
+ ? callback
519
+ : function () {};
520
+ module.verbose('Removing context push state', module.get.direction());
521
+
522
+ module.unbind.clickaway();
523
+ module.unbind.scrollLock();
524
+
525
+ animate = function () {
526
+ module.set.transition(transition);
527
+ module.set.animating();
528
+ if (settings.dimPage && !module.othersVisible()) {
529
+ module.set.closing();
530
+ }
531
+ module.remove.visible();
532
+ };
533
+ transitionEnd = function (event) {
534
+ if (event.target === $transition[0]) {
535
+ $transition.off(transitionEvent + elementNamespace, transitionEnd);
536
+ module.remove.animating();
537
+ module.remove.closing();
538
+ module.remove.transition();
539
+ module.remove.inlineCSS();
540
+ if (transition === 'scale down' || settings.returnScroll) {
541
+ module.scrollBack();
542
+ }
543
+ if (settings.dimPage && !module.othersVisible()) {
544
+ $pusher.removeClass(className.dimmed);
545
+ }
546
+ callback.call(element);
547
+ }
548
+ };
549
+ $transition.off(transitionEvent + elementNamespace);
550
+ $transition.on(transitionEvent + elementNamespace, transitionEnd);
551
+ requestAnimationFrame(animate);
552
+ },
553
+
554
+ scrollToTop: function () {
555
+ module.verbose('Scrolling to top of page to avoid animation issues');
556
+ $module.scrollTop(0);
557
+ (isBody ? $window : $context)[0].scrollTo(0, 0);
558
+ },
559
+
560
+ scrollBack: function () {
561
+ module.verbose('Scrolling back to original page position');
562
+ (isBody ? $window : $context)[0].scrollTo(0, currentScroll);
563
+ },
564
+
565
+ clear: {
566
+ cache: function () {
567
+ module.verbose('Clearing cached dimensions');
568
+ module.cache = {};
569
+ },
570
+ },
571
+
572
+ set: {
573
+ bodyMargin: function () {
574
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
575
+ $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
576
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
577
+ var
578
+ el = $(this),
579
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
580
+ ;
581
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
582
+ });
583
+ },
584
+ dimmerStyles: function () {
585
+ if (settings.blurring) {
586
+ $pusher.addClass(className.blurring);
587
+ } else {
588
+ $pusher.removeClass(className.blurring);
589
+ }
590
+ },
591
+ // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
592
+ // (This is no longer necessary in latest iOS)
593
+ ios: function () {
594
+ $html.addClass(className.ios);
595
+ },
596
+
597
+ // container
598
+ pushed: function () {
599
+ $context.addClass(className.pushed);
600
+ },
601
+ pushable: function () {
602
+ $context.addClass(className.pushable);
603
+ },
604
+
605
+ // pusher
606
+ dimmed: function () {
607
+ $pusher.addClass(className.dimmed);
608
+ },
609
+
610
+ // sidebar
611
+ active: function () {
612
+ $module.addClass(className.active);
613
+ },
614
+ animating: function () {
615
+ $module.addClass(className.animating);
616
+ },
617
+ closing: function () {
618
+ $pusher.addClass(className.closing);
619
+ },
620
+ transition: function (transition) {
621
+ transition = transition || module.get.transition();
622
+ $module.addClass(transition);
623
+ },
624
+ direction: function (direction) {
625
+ direction = direction || module.get.direction();
626
+ $module.addClass(className[direction]);
627
+ },
628
+ visible: function () {
629
+ $module.addClass(className.visible);
630
+ },
631
+ overlay: function () {
632
+ $module.addClass(className.overlay);
633
+ },
634
+ },
635
+ remove: {
636
+
637
+ inlineCSS: function () {
638
+ module.debug('Removing inline css styles', $style);
639
+ if ($style && $style.length > 0) {
640
+ $style.remove();
641
+ }
642
+ },
643
+
644
+ // ios scroll on html not document
645
+ ios: function () {
646
+ $html.removeClass(className.ios);
647
+ },
648
+
649
+ // context
650
+ pushed: function () {
651
+ $context.removeClass(className.pushed);
652
+ },
653
+ pushable: function () {
654
+ $context.removeClass(className.pushable);
655
+ },
656
+
657
+ // sidebar
658
+ active: function () {
659
+ $module.removeClass(className.active);
660
+ },
661
+ animating: function () {
662
+ $module.removeClass(className.animating);
663
+ },
664
+ closing: function () {
665
+ $pusher.removeClass(className.closing);
666
+ },
667
+ transition: function (transition) {
668
+ transition = transition || module.get.transition();
669
+ $module.removeClass(transition);
670
+ },
671
+ direction: function (direction) {
672
+ direction = direction || module.get.direction();
673
+ $module.removeClass(className[direction]);
674
+ },
675
+ visible: function () {
676
+ $module.removeClass(className.visible);
677
+ },
678
+ overlay: function () {
679
+ $module.removeClass(className.overlay);
680
+ },
681
+ },
682
+ restore: {
683
+ bodyMargin: function () {
684
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
685
+ $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
686
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
687
+ var
688
+ el = $(this),
689
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
690
+ ;
691
+ el.css(attribute, '');
692
+ });
693
+ },
694
+ },
695
+ get: {
696
+ direction: function () {
697
+ if ($module.hasClass(className.top)) {
698
+ return className.top;
699
+ }
700
+ if ($module.hasClass(className.right)) {
701
+ return className.right;
702
+ }
703
+ if ($module.hasClass(className.bottom)) {
704
+ return className.bottom;
705
+ }
706
+
707
+ return className.left;
708
+ },
709
+ transition: function () {
710
+ var
711
+ direction = module.get.direction(),
712
+ transition
713
+ ;
714
+ transition = module.is.mobile()
715
+ ? (settings.mobileTransition === 'auto'
716
+ ? settings.defaultTransition.mobile[direction]
717
+ : settings.mobileTransition)
718
+ : (settings.transition === 'auto'
719
+ ? settings.defaultTransition.computer[direction]
720
+ : settings.transition);
721
+ module.verbose('Determined transition', transition);
722
+
723
+ return transition;
724
+ },
725
+ transitionEvent: function () {
726
+ var
727
+ element = document.createElement('element'),
728
+ transitions = {
729
+ transition: 'transitionend',
730
+ OTransition: 'oTransitionEnd',
731
+ MozTransition: 'transitionend',
732
+ WebkitTransition: 'webkitTransitionEnd',
733
+ },
734
+ transition
735
+ ;
736
+ for (transition in transitions) {
737
+ if (element.style[transition] !== undefined) {
738
+ return transitions[transition];
739
+ }
740
+ }
741
+ },
742
+ },
743
+ has: {
744
+ scrollbar: function () {
745
+ return isBody || $context.css('overflow-y') !== 'hidden';
746
+ },
747
+ },
748
+ is: {
749
+ safari: function () {
750
+ if (module.cache.isSafari === undefined) {
751
+ module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
752
+ }
753
+
754
+ return module.cache.isSafari;
755
+ },
756
+ edge: function () {
757
+ if (module.cache.isEdge === undefined) {
758
+ module.cache.isEdge = !!window.setImmediate && !module.is.ie();
759
+ }
760
+
761
+ return module.cache.isEdge;
762
+ },
763
+ firefox: function () {
764
+ if (module.cache.isFirefox === undefined) {
765
+ module.cache.isFirefox = !!window.InstallTrigger;
766
+ }
767
+
768
+ return module.cache.isFirefox;
769
+ },
770
+ iframe: function () {
771
+ return !(self === top);
772
+ },
773
+ ie: function () {
774
+ if (module.cache.isIE === undefined) {
775
+ var
776
+ isIE11 = !window.ActiveXObject && 'ActiveXObject' in window,
777
+ isIE = 'ActiveXObject' in window
778
+ ;
779
+ module.cache.isIE = isIE11 || isIE;
780
+ }
781
+
782
+ return module.cache.isIE;
783
+ },
784
+
785
+ ios: function () {
786
+ var
787
+ userAgent = navigator.userAgent,
788
+ isIOS = userAgent.match(regExp.ios),
789
+ isMobileChrome = userAgent.match(regExp.mobileChrome)
790
+ ;
791
+ if (isIOS && !isMobileChrome) {
792
+ module.verbose('Browser was found to be iOS', userAgent);
793
+
794
+ return true;
795
+ }
796
+
797
+ return false;
798
+ },
799
+ mobile: function () {
800
+ var
801
+ userAgent = navigator.userAgent,
802
+ isMobile = userAgent.match(regExp.mobile)
803
+ ;
804
+ if (isMobile) {
805
+ module.verbose('Browser was found to be mobile', userAgent);
806
+
807
+ return true;
808
+ }
809
+
810
+ module.verbose('Browser is not mobile, using regular transition', userAgent);
811
+
812
+ return false;
813
+ },
814
+ hidden: function () {
815
+ return !module.is.visible();
816
+ },
817
+ visible: function () {
818
+ return $module.hasClass(className.visible);
819
+ },
820
+ // alias
821
+ open: function () {
822
+ return module.is.visible();
823
+ },
824
+ closed: function () {
825
+ return module.is.hidden();
826
+ },
827
+ vertical: function () {
828
+ return $module.hasClass(className.top);
829
+ },
830
+ animating: function () {
831
+ return $context.hasClass(className.animating);
832
+ },
833
+ rtl: function () {
834
+ if (module.cache.isRTL === undefined) {
835
+ module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
836
+ }
837
+
838
+ return module.cache.isRTL;
839
+ },
840
+ },
841
+
842
+ setting: function (name, value) {
843
+ module.debug('Changing setting', name, value);
844
+ if ($.isPlainObject(name)) {
845
+ $.extend(true, settings, name);
846
+ } else if (value !== undefined) {
847
+ if ($.isPlainObject(settings[name])) {
848
+ $.extend(true, settings[name], value);
849
+ } else {
850
+ settings[name] = value;
851
+ }
852
+ } else {
853
+ return settings[name];
854
+ }
855
+ },
856
+ internal: function (name, value) {
857
+ if ($.isPlainObject(name)) {
858
+ $.extend(true, module, name);
859
+ } else if (value !== undefined) {
860
+ module[name] = value;
861
+ } else {
862
+ return module[name];
863
+ }
864
+ },
865
+ debug: function () {
866
+ if (!settings.silent && settings.debug) {
867
+ if (settings.performance) {
868
+ module.performance.log(arguments);
869
+ } else {
870
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
871
+ module.debug.apply(console, arguments);
872
+ }
873
+ }
874
+ },
875
+ verbose: function () {
876
+ if (!settings.silent && settings.verbose && settings.debug) {
877
+ if (settings.performance) {
878
+ module.performance.log(arguments);
879
+ } else {
880
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
881
+ module.verbose.apply(console, arguments);
882
+ }
883
+ }
884
+ },
885
+ error: function () {
886
+ if (!settings.silent) {
887
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
888
+ module.error.apply(console, arguments);
889
+ }
890
+ },
891
+ performance: {
892
+ log: function (message) {
893
+ var
894
+ currentTime,
895
+ executionTime,
896
+ previousTime
897
+ ;
898
+ if (settings.performance) {
899
+ currentTime = Date.now();
900
+ previousTime = time || currentTime;
901
+ executionTime = currentTime - previousTime;
902
+ time = currentTime;
903
+ performance.push({
904
+ Name: message[0],
905
+ Arguments: [].slice.call(message, 1) || '',
906
+ Element: element,
907
+ 'Execution Time': executionTime,
908
+ });
909
+ }
910
+ clearTimeout(module.performance.timer);
911
+ module.performance.timer = setTimeout(module.performance.display, 500);
912
+ },
913
+ display: function () {
914
+ var
915
+ title = settings.name + ':',
916
+ totalTime = 0
917
+ ;
918
+ time = false;
919
+ clearTimeout(module.performance.timer);
920
+ $.each(performance, function (index, data) {
921
+ totalTime += data['Execution Time'];
922
+ });
923
+ title += ' ' + totalTime + 'ms';
924
+ if (moduleSelector) {
925
+ title += ' \'' + moduleSelector + '\'';
926
+ }
927
+ if (performance.length > 0) {
928
+ console.groupCollapsed(title);
929
+ if (console.table) {
930
+ console.table(performance);
931
+ } else {
932
+ $.each(performance, function (index, data) {
933
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
934
+ });
935
+ }
936
+ console.groupEnd();
937
+ }
938
+ performance = [];
939
+ },
940
+ },
941
+ invoke: function (query, passedArguments, context) {
942
+ var
943
+ object = instance,
944
+ maxDepth,
945
+ found,
946
+ response
947
+ ;
948
+ passedArguments = passedArguments || queryArguments;
949
+ context = context || element;
950
+ if (typeof query === 'string' && object !== undefined) {
951
+ query = query.split(/[ .]/);
952
+ maxDepth = query.length - 1;
953
+ $.each(query, function (depth, value) {
954
+ var camelCaseValue = depth !== maxDepth
955
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
956
+ : query
957
+ ;
958
+ if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
959
+ object = object[camelCaseValue];
960
+ } else if (object[camelCaseValue] !== undefined) {
961
+ found = object[camelCaseValue];
962
+
963
+ return false;
964
+ } else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
965
+ object = object[value];
966
+ } else if (object[value] !== undefined) {
967
+ found = object[value];
968
+
969
+ return false;
970
+ } else {
971
+ module.error(error.method, query);
972
+
973
+ return false;
974
+ }
975
+ });
976
+ }
977
+ if (isFunction(found)) {
978
+ response = found.apply(context, passedArguments);
979
+ } else if (found !== undefined) {
980
+ response = found;
981
+ }
982
+ if (Array.isArray(returnedValue)) {
983
+ returnedValue.push(response);
984
+ } else if (returnedValue !== undefined) {
985
+ returnedValue = [returnedValue, response];
986
+ } else if (response !== undefined) {
987
+ returnedValue = response;
988
+ }
989
+
990
+ return found;
991
+ },
333
992
  };
334
- },
335
- layout: function() {
336
- if( $context.children(selector.pusher).length === 0 ) {
337
- module.debug('Adding wrapper element for sidebar');
338
- module.error(error.pusher);
339
- $pusher = $('<div class="pusher" />');
340
- $context
341
- .children()
342
- .not(selector.omitted)
343
- .not($sidebars)
344
- .wrapAll($pusher)
345
- ;
346
- module.refresh();
347
- }
348
- if($module.nextAll(selector.pusher).length === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
349
- module.debug('Moved sidebar to correct parent element');
350
- module.error(error.movedSidebar, element);
351
- $module.detach().prependTo($context);
352
- module.refresh();
353
- }
354
- module.clear.cache();
355
- module.set.pushable();
356
- module.set.direction();
357
- }
358
- },
359
993
 
360
- attachEvents: function(selector, event) {
361
- var
362
- $toggle = $(selector)
363
- ;
364
- event = $.isFunction(module[event])
365
- ? module[event]
366
- : module.toggle
367
- ;
368
- if($toggle.length > 0) {
369
- module.debug('Attaching sidebar events to element', selector, event);
370
- $toggle
371
- .on('click' + eventNamespace, event)
372
- ;
373
- }
374
- else {
375
- module.error(error.notFound, selector);
376
- }
377
- },
378
- can: {
379
- leftBodyScrollbar: function () {
380
- if (module.cache.leftBodyScrollbar === undefined) {
381
- module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
382
- }
383
- return module.cache.leftBodyScrollbar;
384
- }
385
- },
386
- save: {
387
- bodyMargin: function() {
388
- initialBodyMargin = $context.css((isBody ? 'margin-':'padding-')+(module.can.leftBodyScrollbar() ? 'left':'right'));
389
- var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
390
- bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
391
- tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
392
- }
393
- },
394
- show: function(callback) {
395
- callback = $.isFunction(callback)
396
- ? callback
397
- : function(){}
398
- ;
399
- if(module.is.hidden()) {
400
- if(settings.onShow.call(element) === false) {
401
- module.verbose('Show callback returned false cancelling show');
402
- return;
403
- }
404
- if(settings.overlay) {
405
- module.error(error.overlay);
406
- settings.transition = 'overlay';
407
- }
408
- module.refresh();
409
- if(module.othersActive()) {
410
- module.debug('Other sidebars currently visible');
411
- if(settings.exclusive) {
412
- // if not overlay queue animation after hide
413
- if(settings.transition != 'overlay') {
414
- module.hideOthers(module.show);
415
- return;
994
+ if (methodInvoked) {
995
+ if (instance === undefined) {
996
+ module.initialize();
416
997
  }
417
- else {
418
- module.hideOthers();
998
+ module.invoke(query);
999
+ } else {
1000
+ if (instance !== undefined) {
1001
+ module.invoke('destroy');
419
1002
  }
420
- }
421
- else {
422
- settings.transition = 'overlay';
423
- }
424
- }
425
- module.set.dimmerStyles();
426
- module.pushPage(function() {
427
- callback.call(element);
428
- settings.onVisible.call(element);
429
- });
430
- settings.onChange.call(element);
431
- }
432
- else {
433
- module.debug('Sidebar is already visible');
434
- }
435
- },
436
-
437
- hide: function(callback) {
438
- callback = $.isFunction(callback)
439
- ? callback
440
- : function(){}
441
- ;
442
- if((module.is.visible() || module.is.animating()) && settings.onHide.call(element) !== false) {
443
- module.debug('Hiding sidebar', callback);
444
- module.refreshSidebars();
445
- module.pullPage(function() {
446
- callback.call(element);
447
- settings.onHidden.call(element);
448
- });
449
- settings.onChange.call(element);
450
- }
451
- },
452
-
453
- othersAnimating: function() {
454
- return ($sidebars.not($module).filter('.' + className.animating).length > 0);
455
- },
456
- othersVisible: function() {
457
- return ($sidebars.not($module).filter('.' + className.visible).length > 0);
458
- },
459
- othersActive: function() {
460
- return(module.othersVisible() || module.othersAnimating());
461
- },
462
-
463
- hideOthers: function(callback) {
464
- var
465
- $otherSidebars = $sidebars.not($module).filter('.' + className.visible),
466
- sidebarCount = $otherSidebars.length,
467
- callbackCount = 0
468
- ;
469
- callback = callback || function(){};
470
- $otherSidebars
471
- .sidebar('hide', function() {
472
- callbackCount++;
473
- if(callbackCount == sidebarCount) {
474
- callback();
475
- }
476
- })
477
- ;
478
- },
479
-
480
- toggle: function() {
481
- module.verbose('Determining toggled direction');
482
- if(module.is.hidden()) {
483
- module.show();
484
- }
485
- else {
486
- module.hide();
487
- }
488
- },
489
-
490
- pushPage: function(callback) {
491
- var
492
- transition = module.get.transition(),
493
- $transition = (transition === 'overlay' || module.othersActive())
494
- ? $module
495
- : $pusher,
496
- animate,
497
- dim,
498
- transitionEnd
499
- ;
500
- callback = $.isFunction(callback)
501
- ? callback
502
- : function(){}
503
- ;
504
- if(settings.returnScroll) {
505
- currentScroll = (isBody ? $window : $context).scrollTop();
506
- }
507
- if(settings.transition === 'scale down') {
508
- module.scrollToTop();
509
- }
510
- module.bind.scrollLock();
511
- module.set.transition(transition);
512
- module.repaint();
513
- animate = function() {
514
- module.bind.clickaway();
515
- module.add.inlineCSS();
516
- module.set.animating();
517
- module.set.visible();
518
- };
519
- dim = function() {
520
- module.set.dimmed();
521
- };
522
- transitionEnd = function(event) {
523
- if( event.target == $transition[0] ) {
524
- $transition.off(transitionEvent + elementNamespace, transitionEnd);
525
- module.remove.animating();
526
- callback.call(element);
527
- }
528
- };
529
- $transition.off(transitionEvent + elementNamespace);
530
- $transition.on(transitionEvent + elementNamespace, transitionEnd);
531
- requestAnimationFrame(animate);
532
- if(settings.dimPage && !module.othersVisible()) {
533
- requestAnimationFrame(dim);
534
- }
535
- },
536
-
537
- pullPage: function(callback) {
538
- var
539
- transition = module.get.transition(),
540
- $transition = (transition == 'overlay' || module.othersActive())
541
- ? $module
542
- : $pusher,
543
- animate,
544
- transitionEnd
545
- ;
546
- callback = $.isFunction(callback)
547
- ? callback
548
- : function(){}
549
- ;
550
- module.verbose('Removing context push state', module.get.direction());
551
-
552
- module.unbind.clickaway();
553
- module.unbind.scrollLock();
554
-
555
- animate = function() {
556
- module.set.transition(transition);
557
- module.set.animating();
558
- if(settings.dimPage && !module.othersVisible()) {
559
- module.set.closing();
1003
+ module.initialize();
560
1004
  }
561
- module.remove.visible();
562
- };
563
- transitionEnd = function(event) {
564
- if( event.target == $transition[0] ) {
565
- $transition.off(transitionEvent + elementNamespace, transitionEnd);
566
- module.remove.animating();
567
- module.remove.closing();
568
- module.remove.transition();
569
- module.remove.inlineCSS();
570
- if(transition === 'scale down' || settings.returnScroll) {
571
- module.scrollBack();
572
- }
573
- if(settings.dimPage && !module.othersVisible()) {
574
- $pusher.removeClass(className.dimmed);
575
- }
576
- callback.call(element);
577
- }
578
- };
579
- $transition.off(transitionEvent + elementNamespace);
580
- $transition.on(transitionEvent + elementNamespace, transitionEnd);
581
- requestAnimationFrame(animate);
1005
+ });
1006
+
1007
+ return returnedValue !== undefined
1008
+ ? returnedValue
1009
+ : this;
1010
+ };
1011
+
1012
+ $.fn.sidebar.settings = {
1013
+
1014
+ name: 'Sidebar',
1015
+ namespace: 'sidebar',
1016
+
1017
+ silent: false,
1018
+ debug: false,
1019
+ verbose: false,
1020
+ performance: true,
1021
+
1022
+ transition: 'auto',
1023
+ mobileTransition: 'auto',
1024
+
1025
+ defaultTransition: {
1026
+ computer: {
1027
+ left: 'uncover',
1028
+ right: 'uncover',
1029
+ top: 'overlay',
1030
+ bottom: 'overlay',
1031
+ },
1032
+ mobile: {
1033
+ left: 'uncover',
1034
+ right: 'uncover',
1035
+ top: 'overlay',
1036
+ bottom: 'overlay',
1037
+ },
582
1038
  },
583
1039
 
584
- scrollToTop: function() {
585
- module.verbose('Scrolling to top of page to avoid animation issues');
586
- $module.scrollTop(0);
587
- (isBody ? $window : $context)[0].scrollTo(0, 0);
1040
+ context: 'body',
1041
+ exclusive: false,
1042
+ closable: true,
1043
+ dimPage: true,
1044
+ scrollLock: false,
1045
+ returnScroll: false,
1046
+ delaySetup: false,
1047
+
1048
+ onChange: function () {},
1049
+ onShow: function () {},
1050
+ onHide: function () {},
1051
+
1052
+ onHidden: function () {},
1053
+ onVisible: function () {},
1054
+
1055
+ className: {
1056
+ active: 'active',
1057
+ animating: 'animating',
1058
+ blurring: 'blurring',
1059
+ closing: 'closing',
1060
+ dimmed: 'dimmed',
1061
+ ios: 'ios',
1062
+ locked: 'locked',
1063
+ pushable: 'pushable',
1064
+ pushed: 'pushed',
1065
+ right: 'right',
1066
+ top: 'top',
1067
+ left: 'left',
1068
+ bottom: 'bottom',
1069
+ visible: 'visible',
588
1070
  },
589
1071
 
590
- scrollBack: function() {
591
- module.verbose('Scrolling back to original page position');
592
- (isBody ? $window : $context)[0].scrollTo(0, currentScroll);
1072
+ selector: {
1073
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1074
+ fixed: '.fixed',
1075
+ omitted: 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1076
+ pusher: '.pusher',
1077
+ sidebar: '.ui.sidebar',
593
1078
  },
594
1079
 
595
- clear: {
596
- cache: function() {
597
- module.verbose('Clearing cached dimensions');
598
- module.cache = {};
599
- }
1080
+ regExp: {
1081
+ ios: /(iPad|iPhone|iPod)/g,
1082
+ mobileChrome: /(CriOS)/g,
1083
+ 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,
600
1084
  },
601
1085
 
602
- set: {
603
- bodyMargin: function() {
604
- var position = module.can.leftBodyScrollbar() ? 'left':'right';
605
- $context.css((isBody ? 'margin-':'padding-')+position, tempBodyMargin + 'px');
606
- $context.find(selector.bodyFixed.replace('right',position)).each(function(){
607
- var el = $(this),
608
- attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
609
- ;
610
- el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
611
- });
612
- },
613
- dimmerStyles: function() {
614
- if(settings.blurring) {
615
- $pusher.addClass(className.blurring);
616
- }
617
- else {
618
- $pusher.removeClass(className.blurring);
619
- }
620
- },
621
- // ios only (scroll on html not document). This prevent auto-resize canvas/scroll in ios
622
- // (This is no longer necessary in latest iOS)
623
- ios: function() {
624
- $html.addClass(className.ios);
625
- },
626
-
627
- // container
628
- pushed: function() {
629
- $context.addClass(className.pushed);
630
- },
631
- pushable: function() {
632
- $context.addClass(className.pushable);
633
- },
634
-
635
- // pusher
636
- dimmed: function() {
637
- $pusher.addClass(className.dimmed);
638
- },
639
-
640
- // sidebar
641
- active: function() {
642
- $module.addClass(className.active);
643
- },
644
- animating: function() {
645
- $module.addClass(className.animating);
646
- },
647
- closing: function() {
648
- $pusher.addClass(className.closing);
649
- },
650
- transition: function(transition) {
651
- transition = transition || module.get.transition();
652
- $module.addClass(transition);
653
- },
654
- direction: function(direction) {
655
- direction = direction || module.get.direction();
656
- $module.addClass(className[direction]);
657
- },
658
- visible: function() {
659
- $module.addClass(className.visible);
660
- },
661
- overlay: function() {
662
- $module.addClass(className.overlay);
663
- }
1086
+ error: {
1087
+ method: 'The method you called is not defined.',
1088
+ pusher: 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1089
+ movedSidebar: 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1090
+ overlay: 'The overlay setting is no longer supported, use animation: overlay',
1091
+ notFound: 'There were no elements that matched the specified selector',
664
1092
  },
665
- remove: {
666
1093
 
667
- inlineCSS: function() {
668
- module.debug('Removing inline css styles', $style);
669
- if($style && $style.length > 0) {
670
- $style.remove();
671
- }
672
- },
673
-
674
- // ios scroll on html not document
675
- ios: function() {
676
- $html.removeClass(className.ios);
677
- },
678
-
679
- // context
680
- pushed: function() {
681
- $context.removeClass(className.pushed);
682
- },
683
- pushable: function() {
684
- $context.removeClass(className.pushable);
685
- },
686
-
687
- // sidebar
688
- active: function() {
689
- $module.removeClass(className.active);
690
- },
691
- animating: function() {
692
- $module.removeClass(className.animating);
693
- },
694
- closing: function() {
695
- $pusher.removeClass(className.closing);
696
- },
697
- transition: function(transition) {
698
- transition = transition || module.get.transition();
699
- $module.removeClass(transition);
700
- },
701
- direction: function(direction) {
702
- direction = direction || module.get.direction();
703
- $module.removeClass(className[direction]);
704
- },
705
- visible: function() {
706
- $module.removeClass(className.visible);
707
- },
708
- overlay: function() {
709
- $module.removeClass(className.overlay);
710
- }
711
- },
712
- restore: {
713
- bodyMargin: function() {
714
- var position = module.can.leftBodyScrollbar() ? 'left':'right';
715
- $context.css((isBody ? 'margin-':'padding-')+position, initialBodyMargin);
716
- $context.find(selector.bodyFixed.replace('right',position)).each(function(){
717
- var el = $(this),
718
- attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
719
- ;
720
- el.css(attribute, '');
721
- });
722
- }
723
- },
724
- get: {
725
- direction: function() {
726
- if($module.hasClass(className.top)) {
727
- return className.top;
728
- }
729
- else if($module.hasClass(className.right)) {
730
- return className.right;
731
- }
732
- else if($module.hasClass(className.bottom)) {
733
- return className.bottom;
734
- }
735
- return className.left;
736
- },
737
- transition: function() {
738
- var
739
- direction = module.get.direction(),
740
- transition
741
- ;
742
- transition = ( module.is.mobile() )
743
- ? (settings.mobileTransition == 'auto')
744
- ? settings.defaultTransition.mobile[direction]
745
- : settings.mobileTransition
746
- : (settings.transition == 'auto')
747
- ? settings.defaultTransition.computer[direction]
748
- : settings.transition
749
- ;
750
- module.verbose('Determined transition', transition);
751
- return transition;
752
- },
753
- transitionEvent: function() {
754
- var
755
- element = document.createElement('element'),
756
- transitions = {
757
- 'transition' :'transitionend',
758
- 'OTransition' :'oTransitionEnd',
759
- 'MozTransition' :'transitionend',
760
- 'WebkitTransition' :'webkitTransitionEnd'
761
- },
762
- transition
763
- ;
764
- for(transition in transitions){
765
- if( element.style[transition] !== undefined ){
766
- return transitions[transition];
767
- }
768
- }
769
- }
770
- },
771
- has: {
772
- scrollbar: function() {
773
- return isBody || $context.css('overflow-y') !== 'hidden';
774
- }
775
- },
776
- is: {
777
- safari: function() {
778
- if(module.cache.isSafari === undefined) {
779
- module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
780
- }
781
- return module.cache.isSafari;
782
- },
783
- edge: function(){
784
- if(module.cache.isEdge === undefined) {
785
- module.cache.isEdge = !!window.setImmediate && !module.is.ie();
786
- }
787
- return module.cache.isEdge;
788
- },
789
- firefox: function(){
790
- if(module.cache.isFirefox === undefined) {
791
- module.cache.isFirefox = !!window.InstallTrigger;
792
- }
793
- return module.cache.isFirefox;
794
- },
795
- iframe: function() {
796
- return !(self === top);
797
- },
798
- ie: function() {
799
- if(module.cache.isIE === undefined) {
800
- var
801
- isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
802
- isIE = ('ActiveXObject' in window)
803
- ;
804
- module.cache.isIE = (isIE11 || isIE);
805
- }
806
- return module.cache.isIE;
807
- },
808
-
809
- ios: function() {
810
- var
811
- userAgent = navigator.userAgent,
812
- isIOS = userAgent.match(regExp.ios),
813
- isMobileChrome = userAgent.match(regExp.mobileChrome)
814
- ;
815
- if(isIOS && !isMobileChrome) {
816
- module.verbose('Browser was found to be iOS', userAgent);
817
- return true;
818
- }
819
- else {
820
- return false;
821
- }
822
- },
823
- mobile: function() {
824
- var
825
- userAgent = navigator.userAgent,
826
- isMobile = userAgent.match(regExp.mobile)
827
- ;
828
- if(isMobile) {
829
- module.verbose('Browser was found to be mobile', userAgent);
830
- return true;
831
- }
832
- else {
833
- module.verbose('Browser is not mobile, using regular transition', userAgent);
834
- return false;
835
- }
836
- },
837
- hidden: function() {
838
- return !module.is.visible();
839
- },
840
- visible: function() {
841
- return $module.hasClass(className.visible);
842
- },
843
- // alias
844
- open: function() {
845
- return module.is.visible();
846
- },
847
- closed: function() {
848
- return module.is.hidden();
849
- },
850
- vertical: function() {
851
- return $module.hasClass(className.top);
852
- },
853
- animating: function() {
854
- return $context.hasClass(className.animating);
855
- },
856
- rtl: function() {
857
- if(module.cache.isRTL === undefined) {
858
- module.cache.isRTL = $module.attr('dir') === 'rtl' || $module.css('direction') === 'rtl' || $body.attr('dir') === 'rtl' || $body.css('direction') === 'rtl' || $context.attr('dir') === 'rtl' || $context.css('direction') === 'rtl';
859
- }
860
- return module.cache.isRTL;
861
- },
862
- },
863
-
864
- setting: function(name, value) {
865
- module.debug('Changing setting', name, value);
866
- if( $.isPlainObject(name) ) {
867
- $.extend(true, settings, name);
868
- }
869
- else if(value !== undefined) {
870
- if($.isPlainObject(settings[name])) {
871
- $.extend(true, settings[name], value);
872
- }
873
- else {
874
- settings[name] = value;
875
- }
876
- }
877
- else {
878
- return settings[name];
879
- }
880
- },
881
- internal: function(name, value) {
882
- if( $.isPlainObject(name) ) {
883
- $.extend(true, module, name);
884
- }
885
- else if(value !== undefined) {
886
- module[name] = value;
887
- }
888
- else {
889
- return module[name];
890
- }
891
- },
892
- debug: function() {
893
- if(!settings.silent && settings.debug) {
894
- if(settings.performance) {
895
- module.performance.log(arguments);
896
- }
897
- else {
898
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
899
- module.debug.apply(console, arguments);
900
- }
901
- }
902
- },
903
- verbose: function() {
904
- if(!settings.silent && settings.verbose && settings.debug) {
905
- if(settings.performance) {
906
- module.performance.log(arguments);
907
- }
908
- else {
909
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
910
- module.verbose.apply(console, arguments);
911
- }
912
- }
913
- },
914
- error: function() {
915
- if(!settings.silent) {
916
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
917
- module.error.apply(console, arguments);
918
- }
919
- },
920
- performance: {
921
- log: function(message) {
922
- var
923
- currentTime,
924
- executionTime,
925
- previousTime
926
- ;
927
- if(settings.performance) {
928
- currentTime = new Date().getTime();
929
- previousTime = time || currentTime;
930
- executionTime = currentTime - previousTime;
931
- time = currentTime;
932
- performance.push({
933
- 'Name' : message[0],
934
- 'Arguments' : [].slice.call(message, 1) || '',
935
- 'Element' : element,
936
- 'Execution Time' : executionTime
937
- });
938
- }
939
- clearTimeout(module.performance.timer);
940
- module.performance.timer = setTimeout(module.performance.display, 500);
941
- },
942
- display: function() {
943
- var
944
- title = settings.name + ':',
945
- totalTime = 0
946
- ;
947
- time = false;
948
- clearTimeout(module.performance.timer);
949
- $.each(performance, function(index, data) {
950
- totalTime += data['Execution Time'];
951
- });
952
- title += ' ' + totalTime + 'ms';
953
- if(moduleSelector) {
954
- title += ' \'' + moduleSelector + '\'';
955
- }
956
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
957
- console.groupCollapsed(title);
958
- if(console.table) {
959
- console.table(performance);
960
- }
961
- else {
962
- $.each(performance, function(index, data) {
963
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
964
- });
965
- }
966
- console.groupEnd();
967
- }
968
- performance = [];
969
- }
970
- },
971
- invoke: function(query, passedArguments, context) {
972
- var
973
- object = instance,
974
- maxDepth,
975
- found,
976
- response
977
- ;
978
- passedArguments = passedArguments || queryArguments;
979
- context = context || element;
980
- if(typeof query == 'string' && object !== undefined) {
981
- query = query.split(/[\. ]/);
982
- maxDepth = query.length - 1;
983
- $.each(query, function(depth, value) {
984
- var camelCaseValue = (depth != maxDepth)
985
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
986
- : query
987
- ;
988
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
989
- object = object[camelCaseValue];
990
- }
991
- else if( object[camelCaseValue] !== undefined ) {
992
- found = object[camelCaseValue];
993
- return false;
994
- }
995
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
996
- object = object[value];
997
- }
998
- else if( object[value] !== undefined ) {
999
- found = object[value];
1000
- return false;
1001
- }
1002
- else {
1003
- module.error(error.method, query);
1004
- return false;
1005
- }
1006
- });
1007
- }
1008
- if ( $.isFunction( found ) ) {
1009
- response = found.apply(context, passedArguments);
1010
- }
1011
- else if(found !== undefined) {
1012
- response = found;
1013
- }
1014
- if(Array.isArray(returnedValue)) {
1015
- returnedValue.push(response);
1016
- }
1017
- else if(returnedValue !== undefined) {
1018
- returnedValue = [returnedValue, response];
1019
- }
1020
- else if(response !== undefined) {
1021
- returnedValue = response;
1022
- }
1023
- return found;
1024
- }
1025
- }
1026
- ;
1027
-
1028
- if(methodInvoked) {
1029
- if(instance === undefined) {
1030
- module.initialize();
1031
- }
1032
- module.invoke(query);
1033
- }
1034
- else {
1035
- if(instance !== undefined) {
1036
- module.invoke('destroy');
1037
- }
1038
- module.initialize();
1039
- }
1040
- });
1041
-
1042
- return (returnedValue !== undefined)
1043
- ? returnedValue
1044
- : this
1045
- ;
1046
- };
1047
-
1048
- $.fn.sidebar.settings = {
1049
-
1050
- name : 'Sidebar',
1051
- namespace : 'sidebar',
1052
-
1053
- silent : false,
1054
- debug : false,
1055
- verbose : false,
1056
- performance : true,
1057
-
1058
- transition : 'auto',
1059
- mobileTransition : 'auto',
1060
-
1061
- defaultTransition : {
1062
- computer: {
1063
- left : 'uncover',
1064
- right : 'uncover',
1065
- top : 'overlay',
1066
- bottom : 'overlay'
1067
- },
1068
- mobile: {
1069
- left : 'uncover',
1070
- right : 'uncover',
1071
- top : 'overlay',
1072
- bottom : 'overlay'
1073
- }
1074
- },
1075
-
1076
- context : 'body',
1077
- exclusive : false,
1078
- closable : true,
1079
- dimPage : true,
1080
- scrollLock : false,
1081
- returnScroll : false,
1082
- delaySetup : false,
1083
-
1084
- onChange : function(){},
1085
- onShow : function(){},
1086
- onHide : function(){},
1087
-
1088
- onHidden : function(){},
1089
- onVisible : function(){},
1090
-
1091
- className : {
1092
- active : 'active',
1093
- animating : 'animating',
1094
- blurring : 'blurring',
1095
- closing : 'closing',
1096
- dimmed : 'dimmed',
1097
- ios : 'ios',
1098
- locked : 'locked',
1099
- pushable : 'pushable',
1100
- pushed : 'pushed',
1101
- right : 'right',
1102
- top : 'top',
1103
- left : 'left',
1104
- bottom : 'bottom',
1105
- visible : 'visible'
1106
- },
1107
-
1108
- selector: {
1109
- bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1110
- fixed : '.fixed',
1111
- omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
1112
- pusher : '.pusher',
1113
- sidebar : '.ui.sidebar'
1114
- },
1115
-
1116
- regExp: {
1117
- ios : /(iPad|iPhone|iPod)/g,
1118
- mobileChrome : /(CriOS)/g,
1119
- 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
1120
- },
1121
-
1122
- error : {
1123
- method : 'The method you called is not defined.',
1124
- pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
1125
- movedSidebar : 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
1126
- overlay : 'The overlay setting is no longer supported, use animation: overlay',
1127
- notFound : 'There were no elements that matched the specified selector'
1128
- }
1129
-
1130
- };
1131
-
1132
-
1133
- })( jQuery, window, document );
1094
+ };
1095
+ })(jQuery, window, document);