fomantic-ui 2.9.1-beta.16 → 2.9.1-beta.18

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