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