fomantic-ui 2.9.1-beta.17 → 2.9.1-beta.19

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 (252) hide show
  1. package/.eslintrc.js +109 -0
  2. package/.github/workflows/ci.yml +13 -3
  3. package/dist/components/accordion.css +1 -1
  4. package/dist/components/accordion.js +569 -598
  5. package/dist/components/accordion.min.css +1 -1
  6. package/dist/components/accordion.min.js +2 -2
  7. package/dist/components/ad.css +1 -1
  8. package/dist/components/ad.min.css +1 -1
  9. package/dist/components/api.js +1161 -1184
  10. package/dist/components/api.min.js +2 -2
  11. package/dist/components/breadcrumb.css +1 -1
  12. package/dist/components/breadcrumb.min.css +1 -1
  13. package/dist/components/button.css +1 -1
  14. package/dist/components/button.min.css +1 -1
  15. package/dist/components/calendar.css +1 -1
  16. package/dist/components/calendar.js +1895 -1818
  17. package/dist/components/calendar.min.css +1 -1
  18. package/dist/components/calendar.min.js +2 -2
  19. package/dist/components/card.css +1 -1
  20. package/dist/components/card.min.css +1 -1
  21. package/dist/components/checkbox.css +1 -1
  22. package/dist/components/checkbox.js +842 -841
  23. package/dist/components/checkbox.min.css +1 -1
  24. package/dist/components/checkbox.min.js +2 -2
  25. package/dist/components/comment.css +1 -1
  26. package/dist/components/comment.min.css +1 -1
  27. package/dist/components/container.css +3 -1
  28. package/dist/components/container.min.css +2 -2
  29. package/dist/components/dimmer.css +1 -1
  30. package/dist/components/dimmer.js +708 -737
  31. package/dist/components/dimmer.min.css +1 -1
  32. package/dist/components/dimmer.min.js +2 -2
  33. package/dist/components/divider.css +1 -1
  34. package/dist/components/divider.min.css +1 -1
  35. package/dist/components/dropdown.css +11 -8
  36. package/dist/components/dropdown.js +4161 -4238
  37. package/dist/components/dropdown.min.css +2 -2
  38. package/dist/components/dropdown.min.js +2 -2
  39. package/dist/components/embed.css +1 -1
  40. package/dist/components/embed.js +651 -675
  41. package/dist/components/embed.min.css +1 -1
  42. package/dist/components/embed.min.js +2 -2
  43. package/dist/components/feed.css +1 -1
  44. package/dist/components/feed.min.css +1 -1
  45. package/dist/components/flag.css +1 -1
  46. package/dist/components/flag.min.css +1 -1
  47. package/dist/components/flyout.css +6 -3
  48. package/dist/components/flyout.js +1464 -1467
  49. package/dist/components/flyout.min.css +2 -2
  50. package/dist/components/flyout.min.js +2 -2
  51. package/dist/components/form.css +1 -1
  52. package/dist/components/form.js +1979 -2004
  53. package/dist/components/form.min.css +1 -1
  54. package/dist/components/form.min.js +2 -2
  55. package/dist/components/grid.css +1 -1
  56. package/dist/components/grid.min.css +1 -1
  57. package/dist/components/header.css +1 -1
  58. package/dist/components/header.min.css +1 -1
  59. package/dist/components/icon.css +1 -1
  60. package/dist/components/icon.min.css +1 -1
  61. package/dist/components/image.css +1 -1
  62. package/dist/components/image.min.css +1 -1
  63. package/dist/components/input.css +1 -1
  64. package/dist/components/input.min.css +1 -1
  65. package/dist/components/item.css +1 -1
  66. package/dist/components/item.min.css +1 -1
  67. package/dist/components/label.css +1 -1
  68. package/dist/components/label.min.css +1 -1
  69. package/dist/components/list.css +1 -1
  70. package/dist/components/list.min.css +1 -1
  71. package/dist/components/loader.css +1 -1
  72. package/dist/components/loader.min.css +1 -1
  73. package/dist/components/message.css +1 -1
  74. package/dist/components/message.min.css +1 -1
  75. package/dist/components/modal.css +7 -1
  76. package/dist/components/modal.js +1491 -1487
  77. package/dist/components/modal.min.css +2 -2
  78. package/dist/components/modal.min.js +2 -2
  79. package/dist/components/nag.css +1 -1
  80. package/dist/components/nag.js +518 -529
  81. package/dist/components/nag.min.css +1 -1
  82. package/dist/components/nag.min.js +2 -2
  83. package/dist/components/placeholder.css +1 -1
  84. package/dist/components/placeholder.min.css +1 -1
  85. package/dist/components/popup.css +1 -1
  86. package/dist/components/popup.js +1437 -1456
  87. package/dist/components/popup.min.css +1 -1
  88. package/dist/components/popup.min.js +2 -2
  89. package/dist/components/progress.css +1 -1
  90. package/dist/components/progress.js +969 -997
  91. package/dist/components/progress.min.css +1 -1
  92. package/dist/components/progress.min.js +2 -2
  93. package/dist/components/rail.css +1 -1
  94. package/dist/components/rail.min.css +1 -1
  95. package/dist/components/rating.css +1 -1
  96. package/dist/components/rating.js +505 -523
  97. package/dist/components/rating.min.css +1 -1
  98. package/dist/components/rating.min.js +2 -2
  99. package/dist/components/reset.css +1 -1
  100. package/dist/components/reset.min.css +1 -1
  101. package/dist/components/reveal.css +1 -1
  102. package/dist/components/reveal.min.css +1 -1
  103. package/dist/components/search.css +3 -1
  104. package/dist/components/search.js +1498 -1534
  105. package/dist/components/search.min.css +2 -2
  106. package/dist/components/search.min.js +2 -2
  107. package/dist/components/segment.css +3 -1
  108. package/dist/components/segment.min.css +2 -2
  109. package/dist/components/shape.css +1 -1
  110. package/dist/components/shape.js +792 -809
  111. package/dist/components/shape.min.css +1 -1
  112. package/dist/components/shape.min.js +2 -2
  113. package/dist/components/sidebar.css +3 -1
  114. package/dist/components/sidebar.js +1071 -1098
  115. package/dist/components/sidebar.min.css +2 -2
  116. package/dist/components/sidebar.min.js +2 -2
  117. package/dist/components/site.css +1 -1
  118. package/dist/components/site.js +462 -471
  119. package/dist/components/site.min.css +1 -1
  120. package/dist/components/site.min.js +2 -2
  121. package/dist/components/slider.js +1287 -1311
  122. package/dist/components/slider.min.js +2 -2
  123. package/dist/components/state.js +639 -657
  124. package/dist/components/state.min.js +2 -2
  125. package/dist/components/statistic.css +1 -1
  126. package/dist/components/statistic.min.css +1 -1
  127. package/dist/components/step.css +1 -1
  128. package/dist/components/step.min.css +1 -1
  129. package/dist/components/sticky.css +1 -1
  130. package/dist/components/sticky.js +857 -903
  131. package/dist/components/sticky.min.css +1 -1
  132. package/dist/components/sticky.min.js +2 -2
  133. package/dist/components/tab.css +1 -1
  134. package/dist/components/tab.js +922 -963
  135. package/dist/components/tab.min.css +1 -1
  136. package/dist/components/tab.min.js +2 -2
  137. package/dist/components/table.css +5 -1
  138. package/dist/components/table.min.css +2 -2
  139. package/dist/components/text.css +1 -1
  140. package/dist/components/text.min.css +1 -1
  141. package/dist/components/toast.css +1 -1
  142. package/dist/components/toast.js +886 -890
  143. package/dist/components/toast.min.css +1 -1
  144. package/dist/components/toast.min.js +2 -2
  145. package/dist/components/transition.css +1 -1
  146. package/dist/components/transition.js +1041 -1077
  147. package/dist/components/transition.min.css +1 -1
  148. package/dist/components/transition.min.js +2 -2
  149. package/dist/components/visibility.js +1220 -1244
  150. package/dist/components/visibility.min.js +2 -2
  151. package/dist/semantic.css +84 -60
  152. package/dist/semantic.js +28949 -29435
  153. package/dist/semantic.min.css +2 -2
  154. package/dist/semantic.min.js +2 -2
  155. package/examples/assets/show-examples.js +13 -13
  156. package/gulpfile.js +9 -10
  157. package/package.json +5 -2
  158. package/scripts/nightly-version.js +81 -75
  159. package/src/definitions/behaviors/api.js +1162 -1185
  160. package/src/definitions/behaviors/form.js +1978 -2003
  161. package/src/definitions/behaviors/state.js +645 -663
  162. package/src/definitions/behaviors/visibility.js +1219 -1243
  163. package/src/definitions/collections/table.less +2 -0
  164. package/src/definitions/elements/container.less +1 -0
  165. package/src/definitions/elements/segment.less +1 -0
  166. package/src/definitions/globals/site.js +461 -470
  167. package/src/definitions/modules/accordion.js +568 -597
  168. package/src/definitions/modules/calendar.js +1894 -1817
  169. package/src/definitions/modules/checkbox.js +841 -840
  170. package/src/definitions/modules/dimmer.js +707 -736
  171. package/src/definitions/modules/dropdown.js +4160 -4237
  172. package/src/definitions/modules/dropdown.less +5 -8
  173. package/src/definitions/modules/embed.js +650 -674
  174. package/src/definitions/modules/flyout.js +1463 -1466
  175. package/src/definitions/modules/flyout.less +15 -12
  176. package/src/definitions/modules/modal.js +1490 -1486
  177. package/src/definitions/modules/modal.less +3 -0
  178. package/src/definitions/modules/nag.js +517 -528
  179. package/src/definitions/modules/popup.js +1436 -1455
  180. package/src/definitions/modules/progress.js +968 -996
  181. package/src/definitions/modules/rating.js +504 -522
  182. package/src/definitions/modules/search.js +1497 -1533
  183. package/src/definitions/modules/search.less +1 -0
  184. package/src/definitions/modules/shape.js +791 -808
  185. package/src/definitions/modules/sidebar.js +1070 -1097
  186. package/src/definitions/modules/sidebar.less +1 -0
  187. package/src/definitions/modules/slider.js +1286 -1310
  188. package/src/definitions/modules/sticky.js +873 -919
  189. package/src/definitions/modules/tab.js +921 -962
  190. package/src/definitions/modules/toast.js +885 -889
  191. package/src/definitions/modules/transition.js +1040 -1076
  192. package/src/themes/default/elements/container.variables +0 -7
  193. package/src/themes/default/elements/segment.variables +0 -7
  194. package/src/themes/default/globals/site.variables +7 -0
  195. package/src/themes/default/globals/variation.variables +1 -0
  196. package/tasks/admin/components/create.js +274 -276
  197. package/tasks/admin/components/init.js +123 -130
  198. package/tasks/admin/components/update.js +149 -157
  199. package/tasks/admin/distributions/create.js +184 -187
  200. package/tasks/admin/distributions/init.js +123 -130
  201. package/tasks/admin/distributions/update.js +145 -152
  202. package/tasks/admin/publish.js +5 -7
  203. package/tasks/admin/register.js +36 -38
  204. package/tasks/admin/release.js +8 -10
  205. package/tasks/build/assets.js +42 -39
  206. package/tasks/build/css.js +225 -216
  207. package/tasks/build/javascript.js +118 -113
  208. package/tasks/build.js +10 -10
  209. package/tasks/check-install.js +14 -16
  210. package/tasks/clean.js +5 -5
  211. package/tasks/collections/admin.js +34 -36
  212. package/tasks/collections/build.js +18 -20
  213. package/tasks/collections/docs.js +9 -11
  214. package/tasks/collections/install.js +9 -11
  215. package/tasks/collections/rtl.js +9 -11
  216. package/tasks/collections/various.js +8 -10
  217. package/tasks/config/admin/github.js +17 -17
  218. package/tasks/config/admin/oauth.example.js +4 -4
  219. package/tasks/config/admin/release.js +98 -98
  220. package/tasks/config/admin/templates/component-package.js +9 -10
  221. package/tasks/config/admin/templates/css-package.js +18 -20
  222. package/tasks/config/admin/templates/less-package.js +11 -13
  223. package/tasks/config/defaults.js +116 -116
  224. package/tasks/config/docs.js +23 -23
  225. package/tasks/config/npm/gulpfile.js +8 -9
  226. package/tasks/config/project/config.js +127 -134
  227. package/tasks/config/project/install.js +715 -713
  228. package/tasks/config/project/release.js +32 -38
  229. package/tasks/config/tasks.js +163 -164
  230. package/tasks/config/user.js +23 -29
  231. package/tasks/docs/build.js +97 -95
  232. package/tasks/docs/metadata.js +90 -96
  233. package/tasks/docs/serve.js +80 -81
  234. package/tasks/install.js +370 -378
  235. package/tasks/rtl/build.js +2 -2
  236. package/tasks/rtl/watch.js +2 -2
  237. package/tasks/version.js +4 -4
  238. package/tasks/watch.js +28 -30
  239. package/test/meteor/assets.js +10 -13
  240. package/test/meteor/fonts.js +12 -13
  241. package/test/modules/accordion.spec.js +6 -8
  242. package/test/modules/checkbox.spec.js +5 -7
  243. package/test/modules/dropdown.spec.js +5 -7
  244. package/test/modules/modal.spec.js +6 -8
  245. package/test/modules/module.spec.js +158 -178
  246. package/test/modules/popup.spec.js +5 -7
  247. package/test/modules/search.spec.js +5 -7
  248. package/test/modules/shape.spec.js +5 -7
  249. package/test/modules/sidebar.spec.js +5 -7
  250. package/test/modules/tab.spec.js +6 -8
  251. package/test/modules/transition.spec.js +5 -7
  252. package/test/modules/video.spec.js +5 -7
@@ -8,554 +8,543 @@
8
8
  *
9
9
  */
10
10
 
11
- ;(function ($, window, document, undefined) {
12
-
13
- 'use strict';
14
-
15
- function isFunction(obj) {
16
- return typeof obj === "function" && typeof obj.nodeType !== "number";
17
- }
18
-
19
- window = (typeof window != 'undefined' && window.Math == Math)
20
- ? window
21
- : (typeof self != 'undefined' && self.Math == Math)
22
- ? self
23
- : Function('return this')()
24
- ;
25
-
26
- $.fn.nag = function(parameters) {
27
- var
28
- $allModules = $(this),
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
- returnedValue
38
- ;
39
- $allModules
40
- .each(function() {
41
- var
42
- settings = ( $.isPlainObject(parameters) )
43
- ? $.extend(true, {}, $.fn.nag.settings, parameters)
44
- : $.extend({}, $.fn.nag.settings),
45
-
46
- selector = settings.selector,
47
- error = settings.error,
48
- namespace = settings.namespace,
49
-
50
- eventNamespace = '.' + namespace,
51
- moduleNamespace = namespace + '-module',
52
-
53
- $module = $(this),
54
-
55
- $context = (settings.context)
56
- ? ([window,document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
57
- : $('body'),
58
-
59
- element = this,
60
- instance = $module.data(moduleNamespace),
61
- storage,
62
- module
63
- ;
64
- module = {
65
-
66
- initialize: function() {
67
- module.verbose('Initializing element');
68
- if(typeof settings.value !== 'string') {
69
- settings.value = JSON.stringify(settings.value);
70
- }
71
- storage = module.get.storage();
72
- $module
73
- .on('click' + eventNamespace, selector.close, module.dismiss)
74
- .data(moduleNamespace, module)
75
- ;
76
-
77
- if(settings.detachable && $module.parent()[0] !== $context[0]) {
78
- $module
79
- .detach()
80
- .prependTo($context)
81
- ;
82
- }
11
+ (function ($, window, document, undefined) {
12
+ 'use strict';
13
+
14
+ function isFunction(obj) {
15
+ return typeof obj === 'function' && typeof obj.nodeType !== 'number';
16
+ }
17
+
18
+ window = (typeof window != 'undefined' && window.Math == Math)
19
+ ? window
20
+ : globalThis;
21
+
22
+ $.fn.nag = function (parameters) {
23
+ var
24
+ $allModules = $(this),
25
+ moduleSelector = $allModules.selector || '',
26
+
27
+ time = new Date().getTime(),
28
+ performance = [],
29
+
30
+ query = arguments[0],
31
+ methodInvoked = (typeof query == 'string'),
32
+ queryArguments = [].slice.call(arguments, 1),
33
+ returnedValue
34
+ ;
35
+ $allModules.each(function () {
36
+ var
37
+ settings = ($.isPlainObject(parameters))
38
+ ? $.extend(true, {}, $.fn.nag.settings, parameters)
39
+ : $.extend({}, $.fn.nag.settings),
83
40
 
84
- if(settings.displayTime > 0) {
85
- setTimeout(module.hide, settings.displayTime);
86
- }
87
- module.show();
88
- },
41
+ selector = settings.selector,
42
+ error = settings.error,
43
+ namespace = settings.namespace,
89
44
 
90
- destroy: function() {
91
- module.verbose('Destroying instance');
92
- $module
93
- .removeData(moduleNamespace)
94
- .off(eventNamespace)
95
- ;
96
- },
45
+ eventNamespace = '.' + namespace,
46
+ moduleNamespace = namespace + '-module',
97
47
 
98
- show: function() {
99
- if( module.should.show() && !$module.is(':visible') ) {
100
- if(settings.onShow.call(element) === false) {
101
- module.debug('onShow callback returned false, cancelling nag animation');
102
- return false;
103
- }
104
- module.debug('Showing nag', settings.animation.show);
105
- if(settings.animation.show === 'fade') {
106
- $module
107
- .fadeIn(settings.duration, settings.easing, settings.onVisible)
108
- ;
109
- }
110
- else {
111
- $module
112
- .slideDown(settings.duration, settings.easing, settings.onVisible)
113
- ;
114
- }
115
- }
116
- },
48
+ $module = $(this),
117
49
 
118
- hide: function() {
119
- if(settings.onHide.call(element) === false) {
120
- module.debug('onHide callback returned false, cancelling nag animation');
121
- return false;
122
- }
123
- module.debug('Hiding nag', settings.animation.hide);
124
- if(settings.animation.hide === 'fade') {
125
- $module
126
- .fadeOut(settings.duration, settings.easing, settings.onHidden)
127
- ;
128
- }
129
- else {
130
- $module
131
- .slideUp(settings.duration, settings.easing, settings.onHidden)
50
+ $context = (settings.context)
51
+ ? ([window, document].indexOf(settings.context) < 0 ? $(document).find(settings.context) : $(settings.context))
52
+ : $('body'),
53
+
54
+ element = this,
55
+ instance = $module.data(moduleNamespace),
56
+ storage,
57
+ module
132
58
  ;
133
- }
134
- },
59
+ module = {
135
60
 
136
- dismiss: function(event) {
137
- if(module.hide() !== false && settings.storageMethod) {
138
- module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
139
- module.storage.set(settings.key, settings.value);
140
- }
141
- event.stopImmediatePropagation();
142
- event.preventDefault();
143
- },
61
+ initialize: function () {
62
+ module.verbose('Initializing element');
63
+ if (typeof settings.value !== 'string') {
64
+ settings.value = JSON.stringify(settings.value);
65
+ }
66
+ storage = module.get.storage();
67
+ $module
68
+ .on('click' + eventNamespace, selector.close, module.dismiss)
69
+ .data(moduleNamespace, module)
70
+ ;
71
+
72
+ if (settings.detachable && $module.parent()[0] !== $context[0]) {
73
+ $module
74
+ .detach()
75
+ .prependTo($context)
76
+ ;
77
+ }
144
78
 
145
- should: {
146
- show: function() {
147
- if(settings.persist) {
148
- module.debug('Persistent nag is set, can show nag');
149
- return true;
150
- }
151
- if( module.storage.get(settings.key) != settings.value.toString() ) {
152
- module.debug('Stored value is not set, can show nag', module.storage.get(settings.key));
153
- return true;
154
- }
155
- module.debug('Stored value is set, cannot show nag', module.storage.get(settings.key));
156
- return false;
157
- }
158
- },
79
+ if (settings.displayTime > 0) {
80
+ setTimeout(module.hide, settings.displayTime);
81
+ }
82
+ module.show();
83
+ },
159
84
 
160
- get: {
161
- expirationDate: function(expires) {
162
- if (typeof expires === 'number') {
163
- expires = new Date(Date.now() + expires * 864e5);
164
- }
165
- if(expires instanceof Date && expires.getTime() ){
166
- return expires.toUTCString();
167
- } else {
168
- module.error(error.expiresFormat);
169
- }
170
- },
171
- storage: function(){
172
- if(settings.storageMethod === 'localstorage' && window.localStorage !== undefined) {
173
- module.debug('Using local storage');
174
- return window.localStorage;
175
- }
176
- else if(settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
177
- module.debug('Using session storage');
178
- return window.sessionStorage;
179
- }
180
- else if("cookie" in document) {
181
- module.debug('Using cookie');
182
- return {
183
- setItem: function(key, value, options) {
184
- // RFC6265 compliant encoding
185
- key = encodeURIComponent(key)
186
- .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
187
- .replace(/[()]/g, escape);
188
- value = encodeURIComponent(value)
189
- .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent);
190
-
191
- var cookieOptions = '';
192
- for (var option in options) {
193
- if (options.hasOwnProperty(option)) {
194
- cookieOptions += '; ' + option;
195
- if (typeof options[option] === 'string') {
196
- cookieOptions += '=' + options[option].split(';')[0];
197
- }
85
+ destroy: function () {
86
+ module.verbose('Destroying instance');
87
+ $module
88
+ .removeData(moduleNamespace)
89
+ .off(eventNamespace)
90
+ ;
91
+ },
92
+
93
+ show: function () {
94
+ if (module.should.show() && !$module.is(':visible')) {
95
+ if (settings.onShow.call(element) === false) {
96
+ module.debug('onShow callback returned false, cancelling nag animation');
97
+
98
+ return false;
99
+ }
100
+ module.debug('Showing nag', settings.animation.show);
101
+ if (settings.animation.show === 'fade') {
102
+ $module
103
+ .fadeIn(settings.duration, settings.easing, settings.onVisible)
104
+ ;
105
+ } else {
106
+ $module
107
+ .slideDown(settings.duration, settings.easing, settings.onVisible)
108
+ ;
109
+ }
110
+ }
111
+ },
112
+
113
+ hide: function () {
114
+ if (settings.onHide.call(element) === false) {
115
+ module.debug('onHide callback returned false, cancelling nag animation');
116
+
117
+ return false;
198
118
  }
199
- }
200
- document.cookie = key + '=' + value + cookieOptions;
119
+ module.debug('Hiding nag', settings.animation.hide);
120
+ if (settings.animation.hide === 'fade') {
121
+ $module
122
+ .fadeOut(settings.duration, settings.easing, settings.onHidden)
123
+ ;
124
+ } else {
125
+ $module
126
+ .slideUp(settings.duration, settings.easing, settings.onHidden)
127
+ ;
128
+ }
129
+ },
130
+
131
+ dismiss: function (event) {
132
+ if (module.hide() !== false && settings.storageMethod) {
133
+ module.debug('Dismissing nag', settings.storageMethod, settings.key, settings.value, settings.expires);
134
+ module.storage.set(settings.key, settings.value);
135
+ }
136
+ event.stopImmediatePropagation();
137
+ event.preventDefault();
138
+ },
139
+
140
+ should: {
141
+ show: function () {
142
+ if (settings.persist) {
143
+ module.debug('Persistent nag is set, can show nag');
144
+
145
+ return true;
146
+ }
147
+ if (module.storage.get(settings.key) != settings.value.toString()) {
148
+ module.debug('Stored value is not set, can show nag', module.storage.get(settings.key));
149
+
150
+ return true;
151
+ }
152
+ module.debug('Stored value is set, cannot show nag', module.storage.get(settings.key));
153
+
154
+ return false;
155
+ },
156
+ },
157
+
158
+ get: {
159
+ expirationDate: function (expires) {
160
+ if (typeof expires === 'number') {
161
+ expires = new Date(Date.now() + expires * 864e5);
162
+ }
163
+ if (expires instanceof Date && expires.getTime()) {
164
+ return expires.toUTCString();
165
+ } else {
166
+ module.error(error.expiresFormat);
167
+ }
168
+ },
169
+ storage: function () {
170
+ if (settings.storageMethod === 'localstorage' && window.localStorage !== undefined) {
171
+ module.debug('Using local storage');
172
+
173
+ return window.localStorage;
174
+ } else if (settings.storageMethod === 'sessionstorage' && window.sessionStorage !== undefined) {
175
+ module.debug('Using session storage');
176
+
177
+ return window.sessionStorage;
178
+ } else if ('cookie' in document) {
179
+ module.debug('Using cookie');
180
+
181
+ return {
182
+ setItem: function (key, value, options) {
183
+ // RFC6265 compliant encoding
184
+ key = encodeURIComponent(key)
185
+ .replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent)
186
+ .replace(/[()]/g, escape)
187
+ ;
188
+ value = encodeURIComponent(value)
189
+ .replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g, decodeURIComponent)
190
+ ;
191
+
192
+ var cookieOptions = '';
193
+ for (var option in options) {
194
+ if (options.hasOwnProperty(option)) {
195
+ cookieOptions += '; ' + option;
196
+ if (typeof options[option] === 'string') {
197
+ cookieOptions += '=' + options[option].split(';')[0];
198
+ }
199
+ }
200
+ }
201
+ document.cookie = key + '=' + value + cookieOptions;
202
+ },
203
+ getItem: function (key) {
204
+ var cookies = document.cookie.split('; ');
205
+ for (var i = 0, il = cookies.length; i < il; i++) {
206
+ var
207
+ parts = cookies[i].split('='),
208
+ foundKey = parts[0].replace(/(%[\dA-F]{2})+/gi, decodeURIComponent)
209
+ ;
210
+ if (key === foundKey) {
211
+ return parts[1] || '';
212
+ }
213
+ }
214
+ },
215
+ removeItem: function (key, options) {
216
+ storage.setItem(key, '', options);
217
+ },
218
+ };
219
+ } else {
220
+ module.error(error.noStorage);
221
+ }
222
+ },
223
+ storageOptions: function () {
224
+ var
225
+ options = {}
226
+ ;
227
+ if (settings.expires) {
228
+ options.expires = module.get.expirationDate(settings.expires);
229
+ }
230
+ if (settings.domain) {
231
+ options.domain = settings.domain;
232
+ }
233
+ if (settings.path) {
234
+ options.path = settings.path;
235
+ }
236
+ if (settings.secure) {
237
+ options.secure = settings.secure;
238
+ }
239
+ if (settings.samesite) {
240
+ options.samesite = settings.samesite;
241
+ }
242
+
243
+ return options;
244
+ },
245
+ },
246
+
247
+ clear: function () {
248
+ module.storage.remove(settings.key);
249
+ },
250
+
251
+ storage: {
252
+ set: function (key, value) {
253
+ var
254
+ options = module.get.storageOptions()
255
+ ;
256
+ if (storage === window.localStorage && options.expires) {
257
+ module.debug('Storing expiration value in localStorage', key, options.expires);
258
+ storage.setItem(key + settings.expirationKey, options.expires);
259
+ }
260
+ module.debug('Value stored', key, value);
261
+ try {
262
+ storage.setItem(key, value, options);
263
+ } catch (e) {
264
+ module.error(error.setItem, e);
265
+ }
266
+ },
267
+ get: function (key) {
268
+ var
269
+ storedValue
270
+ ;
271
+ storedValue = storage.getItem(key);
272
+ if (storage === window.localStorage) {
273
+ var expiration = storage.getItem(key + settings.expirationKey);
274
+ if (expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
275
+ module.debug('Value in localStorage has expired. Deleting key', key);
276
+ module.storage.remove(key);
277
+ storedValue = null;
278
+ }
279
+ }
280
+ if (storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
281
+ storedValue = undefined;
282
+ }
283
+
284
+ return storedValue;
285
+ },
286
+ remove: function (key) {
287
+ var
288
+ options = module.get.storageOptions()
289
+ ;
290
+ options.expires = module.get.expirationDate(-1);
291
+ if (storage === window.localStorage) {
292
+ storage.removeItem(key + settings.expirationKey);
293
+ }
294
+ storage.removeItem(key, options);
295
+ },
201
296
  },
202
- getItem: function(key) {
203
- var cookies = document.cookie.split('; ');
204
- for (var i = 0, il = cookies.length; i < il; i++) {
205
- var parts = cookies[i].split('='),
206
- foundKey = parts[0].replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
207
- if (key === foundKey) {
208
- return parts[1] || '';
297
+
298
+ setting: function (name, value) {
299
+ module.debug('Changing setting', name, value);
300
+ if ($.isPlainObject(name)) {
301
+ $.extend(true, settings, name);
302
+ } else if (value !== undefined) {
303
+ if ($.isPlainObject(settings[name])) {
304
+ $.extend(true, settings[name], value);
305
+ } else {
306
+ settings[name] = value;
307
+ }
308
+ } else {
309
+ return settings[name];
310
+ }
311
+ },
312
+ internal: function (name, value) {
313
+ if ($.isPlainObject(name)) {
314
+ $.extend(true, module, name);
315
+ } else if (value !== undefined) {
316
+ module[name] = value;
317
+ } else {
318
+ return module[name];
319
+ }
320
+ },
321
+ debug: function () {
322
+ if (!settings.silent && settings.debug) {
323
+ if (settings.performance) {
324
+ module.performance.log(arguments);
325
+ } else {
326
+ module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
327
+ module.debug.apply(console, arguments);
328
+ }
329
+ }
330
+ },
331
+ verbose: function () {
332
+ if (!settings.silent && settings.verbose && settings.debug) {
333
+ if (settings.performance) {
334
+ module.performance.log(arguments);
335
+ } else {
336
+ module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
337
+ module.verbose.apply(console, arguments);
338
+ }
209
339
  }
210
- }
211
340
  },
212
- removeItem: function(key, options) {
213
- storage.setItem(key,'',options);
341
+ error: function () {
342
+ if (!settings.silent) {
343
+ module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
344
+ module.error.apply(console, arguments);
345
+ }
346
+ },
347
+ performance: {
348
+ log: function (message) {
349
+ var
350
+ currentTime,
351
+ executionTime,
352
+ previousTime
353
+ ;
354
+ if (settings.performance) {
355
+ currentTime = new Date().getTime();
356
+ previousTime = time || currentTime;
357
+ executionTime = currentTime - previousTime;
358
+ time = currentTime;
359
+ performance.push({
360
+ Name: message[0],
361
+ Arguments: [].slice.call(message, 1) || '',
362
+ Element: element,
363
+ 'Execution Time': executionTime,
364
+ });
365
+ }
366
+ clearTimeout(module.performance.timer);
367
+ module.performance.timer = setTimeout(module.performance.display, 500);
368
+ },
369
+ display: function () {
370
+ var
371
+ title = settings.name + ':',
372
+ totalTime = 0
373
+ ;
374
+ time = false;
375
+ clearTimeout(module.performance.timer);
376
+ $.each(performance, function (index, data) {
377
+ totalTime += data['Execution Time'];
378
+ });
379
+ title += ' ' + totalTime + 'ms';
380
+ if (moduleSelector) {
381
+ title += ' \'' + moduleSelector + '\'';
382
+ }
383
+ if ((console.group !== undefined || console.table !== undefined) && performance.length > 0) {
384
+ console.groupCollapsed(title);
385
+ if (console.table) {
386
+ console.table(performance);
387
+ } else {
388
+ $.each(performance, function (index, data) {
389
+ console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
390
+ });
391
+ }
392
+ console.groupEnd();
393
+ }
394
+ performance = [];
395
+ },
396
+ },
397
+ invoke: function (query, passedArguments, context) {
398
+ var
399
+ object = instance,
400
+ maxDepth,
401
+ found,
402
+ response
403
+ ;
404
+ passedArguments = passedArguments || queryArguments;
405
+ context = context || element;
406
+ if (typeof query == 'string' && object !== undefined) {
407
+ query = query.split(/[\. ]/);
408
+ maxDepth = query.length - 1;
409
+ $.each(query, function (depth, value) {
410
+ var camelCaseValue = (depth != maxDepth)
411
+ ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
412
+ : query
413
+ ;
414
+ if ($.isPlainObject(object[camelCaseValue]) && (depth != maxDepth)) {
415
+ object = object[camelCaseValue];
416
+ } else if (object[camelCaseValue] !== undefined) {
417
+ found = object[camelCaseValue];
418
+
419
+ return false;
420
+ } else if ($.isPlainObject(object[value]) && (depth != maxDepth)) {
421
+ object = object[value];
422
+ } else if (object[value] !== undefined) {
423
+ found = object[value];
424
+
425
+ return false;
426
+ } else {
427
+ module.error(error.method, query);
428
+
429
+ return false;
430
+ }
431
+ });
432
+ }
433
+ if (isFunction(found)) {
434
+ response = found.apply(context, passedArguments);
435
+ } else if (found !== undefined) {
436
+ response = found;
437
+ }
438
+ if (Array.isArray(returnedValue)) {
439
+ returnedValue.push(response);
440
+ } else if (returnedValue !== undefined) {
441
+ returnedValue = [returnedValue, response];
442
+ } else if (response !== undefined) {
443
+ returnedValue = response;
444
+ }
445
+
446
+ return found;
447
+ },
448
+ };
449
+
450
+ if (methodInvoked) {
451
+ if (instance === undefined) {
452
+ module.initialize();
214
453
  }
215
- };
454
+ module.invoke(query);
216
455
  } else {
217
- module.error(error.noStorage);
218
- }
219
- },
220
- storageOptions: function() {
221
- var
222
- options = {}
223
- ;
224
- if(settings.expires) {
225
- options.expires = module.get.expirationDate(settings.expires);
226
- }
227
- if(settings.domain) {
228
- options.domain = settings.domain;
229
- }
230
- if(settings.path) {
231
- options.path = settings.path;
232
- }
233
- if(settings.secure) {
234
- options.secure = settings.secure;
235
- }
236
- if(settings.samesite) {
237
- options.samesite = settings.samesite;
456
+ if (instance !== undefined) {
457
+ instance.invoke('destroy');
458
+ }
459
+ module.initialize();
238
460
  }
239
- return options;
240
- }
241
- },
461
+ });
242
462
 
243
- clear: function() {
244
- module.storage.remove(settings.key);
245
- },
463
+ return (returnedValue !== undefined)
464
+ ? returnedValue
465
+ : this;
466
+ };
246
467
 
247
- storage: {
248
- set: function(key, value) {
249
- var
250
- options = module.get.storageOptions()
251
- ;
252
- if(storage === window.localStorage && options.expires) {
253
- module.debug('Storing expiration value in localStorage', key, options.expires);
254
- storage.setItem(key + settings.expirationKey, options.expires );
255
- }
256
- module.debug('Value stored', key, value);
257
- try {
258
- storage.setItem(key, value, options);
259
- }
260
- catch(e) {
261
- module.error(error.setItem, e);
262
- }
263
- },
264
- get: function(key) {
265
- var
266
- storedValue
267
- ;
268
- storedValue = storage.getItem(key);
269
- if(storage === window.localStorage) {
270
- var expiration = storage.getItem(key + settings.expirationKey);
271
- if(expiration !== null && expiration !== undefined && new Date(expiration) < new Date()) {
272
- module.debug('Value in localStorage has expired. Deleting key', key);
273
- module.storage.remove(key);
274
- storedValue = null;
275
- }
276
- }
277
- if(storedValue == 'undefined' || storedValue == 'null' || storedValue === undefined || storedValue === null) {
278
- storedValue = undefined;
279
- }
280
- return storedValue;
281
- },
282
- remove: function(key) {
283
- var
284
- options = module.get.storageOptions()
285
- ;
286
- options.expires = module.get.expirationDate(-1);
287
- if(storage === window.localStorage) {
288
- storage.removeItem(key + settings.expirationKey);
289
- }
290
- storage.removeItem(key, options);
291
- }
292
- },
468
+ $.fn.nag.settings = {
293
469
 
294
- setting: function(name, value) {
295
- module.debug('Changing setting', name, value);
296
- if( $.isPlainObject(name) ) {
297
- $.extend(true, settings, name);
298
- }
299
- else if(value !== undefined) {
300
- if($.isPlainObject(settings[name])) {
301
- $.extend(true, settings[name], value);
302
- }
303
- else {
304
- settings[name] = value;
305
- }
306
- }
307
- else {
308
- return settings[name];
309
- }
310
- },
311
- internal: function(name, value) {
312
- if( $.isPlainObject(name) ) {
313
- $.extend(true, module, name);
314
- }
315
- else if(value !== undefined) {
316
- module[name] = value;
317
- }
318
- else {
319
- return module[name];
320
- }
321
- },
322
- debug: function() {
323
- if(!settings.silent && settings.debug) {
324
- if(settings.performance) {
325
- module.performance.log(arguments);
326
- }
327
- else {
328
- module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
329
- module.debug.apply(console, arguments);
330
- }
331
- }
470
+ name: 'Nag',
471
+
472
+ silent: false,
473
+ debug: false,
474
+ verbose: false,
475
+ performance: true,
476
+
477
+ namespace: 'Nag',
478
+
479
+ // allows cookie to be overridden
480
+ persist: false,
481
+
482
+ // set to zero to require manually dismissal, otherwise hides on its own
483
+ displayTime: 0,
484
+
485
+ animation: {
486
+ show: 'slide',
487
+ hide: 'slide',
332
488
  },
333
- verbose: function() {
334
- if(!settings.silent && settings.verbose && settings.debug) {
335
- if(settings.performance) {
336
- module.performance.log(arguments);
337
- }
338
- else {
339
- module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
340
- module.verbose.apply(console, arguments);
341
- }
342
- }
489
+
490
+ context: false,
491
+ detachable: false,
492
+
493
+ expires: 30,
494
+
495
+ // cookie storage only options
496
+ domain: false,
497
+ path: '/',
498
+ secure: false,
499
+ samesite: false,
500
+
501
+ // type of storage to use
502
+ storageMethod: 'cookie',
503
+
504
+ // value to store in dismissed localstorage/cookie
505
+ key: 'nag',
506
+ value: 'dismiss',
507
+
508
+ // Key suffix to support expiration in localstorage
509
+ expirationKey: 'ExpirationDate',
510
+
511
+ error: {
512
+ noStorage: 'Unsupported storage method',
513
+ method: 'The method you called is not defined.',
514
+ setItem: 'Unexpected error while setting value',
515
+ expiresFormat: '"expires" must be a number of days or a Date Object',
343
516
  },
344
- error: function() {
345
- if(!settings.silent) {
346
- module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
347
- module.error.apply(console, arguments);
348
- }
517
+
518
+ className: {
519
+ bottom: 'bottom',
520
+ fixed: 'fixed',
349
521
  },
350
- performance: {
351
- log: function(message) {
352
- var
353
- currentTime,
354
- executionTime,
355
- previousTime
356
- ;
357
- if(settings.performance) {
358
- currentTime = new Date().getTime();
359
- previousTime = time || currentTime;
360
- executionTime = currentTime - previousTime;
361
- time = currentTime;
362
- performance.push({
363
- 'Name' : message[0],
364
- 'Arguments' : [].slice.call(message, 1) || '',
365
- 'Element' : element,
366
- 'Execution Time' : executionTime
367
- });
368
- }
369
- clearTimeout(module.performance.timer);
370
- module.performance.timer = setTimeout(module.performance.display, 500);
371
- },
372
- display: function() {
373
- var
374
- title = settings.name + ':',
375
- totalTime = 0
376
- ;
377
- time = false;
378
- clearTimeout(module.performance.timer);
379
- $.each(performance, function(index, data) {
380
- totalTime += data['Execution Time'];
381
- });
382
- title += ' ' + totalTime + 'ms';
383
- if(moduleSelector) {
384
- title += ' \'' + moduleSelector + '\'';
385
- }
386
- if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
387
- console.groupCollapsed(title);
388
- if(console.table) {
389
- console.table(performance);
390
- }
391
- else {
392
- $.each(performance, function(index, data) {
393
- console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
394
- });
395
- }
396
- console.groupEnd();
397
- }
398
- performance = [];
399
- }
522
+
523
+ selector: {
524
+ close: '> .close.icon',
400
525
  },
401
- invoke: function(query, passedArguments, context) {
402
- var
403
- object = instance,
404
- maxDepth,
405
- found,
406
- response
407
- ;
408
- passedArguments = passedArguments || queryArguments;
409
- context = context || element;
410
- if(typeof query == 'string' && object !== undefined) {
411
- query = query.split(/[\. ]/);
412
- maxDepth = query.length - 1;
413
- $.each(query, function(depth, value) {
414
- var camelCaseValue = (depth != maxDepth)
415
- ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
416
- : query
417
- ;
418
- if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) {
419
- object = object[camelCaseValue];
420
- }
421
- else if( object[camelCaseValue] !== undefined ) {
422
- found = object[camelCaseValue];
423
- return false;
424
- }
425
- else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) {
426
- object = object[value];
427
- }
428
- else if( object[value] !== undefined ) {
429
- found = object[value];
430
- return false;
431
- }
432
- else {
433
- module.error(error.method, query);
434
- return false;
435
- }
436
- });
437
- }
438
- if ( isFunction( found ) ) {
439
- response = found.apply(context, passedArguments);
440
- }
441
- else if(found !== undefined) {
442
- response = found;
443
- }
444
- if(Array.isArray(returnedValue)) {
445
- returnedValue.push(response);
446
- }
447
- else if(returnedValue !== undefined) {
448
- returnedValue = [returnedValue, response];
449
- }
450
- else if(response !== undefined) {
451
- returnedValue = response;
452
- }
453
- return found;
454
- }
455
- };
456
-
457
- if(methodInvoked) {
458
- if(instance === undefined) {
459
- module.initialize();
460
- }
461
- module.invoke(query);
462
- }
463
- else {
464
- if(instance !== undefined) {
465
- instance.invoke('destroy');
466
- }
467
- module.initialize();
468
- }
469
- })
470
- ;
471
-
472
- return (returnedValue !== undefined)
473
- ? returnedValue
474
- : this
475
- ;
476
- };
477
-
478
- $.fn.nag.settings = {
479
-
480
- name : 'Nag',
481
-
482
- silent : false,
483
- debug : false,
484
- verbose : false,
485
- performance : true,
486
-
487
- namespace : 'Nag',
488
-
489
- // allows cookie to be overridden
490
- persist : false,
491
-
492
- // set to zero to require manually dismissal, otherwise hides on its own
493
- displayTime : 0,
494
-
495
- animation : {
496
- show : 'slide',
497
- hide : 'slide'
498
- },
499
-
500
- context : false,
501
- detachable : false,
502
-
503
- expires : 30,
504
-
505
- // cookie storage only options
506
- domain : false,
507
- path : '/',
508
- secure : false,
509
- samesite : false,
510
-
511
- // type of storage to use
512
- storageMethod : 'cookie',
513
-
514
- // value to store in dismissed localstorage/cookie
515
- key : 'nag',
516
- value : 'dismiss',
517
-
518
- // Key suffix to support expiration in localstorage
519
- expirationKey : 'ExpirationDate',
520
-
521
- error: {
522
- noStorage : 'Unsupported storage method',
523
- method : 'The method you called is not defined.',
524
- setItem : 'Unexpected error while setting value',
525
- expiresFormat : '"expires" must be a number of days or a Date Object'
526
- },
527
-
528
- className : {
529
- bottom : 'bottom',
530
- fixed : 'fixed'
531
- },
532
-
533
- selector : {
534
- close : '> .close.icon'
535
- },
536
-
537
- duration : 500,
538
- easing : 'easeOutQuad',
539
-
540
- // callback before show animation, return false to prevent show
541
- onShow : function() {},
542
-
543
- // called after show animation
544
- onVisible : function() {},
545
-
546
- // callback before hide animation, return false to prevent hide
547
- onHide : function() {},
548
-
549
- // callback after hide animation
550
- onHidden : function() {}
551
-
552
- };
553
-
554
- // Adds easing
555
- $.extend( $.easing, {
556
- easeOutQuad: function (x) {
557
- return 1 - (1 - x) * (1 - x);
558
- }
559
- });
560
526
 
561
- })( jQuery, window, document );
527
+ duration: 500,
528
+ easing: 'easeOutQuad',
529
+
530
+ // callback before show animation, return false to prevent show
531
+ onShow: function () {},
532
+
533
+ // called after show animation
534
+ onVisible: function () {},
535
+
536
+ // callback before hide animation, return false to prevent hide
537
+ onHide: function () {},
538
+
539
+ // callback after hide animation
540
+ onHidden: function () {},
541
+
542
+ };
543
+
544
+ // Adds easing
545
+ $.extend($.easing, {
546
+ easeOutQuad: function (x) {
547
+ return 1 - (1 - x) * (1 - x);
548
+ },
549
+ });
550
+ })(jQuery, window, document);