semantic-ui-sass 0.19.3.1 → 1.7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -0
- data/README.md +5 -6
- data/app/assets/fonts/semantic-ui/icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/icons.otf +0 -0
- data/app/assets/fonts/semantic-ui/icons.svg +472 -367
- data/app/assets/fonts/semantic-ui/icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/icons.woff +0 -0
- data/app/assets/images/semantic-ui/flags.png +0 -0
- data/app/assets/javascripts/semantic-ui.js +9 -5
- data/app/assets/javascripts/semantic-ui/accordion.js +169 -102
- data/app/assets/javascripts/semantic-ui/api.js +840 -0
- data/app/assets/javascripts/semantic-ui/checkbox.js +203 -46
- data/app/assets/javascripts/semantic-ui/{behavior/colorize.js → colorize.js} +4 -2
- data/app/assets/javascripts/semantic-ui/dimmer.js +110 -76
- data/app/assets/javascripts/semantic-ui/dropdown.js +897 -285
- data/app/assets/javascripts/semantic-ui/{behavior/form.js → form.js} +127 -42
- data/app/assets/javascripts/semantic-ui/modal.js +294 -219
- data/app/assets/javascripts/semantic-ui/nag.js +120 -186
- data/app/assets/javascripts/semantic-ui/popup.js +491 -223
- data/app/assets/javascripts/semantic-ui/progress.js +779 -0
- data/app/assets/javascripts/semantic-ui/rating.js +66 -22
- data/app/assets/javascripts/semantic-ui/search.js +219 -99
- data/app/assets/javascripts/semantic-ui/shape.js +72 -29
- data/app/assets/javascripts/semantic-ui/sidebar.js +678 -142
- data/app/assets/javascripts/semantic-ui/site.js +487 -0
- data/app/assets/javascripts/semantic-ui/{behavior/state.js → state.js} +116 -151
- data/app/assets/javascripts/semantic-ui/sticky.js +771 -0
- data/app/assets/javascripts/semantic-ui/tab.js +680 -603
- data/app/assets/javascripts/semantic-ui/transition.js +269 -158
- data/app/assets/javascripts/semantic-ui/video.js +113 -32
- data/app/assets/javascripts/semantic-ui/visibility.js +970 -0
- data/app/assets/javascripts/semantic-ui/visit.js +513 -0
- data/app/assets/stylesheets/semantic-ui.scss +2 -0
- data/app/assets/stylesheets/semantic-ui/collections/_breadcrumb.scss +58 -14
- data/app/assets/stylesheets/semantic-ui/collections/_form.scss +464 -372
- data/app/assets/stylesheets/semantic-ui/collections/_grid.scss +1385 -533
- data/app/assets/stylesheets/semantic-ui/collections/_menu.scss +482 -655
- data/app/assets/stylesheets/semantic-ui/collections/_message.scss +238 -139
- data/app/assets/stylesheets/semantic-ui/collections/_table.scss +631 -280
- data/app/assets/stylesheets/semantic-ui/elements/_all.scss +3 -2
- data/app/assets/stylesheets/semantic-ui/elements/_button.scss +1614 -657
- data/app/assets/stylesheets/semantic-ui/elements/_divider.scss +143 -80
- data/app/assets/stylesheets/semantic-ui/elements/_flag.scss +1018 -0
- data/app/assets/stylesheets/semantic-ui/elements/_header.scss +302 -145
- data/app/assets/stylesheets/semantic-ui/elements/_icon.scss +1653 -1365
- data/app/assets/stylesheets/semantic-ui/elements/_image.scss +160 -59
- data/app/assets/stylesheets/semantic-ui/elements/_input.scss +247 -118
- data/app/assets/stylesheets/semantic-ui/elements/_label.scss +501 -470
- data/app/assets/stylesheets/semantic-ui/elements/_list.scss +888 -0
- data/app/assets/stylesheets/semantic-ui/elements/_loader.scss +189 -98
- data/app/assets/stylesheets/semantic-ui/elements/_rail.scss +125 -0
- data/app/assets/stylesheets/semantic-ui/elements/_reveal.scss +147 -212
- data/app/assets/stylesheets/semantic-ui/elements/_segment.scss +328 -190
- data/app/assets/stylesheets/semantic-ui/elements/_step.scss +261 -185
- data/app/assets/stylesheets/semantic-ui/globals/_all.scss +2 -0
- data/app/assets/stylesheets/semantic-ui/globals/_reset.scss +430 -0
- data/app/assets/stylesheets/semantic-ui/globals/_site.scss +128 -0
- data/app/assets/stylesheets/semantic-ui/modules/_accordion.scss +190 -106
- data/app/assets/stylesheets/semantic-ui/modules/_all.scss +2 -1
- data/app/assets/stylesheets/semantic-ui/modules/_checkbox.scss +303 -201
- data/app/assets/stylesheets/semantic-ui/modules/_dimmer.scss +72 -63
- data/app/assets/stylesheets/semantic-ui/modules/_dropdown.scss +711 -331
- data/app/assets/stylesheets/semantic-ui/modules/_modal.scss +262 -140
- data/app/assets/stylesheets/semantic-ui/modules/_nag.scss +82 -71
- data/app/assets/stylesheets/semantic-ui/modules/_popup.scss +163 -119
- data/app/assets/stylesheets/semantic-ui/modules/_progress.scss +435 -0
- data/app/assets/stylesheets/semantic-ui/modules/_rating.scss +163 -68
- data/app/assets/stylesheets/semantic-ui/modules/_search.scss +223 -150
- data/app/assets/stylesheets/semantic-ui/modules/_shape.scss +39 -40
- data/app/assets/stylesheets/semantic-ui/modules/_sidebar.scss +413 -147
- data/app/assets/stylesheets/semantic-ui/modules/_sticky.scss +80 -0
- data/app/assets/stylesheets/semantic-ui/modules/_tab.scss +49 -20
- data/app/assets/stylesheets/semantic-ui/modules/_transition.scss +542 -568
- data/app/assets/stylesheets/semantic-ui/modules/_video.scss +69 -37
- data/app/assets/stylesheets/semantic-ui/views/_ad.scss +265 -0
- data/app/assets/stylesheets/semantic-ui/views/_all.scss +1 -1
- data/app/assets/stylesheets/semantic-ui/views/_card.scss +758 -0
- data/app/assets/stylesheets/semantic-ui/views/_comment.scss +133 -92
- data/app/assets/stylesheets/semantic-ui/views/_feed.scss +200 -87
- data/app/assets/stylesheets/semantic-ui/views/_item.scss +298 -523
- data/app/assets/stylesheets/semantic-ui/views/_statistic.scss +390 -12
- data/lib/semantic/ui/sass/version.rb +2 -2
- data/tasks/converter.rb +99 -216
- metadata +22 -27
- data/app/assets/fonts/semantic-ui/basic.icons.eot +0 -0
- data/app/assets/fonts/semantic-ui/basic.icons.svg +0 -450
- data/app/assets/fonts/semantic-ui/basic.icons.ttf +0 -0
- data/app/assets/fonts/semantic-ui/basic.icons.woff +0 -0
- data/app/assets/images/semantic-ui/loader-large-inverted.gif +0 -0
- data/app/assets/images/semantic-ui/loader-large.gif +0 -0
- data/app/assets/images/semantic-ui/loader-medium-inverted.gif +0 -0
- data/app/assets/images/semantic-ui/loader-medium.gif +0 -0
- data/app/assets/images/semantic-ui/loader-mini-inverted.gif +0 -0
- data/app/assets/images/semantic-ui/loader-mini.gif +0 -0
- data/app/assets/images/semantic-ui/loader-small-inverted.gif +0 -0
- data/app/assets/images/semantic-ui/loader-small.gif +0 -0
- data/app/assets/javascripts/semantic-ui/behavior/api.js +0 -634
- data/app/assets/javascripts/semantic-ui/chatroom.js +0 -772
- data/app/assets/stylesheets/semantic-ui/depends/_basic.icon.scss +0 -4
- data/app/assets/stylesheets/semantic-ui/depends/_icon.scss +0 -4
- data/app/assets/stylesheets/semantic-ui/depends/_loader.scss +0 -8
- data/app/assets/stylesheets/semantic-ui/elements/_basic.icon.scss +0 -1124
- data/app/assets/stylesheets/semantic-ui/elements/_progress.scss +0 -280
- data/app/assets/stylesheets/semantic-ui/modules/_chatroom.scss +0 -299
- data/app/assets/stylesheets/semantic-ui/modules/_reveal.scss +0 -322
- data/app/assets/stylesheets/semantic-ui/views/_list.scss +0 -700
@@ -1,9 +1,9 @@
|
|
1
1
|
/*
|
2
2
|
* # Semantic - Shape
|
3
|
-
* http://github.com/
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright 2014
|
6
|
+
* Copyright 2014 Contributor
|
7
7
|
* Released under the MIT license
|
8
8
|
* http://opensource.org/licenses/MIT
|
9
9
|
*
|
@@ -11,6 +11,8 @@
|
|
11
11
|
|
12
12
|
;(function ( $, window, document, undefined ) {
|
13
13
|
|
14
|
+
"use strict";
|
15
|
+
|
14
16
|
$.fn.shape = function(parameters) {
|
15
17
|
var
|
16
18
|
$allModules = $(this),
|
@@ -22,6 +24,13 @@ $.fn.shape = function(parameters) {
|
|
22
24
|
query = arguments[0],
|
23
25
|
methodInvoked = (typeof query == 'string'),
|
24
26
|
queryArguments = [].slice.call(arguments, 1),
|
27
|
+
|
28
|
+
requestAnimationFrame = window.requestAnimationFrame
|
29
|
+
|| window.mozRequestAnimationFrame
|
30
|
+
|| window.webkitRequestAnimationFrame
|
31
|
+
|| window.msRequestAnimationFrame
|
32
|
+
|| function(callback) { setTimeout(callback, 0); },
|
33
|
+
|
25
34
|
returnedValue
|
26
35
|
;
|
27
36
|
|
@@ -47,7 +56,7 @@ $.fn.shape = function(parameters) {
|
|
47
56
|
$side = $module.find(selector.side),
|
48
57
|
|
49
58
|
// private variables
|
50
|
-
|
59
|
+
nextIndex = false,
|
51
60
|
$activeSide,
|
52
61
|
$nextSide,
|
53
62
|
|
@@ -112,18 +121,19 @@ $.fn.shape = function(parameters) {
|
|
112
121
|
$module
|
113
122
|
.addClass(className.animating)
|
114
123
|
;
|
115
|
-
module.repaint();
|
116
|
-
$module
|
117
|
-
.addClass(className.animating)
|
118
|
-
;
|
119
|
-
$activeSide
|
120
|
-
.addClass(className.hidden)
|
121
|
-
;
|
122
124
|
$sides
|
123
125
|
.css(propertyObject)
|
124
126
|
.one(module.get.transitionEvent(), callback)
|
125
127
|
;
|
126
128
|
module.set.duration(settings.duration);
|
129
|
+
requestAnimationFrame(function() {
|
130
|
+
$module
|
131
|
+
.addClass(className.animating)
|
132
|
+
;
|
133
|
+
$activeSide
|
134
|
+
.addClass(className.hidden)
|
135
|
+
;
|
136
|
+
});
|
127
137
|
}
|
128
138
|
else {
|
129
139
|
callback();
|
@@ -167,6 +177,9 @@ $.fn.shape = function(parameters) {
|
|
167
177
|
},
|
168
178
|
|
169
179
|
is: {
|
180
|
+
complete: function() {
|
181
|
+
return ($side.filter('.' + className.active)[0] == $nextSide[0]);
|
182
|
+
},
|
170
183
|
animating: function() {
|
171
184
|
return $module.hasClass(className.animating);
|
172
185
|
}
|
@@ -180,7 +193,7 @@ $.fn.shape = function(parameters) {
|
|
180
193
|
? $activeSide.next(selector.side)
|
181
194
|
: $module.find(selector.side).first()
|
182
195
|
;
|
183
|
-
|
196
|
+
nextIndex = false;
|
184
197
|
module.verbose('Active side set to', $activeSide);
|
185
198
|
module.verbose('Next side set to', $nextSide);
|
186
199
|
},
|
@@ -207,8 +220,8 @@ $.fn.shape = function(parameters) {
|
|
207
220
|
var
|
208
221
|
$clone = $module.clone().addClass(className.loading),
|
209
222
|
$activeSide = $clone.find('.' + settings.className.active),
|
210
|
-
$nextSide = (
|
211
|
-
? $clone.find(
|
223
|
+
$nextSide = (nextIndex)
|
224
|
+
? $clone.find(selector.side).eq(nextIndex)
|
212
225
|
: ( $activeSide.next(selector.side).size() > 0 )
|
213
226
|
? $activeSide.next(selector.side)
|
214
227
|
: $clone.find(selector.side).first(),
|
@@ -216,7 +229,7 @@ $.fn.shape = function(parameters) {
|
|
216
229
|
;
|
217
230
|
$activeSide.removeClass(className.active);
|
218
231
|
$nextSide.addClass(className.active);
|
219
|
-
$clone.
|
232
|
+
$clone.insertAfter($module);
|
220
233
|
newSize = {
|
221
234
|
width : $nextSide.outerWidth(),
|
222
235
|
height : $nextSide.outerHeight()
|
@@ -229,9 +242,11 @@ $.fn.shape = function(parameters) {
|
|
229
242
|
},
|
230
243
|
|
231
244
|
nextSide: function(selector) {
|
232
|
-
|
233
|
-
$nextSide = $
|
245
|
+
nextIndex = selector;
|
246
|
+
$nextSide = $side.filter(selector);
|
247
|
+
nextIndex = $side.index($nextSide);
|
234
248
|
if($nextSide.size() === 0) {
|
249
|
+
module.set.defaultSide();
|
235
250
|
module.error(error.side);
|
236
251
|
}
|
237
252
|
module.verbose('Next side manually set to', $nextSide);
|
@@ -253,8 +268,12 @@ $.fn.shape = function(parameters) {
|
|
253
268
|
flip: {
|
254
269
|
|
255
270
|
up: function() {
|
256
|
-
module.
|
257
|
-
|
271
|
+
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
272
|
+
module.debug('Side already visible', $nextSide);
|
273
|
+
return;
|
274
|
+
}
|
275
|
+
if( !module.is.animating()) {
|
276
|
+
module.debug('Flipping up', $nextSide);
|
258
277
|
module.set.stageSize();
|
259
278
|
module.stage.above();
|
260
279
|
module.animate( module.get.transform.up() );
|
@@ -265,8 +284,12 @@ $.fn.shape = function(parameters) {
|
|
265
284
|
},
|
266
285
|
|
267
286
|
down: function() {
|
268
|
-
module.
|
269
|
-
|
287
|
+
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
288
|
+
module.debug('Side already visible', $nextSide);
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
if( !module.is.animating()) {
|
292
|
+
module.debug('Flipping down', $nextSide);
|
270
293
|
module.set.stageSize();
|
271
294
|
module.stage.below();
|
272
295
|
module.animate( module.get.transform.down() );
|
@@ -277,8 +300,12 @@ $.fn.shape = function(parameters) {
|
|
277
300
|
},
|
278
301
|
|
279
302
|
left: function() {
|
280
|
-
module.
|
281
|
-
|
303
|
+
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
304
|
+
module.debug('Side already visible', $nextSide);
|
305
|
+
return;
|
306
|
+
}
|
307
|
+
if( !module.is.animating()) {
|
308
|
+
module.debug('Flipping left', $nextSide);
|
282
309
|
module.set.stageSize();
|
283
310
|
module.stage.left();
|
284
311
|
module.animate(module.get.transform.left() );
|
@@ -289,8 +316,12 @@ $.fn.shape = function(parameters) {
|
|
289
316
|
},
|
290
317
|
|
291
318
|
right: function() {
|
292
|
-
module.
|
293
|
-
|
319
|
+
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
320
|
+
module.debug('Side already visible', $nextSide);
|
321
|
+
return;
|
322
|
+
}
|
323
|
+
if( !module.is.animating()) {
|
324
|
+
module.debug('Flipping right', $nextSide);
|
294
325
|
module.set.stageSize();
|
295
326
|
module.stage.right();
|
296
327
|
module.animate(module.get.transform.right() );
|
@@ -301,8 +332,12 @@ $.fn.shape = function(parameters) {
|
|
301
332
|
},
|
302
333
|
|
303
334
|
over: function() {
|
304
|
-
module.
|
305
|
-
|
335
|
+
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
336
|
+
module.debug('Side already visible', $nextSide);
|
337
|
+
return;
|
338
|
+
}
|
339
|
+
if( !module.is.animating()) {
|
340
|
+
module.debug('Flipping over', $nextSide);
|
306
341
|
module.set.stageSize();
|
307
342
|
module.stage.behind();
|
308
343
|
module.animate(module.get.transform.over() );
|
@@ -313,8 +348,12 @@ $.fn.shape = function(parameters) {
|
|
313
348
|
},
|
314
349
|
|
315
350
|
back: function() {
|
316
|
-
module.
|
317
|
-
|
351
|
+
if(module.is.complete() && !module.is.animating() && !settings.allowRepeats) {
|
352
|
+
module.debug('Side already visible', $nextSide);
|
353
|
+
return;
|
354
|
+
}
|
355
|
+
if( !module.is.animating()) {
|
356
|
+
module.debug('Flipping back', $nextSide);
|
318
357
|
module.set.stageSize();
|
319
358
|
module.stage.behind();
|
320
359
|
module.animate(module.get.transform.back() );
|
@@ -560,6 +599,7 @@ $.fn.shape = function(parameters) {
|
|
560
599
|
}
|
561
600
|
},
|
562
601
|
setting: function(name, value) {
|
602
|
+
module.debug('Changing setting', name, value);
|
563
603
|
if( $.isPlainObject(name) ) {
|
564
604
|
$.extend(true, settings, name);
|
565
605
|
}
|
@@ -620,9 +660,9 @@ $.fn.shape = function(parameters) {
|
|
620
660
|
executionTime = currentTime - previousTime;
|
621
661
|
time = currentTime;
|
622
662
|
performance.push({
|
623
|
-
'Element' : element,
|
624
663
|
'Name' : message[0],
|
625
664
|
'Arguments' : [].slice.call(message, 1) || '',
|
665
|
+
'Element' : element,
|
626
666
|
'Execution Time' : executionTime
|
627
667
|
});
|
628
668
|
}
|
@@ -758,6 +798,9 @@ $.fn.shape.settings = {
|
|
758
798
|
beforeChange : function() {},
|
759
799
|
onChange : function() {},
|
760
800
|
|
801
|
+
// allow animation to same side
|
802
|
+
allowRepeats: false,
|
803
|
+
|
761
804
|
// animation duration
|
762
805
|
duration : 700,
|
763
806
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
/*
|
2
2
|
* # Semantic - Sidebar
|
3
|
-
* http://github.com/
|
3
|
+
* http://github.com/semantic-org/semantic-ui/
|
4
4
|
*
|
5
5
|
*
|
6
|
-
* Copyright 2014
|
6
|
+
* Copyright 2014 Contributor
|
7
7
|
* Released under the MIT license
|
8
8
|
* http://opensource.org/licenses/MIT
|
9
9
|
*
|
@@ -11,10 +11,14 @@
|
|
11
11
|
|
12
12
|
;(function ( $, window, document, undefined ) {
|
13
13
|
|
14
|
+
"use strict";
|
15
|
+
|
14
16
|
$.fn.sidebar = function(parameters) {
|
15
17
|
var
|
16
18
|
$allModules = $(this),
|
17
|
-
$
|
19
|
+
$window = $(window),
|
20
|
+
$document = $(document),
|
21
|
+
$html = $('html'),
|
18
22
|
$head = $('head'),
|
19
23
|
|
20
24
|
moduleSelector = $allModules.selector || '',
|
@@ -25,6 +29,13 @@ $.fn.sidebar = function(parameters) {
|
|
25
29
|
query = arguments[0],
|
26
30
|
methodInvoked = (typeof query == 'string'),
|
27
31
|
queryArguments = [].slice.call(arguments, 1),
|
32
|
+
|
33
|
+
requestAnimationFrame = window.requestAnimationFrame
|
34
|
+
|| window.mozRequestAnimationFrame
|
35
|
+
|| window.webkitRequestAnimationFrame
|
36
|
+
|| window.msRequestAnimationFrame
|
37
|
+
|| function(callback) { setTimeout(callback, 0); },
|
38
|
+
|
28
39
|
returnedValue
|
29
40
|
;
|
30
41
|
|
@@ -38,23 +49,52 @@ $.fn.sidebar = function(parameters) {
|
|
38
49
|
selector = settings.selector,
|
39
50
|
className = settings.className,
|
40
51
|
namespace = settings.namespace,
|
52
|
+
regExp = settings.regExp,
|
41
53
|
error = settings.error,
|
42
54
|
|
43
55
|
eventNamespace = '.' + namespace,
|
44
56
|
moduleNamespace = 'module-' + namespace,
|
45
57
|
|
46
58
|
$module = $(this),
|
47
|
-
$
|
59
|
+
$context = $(settings.context),
|
60
|
+
|
61
|
+
$sidebars = $module.children(selector.sidebar),
|
62
|
+
$pusher = $context.children(selector.pusher),
|
63
|
+
$style,
|
48
64
|
|
49
65
|
element = this,
|
50
66
|
instance = $module.data(moduleNamespace),
|
67
|
+
|
68
|
+
elementNamespace,
|
69
|
+
id,
|
70
|
+
currentScroll,
|
71
|
+
transitionEvent,
|
72
|
+
|
51
73
|
module
|
52
74
|
;
|
53
75
|
|
54
76
|
module = {
|
55
77
|
|
56
78
|
initialize: function() {
|
57
|
-
module.debug('Initializing sidebar',
|
79
|
+
module.debug('Initializing sidebar', parameters);
|
80
|
+
|
81
|
+
module.create.id();
|
82
|
+
|
83
|
+
transitionEvent = module.get.transitionEvent();
|
84
|
+
|
85
|
+
// cache on initialize
|
86
|
+
if( module.is.legacy() || settings.legacy) {
|
87
|
+
settings.transition = 'overlay';
|
88
|
+
settings.useLegacy = true;
|
89
|
+
}
|
90
|
+
|
91
|
+
if(module.is.ios()) {
|
92
|
+
module.set.ios();
|
93
|
+
}
|
94
|
+
|
95
|
+
// avoids locking rendering if initialized in onReady
|
96
|
+
requestAnimationFrame(module.setup.layout);
|
97
|
+
|
58
98
|
module.instantiate();
|
59
99
|
},
|
60
100
|
|
@@ -66,17 +106,208 @@ $.fn.sidebar = function(parameters) {
|
|
66
106
|
;
|
67
107
|
},
|
68
108
|
|
109
|
+
create: {
|
110
|
+
id: function() {
|
111
|
+
module.verbose('Creating unique id for element');
|
112
|
+
id = module.get.uniqueID();
|
113
|
+
elementNamespace = '.' + id;
|
114
|
+
}
|
115
|
+
},
|
116
|
+
|
69
117
|
destroy: function() {
|
70
118
|
module.verbose('Destroying previous module for', $module);
|
119
|
+
module.remove.direction();
|
71
120
|
$module
|
72
121
|
.off(eventNamespace)
|
73
122
|
.removeData(moduleNamespace)
|
74
123
|
;
|
124
|
+
// bound by uuid
|
125
|
+
$context.off(elementNamespace);
|
126
|
+
$window.off(elementNamespace);
|
127
|
+
$document.off(elementNamespace);
|
128
|
+
},
|
129
|
+
|
130
|
+
event: {
|
131
|
+
clickaway: function(event) {
|
132
|
+
if( $(event.target).closest(selector.sidebar).size() === 0 ) {
|
133
|
+
module.verbose('User clicked on dimmed page');
|
134
|
+
module.hide();
|
135
|
+
}
|
136
|
+
},
|
137
|
+
touch: function(event) {
|
138
|
+
//event.stopPropagation();
|
139
|
+
},
|
140
|
+
containScroll: function(event) {
|
141
|
+
if(element.scrollTop <= 0) {
|
142
|
+
element.scrollTop = 1;
|
143
|
+
}
|
144
|
+
if((element.scrollTop + element.offsetHeight) >= element.scrollHeight) {
|
145
|
+
element.scrollTop = element.scrollHeight - element.offsetHeight - 1;
|
146
|
+
}
|
147
|
+
},
|
148
|
+
scroll: function(event) {
|
149
|
+
if( $(event.target).closest(selector.sidebar).size() === 0 ) {
|
150
|
+
event.preventDefault();
|
151
|
+
}
|
152
|
+
}
|
153
|
+
},
|
154
|
+
|
155
|
+
bind: {
|
156
|
+
clickaway: function() {
|
157
|
+
module.verbose('Adding clickaway events to context', $context);
|
158
|
+
if(settings.closable) {
|
159
|
+
$context
|
160
|
+
.on('click' + elementNamespace, module.event.clickaway)
|
161
|
+
.on('touchend' + elementNamespace, module.event.clickaway)
|
162
|
+
;
|
163
|
+
}
|
164
|
+
},
|
165
|
+
scrollLock: function() {
|
166
|
+
if(settings.scrollLock) {
|
167
|
+
module.debug('Disabling page scroll');
|
168
|
+
$window
|
169
|
+
.on('DOMMouseScroll' + elementNamespace, module.event.scroll)
|
170
|
+
;
|
171
|
+
}
|
172
|
+
module.verbose('Adding events to contain sidebar scroll');
|
173
|
+
$document
|
174
|
+
.on('touchmove' + elementNamespace, module.event.touch)
|
175
|
+
;
|
176
|
+
$module
|
177
|
+
.on('scroll' + eventNamespace, module.event.containScroll)
|
178
|
+
;
|
179
|
+
}
|
180
|
+
},
|
181
|
+
unbind: {
|
182
|
+
clickaway: function() {
|
183
|
+
module.verbose('Removing clickaway events from context', $context);
|
184
|
+
$context.off(elementNamespace);
|
185
|
+
},
|
186
|
+
scrollLock: function() {
|
187
|
+
module.verbose('Removing scroll lock from page');
|
188
|
+
$document.off(elementNamespace);
|
189
|
+
$window.off(elementNamespace);
|
190
|
+
$module.off('scroll' + eventNamespace);
|
191
|
+
}
|
192
|
+
},
|
193
|
+
|
194
|
+
add: {
|
195
|
+
bodyCSS: function(direction, distance) {
|
196
|
+
var
|
197
|
+
width = $module.outerWidth(),
|
198
|
+
height = $module.outerHeight(),
|
199
|
+
style
|
200
|
+
;
|
201
|
+
style = ''
|
202
|
+
+ '<style title="' + namespace + '">'
|
203
|
+
+ ' .ui.visible.left.sidebar ~ .fixed,'
|
204
|
+
+ ' .ui.visible.left.sidebar ~ .pusher {'
|
205
|
+
+ ' -webkit-transform: translate3d('+ width + 'px, 0, 0);'
|
206
|
+
+ ' transform: translate3d('+ width + 'px, 0, 0);'
|
207
|
+
+ ' }'
|
208
|
+
+ ' .ui.visible.right.sidebar ~ .fixed,'
|
209
|
+
+ ' .ui.visible.right.sidebar ~ .pusher {'
|
210
|
+
+ ' -webkit-transform: translate3d(-'+ width + 'px, 0, 0);'
|
211
|
+
+ ' transform: translate3d(-'+ width + 'px, 0, 0);'
|
212
|
+
+ ' }'
|
213
|
+
+ ' .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .fixed,'
|
214
|
+
+ ' .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher,'
|
215
|
+
+ ' .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .fixed,'
|
216
|
+
+ ' .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher {'
|
217
|
+
+ ' -webkit-transform: translate3d(0px, 0, 0);'
|
218
|
+
+ ' transform: translate3d(0px, 0, 0);'
|
219
|
+
+ ' }'
|
220
|
+
+ ' .ui.visible.top.sidebar ~ .fixed,'
|
221
|
+
+ ' .ui.visible.top.sidebar ~ .pusher {'
|
222
|
+
+ ' -webkit-transform: translate3d(0, ' + height + 'px, 0);'
|
223
|
+
+ ' transform: translate3d(0, ' + height + 'px, 0);'
|
224
|
+
+ ' }'
|
225
|
+
+ ' .ui.visible.bottom.sidebar ~ .fixed,'
|
226
|
+
+ ' .ui.visible.bottom.sidebar ~ .pusher {'
|
227
|
+
+ ' -webkit-transform: translate3d(0, -' + height + 'px, 0);'
|
228
|
+
+ ' transform: translate3d(0, -' + height + 'px, 0);'
|
229
|
+
+ ' }'
|
230
|
+
;
|
231
|
+
|
232
|
+
/* IE is only browser not to create context with transforms */
|
233
|
+
/* https://www.w3.org/Bugs/Public/show_bug.cgi?id=16328 */
|
234
|
+
if( module.is.ie() ) {
|
235
|
+
style += ''
|
236
|
+
+ ' .ui.visible.left.sidebar ~ .pusher:after {'
|
237
|
+
+ ' -webkit-transform: translate3d('+ width + 'px, 0, 0);'
|
238
|
+
+ ' transform: translate3d('+ width + 'px, 0, 0);'
|
239
|
+
+ ' }'
|
240
|
+
+ ' .ui.visible.right.sidebar ~ .pusher:after {'
|
241
|
+
+ ' -webkit-transform: translate3d(-'+ width + 'px, 0, 0);'
|
242
|
+
+ ' transform: translate3d(-'+ width + 'px, 0, 0);'
|
243
|
+
+ ' }'
|
244
|
+
+ ' .ui.visible.left.sidebar ~ .ui.visible.right.sidebar ~ .pusher:after,'
|
245
|
+
+ ' .ui.visible.right.sidebar ~ .ui.visible.left.sidebar ~ .pusher:after {'
|
246
|
+
+ ' -webkit-transform: translate3d(0px, 0, 0);'
|
247
|
+
+ ' transform: translate3d(0px, 0, 0);'
|
248
|
+
+ ' }'
|
249
|
+
+ ' .ui.visible.top.sidebar ~ .pusher:after {'
|
250
|
+
+ ' -webkit-transform: translate3d(0, ' + height + 'px, 0);'
|
251
|
+
+ ' transform: translate3d(0, ' + height + 'px, 0);'
|
252
|
+
+ ' }'
|
253
|
+
+ ' .ui.visible.bottom.sidebar ~ .pusher:after {'
|
254
|
+
+ ' -webkit-transform: translate3d(0, -' + height + 'px, 0);'
|
255
|
+
+ ' transform: translate3d(0, -' + height + 'px, 0);'
|
256
|
+
+ ' }'
|
257
|
+
;
|
258
|
+
}
|
259
|
+
|
260
|
+
style += '</style>';
|
261
|
+
|
262
|
+
$head.append(style);
|
263
|
+
$style = $('style[title=' + namespace + ']');
|
264
|
+
module.debug('Adding sizing css to head', $style);
|
265
|
+
}
|
75
266
|
},
|
76
267
|
|
77
268
|
refresh: function() {
|
78
269
|
module.verbose('Refreshing selector cache');
|
79
|
-
$
|
270
|
+
$context = $(settings.context);
|
271
|
+
$sidebars = $context.children(selector.sidebar);
|
272
|
+
$pusher = $context.children(selector.pusher);
|
273
|
+
},
|
274
|
+
|
275
|
+
refreshSidebars: function() {
|
276
|
+
module.verbose('Refreshing other sidebars');
|
277
|
+
$sidebars = $context.children(selector.sidebar);
|
278
|
+
},
|
279
|
+
|
280
|
+
repaint: function() {
|
281
|
+
module.verbose('Forcing repaint event');
|
282
|
+
element.style.display='none';
|
283
|
+
element.offsetHeight;
|
284
|
+
element.scrollTop = element.scrollTop;
|
285
|
+
element.style.display='';
|
286
|
+
},
|
287
|
+
|
288
|
+
setup: {
|
289
|
+
layout: function() {
|
290
|
+
if( $context.children(selector.pusher).size() === 0 ) {
|
291
|
+
module.debug('Adding wrapper element for sidebar');
|
292
|
+
module.error(error.pusher);
|
293
|
+
$pusher = $('<div class="pusher" />');
|
294
|
+
$context
|
295
|
+
.children()
|
296
|
+
.not(selector.omitted)
|
297
|
+
.not($sidebars)
|
298
|
+
.wrapAll($pusher)
|
299
|
+
;
|
300
|
+
module.refresh();
|
301
|
+
}
|
302
|
+
if($module.nextAll(selector.pusher).size() === 0 || $module.nextAll(selector.pusher)[0] !== $pusher[0]) {
|
303
|
+
module.debug('Moved sidebar to correct parent element');
|
304
|
+
module.error(error.movedSidebar, element);
|
305
|
+
$module.detach().prependTo($context);
|
306
|
+
module.refresh();
|
307
|
+
}
|
308
|
+
module.set.pushable();
|
309
|
+
module.set.direction();
|
310
|
+
}
|
80
311
|
},
|
81
312
|
|
82
313
|
attachEvents: function(selector, event) {
|
@@ -90,32 +321,43 @@ $.fn.sidebar = function(parameters) {
|
|
90
321
|
if($toggle.size() > 0) {
|
91
322
|
module.debug('Attaching sidebar events to element', selector, event);
|
92
323
|
$toggle
|
93
|
-
.off(eventNamespace)
|
94
324
|
.on('click' + eventNamespace, event)
|
95
325
|
;
|
96
326
|
}
|
97
327
|
else {
|
98
|
-
module.error(error.notFound);
|
328
|
+
module.error(error.notFound, selector);
|
99
329
|
}
|
100
330
|
},
|
101
331
|
|
102
332
|
show: function(callback) {
|
333
|
+
var
|
334
|
+
animateMethod = (settings.useLegacy)
|
335
|
+
? module.legacyPushPage
|
336
|
+
: module.pushPage
|
337
|
+
;
|
103
338
|
callback = $.isFunction(callback)
|
104
339
|
? callback
|
105
340
|
: function(){}
|
106
341
|
;
|
107
|
-
module.
|
108
|
-
|
109
|
-
if(
|
342
|
+
if(module.is.hidden()) {
|
343
|
+
module.refreshSidebars();
|
344
|
+
if(settings.overlay) {
|
345
|
+
module.error(error.overlay);
|
346
|
+
settings.transition = 'overlay';
|
347
|
+
}
|
348
|
+
module.refresh();
|
349
|
+
if(module.othersVisible() && module.get.transition() != 'overlay') {
|
350
|
+
module.debug('Other sidebars currently open');
|
110
351
|
if(settings.exclusive) {
|
111
|
-
module.
|
352
|
+
module.hideOthers();
|
112
353
|
}
|
113
|
-
module.pushPage();
|
114
354
|
}
|
115
|
-
|
116
|
-
|
355
|
+
animateMethod(function() {
|
356
|
+
$.proxy(callback, element)();
|
357
|
+
$.proxy(settings.onShow, element)();
|
358
|
+
});
|
117
359
|
$.proxy(settings.onChange, element)();
|
118
|
-
$.proxy(settings.
|
360
|
+
$.proxy(settings.onVisible, element)();
|
119
361
|
}
|
120
362
|
else {
|
121
363
|
module.debug('Sidebar is already visible');
|
@@ -123,32 +365,51 @@ $.fn.sidebar = function(parameters) {
|
|
123
365
|
},
|
124
366
|
|
125
367
|
hide: function(callback) {
|
368
|
+
var
|
369
|
+
animateMethod = (settings.useLegacy)
|
370
|
+
? module.legacyPullPage
|
371
|
+
: module.pullPage
|
372
|
+
;
|
126
373
|
callback = $.isFunction(callback)
|
127
374
|
? callback
|
128
375
|
: function(){}
|
129
376
|
;
|
130
|
-
module.
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
callback();
|
377
|
+
if(module.is.visible() || module.is.animating()) {
|
378
|
+
module.debug('Hiding sidebar', callback);
|
379
|
+
module.refreshSidebars();
|
380
|
+
animateMethod(function() {
|
381
|
+
$.proxy(callback, element)();
|
382
|
+
$.proxy(settings.onHidden, element)();
|
383
|
+
});
|
138
384
|
$.proxy(settings.onChange, element)();
|
139
385
|
$.proxy(settings.onHide, element)();
|
140
386
|
}
|
141
387
|
},
|
142
388
|
|
143
|
-
|
144
|
-
$(
|
145
|
-
|
146
|
-
|
389
|
+
othersVisible: function() {
|
390
|
+
return ($sidebars.not($module).filter('.' + className.visible).size() > 0);
|
391
|
+
},
|
392
|
+
|
393
|
+
hideOthers: function(callback) {
|
394
|
+
var
|
395
|
+
$otherSidebars = $sidebars.not($module).filter('.' + className.visible),
|
396
|
+
callback = callback || function(){},
|
397
|
+
sidebarCount = $otherSidebars.size(),
|
398
|
+
callbackCount = 0
|
399
|
+
;
|
400
|
+
$otherSidebars
|
401
|
+
.sidebar('hide', function() {
|
402
|
+
callbackCount++;
|
403
|
+
if(callbackCount == sidebarCount) {
|
404
|
+
callback();
|
405
|
+
}
|
406
|
+
})
|
147
407
|
;
|
148
408
|
},
|
149
409
|
|
150
410
|
toggle: function() {
|
151
|
-
|
411
|
+
module.verbose('Determining toggled direction');
|
412
|
+
if(module.is.hidden()) {
|
152
413
|
module.show();
|
153
414
|
}
|
154
415
|
else {
|
@@ -156,97 +417,235 @@ $.fn.sidebar = function(parameters) {
|
|
156
417
|
}
|
157
418
|
},
|
158
419
|
|
159
|
-
pushPage: function() {
|
420
|
+
pushPage: function(callback) {
|
160
421
|
var
|
161
|
-
|
162
|
-
|
163
|
-
? $
|
164
|
-
:
|
422
|
+
transition = module.get.transition(),
|
423
|
+
$transition = (transition == 'safe')
|
424
|
+
? $context
|
425
|
+
: (transition == 'overlay' || module.othersVisible())
|
426
|
+
? $module
|
427
|
+
: $pusher,
|
428
|
+
animate,
|
429
|
+
transitionEnd
|
165
430
|
;
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
module.animatePage(direction, distance, module.set.pushed);
|
431
|
+
callback = $.isFunction(callback)
|
432
|
+
? callback
|
433
|
+
: function(){}
|
434
|
+
;
|
435
|
+
if(settings.transition == 'scale down') {
|
436
|
+
module.scrollToTop();
|
173
437
|
}
|
438
|
+
module.set.transition();
|
439
|
+
module.repaint();
|
440
|
+
animate = function() {
|
441
|
+
module.bind.clickaway();
|
442
|
+
module.add.bodyCSS();
|
443
|
+
module.set.animating();
|
444
|
+
module.set.visible();
|
445
|
+
if(!module.othersVisible()) {
|
446
|
+
if(settings.dimPage) {
|
447
|
+
$pusher.addClass(className.dimmed);
|
448
|
+
}
|
449
|
+
}
|
450
|
+
};
|
451
|
+
transitionEnd = function(event) {
|
452
|
+
if( event.target == $transition[0] ) {
|
453
|
+
$transition.off(transitionEvent + elementNamespace, transitionEnd);
|
454
|
+
module.remove.animating();
|
455
|
+
module.bind.scrollLock();
|
456
|
+
$.proxy(callback, element)();
|
457
|
+
}
|
458
|
+
};
|
459
|
+
$transition.off(transitionEvent + elementNamespace);
|
460
|
+
$transition.on(transitionEvent + elementNamespace, transitionEnd);
|
461
|
+
requestAnimationFrame(animate);
|
174
462
|
},
|
175
463
|
|
176
|
-
pullPage: function() {
|
464
|
+
pullPage: function(callback) {
|
177
465
|
var
|
178
|
-
|
466
|
+
transition = module.get.transition(),
|
467
|
+
$transition = (transition == 'safe')
|
468
|
+
? $context
|
469
|
+
: (transition == 'overlay' || module.othersVisible())
|
470
|
+
? $module
|
471
|
+
: $pusher,
|
472
|
+
animate,
|
473
|
+
transitionEnd
|
179
474
|
;
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
475
|
+
callback = $.isFunction(callback)
|
476
|
+
? callback
|
477
|
+
: function(){}
|
478
|
+
;
|
479
|
+
module.verbose('Removing context push state', module.get.direction());
|
480
|
+
|
481
|
+
module.unbind.clickaway();
|
482
|
+
module.unbind.scrollLock();
|
483
|
+
|
484
|
+
animate = function() {
|
485
|
+
module.set.animating();
|
486
|
+
module.remove.visible();
|
487
|
+
if(settings.dimPage && !module.othersVisible()) {
|
488
|
+
$pusher.removeClass(className.dimmed);
|
489
|
+
}
|
490
|
+
};
|
491
|
+
transitionEnd = function(event) {
|
492
|
+
if( event.target == $transition[0] ) {
|
493
|
+
$transition.off(transitionEvent + elementNamespace, transitionEnd);
|
494
|
+
module.remove.animating();
|
495
|
+
module.remove.transition();
|
496
|
+
module.remove.bodyCSS();
|
497
|
+
if(transition == 'scale down' || (settings.returnScroll && module.is.mobile()) ) {
|
498
|
+
module.scrollBack();
|
499
|
+
}
|
500
|
+
$.proxy(callback, element)();
|
501
|
+
}
|
502
|
+
};
|
503
|
+
$transition.off(transitionEvent + elementNamespace);
|
504
|
+
$transition.on(transitionEvent + elementNamespace, transitionEnd);
|
505
|
+
requestAnimationFrame(animate);
|
189
506
|
},
|
190
507
|
|
191
|
-
|
508
|
+
legacyPushPage: function(callback) {
|
192
509
|
var
|
193
|
-
|
510
|
+
distance = $module.width(),
|
511
|
+
direction = module.get.direction(),
|
512
|
+
properties = {}
|
194
513
|
;
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
514
|
+
distance = distance || $module.width();
|
515
|
+
callback = $.isFunction(callback)
|
516
|
+
? callback
|
517
|
+
: function(){}
|
518
|
+
;
|
519
|
+
properties[direction] = distance;
|
520
|
+
module.debug('Using javascript to push context', properties);
|
521
|
+
module.set.visible();
|
522
|
+
module.set.transition();
|
523
|
+
module.set.animating();
|
524
|
+
if(settings.dimPage) {
|
525
|
+
$pusher.addClass(className.dimmed);
|
526
|
+
}
|
527
|
+
$context
|
528
|
+
.css('position', 'relative')
|
529
|
+
.animate(properties, settings.duration, settings.easing, function() {
|
530
|
+
module.remove.animating();
|
531
|
+
module.bind.clickaway();
|
532
|
+
$.proxy(callback, module)();
|
533
|
+
})
|
199
534
|
;
|
200
535
|
},
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
536
|
+
legacyPullPage: function(callback) {
|
537
|
+
var
|
538
|
+
distance = 0,
|
539
|
+
direction = module.get.direction(),
|
540
|
+
properties = {}
|
541
|
+
;
|
542
|
+
distance = distance || $module.width();
|
543
|
+
callback = $.isFunction(callback)
|
544
|
+
? callback
|
545
|
+
: function(){}
|
546
|
+
;
|
547
|
+
properties[direction] = '0px';
|
548
|
+
module.debug('Using javascript to pull context', properties);
|
549
|
+
module.unbind.clickaway();
|
550
|
+
module.set.animating();
|
551
|
+
module.remove.visible();
|
552
|
+
if(settings.dimPage && !module.othersVisible()) {
|
553
|
+
$pusher.removeClass(className.dimmed);
|
218
554
|
}
|
555
|
+
$context
|
556
|
+
.css('position', 'relative')
|
557
|
+
.animate(properties, settings.duration, settings.easing, function() {
|
558
|
+
module.remove.animating();
|
559
|
+
$.proxy(callback, module)();
|
560
|
+
})
|
561
|
+
;
|
219
562
|
},
|
220
563
|
|
564
|
+
scrollToTop: function() {
|
565
|
+
module.verbose('Scrolling to top of page to avoid animation issues');
|
566
|
+
currentScroll = $(window).scrollTop();
|
567
|
+
$module.scrollTop(0);
|
568
|
+
window.scrollTo(0, 0);
|
569
|
+
},
|
221
570
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
571
|
+
scrollBack: function() {
|
572
|
+
module.verbose('Scrolling back to original page position');
|
573
|
+
window.scrollTo(0, currentScroll);
|
574
|
+
},
|
575
|
+
|
576
|
+
set: {
|
577
|
+
// html
|
578
|
+
ios: function() {
|
579
|
+
$html.addClass(className.ios);
|
580
|
+
},
|
581
|
+
|
582
|
+
// container
|
583
|
+
pushed: function() {
|
584
|
+
$context.addClass(className.pushed);
|
227
585
|
},
|
586
|
+
pushable: function() {
|
587
|
+
$context.addClass(className.pushable);
|
588
|
+
},
|
589
|
+
|
590
|
+
// sidebar
|
228
591
|
active: function() {
|
229
|
-
$module.
|
592
|
+
$module.addClass(className.active);
|
230
593
|
},
|
231
|
-
|
232
|
-
module.
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
;
|
594
|
+
animating: function() {
|
595
|
+
$module.addClass(className.animating);
|
596
|
+
},
|
597
|
+
transition: function(transition) {
|
598
|
+
transition = transition || module.get.transition();
|
599
|
+
$module.addClass(transition);
|
600
|
+
},
|
601
|
+
direction: function(direction) {
|
602
|
+
direction = direction || module.get.direction();
|
603
|
+
$module.addClass(className[direction]);
|
604
|
+
},
|
605
|
+
visible: function() {
|
606
|
+
$module.addClass(className.visible);
|
607
|
+
},
|
608
|
+
overlay: function() {
|
609
|
+
$module.addClass(className.overlay);
|
237
610
|
}
|
238
611
|
},
|
612
|
+
remove: {
|
239
613
|
|
240
|
-
|
241
|
-
|
242
|
-
$
|
614
|
+
bodyCSS: function() {
|
615
|
+
module.debug('Removing body css styles', $style);
|
616
|
+
if($style.size() > 0) {
|
617
|
+
$style.remove();
|
618
|
+
}
|
243
619
|
},
|
620
|
+
|
621
|
+
// context
|
244
622
|
pushed: function() {
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
623
|
+
$context.removeClass(className.pushed);
|
624
|
+
},
|
625
|
+
pushable: function() {
|
626
|
+
$context.removeClass(className.pushable);
|
627
|
+
},
|
628
|
+
|
629
|
+
// sidebar
|
630
|
+
active: function() {
|
631
|
+
$module.removeClass(className.active);
|
632
|
+
},
|
633
|
+
animating: function() {
|
634
|
+
$module.removeClass(className.animating);
|
635
|
+
},
|
636
|
+
transition: function(transition) {
|
637
|
+
transition = transition || module.get.transition();
|
638
|
+
$module.removeClass(transition);
|
639
|
+
},
|
640
|
+
direction: function(direction) {
|
641
|
+
direction = direction || module.get.direction();
|
642
|
+
$module.removeClass(className[direction]);
|
643
|
+
},
|
644
|
+
visible: function() {
|
645
|
+
$module.removeClass(className.visible);
|
646
|
+
},
|
647
|
+
overlay: function() {
|
648
|
+
$module.removeClass(className.overlay);
|
250
649
|
}
|
251
650
|
},
|
252
651
|
|
@@ -261,9 +660,21 @@ $.fn.sidebar = function(parameters) {
|
|
261
660
|
else if($module.hasClass(className.bottom)) {
|
262
661
|
return className.bottom;
|
263
662
|
}
|
264
|
-
|
265
|
-
|
266
|
-
|
663
|
+
return className.left;
|
664
|
+
},
|
665
|
+
transition: function() {
|
666
|
+
var
|
667
|
+
direction = module.get.direction(),
|
668
|
+
transition
|
669
|
+
;
|
670
|
+
return ( module.is.mobile() )
|
671
|
+
? (settings.mobileTransition == 'auto')
|
672
|
+
? settings.defaultTransition.mobile[direction]
|
673
|
+
: settings.mobileTransition
|
674
|
+
: (settings.transition == 'auto')
|
675
|
+
? settings.defaultTransition.computer[direction]
|
676
|
+
: settings.transition
|
677
|
+
;
|
267
678
|
},
|
268
679
|
transitionEvent: function() {
|
269
680
|
var
|
@@ -281,22 +692,96 @@ $.fn.sidebar = function(parameters) {
|
|
281
692
|
return transitions[transition];
|
282
693
|
}
|
283
694
|
}
|
695
|
+
},
|
696
|
+
uniqueID: function() {
|
697
|
+
return (Math.random().toString(16) + '000000000').substr(2,8);
|
284
698
|
}
|
285
699
|
},
|
286
700
|
|
287
701
|
is: {
|
702
|
+
|
703
|
+
ie: function() {
|
704
|
+
var
|
705
|
+
isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
|
706
|
+
isIE = ('ActiveXObject' in window)
|
707
|
+
;
|
708
|
+
return (isIE11 || isIE);
|
709
|
+
},
|
710
|
+
|
711
|
+
legacy: function() {
|
712
|
+
var
|
713
|
+
element = document.createElement('div'),
|
714
|
+
transforms = {
|
715
|
+
'webkitTransform' :'-webkit-transform',
|
716
|
+
'OTransform' :'-o-transform',
|
717
|
+
'msTransform' :'-ms-transform',
|
718
|
+
'MozTransform' :'-moz-transform',
|
719
|
+
'transform' :'transform'
|
720
|
+
},
|
721
|
+
has3D
|
722
|
+
;
|
723
|
+
|
724
|
+
// Add it to the body to get the computed style.
|
725
|
+
document.body.insertBefore(element, null);
|
726
|
+
for (var transform in transforms) {
|
727
|
+
if (element.style[transform] !== undefined) {
|
728
|
+
element.style[transform] = "translate3d(1px,1px,1px)";
|
729
|
+
has3D = window.getComputedStyle(element).getPropertyValue(transforms[transform]);
|
730
|
+
}
|
731
|
+
}
|
732
|
+
document.body.removeChild(element);
|
733
|
+
return !(has3D !== undefined && has3D.length > 0 && has3D !== 'none');
|
734
|
+
},
|
735
|
+
ios: function() {
|
736
|
+
var
|
737
|
+
userAgent = navigator.userAgent,
|
738
|
+
isIOS = regExp.ios.test(userAgent)
|
739
|
+
;
|
740
|
+
if(isIOS) {
|
741
|
+
module.verbose('Browser was found to be iOS', userAgent);
|
742
|
+
return true;
|
743
|
+
}
|
744
|
+
else {
|
745
|
+
return false;
|
746
|
+
}
|
747
|
+
},
|
748
|
+
mobile: function() {
|
749
|
+
var
|
750
|
+
userAgent = navigator.userAgent,
|
751
|
+
isMobile = regExp.mobile.test(userAgent)
|
752
|
+
;
|
753
|
+
if(isMobile) {
|
754
|
+
module.verbose('Browser was found to be mobile', userAgent);
|
755
|
+
return true;
|
756
|
+
}
|
757
|
+
else {
|
758
|
+
module.verbose('Browser is not mobile, using regular transition', userAgent);
|
759
|
+
return false;
|
760
|
+
}
|
761
|
+
},
|
762
|
+
hidden: function() {
|
763
|
+
return !module.is.visible();
|
764
|
+
},
|
765
|
+
visible: function() {
|
766
|
+
return $module.hasClass(className.visible);
|
767
|
+
},
|
768
|
+
// alias
|
288
769
|
open: function() {
|
289
|
-
return
|
770
|
+
return module.is.visible();
|
290
771
|
},
|
291
772
|
closed: function() {
|
292
|
-
return
|
773
|
+
return module.is.hidden();
|
293
774
|
},
|
294
775
|
vertical: function() {
|
295
776
|
return $module.hasClass(className.top);
|
777
|
+
},
|
778
|
+
animating: function() {
|
779
|
+
return $context.hasClass(className.animating);
|
296
780
|
}
|
297
781
|
},
|
298
782
|
|
299
783
|
setting: function(name, value) {
|
784
|
+
module.debug('Changing setting', name, value);
|
300
785
|
if( $.isPlainObject(name) ) {
|
301
786
|
$.extend(true, settings, name);
|
302
787
|
}
|
@@ -357,9 +842,9 @@ $.fn.sidebar = function(parameters) {
|
|
357
842
|
executionTime = currentTime - previousTime;
|
358
843
|
time = currentTime;
|
359
844
|
performance.push({
|
360
|
-
'Element' : element,
|
361
845
|
'Name' : message[0],
|
362
846
|
'Arguments' : [].slice.call(message, 1) || '',
|
847
|
+
'Element' : element,
|
363
848
|
'Execution Time' : executionTime
|
364
849
|
});
|
365
850
|
}
|
@@ -380,9 +865,6 @@ $.fn.sidebar = function(parameters) {
|
|
380
865
|
if(moduleSelector) {
|
381
866
|
title += ' \'' + moduleSelector + '\'';
|
382
867
|
}
|
383
|
-
if($allModules.size() > 1) {
|
384
|
-
title += ' ' + '(' + $allModules.size() + ')';
|
385
|
-
}
|
386
868
|
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
|
387
869
|
console.groupCollapsed(title);
|
388
870
|
if(console.table) {
|
@@ -430,6 +912,7 @@ $.fn.sidebar = function(parameters) {
|
|
430
912
|
return false;
|
431
913
|
}
|
432
914
|
else {
|
915
|
+
module.error(error.method, query);
|
433
916
|
return false;
|
434
917
|
}
|
435
918
|
});
|
@@ -451,21 +934,22 @@ $.fn.sidebar = function(parameters) {
|
|
451
934
|
}
|
452
935
|
return found;
|
453
936
|
}
|
454
|
-
};
|
455
|
-
if(methodInvoked) {
|
456
|
-
if(instance === undefined) {
|
457
|
-
module.initialize();
|
458
|
-
}
|
459
|
-
module.invoke(query);
|
460
937
|
}
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
938
|
+
;
|
939
|
+
|
940
|
+
if(methodInvoked) {
|
941
|
+
if(instance === undefined) {
|
465
942
|
module.initialize();
|
466
943
|
}
|
467
|
-
|
468
|
-
|
944
|
+
module.invoke(query);
|
945
|
+
}
|
946
|
+
else {
|
947
|
+
if(instance !== undefined) {
|
948
|
+
module.invoke('destroy');
|
949
|
+
}
|
950
|
+
module.initialize();
|
951
|
+
}
|
952
|
+
});
|
469
953
|
|
470
954
|
return (returnedValue !== undefined)
|
471
955
|
? returnedValue
|
@@ -475,40 +959,92 @@ $.fn.sidebar = function(parameters) {
|
|
475
959
|
|
476
960
|
$.fn.sidebar.settings = {
|
477
961
|
|
478
|
-
name
|
479
|
-
namespace
|
480
|
-
|
481
|
-
debug
|
482
|
-
verbose
|
483
|
-
performance
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
962
|
+
name : 'Sidebar',
|
963
|
+
namespace : 'sidebar',
|
964
|
+
|
965
|
+
debug : false,
|
966
|
+
verbose : true,
|
967
|
+
performance : true,
|
968
|
+
|
969
|
+
transition : 'auto',
|
970
|
+
mobileTransition : 'auto',
|
971
|
+
|
972
|
+
defaultTransition : {
|
973
|
+
computer: {
|
974
|
+
left : 'uncover',
|
975
|
+
right : 'uncover',
|
976
|
+
top : 'overlay',
|
977
|
+
bottom : 'overlay'
|
978
|
+
},
|
979
|
+
mobile: {
|
980
|
+
left : 'uncover',
|
981
|
+
right : 'uncover',
|
982
|
+
top : 'overlay',
|
983
|
+
bottom : 'overlay'
|
984
|
+
}
|
985
|
+
},
|
986
|
+
|
987
|
+
context : 'body',
|
988
|
+
exclusive : false,
|
989
|
+
closable : true,
|
990
|
+
dimPage : true,
|
991
|
+
scrollLock : false,
|
992
|
+
returnScroll : false,
|
993
|
+
|
994
|
+
useLegacy : false,
|
995
|
+
duration : 500,
|
996
|
+
easing : 'easeInOutQuint',
|
997
|
+
|
998
|
+
onChange : function(){},
|
999
|
+
onShow : function(){},
|
1000
|
+
onHide : function(){},
|
1001
|
+
|
1002
|
+
onHidden : function(){},
|
1003
|
+
onVisible : function(){},
|
1004
|
+
|
1005
|
+
className : {
|
1006
|
+
active : 'active',
|
1007
|
+
animating : 'animating',
|
1008
|
+
dimmed : 'dimmed',
|
1009
|
+
ios : 'ios',
|
1010
|
+
pushable : 'pushable',
|
1011
|
+
pushed : 'pushed',
|
1012
|
+
right : 'right',
|
1013
|
+
top : 'top',
|
1014
|
+
left : 'left',
|
1015
|
+
bottom : 'bottom',
|
1016
|
+
visible : 'visible'
|
501
1017
|
},
|
502
1018
|
|
503
1019
|
selector: {
|
504
|
-
|
1020
|
+
fixed : '.fixed',
|
1021
|
+
omitted : 'script, link, style, .ui.modal, .ui.dimmer, .ui.nag, .ui.fixed',
|
1022
|
+
pusher : '.pusher',
|
1023
|
+
sidebar : '.ui.sidebar'
|
1024
|
+
},
|
1025
|
+
|
1026
|
+
regExp: {
|
1027
|
+
ios : /(iPad|iPhone|iPod)/g,
|
1028
|
+
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
|
505
1029
|
},
|
506
1030
|
|
507
1031
|
error : {
|
508
|
-
method
|
509
|
-
|
1032
|
+
method : 'The method you called is not defined.',
|
1033
|
+
pusher : 'Had to add pusher element. For optimal performance make sure body content is inside a pusher element',
|
1034
|
+
movedSidebar : 'Had to move sidebar. For optimal performance make sure sidebar and pusher are direct children of your body tag',
|
1035
|
+
overlay : 'The overlay setting is no longer supported, use animation: overlay',
|
1036
|
+
notFound : 'There were no elements that matched the specified selector'
|
510
1037
|
}
|
511
1038
|
|
512
1039
|
};
|
513
1040
|
|
1041
|
+
// Adds easing
|
1042
|
+
$.extend( $.easing, {
|
1043
|
+
easeInOutQuint: function (x, t, b, c, d) {
|
1044
|
+
if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
|
1045
|
+
return c/2*((t-=2)*t*t*t*t + 2) + b;
|
1046
|
+
}
|
1047
|
+
});
|
1048
|
+
|
1049
|
+
|
514
1050
|
})( jQuery, window , document );
|