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.
Files changed (339) hide show
  1. package/.eslintrc.js +110 -0
  2. package/.github/workflows/ci.yml +14 -4
  3. package/.stylelintrc.js +46 -0
  4. package/dist/components/accordion.css +19 -26
  5. package/dist/components/accordion.js +568 -595
  6. package/dist/components/accordion.min.css +1 -1
  7. package/dist/components/accordion.min.js +2 -2
  8. package/dist/components/ad.css +31 -41
  9. package/dist/components/ad.min.css +1 -1
  10. package/dist/components/api.js +1161 -1179
  11. package/dist/components/api.min.js +2 -2
  12. package/dist/components/breadcrumb.css +1 -1
  13. package/dist/components/breadcrumb.min.css +1 -1
  14. package/dist/components/button.css +71 -106
  15. package/dist/components/button.min.css +1 -1
  16. package/dist/components/calendar.css +18 -16
  17. package/dist/components/calendar.js +1895 -1809
  18. package/dist/components/calendar.min.css +2 -2
  19. package/dist/components/calendar.min.js +2 -2
  20. package/dist/components/card.css +83 -115
  21. package/dist/components/card.min.css +1 -1
  22. package/dist/components/checkbox.css +47 -64
  23. package/dist/components/checkbox.js +842 -841
  24. package/dist/components/checkbox.min.css +1 -1
  25. package/dist/components/checkbox.min.js +2 -2
  26. package/dist/components/comment.css +37 -51
  27. package/dist/components/comment.min.css +1 -1
  28. package/dist/components/container.css +6 -5
  29. package/dist/components/container.min.css +2 -2
  30. package/dist/components/dimmer.css +31 -41
  31. package/dist/components/dimmer.js +708 -737
  32. package/dist/components/dimmer.min.css +1 -1
  33. package/dist/components/dimmer.min.js +2 -2
  34. package/dist/components/divider.css +32 -44
  35. package/dist/components/divider.min.css +1 -1
  36. package/dist/components/dropdown.css +129 -166
  37. package/dist/components/dropdown.js +4161 -4234
  38. package/dist/components/dropdown.min.css +2 -2
  39. package/dist/components/dropdown.min.js +2 -2
  40. package/dist/components/embed.css +13 -19
  41. package/dist/components/embed.js +651 -675
  42. package/dist/components/embed.min.css +1 -1
  43. package/dist/components/embed.min.js +2 -2
  44. package/dist/components/emoji.css +7 -6
  45. package/dist/components/feed.css +24 -32
  46. package/dist/components/feed.min.css +1 -1
  47. package/dist/components/flag.css +5 -3
  48. package/dist/components/flag.min.css +1 -1
  49. package/dist/components/flyout.css +44 -58
  50. package/dist/components/flyout.js +1464 -1465
  51. package/dist/components/flyout.min.css +2 -2
  52. package/dist/components/flyout.min.js +2 -2
  53. package/dist/components/form.css +85 -111
  54. package/dist/components/form.js +1979 -2004
  55. package/dist/components/form.min.css +1 -1
  56. package/dist/components/form.min.js +2 -2
  57. package/dist/components/grid.css +70 -96
  58. package/dist/components/grid.min.css +1 -1
  59. package/dist/components/header.css +47 -65
  60. package/dist/components/header.min.css +1 -1
  61. package/dist/components/icon.css +45 -66
  62. package/dist/components/icon.min.css +2 -2
  63. package/dist/components/image.css +32 -42
  64. package/dist/components/image.min.css +1 -1
  65. package/dist/components/input.css +182 -65
  66. package/dist/components/input.min.css +2 -2
  67. package/dist/components/item.css +55 -77
  68. package/dist/components/item.min.css +1 -1
  69. package/dist/components/label.css +68 -91
  70. package/dist/components/label.min.css +2 -2
  71. package/dist/components/list.css +44 -59
  72. package/dist/components/list.min.css +1 -1
  73. package/dist/components/loader.css +16 -22
  74. package/dist/components/loader.min.css +1 -1
  75. package/dist/components/menu.css +126 -186
  76. package/dist/components/message.css +25 -35
  77. package/dist/components/message.min.css +1 -1
  78. package/dist/components/modal.css +39 -40
  79. package/dist/components/modal.js +1491 -1485
  80. package/dist/components/modal.min.css +2 -2
  81. package/dist/components/modal.min.js +2 -2
  82. package/dist/components/nag.css +21 -28
  83. package/dist/components/nag.js +518 -526
  84. package/dist/components/nag.min.css +2 -2
  85. package/dist/components/nag.min.js +2 -2
  86. package/dist/components/placeholder.css +10 -12
  87. package/dist/components/placeholder.min.css +1 -1
  88. package/dist/components/popup.css +352 -59
  89. package/dist/components/popup.js +1437 -1456
  90. package/dist/components/popup.min.css +2 -2
  91. package/dist/components/popup.min.js +2 -2
  92. package/dist/components/progress.css +29 -39
  93. package/dist/components/progress.js +969 -997
  94. package/dist/components/progress.min.css +1 -1
  95. package/dist/components/progress.min.js +2 -2
  96. package/dist/components/rail.css +15 -20
  97. package/dist/components/rail.min.css +1 -1
  98. package/dist/components/rating.css +9 -13
  99. package/dist/components/rating.js +505 -523
  100. package/dist/components/rating.min.css +1 -1
  101. package/dist/components/rating.min.js +2 -2
  102. package/dist/components/reset.css +1 -1
  103. package/dist/components/reset.min.css +1 -1
  104. package/dist/components/reveal.css +19 -26
  105. package/dist/components/reveal.min.css +1 -1
  106. package/dist/components/search.css +43 -58
  107. package/dist/components/search.js +1498 -1534
  108. package/dist/components/search.min.css +2 -2
  109. package/dist/components/search.min.js +2 -2
  110. package/dist/components/segment.css +64 -83
  111. package/dist/components/segment.min.css +2 -2
  112. package/dist/components/shape.css +10 -14
  113. package/dist/components/shape.js +792 -809
  114. package/dist/components/shape.min.css +1 -1
  115. package/dist/components/shape.min.js +2 -2
  116. package/dist/components/sidebar.css +43 -58
  117. package/dist/components/sidebar.js +1071 -1098
  118. package/dist/components/sidebar.min.css +2 -2
  119. package/dist/components/sidebar.min.js +2 -2
  120. package/dist/components/site.css +5 -5
  121. package/dist/components/site.js +462 -476
  122. package/dist/components/site.min.css +1 -1
  123. package/dist/components/site.min.js +2 -2
  124. package/dist/components/slider.css +27 -37
  125. package/dist/components/slider.js +1287 -1306
  126. package/dist/components/slider.min.js +2 -2
  127. package/dist/components/state.js +639 -657
  128. package/dist/components/state.min.js +2 -2
  129. package/dist/components/statistic.css +32 -41
  130. package/dist/components/statistic.min.css +2 -2
  131. package/dist/components/step.css +26 -35
  132. package/dist/components/step.min.css +1 -1
  133. package/dist/components/sticky.css +1 -1
  134. package/dist/components/sticky.js +857 -902
  135. package/dist/components/sticky.min.css +1 -1
  136. package/dist/components/sticky.min.js +2 -2
  137. package/dist/components/tab.css +6 -8
  138. package/dist/components/tab.js +922 -963
  139. package/dist/components/tab.min.css +1 -1
  140. package/dist/components/tab.min.js +2 -2
  141. package/dist/components/table.css +93 -119
  142. package/dist/components/table.min.css +2 -2
  143. package/dist/components/text.css +1 -1
  144. package/dist/components/text.min.css +1 -1
  145. package/dist/components/toast.css +4 -6
  146. package/dist/components/toast.js +886 -887
  147. package/dist/components/toast.min.css +1 -1
  148. package/dist/components/toast.min.js +2 -2
  149. package/dist/components/transition.css +150 -3
  150. package/dist/components/transition.js +1041 -1077
  151. package/dist/components/transition.min.css +2 -2
  152. package/dist/components/transition.min.js +2 -2
  153. package/dist/components/visibility.js +1220 -1244
  154. package/dist/components/visibility.min.js +2 -2
  155. package/dist/semantic.css +2529 -1778
  156. package/dist/semantic.js +28928 -29383
  157. package/dist/semantic.min.css +2 -2
  158. package/dist/semantic.min.js +2 -2
  159. package/dist/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  160. package/dist/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  161. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  162. package/dist/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  163. package/dist/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  164. package/dist/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  165. package/dist/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  166. package/dist/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  167. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  168. package/dist/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  169. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  170. package/dist/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  171. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  172. package/dist/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  173. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  174. package/dist/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  175. package/examples/assets/show-examples.js +13 -13
  176. package/gulpfile.js +9 -10
  177. package/package.json +13 -8
  178. package/scripts/nightly-version.js +81 -75
  179. package/src/definitions/behaviors/api.js +1162 -1180
  180. package/src/definitions/behaviors/form.js +1978 -2003
  181. package/src/definitions/behaviors/state.js +645 -663
  182. package/src/definitions/behaviors/visibility.js +1219 -1243
  183. package/src/definitions/collections/breadcrumb.less +41 -44
  184. package/src/definitions/collections/form.less +869 -879
  185. package/src/definitions/collections/grid.less +1690 -1695
  186. package/src/definitions/collections/menu.less +1493 -1503
  187. package/src/definitions/collections/message.less +292 -295
  188. package/src/definitions/collections/table.less +1616 -1620
  189. package/src/definitions/elements/button.less +1721 -1743
  190. package/src/definitions/elements/container.less +209 -209
  191. package/src/definitions/elements/divider.less +205 -206
  192. package/src/definitions/elements/emoji.less +38 -44
  193. package/src/definitions/elements/flag.less +44 -46
  194. package/src/definitions/elements/header.less +337 -345
  195. package/src/definitions/elements/icon.less +516 -443
  196. package/src/definitions/elements/image.less +221 -225
  197. package/src/definitions/elements/input.less +663 -659
  198. package/src/definitions/elements/label.less +803 -793
  199. package/src/definitions/elements/list.less +809 -809
  200. package/src/definitions/elements/loader.less +272 -266
  201. package/src/definitions/elements/placeholder.less +171 -168
  202. package/src/definitions/elements/rail.less +91 -91
  203. package/src/definitions/elements/reveal.less +192 -196
  204. package/src/definitions/elements/segment.less +743 -746
  205. package/src/definitions/elements/step.less +425 -433
  206. package/src/definitions/elements/text.less +32 -34
  207. package/src/definitions/globals/reset.less +9 -6
  208. package/src/definitions/globals/site.js +461 -475
  209. package/src/definitions/globals/site.less +106 -108
  210. package/src/definitions/modules/accordion.js +567 -594
  211. package/src/definitions/modules/accordion.less +242 -246
  212. package/src/definitions/modules/calendar.js +1894 -1808
  213. package/src/definitions/modules/calendar.less +98 -95
  214. package/src/definitions/modules/checkbox.js +841 -840
  215. package/src/definitions/modules/checkbox.less +536 -542
  216. package/src/definitions/modules/dimmer.js +707 -736
  217. package/src/definitions/modules/dimmer.less +300 -297
  218. package/src/definitions/modules/dropdown.js +4160 -4233
  219. package/src/definitions/modules/dropdown.less +1577 -1589
  220. package/src/definitions/modules/embed.js +650 -674
  221. package/src/definitions/modules/embed.less +81 -82
  222. package/src/definitions/modules/flyout.js +1463 -1464
  223. package/src/definitions/modules/flyout.less +445 -451
  224. package/src/definitions/modules/modal.js +1490 -1484
  225. package/src/definitions/modules/modal.less +459 -459
  226. package/src/definitions/modules/nag.js +517 -525
  227. package/src/definitions/modules/nag.less +134 -138
  228. package/src/definitions/modules/popup.js +1436 -1455
  229. package/src/definitions/modules/popup.less +742 -687
  230. package/src/definitions/modules/progress.js +968 -996
  231. package/src/definitions/modules/progress.less +521 -494
  232. package/src/definitions/modules/rating.js +504 -522
  233. package/src/definitions/modules/rating.less +94 -101
  234. package/src/definitions/modules/search.js +1497 -1533
  235. package/src/definitions/modules/search.less +375 -382
  236. package/src/definitions/modules/shape.js +791 -808
  237. package/src/definitions/modules/shape.less +71 -76
  238. package/src/definitions/modules/sidebar.js +1070 -1097
  239. package/src/definitions/modules/sidebar.less +463 -472
  240. package/src/definitions/modules/slider.js +1286 -1305
  241. package/src/definitions/modules/slider.less +307 -308
  242. package/src/definitions/modules/sticky.js +873 -918
  243. package/src/definitions/modules/sticky.less +21 -23
  244. package/src/definitions/modules/tab.js +921 -962
  245. package/src/definitions/modules/tab.less +51 -52
  246. package/src/definitions/modules/toast.js +885 -886
  247. package/src/definitions/modules/toast.less +584 -586
  248. package/src/definitions/modules/transition.js +1040 -1076
  249. package/src/definitions/modules/transition.less +62 -28
  250. package/src/definitions/views/ad.less +206 -206
  251. package/src/definitions/views/card.less +968 -970
  252. package/src/definitions/views/comment.less +190 -198
  253. package/src/definitions/views/feed.less +220 -224
  254. package/src/definitions/views/item.less +436 -446
  255. package/src/definitions/views/statistic.less +271 -277
  256. package/src/theme.less +29 -32
  257. package/src/themes/default/assets/fonts/Lato-Bold.woff +0 -0
  258. package/src/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
  259. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
  260. package/src/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
  261. package/src/themes/default/assets/fonts/Lato-Italic.woff +0 -0
  262. package/src/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
  263. package/src/themes/default/assets/fonts/Lato-Regular.woff +0 -0
  264. package/src/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
  265. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
  266. package/src/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
  267. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
  268. package/src/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
  269. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
  270. package/src/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
  271. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
  272. package/src/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
  273. package/src/themes/default/elements/container.variables +0 -7
  274. package/src/themes/default/elements/icon.variables +18 -0
  275. package/src/themes/default/elements/segment.variables +0 -7
  276. package/src/themes/default/globals/colors.less +589 -589
  277. package/src/themes/default/globals/site.variables +8 -0
  278. package/src/themes/default/globals/variation.variables +13 -1
  279. package/src/themes/default/modules/calendar.variables +2 -0
  280. package/src/themes/default/modules/nag.variables +1 -1
  281. package/src/themes/default/modules/popup.variables +2 -0
  282. package/src/themes/default/modules/transition.variables +8 -1
  283. package/tasks/admin/components/create.js +274 -276
  284. package/tasks/admin/components/init.js +123 -130
  285. package/tasks/admin/components/update.js +149 -157
  286. package/tasks/admin/distributions/create.js +184 -187
  287. package/tasks/admin/distributions/init.js +123 -130
  288. package/tasks/admin/distributions/update.js +145 -152
  289. package/tasks/admin/publish.js +5 -7
  290. package/tasks/admin/register.js +36 -38
  291. package/tasks/admin/release.js +8 -10
  292. package/tasks/build/assets.js +42 -39
  293. package/tasks/build/css.js +225 -216
  294. package/tasks/build/javascript.js +118 -113
  295. package/tasks/build.js +10 -10
  296. package/tasks/check-install.js +14 -16
  297. package/tasks/clean.js +5 -5
  298. package/tasks/collections/admin.js +34 -36
  299. package/tasks/collections/build.js +18 -20
  300. package/tasks/collections/docs.js +9 -11
  301. package/tasks/collections/install.js +9 -11
  302. package/tasks/collections/rtl.js +9 -11
  303. package/tasks/collections/various.js +8 -10
  304. package/tasks/config/admin/github.js +17 -17
  305. package/tasks/config/admin/oauth.example.js +4 -4
  306. package/tasks/config/admin/release.js +98 -98
  307. package/tasks/config/admin/templates/component-package.js +9 -10
  308. package/tasks/config/admin/templates/css-package.js +18 -20
  309. package/tasks/config/admin/templates/less-package.js +11 -13
  310. package/tasks/config/defaults.js +116 -114
  311. package/tasks/config/docs.js +23 -23
  312. package/tasks/config/npm/gulpfile.js +8 -9
  313. package/tasks/config/project/config.js +127 -134
  314. package/tasks/config/project/install.js +715 -713
  315. package/tasks/config/project/release.js +32 -38
  316. package/tasks/config/tasks.js +165 -156
  317. package/tasks/config/user.js +23 -26
  318. package/tasks/docs/build.js +97 -95
  319. package/tasks/docs/metadata.js +90 -96
  320. package/tasks/docs/serve.js +80 -81
  321. package/tasks/install.js +370 -378
  322. package/tasks/rtl/build.js +2 -2
  323. package/tasks/rtl/watch.js +2 -2
  324. package/tasks/version.js +4 -4
  325. package/tasks/watch.js +28 -30
  326. package/test/meteor/assets.js +10 -13
  327. package/test/meteor/fonts.js +12 -13
  328. package/test/modules/accordion.spec.js +6 -8
  329. package/test/modules/checkbox.spec.js +5 -7
  330. package/test/modules/dropdown.spec.js +5 -7
  331. package/test/modules/modal.spec.js +6 -8
  332. package/test/modules/module.spec.js +158 -178
  333. package/test/modules/popup.spec.js +5 -7
  334. package/test/modules/search.spec.js +5 -7
  335. package/test/modules/shape.spec.js +5 -7
  336. package/test/modules/sidebar.spec.js +5 -7
  337. package/test/modules/tab.spec.js +6 -8
  338. package/test/modules/transition.spec.js +5 -7
  339. package/test/modules/video.spec.js +5 -7
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * # Fomantic-UI 2.9.1-beta.2+f5a64f3 - Modal
2
+ * # Fomantic-UI 2.9.1-beta.20+d4987bf - Modal
3
3
  * https://github.com/fomantic/Fomantic-UI/
4
4
  *
5
5
  *
@@ -8,1549 +8,1555 @@
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
12
-
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
- $.modal = $.fn.modal = function(parameters) {
27
- var
28
- $allModules = $(this),
29
- $window = $(window),
30
- $document = $(document),
31
- $body = $('body'),
32
-
33
- moduleSelector = $allModules.selector || '',
34
-
35
- time = new Date().getTime(),
36
- performance = [],
37
-
38
- query = arguments[0],
39
- methodInvoked = (typeof query == 'string'),
40
- queryArguments = [].slice.call(arguments, 1),
41
-
42
- requestAnimationFrame = window.requestAnimationFrame
43
- || window.mozRequestAnimationFrame
44
- || window.webkitRequestAnimationFrame
45
- || window.msRequestAnimationFrame
46
- || function(callback) { setTimeout(callback, 0); },
47
-
48
- returnedValue
49
- ;
50
-
51
- $allModules
52
- .each(function() {
53
- var
54
- settings = ( $.isPlainObject(parameters) )
55
- ? $.extend(true, {}, $.fn.modal.settings, parameters)
56
- : $.extend({}, $.fn.modal.settings),
57
-
58
- selector = settings.selector,
59
- className = settings.className,
60
- namespace = settings.namespace,
61
- fields = settings.fields,
62
- error = settings.error,
63
-
64
- eventNamespace = '.' + namespace,
65
- moduleNamespace = 'module-' + namespace,
66
-
67
- $module = $(this),
68
- $context = [window,document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
69
- isBody = $context[0] === $body[0],
70
- $closeIcon = $module.find(selector.closeIcon),
71
- $inputs,
72
-
73
- $allModals,
74
- $otherModals,
75
- $focusedElement,
76
- $dimmable,
77
- $dimmer,
78
-
79
- isModalComponent = $module.hasClass('modal'),
80
-
81
- element = this,
82
- instance = isModalComponent ? $module.data(moduleNamespace) : undefined,
83
-
84
- ignoreRepeatedEvents = false,
85
-
86
- initialMouseDownInModal,
87
- initialMouseDownInScrollbar,
88
- initialBodyMargin = '',
89
- tempBodyMargin = '',
90
- keepScrollingClass = false,
91
- hadScrollbar = false,
92
-
93
- elementEventNamespace,
94
- id,
95
- observer,
96
- module
97
- ;
98
- module = {
99
-
100
- initialize: function() {
101
- module.create.id();
102
- if(!isModalComponent) {
103
- module.create.modal();
104
- if(!$.isFunction(settings.onHidden)) {
105
- settings.onHidden = function () {
106
- module.destroy();
107
- $module.remove();
108
- };
109
- }
110
- }
111
- $module.addClass(settings.class);
112
- if (settings.title !== '') {
113
- $module.find(selector.title).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
114
- }
115
- if (settings.content !== '') {
116
- $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
117
- }
118
- if(module.has.configActions()){
119
- var $actions = $module.find(selector.actions).addClass(settings.classActions);
120
- if ($actions.length === 0) {
121
- $actions = $('<div/>', {class: className.actions + ' ' + (settings.classActions || '')}).appendTo($module);
122
- } else {
123
- $actions.empty();
124
- }
125
- settings.actions.forEach(function (el) {
126
- var icon = el[fields.icon] ? '<i '+(el[fields.text] ? 'aria-hidden="true"' : '')+' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
127
- text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
128
- cls = module.helpers.deQuote(el[fields.class] || ''),
129
- click = el[fields.click] && $.isFunction(el[fields.click]) ? el[fields.click] : function () {};
130
- $actions.append($('<button/>', {
131
- html: icon + text,
132
- 'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g,''),
133
- class: className.button + ' ' + cls,
134
- click: function () {
135
- var button = $(this);
136
- if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
137
- return;
138
- }
139
- module.hide();
140
- }
141
- }));
142
- });
143
- }
144
- module.cache = {};
145
- module.verbose('Initializing dimmer', $context);
146
-
147
- module.create.dimmer();
148
-
149
- if ( settings.allowMultiple ) {
150
- module.create.innerDimmer();
151
- }
152
- if (!settings.centered){
153
- $module.addClass('top aligned');
154
- }
155
- module.refreshModals();
156
- module.bind.events();
157
- module.observeChanges();
158
- module.instantiate();
159
- if(settings.autoShow){
160
- module.show();
161
- }
162
- },
11
+ (function ($, window, document, undefined) {
12
+ 'use strict';
163
13
 
164
- instantiate: function() {
165
- module.verbose('Storing instance of modal');
166
- instance = module;
167
- $module
168
- .data(moduleNamespace, instance)
169
- ;
170
- },
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
171
17
 
172
- create: {
173
- modal: function() {
174
- $module = $('<div/>', {class: className.modal, role: 'dialog', 'aria-modal': true});
175
- if (settings.closeIcon) {
176
- $closeIcon = $('<i/>', {class: className.close, role: 'button', tabindex: 0, 'aria-label': settings.text.close})
177
- $module.append($closeIcon);
178
- }
179
- if (settings.title !== '') {
180
- var titleId = '_' + module.get.id() + 'title';
181
- $module.attr('aria-labelledby', titleId);
182
- $('<div/>', {class: className.title, id: titleId}).appendTo($module);
183
- }
184
- if (settings.content !== '') {
185
- var descId = '_' + module.get.id() + 'desc';
186
- $module.attr('aria-describedby', descId);
187
- $('<div/>', {class: className.content, id: descId}).appendTo($module);
188
- }
189
- if (module.has.configActions()) {
190
- $('<div/>', {class: className.actions}).appendTo($module);
191
- }
192
- $context.append($module);
193
- element = $module[0];
194
- },
195
- dimmer: function() {
18
+ window = (typeof window != 'undefined' && window.Math == Math)
19
+ ? window
20
+ : globalThis;
21
+
22
+ $.modal = $.fn.modal = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ $window = $(window),
26
+ $document = $(document),
27
+ $body = $('body'),
28
+
29
+ moduleSelector = $allModules.selector || '',
30
+
31
+ time = new Date().getTime(),
32
+ performance = [],
33
+
34
+ query = arguments[0],
35
+ methodInvoked = (typeof query == 'string'),
36
+ queryArguments = [].slice.call(arguments, 1),
37
+
38
+ requestAnimationFrame = window.requestAnimationFrame
39
+ || window.mozRequestAnimationFrame
40
+ || window.webkitRequestAnimationFrame
41
+ || window.msRequestAnimationFrame
42
+ || function (callback) {
43
+ setTimeout(callback, 0);
44
+ },
45
+
46
+ returnedValue
47
+ ;
48
+
49
+ $allModules.each(function () {
196
50
  var
197
- defaultSettings = {
198
- debug : settings.debug,
199
- dimmerName : 'modals'
200
- },
201
- dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
51
+ settings = ($.isPlainObject(parameters))
52
+ ? $.extend(true, {}, $.fn.modal.settings, parameters)
53
+ : $.extend({}, $.fn.modal.settings),
54
+
55
+ selector = settings.selector,
56
+ className = settings.className,
57
+ namespace = settings.namespace,
58
+ fields = settings.fields,
59
+ error = settings.error,
60
+
61
+ eventNamespace = '.' + namespace,
62
+ moduleNamespace = 'module-' + namespace,
63
+
64
+ $module = $(this),
65
+ $context = [window, document].indexOf(settings.context) < 0 ? $document.find(settings.context) : $body,
66
+ isBody = $context[0] === $body[0],
67
+ $closeIcon = $module.find(selector.closeIcon),
68
+ $inputs,
69
+
70
+ $allModals,
71
+ $otherModals,
72
+ $focusedElement,
73
+ $dimmable,
74
+ $dimmer,
75
+
76
+ isModalComponent = $module.hasClass('modal'),
77
+
78
+ element = this,
79
+ instance = isModalComponent ? $module.data(moduleNamespace) : undefined,
80
+
81
+ ignoreRepeatedEvents = false,
82
+
83
+ initialMouseDownInModal,
84
+ initialMouseDownInScrollbar,
85
+ initialBodyMargin = '',
86
+ tempBodyMargin = '',
87
+ keepScrollingClass = false,
88
+ hadScrollbar = false,
89
+
90
+ elementEventNamespace,
91
+ id,
92
+ observer,
93
+ module
202
94
  ;
203
- if($.fn.dimmer === undefined) {
204
- module.error(error.dimmer);
205
- return;
206
- }
207
- module.debug('Creating dimmer');
208
- $dimmable = $context.dimmer(dimmerSettings);
209
- keepScrollingClass = module.is.scrolling();
210
- if(settings.detachable) {
211
- module.verbose('Modal is detachable, moving content into dimmer');
212
- $dimmable.dimmer('add content', $module);
213
- }
214
- else {
215
- module.set.undetached();
216
- }
217
- $dimmer = $dimmable.dimmer('get dimmer');
218
- },
219
- id: function() {
220
- id = (Math.random().toString(16) + '000000000').slice(2, 10);
221
- elementEventNamespace = '.' + id;
222
- module.verbose('Creating unique id for element', id);
223
- },
224
- innerDimmer: function() {
225
- if ( $module.find(selector.dimmer).length === 0 ) {
226
- $('<div/>', {class: className.innerDimmer}).prependTo($module);
227
- }
228
- }
229
- },
95
+ module = {
96
+
97
+ initialize: function () {
98
+ module.create.id();
99
+ if (!isModalComponent) {
100
+ module.create.modal();
101
+ if (!isFunction(settings.onHidden)) {
102
+ settings.onHidden = function () {
103
+ module.destroy();
104
+ $module.remove();
105
+ };
106
+ }
107
+ }
108
+ $module.addClass(settings.class);
109
+ if (settings.title !== '') {
110
+ $module.find(selector.title).html(module.helpers.escape(settings.title, settings.preserveHTML)).addClass(settings.classTitle);
111
+ }
112
+ if (settings.content !== '') {
113
+ $module.find(selector.content).html(module.helpers.escape(settings.content, settings.preserveHTML)).addClass(settings.classContent);
114
+ }
115
+ if (module.has.configActions()) {
116
+ var $actions = $module.find(selector.actions).addClass(settings.classActions);
117
+ if ($actions.length === 0) {
118
+ $actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($module);
119
+ } else {
120
+ $actions.empty();
121
+ }
122
+ settings.actions.forEach(function (el) {
123
+ var
124
+ icon = el[fields.icon] ? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '') + ' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>' : '',
125
+ text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
126
+ cls = module.helpers.deQuote(el[fields.class] || ''),
127
+ click = el[fields.click] && isFunction(el[fields.click]) ? el[fields.click] : function () {}
128
+ ;
129
+ $actions.append($('<button/>', {
130
+ html: icon + text,
131
+ 'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
132
+ class: className.button + ' ' + cls,
133
+ on: {
134
+ click: function () {
135
+ var button = $(this);
136
+ if (button.is(selector.approve) || button.is(selector.deny) || click.call(element, $module) === false) {
137
+ return;
138
+ }
139
+ module.hide();
140
+ },
141
+ },
142
+ }));
143
+ });
144
+ }
145
+ module.cache = {};
146
+ module.verbose('Initializing dimmer', $context);
230
147
 
231
- destroy: function() {
232
- if (observer) {
233
- observer.disconnect();
234
- }
235
- module.verbose('Destroying previous modal');
236
- $module
237
- .removeData(moduleNamespace)
238
- .off(eventNamespace)
239
- ;
240
- $window.off(elementEventNamespace);
241
- $dimmer.off(elementEventNamespace);
242
- $closeIcon.off(elementEventNamespace);
243
- if($inputs) {
244
- $inputs.off(elementEventNamespace);
245
- }
246
- $context.dimmer('destroy');
247
- },
148
+ module.create.dimmer();
248
149
 
249
- observeChanges: function() {
250
- if('MutationObserver' in window) {
251
- observer = new MutationObserver(function(mutations) {
252
- if(settings.observeChanges) {
253
- module.debug('DOM tree modified, refreshing');
254
- module.refresh();
255
- }
256
- module.refreshInputs();
257
- });
258
- observer.observe(element, {
259
- childList : true,
260
- subtree : true
261
- });
262
- module.debug('Setting up mutation observer', observer);
263
- }
264
- },
150
+ if (settings.allowMultiple) {
151
+ module.create.innerDimmer();
152
+ }
153
+ if (!settings.centered) {
154
+ $module.addClass('top aligned');
155
+ }
156
+ module.refreshModals();
157
+ module.bind.events();
158
+ module.observeChanges();
159
+ module.instantiate();
160
+ if (settings.autoShow) {
161
+ module.show();
162
+ }
163
+ },
265
164
 
266
- refresh: function() {
267
- module.remove.scrolling();
268
- module.cacheSizes();
269
- if(!module.can.useFlex()) {
270
- module.set.modalOffset();
271
- }
272
- module.set.screenHeight();
273
- module.set.type();
274
- },
165
+ instantiate: function () {
166
+ module.verbose('Storing instance of modal');
167
+ instance = module;
168
+ $module
169
+ .data(moduleNamespace, instance)
170
+ ;
171
+ },
275
172
 
276
- refreshModals: function() {
277
- $otherModals = $module.siblings(selector.modal);
278
- $allModals = $otherModals.add($module);
279
- },
173
+ create: {
174
+ modal: function () {
175
+ $module = $('<div/>', { class: className.modal, role: 'dialog', 'aria-modal': true });
176
+ if (settings.closeIcon) {
177
+ $closeIcon = $('<i/>', {
178
+ class: className.close,
179
+ role: 'button',
180
+ tabindex: 0,
181
+ 'aria-label': settings.text.close,
182
+ });
183
+ $module.append($closeIcon);
184
+ }
185
+ if (settings.title !== '') {
186
+ var titleId = '_' + module.get.id() + 'title';
187
+ $module.attr('aria-labelledby', titleId);
188
+ $('<div/>', { class: className.title, id: titleId }).appendTo($module);
189
+ }
190
+ if (settings.content !== '') {
191
+ var descId = '_' + module.get.id() + 'desc';
192
+ $module.attr('aria-describedby', descId);
193
+ $('<div/>', { class: className.content, id: descId }).appendTo($module);
194
+ }
195
+ if (module.has.configActions()) {
196
+ $('<div/>', { class: className.actions }).appendTo($module);
197
+ }
198
+ $context.append($module);
199
+ element = $module[0];
200
+ },
201
+ dimmer: function () {
202
+ var
203
+ defaultSettings = {
204
+ debug: settings.debug,
205
+ dimmerName: 'modals',
206
+ },
207
+ dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
208
+ ;
209
+ if ($.fn.dimmer === undefined) {
210
+ module.error(error.dimmer);
211
+
212
+ return;
213
+ }
214
+ module.debug('Creating dimmer');
215
+ $dimmable = $context.dimmer(dimmerSettings);
216
+ keepScrollingClass = module.is.scrolling();
217
+ if (settings.detachable) {
218
+ module.verbose('Modal is detachable, moving content into dimmer');
219
+ $dimmable.dimmer('add content', $module);
220
+ } else {
221
+ module.set.undetached();
222
+ }
223
+ $dimmer = $dimmable.dimmer('get dimmer');
224
+ },
225
+ id: function () {
226
+ id = (Math.random().toString(16) + '000000000').slice(2, 10);
227
+ elementEventNamespace = '.' + id;
228
+ module.verbose('Creating unique id for element', id);
229
+ },
230
+ innerDimmer: function () {
231
+ if ($module.find(selector.dimmer).length === 0) {
232
+ $('<div/>', { class: className.innerDimmer }).prependTo($module);
233
+ }
234
+ },
235
+ },
280
236
 
281
- refreshInputs: function(){
282
- if($inputs){
283
- $inputs
284
- .off('keydown' + elementEventNamespace)
285
- ;
286
- }
287
- $inputs = $module.find('[tabindex], :input').filter(':visible').filter(function() {
288
- return $(this).closest('.disabled').length === 0;
289
- });
290
- $inputs.first()
291
- .on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
292
- ;
293
- $inputs.last()
294
- .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
295
- ;
296
- },
237
+ destroy: function () {
238
+ if (observer) {
239
+ observer.disconnect();
240
+ }
241
+ module.verbose('Destroying previous modal');
242
+ $module
243
+ .removeData(moduleNamespace)
244
+ .off(eventNamespace)
245
+ ;
246
+ $window.off(elementEventNamespace);
247
+ $dimmer.off(elementEventNamespace);
248
+ $closeIcon.off(elementEventNamespace);
249
+ if ($inputs) {
250
+ $inputs.off(elementEventNamespace);
251
+ }
252
+ $context.dimmer('destroy');
253
+ },
297
254
 
298
- attachEvents: function(selector, event) {
299
- var
300
- $toggle = $(selector)
301
- ;
302
- event = $.isFunction(module[event])
303
- ? module[event]
304
- : module.toggle
305
- ;
306
- if($toggle.length > 0) {
307
- module.debug('Attaching modal events to element', selector, event);
308
- $toggle
309
- .off(eventNamespace)
310
- .on('click' + eventNamespace, event)
311
- ;
312
- }
313
- else {
314
- module.error(error.notFound, selector);
315
- }
316
- },
255
+ observeChanges: function () {
256
+ if ('MutationObserver' in window) {
257
+ observer = new MutationObserver(function (mutations) {
258
+ if (settings.observeChanges) {
259
+ module.debug('DOM tree modified, refreshing');
260
+ module.refresh();
261
+ }
262
+ module.refreshInputs();
263
+ });
264
+ observer.observe(element, {
265
+ childList: true,
266
+ subtree: true,
267
+ });
268
+ module.debug('Setting up mutation observer', observer);
269
+ }
270
+ },
317
271
 
318
- bind: {
319
- events: function() {
320
- module.verbose('Attaching events');
321
- $module
322
- .on('click' + eventNamespace, selector.close, module.event.close)
323
- .on('click' + eventNamespace, selector.approve, module.event.approve)
324
- .on('click' + eventNamespace, selector.deny, module.event.deny)
325
- ;
326
- $closeIcon
327
- .on('keyup' + elementEventNamespace, module.event.closeKeyUp)
328
- ;
329
- $window
330
- .on('resize' + elementEventNamespace, module.event.resize)
331
- ;
332
- },
333
- scrollLock: function() {
334
- // touch events default to passive, due to changes in chrome to optimize mobile perf
335
- $dimmable[0].addEventListener('touchmove', module.event.preventScroll, { passive: false });
336
- }
337
- },
272
+ refresh: function () {
273
+ module.remove.scrolling();
274
+ module.cacheSizes();
275
+ if (!module.can.useFlex()) {
276
+ module.set.modalOffset();
277
+ }
278
+ module.set.screenHeight();
279
+ module.set.type();
280
+ },
338
281
 
339
- unbind: {
340
- scrollLock: function() {
341
- $dimmable[0].removeEventListener('touchmove', module.event.preventScroll, { passive: false });
342
- }
343
- },
282
+ refreshModals: function () {
283
+ $otherModals = $module.siblings(selector.modal);
284
+ $allModals = $otherModals.add($module);
285
+ },
344
286
 
345
- get: {
346
- id: function() {
347
- return id;
348
- },
349
- element: function() {
350
- return $module;
351
- },
352
- settings: function() {
353
- return settings;
354
- }
355
- },
287
+ refreshInputs: function () {
288
+ if ($inputs) {
289
+ $inputs
290
+ .off('keydown' + elementEventNamespace)
291
+ ;
292
+ }
293
+ $inputs = $module.find('[tabindex], :input').filter(':visible').filter(function () {
294
+ return $(this).closest('.disabled').length === 0;
295
+ });
296
+ $inputs.first()
297
+ .on('keydown' + elementEventNamespace, module.event.inputKeyDown.first)
298
+ ;
299
+ $inputs.last()
300
+ .on('keydown' + elementEventNamespace, module.event.inputKeyDown.last)
301
+ ;
302
+ },
356
303
 
357
- event: {
358
- approve: function() {
359
- if(ignoreRepeatedEvents || settings.onApprove.call(element, $(this)) === false) {
360
- module.verbose('Approve callback returned false cancelling hide');
361
- return;
362
- }
363
- ignoreRepeatedEvents = true;
364
- module.hide(function() {
365
- ignoreRepeatedEvents = false;
366
- });
367
- },
368
- preventScroll: function(event) {
369
- if(event.target.className.indexOf('dimmer') !== -1) {
370
- event.preventDefault();
371
- }
372
- },
373
- deny: function() {
374
- if(ignoreRepeatedEvents || settings.onDeny.call(element, $(this)) === false) {
375
- module.verbose('Deny callback returned false cancelling hide');
376
- return;
377
- }
378
- ignoreRepeatedEvents = true;
379
- module.hide(function() {
380
- ignoreRepeatedEvents = false;
381
- });
382
- },
383
- close: function() {
384
- module.hide();
385
- },
386
- closeKeyUp: function(event){
387
- var
388
- keyCode = event.which
389
- ;
390
- if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
391
- module.hide();
392
- }
393
- },
394
- inputKeyDown: {
395
- first: function(event) {
396
- var
397
- keyCode = event.which
398
- ;
399
- if (keyCode === settings.keys.tab && event.shiftKey) {
400
- $inputs.last().focus();
401
- event.preventDefault();
402
- }
403
- },
404
- last: function(event) {
405
- var
406
- keyCode = event.which
407
- ;
408
- if (keyCode === settings.keys.tab && !event.shiftKey) {
409
- $inputs.first().focus();
410
- event.preventDefault();
411
- }
412
- }
413
- },
414
- mousedown: function(event) {
415
- var
416
- $target = $(event.target),
417
- isRtl = module.is.rtl()
418
- ;
419
- initialMouseDownInModal = ($target.closest(selector.modal).length > 0);
420
- if(initialMouseDownInModal) {
421
- module.verbose('Mouse down event registered inside the modal');
422
- }
423
- initialMouseDownInScrollbar = module.is.scrolling() && ((!isRtl && $window.outerWidth() - settings.scrollbarWidth <= event.clientX) || (isRtl && settings.scrollbarWidth >= event.clientX));
424
- if(initialMouseDownInScrollbar) {
425
- module.verbose('Mouse down event registered inside the scrollbar');
426
- }
427
- },
428
- mouseup: function(event) {
429
- if(!settings.closable) {
430
- module.verbose('Dimmer clicked but closable setting is disabled');
431
- return;
432
- }
433
- if(initialMouseDownInModal) {
434
- module.debug('Dimmer clicked but mouse down was initially registered inside the modal');
435
- return;
436
- }
437
- if(initialMouseDownInScrollbar){
438
- module.debug('Dimmer clicked but mouse down was initially registered inside the scrollbar');
439
- return;
440
- }
441
- var
442
- $target = $(event.target),
443
- isInModal = ($target.closest(selector.modal).length > 0),
444
- isInDOM = $.contains(document.documentElement, event.target)
445
- ;
446
- if(!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front) ) {
447
- module.debug('Dimmer clicked, hiding all modals');
448
- if(settings.allowMultiple) {
449
- if(!module.hideAll()) {
450
- return;
451
- }
452
- }
453
- else if(!module.hide()){
454
- return;
455
- }
456
- module.remove.clickaway();
457
- }
458
- },
459
- debounce: function(method, delay) {
460
- clearTimeout(module.timer);
461
- module.timer = setTimeout(method, delay);
462
- },
463
- keyboard: function(event) {
464
- var
465
- keyCode = event.which
466
- ;
467
- if(keyCode === settings.keys.escape) {
468
- if(settings.closable) {
469
- module.debug('Escape key pressed hiding modal');
470
- if ( $module.hasClass(className.front) ) {
471
- module.hide();
472
- }
473
- }
474
- else {
475
- module.debug('Escape key pressed, but closable is set to false');
476
- }
477
- event.preventDefault();
478
- }
479
- },
480
- resize: function() {
481
- if( $dimmable.dimmer('is active') && ( module.is.animating() || module.is.active() ) ) {
482
- requestAnimationFrame(module.refresh);
483
- }
484
- }
485
- },
304
+ attachEvents: function (selector, event) {
305
+ var
306
+ $toggle = $(selector)
307
+ ;
308
+ event = isFunction(module[event])
309
+ ? module[event]
310
+ : module.toggle;
311
+ if ($toggle.length > 0) {
312
+ module.debug('Attaching modal events to element', selector, event);
313
+ $toggle
314
+ .off(eventNamespace)
315
+ .on('click' + eventNamespace, event)
316
+ ;
317
+ } else {
318
+ module.error(error.notFound, selector);
319
+ }
320
+ },
486
321
 
487
- toggle: function() {
488
- if( module.is.active() || module.is.animating() ) {
489
- module.hide();
490
- }
491
- else {
492
- module.show();
493
- }
494
- },
322
+ bind: {
323
+ events: function () {
324
+ module.verbose('Attaching events');
325
+ $module
326
+ .on('click' + eventNamespace, selector.close, module.event.close)
327
+ .on('click' + eventNamespace, selector.approve, module.event.approve)
328
+ .on('click' + eventNamespace, selector.deny, module.event.deny)
329
+ ;
330
+ $closeIcon
331
+ .on('keyup' + elementEventNamespace, module.event.closeKeyUp)
332
+ ;
333
+ $window
334
+ .on('resize' + elementEventNamespace, module.event.resize)
335
+ ;
336
+ },
337
+ scrollLock: function () {
338
+ // touch events default to passive, due to changes in chrome to optimize mobile perf
339
+ $dimmable[0].addEventListener('touchmove', module.event.preventScroll, { passive: false });
340
+ },
341
+ },
495
342
 
496
- show: function(callback) {
497
- callback = $.isFunction(callback)
498
- ? callback
499
- : function(){}
500
- ;
501
- module.refreshModals();
502
- module.set.dimmerSettings();
503
- module.set.dimmerStyles();
343
+ unbind: {
344
+ scrollLock: function () {
345
+ $dimmable[0].removeEventListener('touchmove', module.event.preventScroll, { passive: false });
346
+ },
347
+ },
504
348
 
505
- module.showModal(callback);
506
- },
349
+ get: {
350
+ id: function () {
351
+ return id;
352
+ },
353
+ element: function () {
354
+ return $module;
355
+ },
356
+ settings: function () {
357
+ return settings;
358
+ },
359
+ },
507
360
 
508
- hide: function(callback) {
509
- callback = $.isFunction(callback)
510
- ? callback
511
- : function(){}
512
- ;
513
- module.refreshModals();
514
- return module.hideModal(callback);
515
- },
361
+ event: {
362
+ approve: function () {
363
+ if (ignoreRepeatedEvents || settings.onApprove.call(element, $(this)) === false) {
364
+ module.verbose('Approve callback returned false cancelling hide');
365
+
366
+ return;
367
+ }
368
+ ignoreRepeatedEvents = true;
369
+ module.hide(function () {
370
+ ignoreRepeatedEvents = false;
371
+ });
372
+ },
373
+ preventScroll: function (event) {
374
+ if (event.target.className.indexOf('dimmer') !== -1) {
375
+ event.preventDefault();
376
+ }
377
+ },
378
+ deny: function () {
379
+ if (ignoreRepeatedEvents || settings.onDeny.call(element, $(this)) === false) {
380
+ module.verbose('Deny callback returned false cancelling hide');
381
+
382
+ return;
383
+ }
384
+ ignoreRepeatedEvents = true;
385
+ module.hide(function () {
386
+ ignoreRepeatedEvents = false;
387
+ });
388
+ },
389
+ close: function () {
390
+ module.hide();
391
+ },
392
+ closeKeyUp: function (event) {
393
+ var
394
+ keyCode = event.which
395
+ ;
396
+ if ((keyCode === settings.keys.enter || keyCode === settings.keys.space) && $module.hasClass(className.front)) {
397
+ module.hide();
398
+ }
399
+ },
400
+ inputKeyDown: {
401
+ first: function (event) {
402
+ var
403
+ keyCode = event.which
404
+ ;
405
+ if (keyCode === settings.keys.tab && event.shiftKey) {
406
+ $inputs.last().trigger('focus');
407
+ event.preventDefault();
408
+ }
409
+ },
410
+ last: function (event) {
411
+ var
412
+ keyCode = event.which
413
+ ;
414
+ if (keyCode === settings.keys.tab && !event.shiftKey) {
415
+ $inputs.first().trigger('focus');
416
+ event.preventDefault();
417
+ }
418
+ },
419
+ },
420
+ mousedown: function (event) {
421
+ var
422
+ $target = $(event.target),
423
+ isRtl = module.is.rtl()
424
+ ;
425
+ initialMouseDownInModal = ($target.closest(selector.modal).length > 0);
426
+ if (initialMouseDownInModal) {
427
+ module.verbose('Mouse down event registered inside the modal');
428
+ }
429
+ initialMouseDownInScrollbar = module.is.scrolling() && ((!isRtl && $window.outerWidth() - settings.scrollbarWidth <= event.clientX) || (isRtl && settings.scrollbarWidth >= event.clientX));
430
+ if (initialMouseDownInScrollbar) {
431
+ module.verbose('Mouse down event registered inside the scrollbar');
432
+ }
433
+ },
434
+ mouseup: function (event) {
435
+ if (!settings.closable) {
436
+ module.verbose('Dimmer clicked but closable setting is disabled');
437
+
438
+ return;
439
+ }
440
+ if (initialMouseDownInModal) {
441
+ module.debug('Dimmer clicked but mouse down was initially registered inside the modal');
442
+
443
+ return;
444
+ }
445
+ if (initialMouseDownInScrollbar) {
446
+ module.debug('Dimmer clicked but mouse down was initially registered inside the scrollbar');
447
+
448
+ return;
449
+ }
450
+ var
451
+ $target = $(event.target),
452
+ isInModal = ($target.closest(selector.modal).length > 0),
453
+ isInDOM = $.contains(document.documentElement, event.target)
454
+ ;
455
+ if (!isInModal && isInDOM && module.is.active() && $module.hasClass(className.front)) {
456
+ module.debug('Dimmer clicked, hiding all modals');
457
+ if (settings.allowMultiple) {
458
+ if (!module.hideAll()) {
459
+ return;
460
+ }
461
+ } else if (!module.hide()) {
462
+ return;
463
+ }
464
+ module.remove.clickaway();
465
+ }
466
+ },
467
+ debounce: function (method, delay) {
468
+ clearTimeout(module.timer);
469
+ module.timer = setTimeout(method, delay);
470
+ },
471
+ keyboard: function (event) {
472
+ var
473
+ keyCode = event.which
474
+ ;
475
+ if (keyCode === settings.keys.escape) {
476
+ if (settings.closable) {
477
+ module.debug('Escape key pressed hiding modal');
478
+ if ($module.hasClass(className.front)) {
479
+ module.hide();
480
+ }
481
+ } else {
482
+ module.debug('Escape key pressed, but closable is set to false');
483
+ }
484
+ event.preventDefault();
485
+ }
486
+ },
487
+ resize: function () {
488
+ if ($dimmable.dimmer('is active') && (module.is.animating() || module.is.active())) {
489
+ requestAnimationFrame(module.refresh);
490
+ }
491
+ },
492
+ },
516
493
 
517
- showModal: function(callback) {
518
- callback = $.isFunction(callback)
519
- ? callback
520
- : function(){}
521
- ;
522
- if( module.is.animating() || !module.is.active() ) {
523
- if(settings.onShow.call(element) === false) {
524
- module.verbose('Show callback returned false cancelling show');
525
- return;
526
- }
527
- hadScrollbar = module.has.scrollbar();
528
- module.showDimmer();
529
- module.cacheSizes();
530
- if(hadScrollbar) {
531
- module.set.bodyMargin();
532
- }
533
- if(module.can.useFlex()) {
534
- module.remove.legacy();
535
- }
536
- else {
537
- module.set.legacy();
538
- module.set.modalOffset();
539
- module.debug('Using non-flex legacy modal positioning.');
540
- }
541
- module.set.screenHeight();
542
- module.set.type();
543
- module.set.clickaway();
494
+ toggle: function () {
495
+ if (module.is.active() || module.is.animating()) {
496
+ module.hide();
497
+ } else {
498
+ module.show();
499
+ }
500
+ },
544
501
 
545
- if( !settings.allowMultiple && module.others.active() ) {
546
- module.hideOthers(module.showModal);
547
- }
548
- else {
549
- ignoreRepeatedEvents = false;
550
- if( settings.allowMultiple ) {
551
- if ( module.others.active() ) {
552
- $otherModals.filter('.' + className.active).find(selector.dimmer).addClass('active');
553
- }
502
+ show: function (callback) {
503
+ callback = isFunction(callback)
504
+ ? callback
505
+ : function () {};
506
+ module.refreshModals();
507
+ module.set.dimmerSettings();
508
+ module.set.dimmerStyles();
554
509
 
555
- if ( settings.detachable ) {
556
- $module.detach().appendTo($dimmer);
557
- }
558
- }
559
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
560
- module.debug('Showing modal with css animations');
561
- $module
562
- .transition({
563
- debug : settings.debug,
564
- verbose : settings.verbose,
565
- silent : settings.silent,
566
- animation : (settings.transition.showMethod || settings.transition) + ' in',
567
- queue : settings.queue,
568
- duration : settings.transition.showDuration || settings.duration,
569
- useFailSafe : true,
570
- onComplete : function() {
571
- settings.onVisible.apply(element);
572
- if(settings.keyboardShortcuts) {
573
- module.add.keyboardShortcuts();
574
- }
575
- module.save.focus();
576
- module.set.active();
577
- module.refreshInputs()
578
- if(settings.autofocus) {
579
- module.set.autofocus();
580
- }
581
- callback();
510
+ module.showModal(callback);
511
+ },
512
+
513
+ hide: function (callback) {
514
+ callback = isFunction(callback)
515
+ ? callback
516
+ : function () {};
517
+ module.refreshModals();
518
+
519
+ return module.hideModal(callback);
520
+ },
521
+
522
+ showModal: function (callback) {
523
+ callback = isFunction(callback)
524
+ ? callback
525
+ : function () {};
526
+ if (module.is.animating() || !module.is.active()) {
527
+ if (settings.onShow.call(element) === false) {
528
+ module.verbose('Show callback returned false cancelling show');
529
+
530
+ return;
531
+ }
532
+ hadScrollbar = module.has.scrollbar();
533
+ module.showDimmer();
534
+ module.cacheSizes();
535
+ if (hadScrollbar) {
536
+ module.set.bodyMargin();
537
+ }
538
+ if (module.can.useFlex()) {
539
+ module.remove.legacy();
540
+ } else {
541
+ module.set.legacy();
542
+ module.set.modalOffset();
543
+ module.debug('Using non-flex legacy modal positioning.');
544
+ }
545
+ module.set.screenHeight();
546
+ module.set.type();
547
+ module.set.clickaway();
548
+
549
+ if (!settings.allowMultiple && module.others.active()) {
550
+ module.hideOthers(module.showModal);
551
+ } else {
552
+ ignoreRepeatedEvents = false;
553
+ if (settings.allowMultiple) {
554
+ if (module.others.active()) {
555
+ $otherModals.filter('.' + className.active).find(selector.dimmer).addClass('active');
556
+ }
557
+
558
+ if (settings.detachable) {
559
+ $module.detach().appendTo($dimmer);
560
+ }
561
+ }
562
+ if (settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
563
+ module.debug('Showing modal with css animations');
564
+ $module
565
+ .transition({
566
+ debug: settings.debug,
567
+ verbose: settings.verbose,
568
+ silent: settings.silent,
569
+ animation: (settings.transition.showMethod || settings.transition) + ' in',
570
+ queue: settings.queue,
571
+ duration: settings.transition.showDuration || settings.duration,
572
+ useFailSafe: true,
573
+ onComplete: function () {
574
+ settings.onVisible.apply(element);
575
+ if (settings.keyboardShortcuts) {
576
+ module.add.keyboardShortcuts();
577
+ }
578
+ module.save.focus();
579
+ module.set.active();
580
+ module.refreshInputs();
581
+ if (settings.autofocus) {
582
+ module.set.autofocus();
583
+ }
584
+ callback();
585
+ },
586
+ })
587
+ ;
588
+ } else {
589
+ module.error(error.noTransition);
590
+ }
591
+ }
592
+ } else {
593
+ module.debug('Modal is already visible');
582
594
  }
583
- })
584
- ;
585
- }
586
- else {
587
- module.error(error.noTransition);
588
- }
589
- }
590
- }
591
- else {
592
- module.debug('Modal is already visible');
593
- }
594
- },
595
+ },
596
+
597
+ hideModal: function (callback, keepDimmed, hideOthersToo) {
598
+ var
599
+ $previousModal = $otherModals.filter('.' + className.active).last()
600
+ ;
601
+ callback = isFunction(callback)
602
+ ? callback
603
+ : function () {};
604
+ if (settings.onHide.call(element, $(this)) === false) {
605
+ module.verbose('Hide callback returned false cancelling hide');
606
+ ignoreRepeatedEvents = false;
607
+
608
+ return false;
609
+ }
610
+
611
+ if (module.is.animating() || module.is.active()) {
612
+ module.debug('Hiding modal');
613
+ if (settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
614
+ module.remove.active();
615
+ $module
616
+ .transition({
617
+ debug: settings.debug,
618
+ verbose: settings.verbose,
619
+ silent: settings.silent,
620
+ animation: (settings.transition.hideMethod || settings.transition) + ' out',
621
+ queue: settings.queue,
622
+ duration: settings.transition.hideDuration || settings.duration,
623
+ useFailSafe: true,
624
+ onStart: function () {
625
+ if (!module.others.active() && !module.others.animating() && !keepDimmed) {
626
+ module.hideDimmer();
627
+ }
628
+ if (settings.keyboardShortcuts && !module.others.active()) {
629
+ module.remove.keyboardShortcuts();
630
+ }
631
+ },
632
+ onComplete: function () {
633
+ module.unbind.scrollLock();
634
+ if (settings.allowMultiple) {
635
+ $previousModal.addClass(className.front);
636
+ $module.removeClass(className.front);
637
+
638
+ if (hideOthersToo) {
639
+ $allModals.find(selector.dimmer).removeClass('active');
640
+ } else {
641
+ $previousModal.find(selector.dimmer).removeClass('active');
642
+ }
643
+ }
644
+ if (isFunction(settings.onHidden)) {
645
+ settings.onHidden.call(element);
646
+ }
647
+ module.remove.dimmerStyles();
648
+ module.restore.focus();
649
+ callback();
650
+ },
651
+ })
652
+ ;
653
+ } else {
654
+ module.error(error.noTransition);
655
+ }
656
+ }
657
+ },
595
658
 
596
- hideModal: function(callback, keepDimmed, hideOthersToo) {
597
- var
598
- $previousModal = $otherModals.filter('.' + className.active).last()
599
- ;
600
- callback = $.isFunction(callback)
601
- ? callback
602
- : function(){}
603
- ;
604
- if(settings.onHide.call(element, $(this)) === false) {
605
- module.verbose('Hide callback returned false cancelling hide');
606
- ignoreRepeatedEvents = false;
607
- return false;
608
- }
609
-
610
- if( module.is.animating() || module.is.active() ) {
611
- module.debug('Hiding modal');
612
- if(settings.transition && $.fn.transition !== undefined && $module.transition('is supported')) {
613
- module.remove.active();
614
- $module
615
- .transition({
616
- debug : settings.debug,
617
- verbose : settings.verbose,
618
- silent : settings.silent,
619
- animation : (settings.transition.hideMethod || settings.transition) + ' out',
620
- queue : settings.queue,
621
- duration : settings.transition.hideDuration || settings.duration,
622
- useFailSafe : true,
623
- onStart : function() {
624
- if(!module.others.active() && !module.others.animating() && !keepDimmed) {
625
- module.hideDimmer();
659
+ showDimmer: function () {
660
+ if ($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active')) {
661
+ if (hadScrollbar) {
662
+ if (!isBody) {
663
+ $dimmer.css('top', $dimmable.scrollTop());
664
+ }
665
+ module.save.bodyMargin();
666
+ }
667
+ module.debug('Showing dimmer');
668
+ $dimmable.dimmer('show');
669
+ } else {
670
+ module.debug('Dimmer already visible');
626
671
  }
627
- if( settings.keyboardShortcuts && !module.others.active() ) {
628
- module.remove.keyboardShortcuts();
672
+ },
673
+
674
+ hideDimmer: function () {
675
+ if ($dimmable.dimmer('is animating') || ($dimmable.dimmer('is active'))) {
676
+ module.unbind.scrollLock();
677
+ $dimmable.dimmer('hide', function () {
678
+ if (hadScrollbar) {
679
+ module.restore.bodyMargin();
680
+ }
681
+ module.remove.clickaway();
682
+ module.remove.screenHeight();
683
+ });
684
+ } else {
685
+ module.debug('Dimmer is not visible cannot hide');
629
686
  }
630
- },
631
- onComplete : function() {
632
- module.unbind.scrollLock();
633
- if ( settings.allowMultiple ) {
634
- $previousModal.addClass(className.front);
635
- $module.removeClass(className.front);
636
-
637
- if ( hideOthersToo ) {
638
- $allModals.find(selector.dimmer).removeClass('active');
639
- }
640
- else {
641
- $previousModal.find(selector.dimmer).removeClass('active');
642
- }
687
+ },
688
+
689
+ hideAll: function (callback) {
690
+ var
691
+ $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
692
+ ;
693
+ callback = isFunction(callback)
694
+ ? callback
695
+ : function () {};
696
+ if ($visibleModals.length > 0) {
697
+ module.debug('Hiding all visible modals');
698
+ var hideOk = true;
699
+ // check in reverse order trying to hide most top displayed modal first
700
+ $($visibleModals.get().reverse()).each(function (index, element) {
701
+ if (hideOk) {
702
+ hideOk = $(element).modal('hide modal', callback, false, true);
703
+ }
704
+ });
705
+ if (hideOk) {
706
+ module.hideDimmer();
707
+ }
708
+
709
+ return hideOk;
643
710
  }
644
- if($.isFunction(settings.onHidden)) {
645
- settings.onHidden.call(element);
711
+ },
712
+
713
+ hideOthers: function (callback) {
714
+ var
715
+ $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
716
+ ;
717
+ callback = isFunction(callback)
718
+ ? callback
719
+ : function () {};
720
+ if ($visibleModals.length > 0) {
721
+ module.debug('Hiding other modals', $otherModals);
722
+ $visibleModals
723
+ .modal('hide modal', callback, true)
724
+ ;
646
725
  }
647
- module.remove.dimmerStyles();
648
- module.restore.focus();
649
- callback();
650
- }
651
- })
652
- ;
653
- }
654
- else {
655
- module.error(error.noTransition);
656
- }
657
- }
658
- },
726
+ },
659
727
 
660
- showDimmer: function() {
661
- if($dimmable.dimmer('is animating') || !$dimmable.dimmer('is active') ) {
662
- if(hadScrollbar) {
663
- if(!isBody) {
664
- $dimmer.css('top', $dimmable.scrollTop());
665
- }
666
- module.save.bodyMargin();
667
- }
668
- module.debug('Showing dimmer');
669
- $dimmable.dimmer('show');
670
- }
671
- else {
672
- module.debug('Dimmer already visible');
673
- }
674
- },
728
+ others: {
729
+ active: function () {
730
+ return ($otherModals.filter('.' + className.active).length > 0);
731
+ },
732
+ animating: function () {
733
+ return ($otherModals.filter('.' + className.animating).length > 0);
734
+ },
735
+ },
675
736
 
676
- hideDimmer: function() {
677
- if( $dimmable.dimmer('is animating') || ($dimmable.dimmer('is active')) ) {
678
- module.unbind.scrollLock();
679
- $dimmable.dimmer('hide', function() {
680
- if(hadScrollbar) {
681
- module.restore.bodyMargin();
682
- }
683
- module.remove.clickaway();
684
- module.remove.screenHeight();
685
- });
686
- }
687
- else {
688
- module.debug('Dimmer is not visible cannot hide');
689
- }
690
- },
737
+ add: {
738
+ keyboardShortcuts: function () {
739
+ module.verbose('Adding keyboard shortcuts');
740
+ $document
741
+ .on('keydown' + eventNamespace, module.event.keyboard)
742
+ ;
743
+ },
744
+ },
691
745
 
692
- hideAll: function(callback) {
693
- var
694
- $visibleModals = $allModals.filter('.' + className.active + ', .' + className.animating)
695
- ;
696
- callback = $.isFunction(callback)
697
- ? callback
698
- : function(){}
699
- ;
700
- if( $visibleModals.length > 0 ) {
701
- module.debug('Hiding all visible modals');
702
- var hideOk = true;
703
- //check in reverse order trying to hide most top displayed modal first
704
- $($visibleModals.get().reverse()).each(function(index,element){
705
- if(hideOk){
706
- hideOk = $(element).modal('hide modal', callback, false, true);
746
+ save: {
747
+ focus: function () {
748
+ var
749
+ $activeElement = $(document.activeElement),
750
+ inCurrentModal = $activeElement.closest($module).length > 0
751
+ ;
752
+ if (!inCurrentModal) {
753
+ $focusedElement = $(document.activeElement).trigger('blur');
754
+ }
755
+ },
756
+ bodyMargin: function () {
757
+ initialBodyMargin = $context.css((isBody ? 'margin-' : 'padding-') + (module.can.leftBodyScrollbar() ? 'left' : 'right'));
758
+ var
759
+ bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
760
+ bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth
761
+ ;
762
+ tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
763
+ },
764
+ },
765
+
766
+ restore: {
767
+ focus: function () {
768
+ if ($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
769
+ $focusedElement.trigger('focus');
770
+ }
771
+ },
772
+ bodyMargin: function () {
773
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
774
+ $context.css((isBody ? 'margin-' : 'padding-') + position, initialBodyMargin);
775
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
776
+ var
777
+ el = $(this),
778
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
779
+ ;
780
+ el.css(attribute, '');
781
+ });
782
+ },
783
+ },
784
+
785
+ remove: {
786
+ active: function () {
787
+ $module.removeClass(className.active);
788
+ },
789
+ legacy: function () {
790
+ $module.removeClass(className.legacy);
791
+ },
792
+ clickaway: function () {
793
+ if (!settings.detachable) {
794
+ $module
795
+ .off('mousedown' + elementEventNamespace)
796
+ ;
797
+ }
798
+ $dimmer
799
+ .off('mousedown' + elementEventNamespace)
800
+ ;
801
+ $dimmer
802
+ .off('mouseup' + elementEventNamespace)
803
+ ;
804
+ },
805
+ dimmerStyles: function () {
806
+ $dimmer.removeClass(className.inverted);
807
+ $dimmable.removeClass(className.blurring);
808
+ },
809
+ bodyStyle: function () {
810
+ if ($context.attr('style') === '') {
811
+ module.verbose('Removing style attribute');
812
+ $context.removeAttr('style');
813
+ }
814
+ },
815
+ screenHeight: function () {
816
+ module.debug('Removing page height');
817
+ $context
818
+ .css('height', '')
819
+ ;
820
+ module.remove.bodyStyle();
821
+ },
822
+ keyboardShortcuts: function () {
823
+ module.verbose('Removing keyboard shortcuts');
824
+ $document
825
+ .off('keydown' + eventNamespace)
826
+ ;
827
+ },
828
+ scrolling: function () {
829
+ if (!keepScrollingClass) {
830
+ $dimmable.removeClass(className.scrolling);
831
+ }
832
+ $module.removeClass(className.scrolling);
833
+ },
834
+ },
835
+
836
+ cacheSizes: function () {
837
+ $module.addClass(className.loading);
838
+ var
839
+ scrollHeight = $module.prop('scrollHeight'),
840
+ modalWidth = $module.outerWidth(),
841
+ modalHeight = $module.outerHeight()
842
+ ;
843
+ if (module.cache.pageHeight === undefined || modalHeight !== 0) {
844
+ $.extend(module.cache, {
845
+ pageHeight: $document.outerHeight(),
846
+ width: modalWidth,
847
+ height: modalHeight + settings.offset,
848
+ scrollHeight: scrollHeight + settings.offset,
849
+ contextHeight: isBody
850
+ ? $window.height()
851
+ : $dimmable.height(),
852
+ });
853
+ module.cache.topOffset = -(module.cache.height / 2);
854
+ }
855
+ $module.removeClass(className.loading);
856
+ module.debug('Caching modal and container sizes', module.cache);
857
+ },
858
+ helpers: {
859
+ deQuote: function (string) {
860
+ return String(string).replace(/"/g, '');
861
+ },
862
+ escape: function (string, preserveHTML) {
863
+ if (preserveHTML) {
864
+ return string;
865
+ }
866
+ var
867
+ badChars = /[<>"'`]/g,
868
+ shouldEscape = /[&<>"'`]/,
869
+ escape = {
870
+ '<': '&lt;',
871
+ '>': '&gt;',
872
+ '"': '&quot;',
873
+ "'": '&#x27;',
874
+ '`': '&#x60;',
875
+ },
876
+ escapedChar = function (chr) {
877
+ return escape[chr];
878
+ }
879
+ ;
880
+ if (shouldEscape.test(string)) {
881
+ string = string.replace(/&(?![a-z0-9#]{1,12};)/gi, '&amp;');
882
+
883
+ return string.replace(badChars, escapedChar);
884
+ }
885
+
886
+ return string;
887
+ },
888
+ },
889
+ can: {
890
+ leftBodyScrollbar: function () {
891
+ if (module.cache.leftBodyScrollbar === undefined) {
892
+ module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
893
+ }
894
+
895
+ return module.cache.leftBodyScrollbar;
896
+ },
897
+ useFlex: function () {
898
+ if (settings.useFlex === 'auto') {
899
+ return settings.detachable && !module.is.ie();
900
+ }
901
+ if (settings.useFlex && module.is.ie()) {
902
+ module.debug('useFlex true is not supported in IE');
903
+ } else if (settings.useFlex && !settings.detachable) {
904
+ module.debug('useFlex true in combination with detachable false is not supported');
905
+ }
906
+
907
+ return settings.useFlex;
908
+ },
909
+ fit: function () {
910
+ var
911
+ contextHeight = module.cache.contextHeight,
912
+ verticalCenter = module.cache.contextHeight / 2,
913
+ topOffset = module.cache.topOffset,
914
+ scrollHeight = module.cache.scrollHeight,
915
+ height = module.cache.height,
916
+ paddingHeight = settings.padding,
917
+ startPosition = (verticalCenter + topOffset)
918
+ ;
919
+
920
+ return (scrollHeight > height)
921
+ ? (startPosition + scrollHeight + paddingHeight < contextHeight)
922
+ : (height + (paddingHeight * 2) < contextHeight);
923
+ },
924
+ },
925
+ has: {
926
+ configActions: function () {
927
+ return Array.isArray(settings.actions) && settings.actions.length > 0;
928
+ },
929
+ scrollbar: function () {
930
+ return isBody || $context.css('overflow-y') !== 'hidden';
931
+ },
932
+ },
933
+ is: {
934
+ active: function () {
935
+ return $module.hasClass(className.active);
936
+ },
937
+ ie: function () {
938
+ if (module.cache.isIE === undefined) {
939
+ var
940
+ isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
941
+ isIE = ('ActiveXObject' in window)
942
+ ;
943
+ module.cache.isIE = (isIE11 || isIE);
944
+ }
945
+
946
+ return module.cache.isIE;
947
+ },
948
+ animating: function () {
949
+ return $module.transition('is supported')
950
+ ? $module.transition('is animating')
951
+ : $module.is(':visible');
952
+ },
953
+ scrolling: function () {
954
+ return $dimmable.hasClass(className.scrolling);
955
+ },
956
+ modernBrowser: function () {
957
+ // appName for IE11 reports 'Netscape' can no longer use
958
+ return !(window.ActiveXObject || 'ActiveXObject' in window);
959
+ },
960
+ rtl: function () {
961
+ if (module.cache.isRTL === undefined) {
962
+ 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';
963
+ }
964
+
965
+ return module.cache.isRTL;
966
+ },
967
+ safari: function () {
968
+ if (module.cache.isSafari === undefined) {
969
+ module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
970
+ }
971
+
972
+ return module.cache.isSafari;
973
+ },
974
+ edge: function () {
975
+ if (module.cache.isEdge === undefined) {
976
+ module.cache.isEdge = !!window.setImmediate && !module.is.ie();
977
+ }
978
+
979
+ return module.cache.isEdge;
980
+ },
981
+ firefox: function () {
982
+ if (module.cache.isFirefox === undefined) {
983
+ module.cache.isFirefox = !!window.InstallTrigger;
984
+ }
985
+
986
+ return module.cache.isFirefox;
987
+ },
988
+ iframe: function () {
989
+ return !(self === top);
990
+ },
991
+ },
992
+
993
+ set: {
994
+ autofocus: function () {
995
+ var
996
+ $autofocus = $inputs.filter('[autofocus]'),
997
+ $input = ($autofocus.length > 0)
998
+ ? $autofocus.first()
999
+ : ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
1000
+ ;
1001
+ if ($input.length > 0) {
1002
+ $input.trigger('focus');
1003
+ }
1004
+ },
1005
+ bodyMargin: function () {
1006
+ var position = module.can.leftBodyScrollbar() ? 'left' : 'right';
1007
+ if (settings.detachable || module.can.fit()) {
1008
+ $context.css((isBody ? 'margin-' : 'padding-') + position, tempBodyMargin + 'px');
1009
+ }
1010
+ $context.find(selector.bodyFixed.replace('right', position)).each(function () {
1011
+ var
1012
+ el = $(this),
1013
+ attribute = el.css('position') === 'fixed' ? 'padding-' + position : position
1014
+ ;
1015
+ el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
1016
+ });
1017
+ },
1018
+ clickaway: function () {
1019
+ if (!settings.detachable) {
1020
+ $module
1021
+ .on('mousedown' + elementEventNamespace, module.event.mousedown)
1022
+ ;
1023
+ }
1024
+ $dimmer
1025
+ .on('mousedown' + elementEventNamespace, module.event.mousedown)
1026
+ ;
1027
+ $dimmer
1028
+ .on('mouseup' + elementEventNamespace, module.event.mouseup)
1029
+ ;
1030
+ },
1031
+ dimmerSettings: function () {
1032
+ if ($.fn.dimmer === undefined) {
1033
+ module.error(error.dimmer);
1034
+
1035
+ return;
1036
+ }
1037
+ var
1038
+ defaultSettings = {
1039
+ debug: settings.debug,
1040
+ dimmerName: 'modals',
1041
+ closable: 'auto',
1042
+ useFlex: module.can.useFlex(),
1043
+ duration: {
1044
+ show: settings.transition.showDuration || settings.duration,
1045
+ hide: settings.transition.hideDuration || settings.duration,
1046
+ },
1047
+ },
1048
+ dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
1049
+ ;
1050
+ if (settings.inverted) {
1051
+ dimmerSettings.variation = (dimmerSettings.variation !== undefined)
1052
+ ? dimmerSettings.variation + ' inverted'
1053
+ : 'inverted';
1054
+ }
1055
+ $context.dimmer('setting', dimmerSettings);
1056
+ },
1057
+ dimmerStyles: function () {
1058
+ if (settings.inverted) {
1059
+ $dimmer.addClass(className.inverted);
1060
+ } else {
1061
+ $dimmer.removeClass(className.inverted);
1062
+ }
1063
+ if (settings.blurring) {
1064
+ $dimmable.addClass(className.blurring);
1065
+ } else {
1066
+ $dimmable.removeClass(className.blurring);
1067
+ }
1068
+ },
1069
+ modalOffset: function () {
1070
+ if (!settings.detachable) {
1071
+ var canFit = module.can.fit();
1072
+ $module
1073
+ .css({
1074
+ top: (!$module.hasClass('aligned') && canFit)
1075
+ ? $document.scrollTop() + (module.cache.contextHeight - module.cache.height) / 2
1076
+ : !canFit || $module.hasClass('top')
1077
+ ? $document.scrollTop() + settings.padding
1078
+ : $document.scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding),
1079
+ marginLeft: -(module.cache.width / 2),
1080
+ })
1081
+ ;
1082
+ } else {
1083
+ $module
1084
+ .css({
1085
+ marginTop: (!$module.hasClass('aligned') && module.can.fit())
1086
+ ? -(module.cache.height / 2)
1087
+ : settings.padding / 2,
1088
+ marginLeft: -(module.cache.width / 2),
1089
+ })
1090
+ ;
1091
+ }
1092
+ module.verbose('Setting modal offset for legacy mode');
1093
+ },
1094
+ screenHeight: function () {
1095
+ if (module.can.fit()) {
1096
+ $context.css('height', '');
1097
+ } else if (!$module.hasClass('bottom')) {
1098
+ module.debug('Modal is taller than page content, resizing page height');
1099
+ $context
1100
+ .css('height', module.cache.height + (settings.padding * 2) + 'px')
1101
+ ;
1102
+ }
1103
+ },
1104
+ active: function () {
1105
+ $module.addClass(className.active + ' ' + className.front);
1106
+ $otherModals.filter('.' + className.active).removeClass(className.front);
1107
+ },
1108
+ scrolling: function () {
1109
+ $dimmable.addClass(className.scrolling);
1110
+ $module.addClass(className.scrolling);
1111
+ module.unbind.scrollLock();
1112
+ },
1113
+ legacy: function () {
1114
+ $module.addClass(className.legacy);
1115
+ },
1116
+ type: function () {
1117
+ if (module.can.fit()) {
1118
+ module.verbose('Modal fits on screen');
1119
+ if (!module.others.active() && !module.others.animating()) {
1120
+ module.remove.scrolling();
1121
+ module.bind.scrollLock();
1122
+ }
1123
+ } else if (!$module.hasClass('bottom')) {
1124
+ module.verbose('Modal cannot fit on screen setting to scrolling');
1125
+ module.set.scrolling();
1126
+ } else {
1127
+ module.verbose('Bottom aligned modal not fitting on screen is unsupported for scrolling');
1128
+ }
1129
+ },
1130
+ undetached: function () {
1131
+ $dimmable.addClass(className.undetached);
1132
+ },
1133
+ },
1134
+
1135
+ setting: function (name, value) {
1136
+ module.debug('Changing setting', name, value);
1137
+ if ($.isPlainObject(name)) {
1138
+ $.extend(true, settings, name);
1139
+ } else if (value !== undefined) {
1140
+ if ($.isPlainObject(settings[name])) {
1141
+ $.extend(true, settings[name], value);
1142
+ } else {
1143
+ settings[name] = value;
1144
+ }
1145
+ } else {
1146
+ return settings[name];
1147
+ }
1148
+ },
1149
+ internal: function (name, value) {
1150
+ if ($.isPlainObject(name)) {
1151
+ $.extend(true, module, name);
1152
+ } else if (value !== undefined) {
1153
+ module[name] = value;
1154
+ } else {
1155
+ return module[name];
1156
+ }
1157
+ },
1158
+ debug: function () {
1159
+ if (!settings.silent && settings.debug) {
1160
+ if (settings.performance) {
1161
+ module.performance.log(arguments);
1162
+ } else {
1163
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1164
+ module.debug.apply(console, arguments);
1165
+ }
1166
+ }
1167
+ },
1168
+ verbose: function () {
1169
+ if (!settings.silent && settings.verbose && settings.debug) {
1170
+ if (settings.performance) {
1171
+ module.performance.log(arguments);
1172
+ } else {
1173
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1174
+ module.verbose.apply(console, arguments);
1175
+ }
1176
+ }
1177
+ },
1178
+ error: function () {
1179
+ if (!settings.silent) {
1180
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1181
+ module.error.apply(console, arguments);
1182
+ }
1183
+ },
1184
+ performance: {
1185
+ log: function (message) {
1186
+ var
1187
+ currentTime,
1188
+ executionTime,
1189
+ previousTime
1190
+ ;
1191
+ if (settings.performance) {
1192
+ currentTime = new Date().getTime();
1193
+ previousTime = time || currentTime;
1194
+ executionTime = currentTime - previousTime;
1195
+ time = currentTime;
1196
+ performance.push({
1197
+ Name: message[0],
1198
+ Arguments: [].slice.call(message, 1) || '',
1199
+ Element: element,
1200
+ 'Execution Time': executionTime,
1201
+ });
1202
+ }
1203
+ clearTimeout(module.performance.timer);
1204
+ module.performance.timer = setTimeout(module.performance.display, 500);
1205
+ },
1206
+ display: function () {
1207
+ var
1208
+ title = settings.name + ':',
1209
+ totalTime = 0
1210
+ ;
1211
+ time = false;
1212
+ clearTimeout(module.performance.timer);
1213
+ $.each(performance, function (index, data) {
1214
+ totalTime += data['Execution Time'];
1215
+ });
1216
+ title += ' ' + totalTime + 'ms';
1217
+ if (moduleSelector) {
1218
+ title += ' \'' + moduleSelector + '\'';
1219
+ }
1220
+ if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1221
+ console.groupCollapsed(title);
1222
+ if (console.table) {
1223
+ console.table(performance);
1224
+ } else {
1225
+ $.each(performance, function (index, data) {
1226
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
1227
+ });
1228
+ }
1229
+ console.groupEnd();
1230
+ }
1231
+ performance = [];
1232
+ },
1233
+ },
1234
+ invoke: function (query, passedArguments, context) {
1235
+ var
1236
+ object = instance,
1237
+ maxDepth,
1238
+ found,
1239
+ response
1240
+ ;
1241
+ passedArguments = passedArguments || queryArguments;
1242
+ context = context || element;
1243
+ if (typeof query == 'string' && object !== undefined) {
1244
+ query = query.split(/[\. ]/);
1245
+ maxDepth = query.length - 1;
1246
+ $.each(query, function (depth, value) {
1247
+ var camelCaseValue = (depth != maxDepth)
1248
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1249
+ : query;
1250
+ if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
1251
+ object = object[camelCaseValue];
1252
+ } else if (object[camelCaseValue] !== undefined) {
1253
+ found = object[camelCaseValue];
1254
+
1255
+ return false;
1256
+ } else if ($.isPlainObject(object[value]) && (depth != maxDepth)) {
1257
+ object = object[value];
1258
+ } else if (object[value] !== undefined) {
1259
+ found = object[value];
1260
+
1261
+ return false;
1262
+ } else {
1263
+ return false;
1264
+ }
1265
+ });
1266
+ }
1267
+ if (isFunction(found)) {
1268
+ response = found.apply(context, passedArguments);
1269
+ } else if (found !== undefined) {
1270
+ response = found;
1271
+ }
1272
+ if (Array.isArray(returnedValue)) {
1273
+ returnedValue.push(response);
1274
+ } else if (returnedValue !== undefined) {
1275
+ returnedValue = [returnedValue, response];
1276
+ } else if (response !== undefined) {
1277
+ returnedValue = response;
1278
+ }
1279
+
1280
+ return found;
1281
+ },
1282
+ };
1283
+
1284
+ if (methodInvoked) {
1285
+ if (instance === undefined) {
1286
+ if (isFunction(settings.templates[query])) {
1287
+ settings.autoShow = true;
1288
+ settings.className.modal = settings.className.template;
1289
+ settings = $.extend(true, {}, settings, settings.templates[query].apply(module, queryArguments));
1290
+
1291
+ // reassign shortcuts
1292
+ className = settings.className;
1293
+ namespace = settings.namespace;
1294
+ fields = settings.fields;
1295
+ error = settings.error;
1296
+ }
1297
+ module.initialize();
707
1298
  }
708
- });
709
- if(hideOk) {
710
- module.hideDimmer();
1299
+ if (!isFunction(settings.templates[query])) {
1300
+ module.invoke(query);
1301
+ }
1302
+ } else {
1303
+ if (instance !== undefined) {
1304
+ instance.invoke('destroy');
1305
+ }
1306
+ module.initialize();
1307
+ returnedValue = $module;
711
1308
  }
712
- return hideOk;
713
- }
714
- },
1309
+ });
715
1310
 
716
- hideOthers: function(callback) {
717
- var
718
- $visibleModals = $otherModals.filter('.' + className.active + ', .' + className.animating)
719
- ;
720
- callback = $.isFunction(callback)
721
- ? callback
722
- : function(){}
723
- ;
724
- if( $visibleModals.length > 0 ) {
725
- module.debug('Hiding other modals', $otherModals);
726
- $visibleModals
727
- .modal('hide modal', callback, true)
728
- ;
729
- }
1311
+ return (returnedValue !== undefined)
1312
+ ? returnedValue
1313
+ : this;
1314
+ };
1315
+
1316
+ $.fn.modal.settings = {
1317
+
1318
+ name: 'Modal',
1319
+ namespace: 'modal',
1320
+
1321
+ useFlex: 'auto',
1322
+ offset: 0,
1323
+
1324
+ silent: false,
1325
+ debug: false,
1326
+ verbose: false,
1327
+ performance: true,
1328
+
1329
+ observeChanges: false,
1330
+
1331
+ allowMultiple: false,
1332
+ detachable: true,
1333
+ closable: true,
1334
+ autofocus: true,
1335
+ restoreFocus: true,
1336
+ autoShow: false,
1337
+
1338
+ inverted: false,
1339
+ blurring: false,
1340
+
1341
+ centered: true,
1342
+
1343
+ dimmerSettings: {
1344
+ closable: false,
1345
+ useCSS: true,
730
1346
  },
731
1347
 
732
- others: {
733
- active: function() {
734
- return ($otherModals.filter('.' + className.active).length > 0);
735
- },
736
- animating: function() {
737
- return ($otherModals.filter('.' + className.animating).length > 0);
738
- }
1348
+ // whether to use keyboard shortcuts
1349
+ keyboardShortcuts: true,
1350
+
1351
+ context: 'body',
1352
+
1353
+ queue: false,
1354
+ duration: 500,
1355
+ transition: 'scale',
1356
+
1357
+ // padding with edge of page
1358
+ padding: 50,
1359
+ scrollbarWidth: 10,
1360
+
1361
+ // dynamic content
1362
+ title: '',
1363
+ content: '',
1364
+ class: '',
1365
+ classTitle: '',
1366
+ classContent: '',
1367
+ classActions: '',
1368
+ closeIcon: false,
1369
+ actions: false,
1370
+ preserveHTML: true,
1371
+
1372
+ fields: {
1373
+ class: 'class',
1374
+ text: 'text',
1375
+ icon: 'icon',
1376
+ click: 'click',
739
1377
  },
740
1378
 
1379
+ // called before show animation
1380
+ onShow: function () {},
741
1381
 
742
- add: {
743
- keyboardShortcuts: function() {
744
- module.verbose('Adding keyboard shortcuts');
745
- $document
746
- .on('keydown' + eventNamespace, module.event.keyboard)
747
- ;
748
- }
1382
+ // called after show animation
1383
+ onVisible: function () {},
1384
+
1385
+ // called before hide animation
1386
+ onHide: function () {
1387
+ return true;
749
1388
  },
750
1389
 
751
- save: {
752
- focus: function() {
753
- var
754
- $activeElement = $(document.activeElement),
755
- inCurrentModal = $activeElement.closest($module).length > 0
756
- ;
757
- if(!inCurrentModal) {
758
- $focusedElement = $(document.activeElement).blur();
759
- }
760
- },
761
- bodyMargin: function() {
762
- initialBodyMargin = $context.css((isBody ? 'margin-':'padding-')+(module.can.leftBodyScrollbar() ? 'left':'right'));
763
- var bodyMarginRightPixel = parseInt(initialBodyMargin.replace(/[^\d.]/g, '')),
764
- bodyScrollbarWidth = isBody ? window.innerWidth - document.documentElement.clientWidth : $context[0].offsetWidth - $context[0].clientWidth;
765
- tempBodyMargin = bodyMarginRightPixel + bodyScrollbarWidth;
766
- }
1390
+ // called after hide animation
1391
+ onHidden: false,
1392
+
1393
+ // called after approve selector match
1394
+ onApprove: function () {
1395
+ return true;
767
1396
  },
768
1397
 
769
- restore: {
770
- focus: function() {
771
- if($focusedElement && $focusedElement.length > 0 && settings.restoreFocus) {
772
- $focusedElement.focus();
773
- }
774
- },
775
- bodyMargin: function() {
776
- var position = module.can.leftBodyScrollbar() ? 'left':'right';
777
- $context.css((isBody ? 'margin-':'padding-')+position, initialBodyMargin);
778
- $context.find(selector.bodyFixed.replace('right',position)).each(function(){
779
- var el = $(this),
780
- attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
781
- ;
782
- el.css(attribute, '');
783
- });
784
- }
1398
+ // called after deny selector match
1399
+ onDeny: function () {
1400
+ return true;
785
1401
  },
786
1402
 
787
- remove: {
788
- active: function() {
789
- $module.removeClass(className.active);
790
- },
791
- legacy: function() {
792
- $module.removeClass(className.legacy);
793
- },
794
- clickaway: function() {
795
- if (!settings.detachable) {
796
- $module
797
- .off('mousedown' + elementEventNamespace)
798
- ;
799
- }
800
- $dimmer
801
- .off('mousedown' + elementEventNamespace)
802
- ;
803
- $dimmer
804
- .off('mouseup' + elementEventNamespace)
805
- ;
806
- },
807
- dimmerStyles: function() {
808
- $dimmer.removeClass(className.inverted);
809
- $dimmable.removeClass(className.blurring);
810
- },
811
- bodyStyle: function() {
812
- if($context.attr('style') === '') {
813
- module.verbose('Removing style attribute');
814
- $context.removeAttr('style');
815
- }
816
- },
817
- screenHeight: function() {
818
- module.debug('Removing page height');
819
- $context
820
- .css('height', '')
821
- ;
822
- module.remove.bodyStyle()
823
- },
824
- keyboardShortcuts: function() {
825
- module.verbose('Removing keyboard shortcuts');
826
- $document
827
- .off('keydown' + eventNamespace)
828
- ;
829
- },
830
- scrolling: function() {
831
- if(!keepScrollingClass) {
832
- $dimmable.removeClass(className.scrolling);
833
- }
834
- $module.removeClass(className.scrolling);
835
- }
1403
+ keys: {
1404
+ space: 32,
1405
+ enter: 13,
1406
+ escape: 27,
1407
+ tab: 9,
836
1408
  },
837
1409
 
838
- cacheSizes: function() {
839
- $module.addClass(className.loading);
840
- var
841
- scrollHeight = $module.prop('scrollHeight'),
842
- modalWidth = $module.outerWidth(),
843
- modalHeight = $module.outerHeight()
844
- ;
845
- if(module.cache.pageHeight === undefined || modalHeight !== 0) {
846
- $.extend(module.cache, {
847
- pageHeight : $document.outerHeight(),
848
- width : modalWidth,
849
- height : modalHeight + settings.offset,
850
- scrollHeight : scrollHeight + settings.offset,
851
- contextHeight : isBody
852
- ? $window.height()
853
- : $dimmable.height(),
854
- });
855
- module.cache.topOffset = -(module.cache.height / 2);
856
- }
857
- $module.removeClass(className.loading);
858
- module.debug('Caching modal and container sizes', module.cache);
1410
+ selector: {
1411
+ title: '> .header',
1412
+ content: '> .content',
1413
+ actions: '> .actions',
1414
+ close: '> .close',
1415
+ closeIcon: '> .close',
1416
+ approve: '.actions .positive, .actions .approve, .actions .ok',
1417
+ deny: '.actions .negative, .actions .deny, .actions .cancel',
1418
+ modal: '.ui.modal',
1419
+ dimmer: '> .ui.dimmer',
1420
+ bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1421
+ prompt: '.ui.input > input',
859
1422
  },
860
- helpers: {
861
- deQuote: function(string) {
862
- return String(string).replace(/"/g,"");
863
- },
864
- escape: function(string, preserveHTML) {
865
- if (preserveHTML){
866
- return string;
867
- }
868
- var
869
- badChars = /[<>"'`]/g,
870
- shouldEscape = /[&<>"'`]/,
871
- escape = {
872
- "<": "&lt;",
873
- ">": "&gt;",
874
- '"': "&quot;",
875
- "'": "&#x27;",
876
- "`": "&#x60;"
877
- },
878
- escapedChar = function(chr) {
879
- return escape[chr];
880
- }
881
- ;
882
- if(shouldEscape.test(string)) {
883
- string = string.replace(/&(?![a-z0-9#]{1,12};)/gi, "&amp;");
884
- return string.replace(badChars, escapedChar);
885
- }
886
- return string;
887
- }
1423
+ error: {
1424
+ dimmer: 'UI Dimmer, a required component is not included in this page',
1425
+ method: 'The method you called is not defined.',
1426
+ notFound: 'The element you specified could not be found',
888
1427
  },
889
- can: {
890
- leftBodyScrollbar: function(){
891
- if(module.cache.leftBodyScrollbar === undefined) {
892
- module.cache.leftBodyScrollbar = module.is.rtl() && ((module.is.iframe && !module.is.firefox()) || module.is.safari() || module.is.edge() || module.is.ie());
893
- }
894
- return module.cache.leftBodyScrollbar;
895
- },
896
- useFlex: function() {
897
- if (settings.useFlex === 'auto') {
898
- return settings.detachable && !module.is.ie();
899
- }
900
- if(settings.useFlex && module.is.ie()) {
901
- module.debug('useFlex true is not supported in IE');
902
- } else if(settings.useFlex && !settings.detachable) {
903
- module.debug('useFlex true in combination with detachable false is not supported');
904
- }
905
- return settings.useFlex;
906
- },
907
- fit: function() {
908
- var
909
- contextHeight = module.cache.contextHeight,
910
- verticalCenter = module.cache.contextHeight / 2,
911
- topOffset = module.cache.topOffset,
912
- scrollHeight = module.cache.scrollHeight,
913
- height = module.cache.height,
914
- paddingHeight = settings.padding,
915
- startPosition = (verticalCenter + topOffset)
916
- ;
917
- return (scrollHeight > height)
918
- ? (startPosition + scrollHeight + paddingHeight < contextHeight)
919
- : (height + (paddingHeight * 2) < contextHeight)
920
- ;
921
- }
1428
+ className: {
1429
+ active: 'active',
1430
+ animating: 'animating',
1431
+ blurring: 'blurring',
1432
+ inverted: 'inverted',
1433
+ legacy: 'legacy',
1434
+ loading: 'loading',
1435
+ scrolling: 'scrolling',
1436
+ undetached: 'undetached',
1437
+ front: 'front',
1438
+ close: 'close icon',
1439
+ button: 'ui button',
1440
+ modal: 'ui modal',
1441
+ title: 'header',
1442
+ content: 'content',
1443
+ actions: 'actions',
1444
+ template: 'ui tiny modal',
1445
+ ok: 'positive',
1446
+ cancel: 'negative',
1447
+ prompt: 'ui fluid input',
1448
+ innerDimmer: 'ui inverted dimmer',
922
1449
  },
923
- has: {
924
- configActions: function () {
925
- return Array.isArray(settings.actions) && settings.actions.length > 0;
926
- },
927
- scrollbar: function() {
928
- return isBody || $context.css('overflow-y') !== 'hidden';
929
- }
1450
+ text: {
1451
+ ok: 'Ok',
1452
+ cancel: 'Cancel',
1453
+ close: 'Close',
930
1454
  },
931
- is: {
932
- active: function() {
933
- return $module.hasClass(className.active);
934
- },
935
- ie: function() {
936
- if(module.cache.isIE === undefined) {
937
- var
938
- isIE11 = (!(window.ActiveXObject) && 'ActiveXObject' in window),
939
- isIE = ('ActiveXObject' in window)
940
- ;
941
- module.cache.isIE = (isIE11 || isIE);
942
- }
943
- return module.cache.isIE;
944
- },
945
- animating: function() {
946
- return $module.transition('is supported')
947
- ? $module.transition('is animating')
948
- : $module.is(':visible')
949
- ;
950
- },
951
- scrolling: function() {
952
- return $dimmable.hasClass(className.scrolling);
953
- },
954
- modernBrowser: function() {
955
- // appName for IE11 reports 'Netscape' can no longer use
956
- return !(window.ActiveXObject || 'ActiveXObject' in window);
957
- },
958
- rtl: function() {
959
- if(module.cache.isRTL === undefined) {
960
- 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';
961
- }
962
- return module.cache.isRTL;
963
- },
964
- safari: function() {
965
- if(module.cache.isSafari === undefined) {
966
- module.cache.isSafari = /constructor/i.test(window.HTMLElement) || !!window.ApplePaySession;
967
- }
968
- return module.cache.isSafari;
969
- },
970
- edge: function(){
971
- if(module.cache.isEdge === undefined) {
972
- module.cache.isEdge = !!window.setImmediate && !module.is.ie();
973
- }
974
- return module.cache.isEdge;
975
- },
976
- firefox: function(){
977
- if(module.cache.isFirefox === undefined) {
978
- module.cache.isFirefox = !!window.InstallTrigger;
1455
+ };
1456
+
1457
+ $.fn.modal.settings.templates = {
1458
+ getArguments: function (args) {
1459
+ var queryArguments = [].slice.call(args);
1460
+ if ($.isPlainObject(queryArguments[0])) {
1461
+ return $.extend({
1462
+ handler: function () {},
1463
+ content: '',
1464
+ title: '',
1465
+ }, queryArguments[0]);
1466
+ } else {
1467
+ if (!isFunction(queryArguments[queryArguments.length - 1])) {
1468
+ queryArguments.push(function () {});
1469
+ }
1470
+
1471
+ return {
1472
+ handler: queryArguments.pop(),
1473
+ content: queryArguments.pop() || '',
1474
+ title: queryArguments.pop() || '',
1475
+ };
979
1476
  }
980
- return module.cache.isFirefox;
981
- },
982
- iframe: function() {
983
- return !(self === top);
984
- }
985
1477
  },
986
-
987
- set: {
988
- autofocus: function() {
1478
+ alert: function () {
989
1479
  var
990
- $autofocus = $inputs.filter('[autofocus]'),
991
- $input = ($autofocus.length > 0)
992
- ? $autofocus.first()
993
- : ($inputs.length > 1 ? $inputs.filter(':not(i.close)') : $inputs).first()
994
- ;
995
- if($input.length > 0) {
996
- $input.focus();
997
- }
998
- },
999
- bodyMargin: function() {
1000
- var position = module.can.leftBodyScrollbar() ? 'left':'right';
1001
- if(settings.detachable || module.can.fit()) {
1002
- $context.css((isBody ? 'margin-':'padding-')+position, tempBodyMargin + 'px');
1003
- }
1004
- $context.find(selector.bodyFixed.replace('right',position)).each(function(){
1005
- var el = $(this),
1006
- attribute = el.css('position') === 'fixed' ? 'padding-'+position : position
1007
- ;
1008
- el.css(attribute, 'calc(' + el.css(attribute) + ' + ' + tempBodyMargin + 'px)');
1009
- });
1010
- },
1011
- clickaway: function() {
1012
- if (!settings.detachable) {
1013
- $module
1014
- .on('mousedown' + elementEventNamespace, module.event.mousedown)
1015
- ;
1016
- }
1017
- $dimmer
1018
- .on('mousedown' + elementEventNamespace, module.event.mousedown)
1019
- ;
1020
- $dimmer
1021
- .on('mouseup' + elementEventNamespace, module.event.mouseup)
1480
+ settings = this.get.settings(),
1481
+ args = settings.templates.getArguments(arguments),
1482
+ approveFn = args.handler
1022
1483
  ;
1023
- },
1024
- dimmerSettings: function() {
1025
- if($.fn.dimmer === undefined) {
1026
- module.error(error.dimmer);
1027
- return;
1028
- }
1484
+
1485
+ return {
1486
+ title: args.title,
1487
+ content: args.content,
1488
+ onApprove: approveFn,
1489
+ actions: [{
1490
+ text: settings.text.ok,
1491
+ class: settings.className.ok,
1492
+ click: approveFn,
1493
+ }],
1494
+ };
1495
+ },
1496
+ confirm: function () {
1029
1497
  var
1030
- defaultSettings = {
1031
- debug : settings.debug,
1032
- dimmerName : 'modals',
1033
- closable : 'auto',
1034
- useFlex : module.can.useFlex(),
1035
- duration : {
1036
- show : settings.transition.showDuration || settings.duration,
1037
- hide : settings.transition.hideDuration || settings.duration
1498
+ settings = this.get.settings(),
1499
+ args = settings.templates.getArguments(arguments),
1500
+ approveFn = function () {
1501
+ args.handler(true);
1502
+ },
1503
+ denyFn = function () {
1504
+ args.handler(false);
1038
1505
  }
1039
- },
1040
- dimmerSettings = $.extend(true, defaultSettings, settings.dimmerSettings)
1041
1506
  ;
1042
- if(settings.inverted) {
1043
- dimmerSettings.variation = (dimmerSettings.variation !== undefined)
1044
- ? dimmerSettings.variation + ' inverted'
1045
- : 'inverted'
1046
- ;
1047
- }
1048
- $context.dimmer('setting', dimmerSettings);
1049
- },
1050
- dimmerStyles: function() {
1051
- if(settings.inverted) {
1052
- $dimmer.addClass(className.inverted);
1053
- }
1054
- else {
1055
- $dimmer.removeClass(className.inverted);
1056
- }
1057
- if(settings.blurring) {
1058
- $dimmable.addClass(className.blurring);
1059
- }
1060
- else {
1061
- $dimmable.removeClass(className.blurring);
1062
- }
1063
- },
1064
- modalOffset: function() {
1065
- if (!settings.detachable) {
1066
- var canFit = module.can.fit();
1067
- $module
1068
- .css({
1069
- top: (!$module.hasClass('aligned') && canFit)
1070
- ? $document.scrollTop() + (module.cache.contextHeight - module.cache.height) / 2
1071
- : !canFit || $module.hasClass('top')
1072
- ? $document.scrollTop() + settings.padding
1073
- : $document.scrollTop() + (module.cache.contextHeight - module.cache.height - settings.padding),
1074
- marginLeft: -(module.cache.width / 2)
1075
- })
1076
- ;
1077
- } else {
1078
- $module
1079
- .css({
1080
- marginTop: (!$module.hasClass('aligned') && module.can.fit())
1081
- ? -(module.cache.height / 2)
1082
- : settings.padding / 2,
1083
- marginLeft: -(module.cache.width / 2)
1084
- })
1085
- ;
1086
- }
1087
- module.verbose('Setting modal offset for legacy mode');
1088
- },
1089
- screenHeight: function() {
1090
- if( module.can.fit() ) {
1091
- $context.css('height', '');
1092
- }
1093
- else if(!$module.hasClass('bottom')) {
1094
- module.debug('Modal is taller than page content, resizing page height');
1095
- $context
1096
- .css('height', module.cache.height + (settings.padding * 2) )
1097
- ;
1098
- }
1099
- },
1100
- active: function() {
1101
- $module.addClass(className.active + ' ' + className.front);
1102
- $otherModals.filter('.' + className.active).removeClass(className.front);
1103
- },
1104
- scrolling: function() {
1105
- $dimmable.addClass(className.scrolling);
1106
- $module.addClass(className.scrolling);
1107
- module.unbind.scrollLock();
1108
- },
1109
- legacy: function() {
1110
- $module.addClass(className.legacy);
1111
- },
1112
- type: function() {
1113
- if(module.can.fit()) {
1114
- module.verbose('Modal fits on screen');
1115
- if(!module.others.active() && !module.others.animating()) {
1116
- module.remove.scrolling();
1117
- module.bind.scrollLock();
1118
- }
1119
- }
1120
- else if (!$module.hasClass('bottom')){
1121
- module.verbose('Modal cannot fit on screen setting to scrolling');
1122
- module.set.scrolling();
1123
- } else {
1124
- module.verbose('Bottom aligned modal not fitting on screen is unsupported for scrolling');
1125
- }
1126
- },
1127
- undetached: function() {
1128
- $dimmable.addClass(className.undetached);
1129
- }
1130
- },
1131
1507
 
1132
- setting: function(name, value) {
1133
- module.debug('Changing setting', name, value);
1134
- if( $.isPlainObject(name) ) {
1135
- $.extend(true, settings, name);
1136
- }
1137
- else if(value !== undefined) {
1138
- if($.isPlainObject(settings[name])) {
1139
- $.extend(true, settings[name], value);
1140
- }
1141
- else {
1142
- settings[name] = value;
1143
- }
1144
- }
1145
- else {
1146
- return settings[name];
1147
- }
1148
- },
1149
- internal: function(name, value) {
1150
- if( $.isPlainObject(name) ) {
1151
- $.extend(true, module, name);
1152
- }
1153
- else if(value !== undefined) {
1154
- module[name] = value;
1155
- }
1156
- else {
1157
- return module[name];
1158
- }
1159
- },
1160
- debug: function() {
1161
- if(!settings.silent && settings.debug) {
1162
- if(settings.performance) {
1163
- module.performance.log(arguments);
1164
- }
1165
- else {
1166
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
1167
- module.debug.apply(console, arguments);
1168
- }
1169
- }
1170
- },
1171
- verbose: function() {
1172
- if(!settings.silent && settings.verbose && settings.debug) {
1173
- if(settings.performance) {
1174
- module.performance.log(arguments);
1175
- }
1176
- else {
1177
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
1178
- module.verbose.apply(console, arguments);
1179
- }
1180
- }
1508
+ return {
1509
+ title: args.title,
1510
+ content: args.content,
1511
+ onApprove: approveFn,
1512
+ onDeny: denyFn,
1513
+ actions: [{
1514
+ text: settings.text.ok,
1515
+ class: settings.className.ok,
1516
+ click: approveFn,
1517
+ }, {
1518
+ text: settings.text.cancel,
1519
+ class: settings.className.cancel,
1520
+ click: denyFn,
1521
+ }],
1522
+ };
1181
1523
  },
1182
- error: function() {
1183
- if(!settings.silent) {
1184
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
1185
- module.error.apply(console, arguments);
1186
- }
1187
- },
1188
- performance: {
1189
- log: function(message) {
1190
- var
1191
- currentTime,
1192
- executionTime,
1193
- previousTime
1194
- ;
1195
- if(settings.performance) {
1196
- currentTime = new Date().getTime();
1197
- previousTime = time || currentTime;
1198
- executionTime = currentTime - previousTime;
1199
- time = currentTime;
1200
- performance.push({
1201
- 'Name' : message[0],
1202
- 'Arguments' : [].slice.call(message, 1) || '',
1203
- 'Element' : element,
1204
- 'Execution Time' : executionTime
1205
- });
1206
- }
1207
- clearTimeout(module.performance.timer);
1208
- module.performance.timer = setTimeout(module.performance.display, 500);
1209
- },
1210
- display: function() {
1524
+ prompt: function () {
1211
1525
  var
1212
- title = settings.name + ':',
1213
- totalTime = 0
1526
+ $this = this,
1527
+ settings = this.get.settings(),
1528
+ args = settings.templates.getArguments(arguments),
1529
+ input = $($.parseHTML(args.content)).filter('.ui.input'),
1530
+ approveFn = function () {
1531
+ var
1532
+ settings = $this.get.settings(),
1533
+ inputField = $this.get.element().find(settings.selector.prompt)[0]
1534
+ ;
1535
+ args.handler($(inputField).val());
1536
+ },
1537
+ denyFn = function () {
1538
+ args.handler(null);
1539
+ }
1214
1540
  ;
1215
- time = false;
1216
- clearTimeout(module.performance.timer);
1217
- $.each(performance, function(index, data) {
1218
- totalTime += data['Execution Time'];
1219
- });
1220
- title += ' ' + totalTime + 'ms';
1221
- if(moduleSelector) {
1222
- title += ' \'' + moduleSelector + '\'';
1223
- }
1224
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
1225
- console.groupCollapsed(title);
1226
- if(console.table) {
1227
- console.table(performance);
1228
- }
1229
- else {
1230
- $.each(performance, function(index, data) {
1231
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
1232
- });
1233
- }
1234
- console.groupEnd();
1235
- }
1236
- performance = [];
1237
- }
1541
+ if (input.length === 0) {
1542
+ args.content += '<p><div class="' + this.helpers.deQuote(settings.className.prompt) + '"><input placeholder="' + this.helpers.deQuote(args.placeholder || '') + '" type="text" value="' + this.helpers.deQuote(args.defaultValue || '') + '"></div></p>';
1543
+ }
1544
+
1545
+ return {
1546
+ title: args.title,
1547
+ content: args.content,
1548
+ onApprove: approveFn,
1549
+ onDeny: denyFn,
1550
+ actions: [{
1551
+ text: settings.text.ok,
1552
+ class: settings.className.ok,
1553
+ click: approveFn,
1554
+ }, {
1555
+ text: settings.text.cancel,
1556
+ class: settings.className.cancel,
1557
+ click: denyFn,
1558
+ }],
1559
+ };
1238
1560
  },
1239
- invoke: function(query, passedArguments, context) {
1240
- var
1241
- object = instance,
1242
- maxDepth,
1243
- found,
1244
- response
1245
- ;
1246
- passedArguments = passedArguments || queryArguments;
1247
- context = context || element;
1248
- if(typeof query == 'string' && object !== undefined) {
1249
- query = query.split(/[\. ]/);
1250
- maxDepth = query.length - 1;
1251
- $.each(query, function(depth, value) {
1252
- var camelCaseValue = (depth != maxDepth)
1253
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
1254
- : query
1255
- ;
1256
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
1257
- object = object[camelCaseValue];
1258
- }
1259
- else if( object[camelCaseValue] !== undefined ) {
1260
- found = object[camelCaseValue];
1261
- return false;
1262
- }
1263
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
1264
- object = object[value];
1265
- }
1266
- else if( object[value] !== undefined ) {
1267
- found = object[value];
1268
- return false;
1269
- }
1270
- else {
1271
- return false;
1272
- }
1273
- });
1274
- }
1275
- if ( $.isFunction( found ) ) {
1276
- response = found.apply(context, passedArguments);
1277
- }
1278
- else if(found !== undefined) {
1279
- response = found;
1280
- }
1281
- if(Array.isArray(returnedValue)) {
1282
- returnedValue.push(response);
1283
- }
1284
- else if(returnedValue !== undefined) {
1285
- returnedValue = [returnedValue, response];
1286
- }
1287
- else if(response !== undefined) {
1288
- returnedValue = response;
1289
- }
1290
- return found;
1291
- }
1292
- };
1293
-
1294
- if(methodInvoked) {
1295
- if(instance === undefined) {
1296
- if ($.isFunction(settings.templates[query])) {
1297
- settings.autoShow = true;
1298
- settings.className.modal = settings.className.template;
1299
- settings = $.extend(true, {}, settings, settings.templates[query].apply(module ,queryArguments));
1300
-
1301
- // reassign shortcuts
1302
- className = settings.className;
1303
- namespace = settings.namespace;
1304
- fields = settings.fields;
1305
- error = settings.error;
1306
- }
1307
- module.initialize();
1308
- }
1309
- if (!$.isFunction(settings.templates[query])) {
1310
- module.invoke(query);
1311
- }
1312
- }
1313
- else {
1314
- if(instance !== undefined) {
1315
- instance.invoke('destroy');
1316
- }
1317
- module.initialize();
1318
- returnedValue = $module;
1319
- }
1320
- })
1321
- ;
1322
-
1323
- return (returnedValue !== undefined)
1324
- ? returnedValue
1325
- : this
1326
- ;
1327
- };
1328
-
1329
- $.fn.modal.settings = {
1330
-
1331
- name : 'Modal',
1332
- namespace : 'modal',
1333
-
1334
- useFlex : 'auto',
1335
- offset : 0,
1336
-
1337
- silent : false,
1338
- debug : false,
1339
- verbose : false,
1340
- performance : true,
1341
-
1342
- observeChanges : false,
1343
-
1344
- allowMultiple : false,
1345
- detachable : true,
1346
- closable : true,
1347
- autofocus : true,
1348
- restoreFocus : true,
1349
- autoShow : false,
1350
-
1351
- inverted : false,
1352
- blurring : false,
1353
-
1354
- centered : true,
1355
-
1356
- dimmerSettings : {
1357
- closable : false,
1358
- useCSS : true
1359
- },
1360
-
1361
- // whether to use keyboard shortcuts
1362
- keyboardShortcuts: true,
1363
-
1364
- context : 'body',
1365
-
1366
- queue : false,
1367
- duration : 500,
1368
- transition : 'scale',
1369
-
1370
- // padding with edge of page
1371
- padding : 50,
1372
- scrollbarWidth: 10,
1373
-
1374
- //dynamic content
1375
- title : '',
1376
- content : '',
1377
- class : '',
1378
- classTitle : '',
1379
- classContent : '',
1380
- classActions : '',
1381
- closeIcon : false,
1382
- actions : false,
1383
- preserveHTML : true,
1384
-
1385
- fields : {
1386
- class : 'class',
1387
- text : 'text',
1388
- icon : 'icon',
1389
- click : 'click'
1390
- },
1391
-
1392
- // called before show animation
1393
- onShow : function(){},
1394
-
1395
- // called after show animation
1396
- onVisible : function(){},
1397
-
1398
- // called before hide animation
1399
- onHide : function(){ return true; },
1400
-
1401
- // called after hide animation
1402
- onHidden : false,
1403
-
1404
- // called after approve selector match
1405
- onApprove : function(){ return true; },
1406
-
1407
- // called after deny selector match
1408
- onDeny : function(){ return true; },
1409
-
1410
- keys : {
1411
- space : 32,
1412
- enter : 13,
1413
- escape : 27,
1414
- tab : 9,
1415
- },
1416
-
1417
- selector : {
1418
- title : '> .header',
1419
- content : '> .content',
1420
- actions : '> .actions',
1421
- close : '> .close',
1422
- closeIcon: '> .close',
1423
- approve : '.actions .positive, .actions .approve, .actions .ok',
1424
- deny : '.actions .negative, .actions .deny, .actions .cancel',
1425
- modal : '.ui.modal',
1426
- dimmer : '> .ui.dimmer',
1427
- bodyFixed: '> .ui.fixed.menu, > .ui.right.toast-container, > .ui.right.sidebar, > .ui.fixed.nag, > .ui.fixed.nag > .close',
1428
- prompt : '.ui.input > input'
1429
- },
1430
- error : {
1431
- dimmer : 'UI Dimmer, a required component is not included in this page',
1432
- method : 'The method you called is not defined.',
1433
- notFound : 'The element you specified could not be found'
1434
- },
1435
- className : {
1436
- active : 'active',
1437
- animating : 'animating',
1438
- blurring : 'blurring',
1439
- inverted : 'inverted',
1440
- legacy : 'legacy',
1441
- loading : 'loading',
1442
- scrolling : 'scrolling',
1443
- undetached : 'undetached',
1444
- front : 'front',
1445
- close : 'close icon',
1446
- button : 'ui button',
1447
- modal : 'ui modal',
1448
- title : 'header',
1449
- content : 'content',
1450
- actions : 'actions',
1451
- template : 'ui tiny modal',
1452
- ok : 'positive',
1453
- cancel : 'negative',
1454
- prompt : 'ui fluid input',
1455
- innerDimmer: 'ui inverted dimmer'
1456
- },
1457
- text: {
1458
- ok : 'Ok',
1459
- cancel: 'Cancel',
1460
- close : 'Close'
1461
- }
1462
- };
1463
-
1464
- $.fn.modal.settings.templates = {
1465
- getArguments: function(args) {
1466
- var queryArguments = [].slice.call(args);
1467
- if($.isPlainObject(queryArguments[0])){
1468
- return $.extend({
1469
- handler:function(){},
1470
- content:'',
1471
- title: ''
1472
- }, queryArguments[0]);
1473
- } else {
1474
- if(!$.isFunction(queryArguments[queryArguments.length-1])) {
1475
- queryArguments.push(function() {});
1476
- }
1477
- return {
1478
- handler: queryArguments.pop(),
1479
- content: queryArguments.pop() || '',
1480
- title: queryArguments.pop() || ''
1481
- };
1482
- }
1483
- },
1484
- alert: function () {
1485
- var settings = this.get.settings(),
1486
- args = settings.templates.getArguments(arguments),
1487
- approveFn = args.handler
1488
- ;
1489
- return {
1490
- title : args.title,
1491
- content: args.content,
1492
- onApprove: approveFn,
1493
- actions: [{
1494
- text : settings.text.ok,
1495
- class: settings.className.ok,
1496
- click: approveFn
1497
- }]
1498
- }
1499
- },
1500
- confirm: function () {
1501
- var settings = this.get.settings(),
1502
- args = settings.templates.getArguments(arguments),
1503
- approveFn = function(){args.handler(true)},
1504
- denyFn = function(){args.handler(false)}
1505
- ;
1506
- return {
1507
- title : args.title,
1508
- content: args.content,
1509
- onApprove: approveFn,
1510
- onDeny: denyFn,
1511
- actions: [{
1512
- text : settings.text.ok,
1513
- class: settings.className.ok,
1514
- click: approveFn
1515
- },{
1516
- text: settings.text.cancel,
1517
- class: settings.className.cancel,
1518
- click: denyFn
1519
- }]
1520
- }
1521
- },
1522
- prompt: function () {
1523
- var $this = this,
1524
- settings = this.get.settings(),
1525
- args = settings.templates.getArguments(arguments),
1526
- input = $($.parseHTML(args.content)).filter('.ui.input'),
1527
- approveFn = function(){
1528
- var settings = $this.get.settings(),
1529
- inputField = $this.get.element().find(settings.selector.prompt)[0]
1530
- ;
1531
- args.handler($(inputField).val());
1532
- },
1533
- denyFn = function(){args.handler(null)}
1534
- ;
1535
- if (input.length === 0) {
1536
- args.content += '<p><div class="'+this.helpers.deQuote(settings.className.prompt)+'"><input placeholder="'+this.helpers.deQuote(args.placeholder || '')+'" type="text" value="'+this.helpers.deQuote(args.defaultValue || '')+'"></div></p>';
1537
- }
1538
- return {
1539
- title : args.title,
1540
- content: args.content,
1541
- onApprove: approveFn,
1542
- onDeny: denyFn,
1543
- actions: [{
1544
- text: settings.text.ok,
1545
- class: settings.className.ok,
1546
- click: approveFn
1547
- },{
1548
- text: settings.text.cancel,
1549
- class: settings.className.cancel,
1550
- click: denyFn
1551
- }]
1552
- }
1553
- }
1554
- }
1555
-
1556
- })( jQuery, window, document );
1561
+ };
1562
+ })(jQuery, window, document);