@ntlab/ntjs-assets 2.0.2 → 2.0.4

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