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