fomantic-ui-sass 2.9.0 → 2.9.2

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