fomantic-ui 2.9.1-beta.22 → 2.9.1-beta.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +7 -59
- package/.stylelintrc.js +5 -7
- package/dist/components/accordion.css +1 -1
- package/dist/components/accordion.js +7 -7
- package/dist/components/accordion.min.css +1 -1
- package/dist/components/accordion.min.js +2 -2
- package/dist/components/ad.css +1 -1
- package/dist/components/ad.min.css +1 -1
- package/dist/components/api.js +54 -53
- package/dist/components/api.min.js +2 -2
- package/dist/components/breadcrumb.css +1 -1
- package/dist/components/breadcrumb.min.css +1 -1
- package/dist/components/button.css +1 -1
- package/dist/components/button.min.css +1 -1
- package/dist/components/calendar.css +3 -3
- package/dist/components/calendar.js +118 -99
- package/dist/components/calendar.min.css +2 -2
- package/dist/components/calendar.min.js +2 -2
- package/dist/components/card.css +1 -1
- package/dist/components/card.min.css +1 -1
- package/dist/components/checkbox.css +1 -1
- package/dist/components/checkbox.js +8 -8
- package/dist/components/checkbox.min.css +1 -1
- package/dist/components/checkbox.min.js +2 -2
- package/dist/components/comment.css +1 -1
- package/dist/components/comment.min.css +1 -1
- package/dist/components/container.css +1 -1
- package/dist/components/container.min.css +1 -1
- package/dist/components/dimmer.css +1 -1
- package/dist/components/dimmer.js +16 -18
- package/dist/components/dimmer.min.css +1 -1
- package/dist/components/dimmer.min.js +2 -2
- package/dist/components/divider.css +1 -1
- package/dist/components/divider.min.css +1 -1
- package/dist/components/dropdown.css +1 -1
- package/dist/components/dropdown.js +87 -87
- package/dist/components/dropdown.min.css +1 -1
- package/dist/components/dropdown.min.js +2 -2
- package/dist/components/embed.css +1 -1
- package/dist/components/embed.js +17 -23
- package/dist/components/embed.min.css +1 -1
- package/dist/components/embed.min.js +2 -2
- package/dist/components/feed.css +1 -1
- package/dist/components/feed.min.css +1 -1
- package/dist/components/flag.css +1 -1
- package/dist/components/flag.min.css +1 -1
- package/dist/components/flyout.css +2 -2
- package/dist/components/flyout.js +32 -30
- package/dist/components/flyout.min.css +1 -1
- package/dist/components/flyout.min.js +2 -2
- package/dist/components/form.css +2 -2
- package/dist/components/form.js +113 -89
- package/dist/components/form.min.css +2 -2
- package/dist/components/form.min.js +2 -2
- package/dist/components/grid.css +1 -1
- package/dist/components/grid.min.css +1 -1
- package/dist/components/header.css +1 -1
- package/dist/components/header.min.css +1 -1
- package/dist/components/icon.css +1 -1
- package/dist/components/icon.min.css +1 -1
- package/dist/components/image.css +1 -1
- package/dist/components/image.min.css +1 -1
- package/dist/components/input.css +1 -1
- package/dist/components/input.min.css +1 -1
- package/dist/components/item.css +1 -1
- package/dist/components/item.min.css +1 -1
- package/dist/components/label.css +1 -1
- package/dist/components/label.min.css +1 -1
- package/dist/components/list.css +1 -1
- package/dist/components/list.min.css +1 -1
- package/dist/components/loader.css +1 -1
- package/dist/components/loader.min.css +1 -1
- package/dist/components/message.css +1 -1
- package/dist/components/message.min.css +1 -1
- package/dist/components/modal.css +1 -1
- package/dist/components/modal.js +22 -22
- package/dist/components/modal.min.css +1 -1
- package/dist/components/modal.min.js +2 -2
- package/dist/components/nag.css +1 -1
- package/dist/components/nag.js +18 -16
- package/dist/components/nag.min.css +1 -1
- package/dist/components/nag.min.js +2 -2
- package/dist/components/placeholder.css +1 -1
- package/dist/components/placeholder.min.css +1 -1
- package/dist/components/popup.css +1 -1
- package/dist/components/popup.js +30 -30
- package/dist/components/popup.min.css +1 -1
- package/dist/components/popup.min.js +2 -2
- package/dist/components/progress.css +1 -1
- package/dist/components/progress.js +23 -21
- package/dist/components/progress.min.css +1 -1
- package/dist/components/progress.min.js +2 -2
- package/dist/components/rail.css +1 -1
- package/dist/components/rail.min.css +1 -1
- package/dist/components/rating.css +1 -1
- package/dist/components/rating.js +8 -8
- package/dist/components/rating.min.css +1 -1
- package/dist/components/rating.min.js +2 -2
- package/dist/components/reset.css +1 -1
- package/dist/components/reset.min.css +1 -1
- package/dist/components/reveal.css +1 -1
- package/dist/components/reveal.min.css +1 -1
- package/dist/components/search.css +1 -1
- package/dist/components/search.js +41 -46
- package/dist/components/search.min.css +1 -1
- package/dist/components/search.min.js +2 -2
- package/dist/components/segment.css +1 -1
- package/dist/components/segment.min.css +1 -1
- package/dist/components/shape.css +1 -1
- package/dist/components/shape.js +9 -9
- package/dist/components/shape.min.css +1 -1
- package/dist/components/shape.min.js +2 -2
- package/dist/components/sidebar.css +1 -1
- package/dist/components/sidebar.js +21 -19
- package/dist/components/sidebar.min.css +1 -1
- package/dist/components/sidebar.min.js +2 -2
- package/dist/components/site.css +1 -1
- package/dist/components/site.js +11 -10
- package/dist/components/site.min.css +1 -1
- package/dist/components/site.min.js +2 -2
- package/dist/components/slider.js +39 -42
- package/dist/components/slider.min.js +2 -2
- package/dist/components/state.js +7 -7
- package/dist/components/state.min.js +2 -2
- package/dist/components/statistic.css +1 -1
- package/dist/components/statistic.min.css +1 -1
- package/dist/components/step.css +1 -1
- package/dist/components/step.min.css +1 -1
- package/dist/components/sticky.css +1 -1
- package/dist/components/sticky.js +7 -7
- package/dist/components/sticky.min.css +1 -1
- package/dist/components/sticky.min.js +2 -2
- package/dist/components/tab.css +1 -1
- package/dist/components/tab.js +36 -38
- package/dist/components/tab.min.css +1 -1
- package/dist/components/tab.min.js +2 -2
- package/dist/components/table.css +1 -1
- package/dist/components/table.min.css +1 -1
- package/dist/components/text.css +1 -1
- package/dist/components/text.min.css +1 -1
- package/dist/components/toast.css +1 -1
- package/dist/components/toast.js +20 -17
- package/dist/components/toast.min.css +1 -1
- package/dist/components/toast.min.js +2 -2
- package/dist/components/transition.css +7 -7
- package/dist/components/transition.js +27 -21
- package/dist/components/transition.min.css +1 -1
- package/dist/components/transition.min.js +2 -2
- package/dist/components/visibility.js +8 -8
- package/dist/components/visibility.min.js +2 -2
- package/dist/semantic.css +60 -60
- package/dist/semantic.js +779 -735
- package/dist/semantic.min.css +2 -2
- package/dist/semantic.min.js +2 -2
- package/examples/responsive.html +1 -1
- package/gulpfile.js +1 -1
- package/package.json +1 -1
- package/scripts/nightly-version.js +3 -3
- package/src/definitions/behaviors/api.js +53 -52
- package/src/definitions/behaviors/form.js +112 -88
- package/src/definitions/behaviors/state.js +6 -6
- package/src/definitions/behaviors/visibility.js +7 -7
- package/src/definitions/collections/menu.less +2 -2
- package/src/definitions/elements/button.less +2 -2
- package/src/definitions/elements/loader.less +4 -4
- package/src/definitions/elements/step.less +1 -1
- package/src/definitions/globals/site.js +10 -9
- package/src/definitions/modules/accordion.js +6 -6
- package/src/definitions/modules/calendar.js +117 -98
- package/src/definitions/modules/calendar.less +2 -2
- package/src/definitions/modules/checkbox.js +7 -7
- package/src/definitions/modules/dimmer.js +15 -17
- package/src/definitions/modules/dimmer.less +10 -10
- package/src/definitions/modules/dropdown.js +86 -86
- package/src/definitions/modules/embed.js +16 -22
- package/src/definitions/modules/flyout.js +31 -29
- package/src/definitions/modules/flyout.less +1 -1
- package/src/definitions/modules/modal.js +21 -21
- package/src/definitions/modules/nag.js +17 -15
- package/src/definitions/modules/popup.js +29 -29
- package/src/definitions/modules/progress.js +22 -20
- package/src/definitions/modules/rating.js +7 -7
- package/src/definitions/modules/search.js +40 -45
- package/src/definitions/modules/shape.js +8 -8
- package/src/definitions/modules/sidebar.js +20 -18
- package/src/definitions/modules/slider.js +38 -41
- package/src/definitions/modules/sticky.js +6 -6
- package/src/definitions/modules/tab.js +35 -37
- package/src/definitions/modules/toast.js +19 -16
- package/src/definitions/modules/transition.js +26 -20
- package/src/themes/amazon/elements/button.overrides +7 -7
- package/src/themes/default/collections/form.variables +1 -1
- package/src/themes/default/elements/reveal.variables +1 -1
- package/src/themes/default/globals/site.variables +1 -1
- package/src/themes/default/modules/dimmer.variables +6 -6
- package/src/themes/default/modules/modal.variables +1 -1
- package/src/themes/default/modules/slider.variables +4 -4
- package/src/themes/default/modules/toast.variables +2 -2
- package/src/themes/default/modules/transition.overrides +12 -12
- package/src/themes/flat/collections/form.overrides +2 -2
- package/src/themes/flat/globals/site.variables +1 -1
- package/src/themes/github/collections/form.overrides +2 -2
- package/src/themes/github/collections/menu.variables +1 -1
- package/src/themes/github/collections/message.overrides +3 -3
- package/src/themes/github/elements/input.overrides +2 -2
- package/src/themes/timeline/views/feed.overrides +3 -3
- package/src/themes/twitter/elements/button.overrides +2 -2
- package/tasks/README.md +1 -3
- package/tasks/admin/components/create.js +9 -16
- package/tasks/admin/components/init.js +7 -7
- package/tasks/admin/components/update.js +7 -7
- package/tasks/admin/distributions/create.js +15 -17
- package/tasks/admin/distributions/init.js +7 -7
- package/tasks/admin/distributions/update.js +7 -7
- package/tasks/admin/publish.js +1 -1
- package/tasks/admin/register.js +2 -2
- package/tasks/admin/release.js +1 -1
- package/tasks/build/assets.js +2 -2
- package/tasks/build/css.js +8 -3
- package/tasks/build/javascript.js +3 -1
- package/tasks/build.js +1 -1
- package/tasks/check-install.js +1 -1
- package/tasks/clean.js +1 -1
- package/tasks/collections/README.md +3 -5
- package/tasks/collections/admin.js +1 -1
- package/tasks/collections/docs.js +1 -1
- package/tasks/collections/install.js +1 -1
- package/tasks/collections/rtl.js +1 -1
- package/tasks/collections/various.js +1 -1
- package/tasks/config/admin/github.js +5 -6
- package/tasks/config/admin/templates/css-package.js +1 -1
- package/tasks/config/admin/templates/less-package.js +1 -1
- package/tasks/config/npm/gulpfile.js +7 -7
- package/tasks/config/project/config.js +9 -16
- package/tasks/config/project/install.js +26 -25
- package/tasks/config/project/release.js +12 -14
- package/tasks/config/tasks.js +17 -19
- package/tasks/config/user.js +1 -1
- package/tasks/docs/build.js +5 -3
- package/tasks/docs/metadata.js +7 -8
- package/tasks/docs/serve.js +5 -3
- package/tasks/install.js +38 -38
- package/tasks/rtl/build.js +1 -1
- package/tasks/rtl/watch.js +1 -1
- package/tasks/version.js +1 -1
- package/tasks/watch.js +1 -1
- package/test/.eslintrc.js +0 -4
- package/test/meteor/assets.js +1 -1
- package/test/modules/module.spec.js +15 -15
- package/test/modules/popup.spec.js +1 -1
- package/test/modules/search.spec.js +1 -1
- package/test/modules/tab.spec.js +1 -1
- package/test/modules/transition.spec.js +1 -1
package/.eslintrc.js
CHANGED
@@ -62,14 +62,14 @@ module.exports = {
|
|
62
62
|
'prefer-destructuring': 'off',
|
63
63
|
'prefer-template': 'off',
|
64
64
|
'spaced-comment': ['error', 'always', {
|
65
|
-
line: {
|
66
|
-
markers: ['/'],
|
67
|
-
exceptions: ['-', '+'],
|
68
|
-
},
|
69
65
|
block: {
|
70
|
-
markers: ['!'],
|
71
|
-
exceptions: ['*'],
|
72
66
|
balanced: true,
|
67
|
+
exceptions: ['*'],
|
68
|
+
markers: ['!'],
|
69
|
+
},
|
70
|
+
line: {
|
71
|
+
exceptions: ['-', '+'],
|
72
|
+
markers: ['/'],
|
73
73
|
},
|
74
74
|
}],
|
75
75
|
strict: 'off',
|
@@ -80,6 +80,7 @@ module.exports = {
|
|
80
80
|
'unicorn/no-null': 'off',
|
81
81
|
'unicorn/no-this-assignment': 'off',
|
82
82
|
'unicorn/numeric-separators-style': 'off',
|
83
|
+
'unicorn/prefer-array-find': 'off',
|
83
84
|
'unicorn/prefer-array-some': 'off', // https://github.com/sindresorhus/eslint-plugin-unicorn/issues/2007
|
84
85
|
'unicorn/prefer-module': 'off',
|
85
86
|
'unicorn/prevent-abbreviations': 'off',
|
@@ -118,63 +119,10 @@ module.exports = {
|
|
118
119
|
'unicorn/no-nested-ternary': 'off', // about 80 errors (except 14 nested ternary operators autofixable)
|
119
120
|
|
120
121
|
// TODO
|
121
|
-
'import/extensions': 'off',
|
122
|
-
'import/no-dynamic-require': 'off',
|
123
|
-
'no-bitwise': 'off',
|
124
|
-
'no-cond-assign': 'off',
|
125
|
-
'no-else-return': 'off',
|
126
|
-
'no-empty': 'off',
|
127
|
-
'no-labels': 'off',
|
128
|
-
'no-loop-func': 'off',
|
129
|
-
'no-mixed-operators': 'off',
|
130
|
-
'no-multi-assign': 'off',
|
131
|
-
'no-new-func': 'off',
|
132
|
-
'no-path-concat': 'off',
|
133
|
-
'no-prototype-builtins': 'off',
|
134
122
|
'no-return-assign': 'off',
|
135
|
-
'no-self-assign': 'off',
|
136
123
|
'no-shadow-restricted-names': 'off',
|
137
|
-
'no-unused-expressions': 'off',
|
138
124
|
'no-use-before-define': 'off',
|
139
|
-
'no-useless-concat': 'off',
|
140
|
-
'no-useless-escape': 'off',
|
141
|
-
radix: 'off',
|
142
|
-
'unicorn/better-regex': 'off',
|
143
|
-
'unicorn/consistent-function-scoping': 'off',
|
144
|
-
'unicorn/empty-brace-spaces': 'off',
|
145
|
-
'unicorn/escape-case': 'off',
|
146
|
-
'unicorn/explicit-length-check': 'off',
|
147
|
-
'unicorn/new-for-builtins': 'off',
|
148
|
-
'unicorn/no-hex-escape': 'off',
|
149
|
-
'unicorn/no-instanceof-array': 'off',
|
150
|
-
'unicorn/no-process-exit': 'off',
|
151
|
-
'unicorn/no-typeof-undefined': 'off',
|
152
|
-
'unicorn/no-useless-switch-case': 'off',
|
153
|
-
'unicorn/no-useless-undefined': 'off',
|
154
|
-
'unicorn/prefer-array-find': 'off',
|
155
|
-
'unicorn/prefer-date-now': 'off',
|
156
|
-
'unicorn/prefer-default-parameters': 'off',
|
157
|
-
'unicorn/prefer-logical-operator-over-ternary': 'off',
|
158
|
-
'unicorn/prefer-native-coercion-functions': 'off',
|
159
125
|
'unicorn/prefer-negative-index': 'off',
|
160
|
-
'unicorn/prefer-regexp-test': 'off',
|
161
|
-
'unicorn/prefer-switch': 'off',
|
162
|
-
'unicorn/prefer-ternary': 'off',
|
163
|
-
|
164
|
-
// TODO rare errors
|
165
|
-
'arrow-body-style': 'off',
|
166
|
-
'block-scoped-var': 'off',
|
167
|
-
'import/no-extraneous-dependencies': 'off',
|
168
|
-
'import/order': 'off',
|
169
|
-
'new-cap': 'off',
|
170
|
-
'newline-per-chained-call': 'off',
|
171
|
-
'no-extra-boolean-cast': 'off',
|
172
|
-
'no-redeclare': 'off',
|
173
|
-
'no-unneeded-ternary': 'off',
|
174
|
-
'no-useless-return': 'off',
|
175
|
-
'operator-assignment': 'off',
|
176
|
-
'unicorn/no-console-spaces': 'off',
|
177
|
-
yoda: 'off',
|
178
126
|
},
|
179
127
|
reportUnusedDisableDirectives: true,
|
180
128
|
globals: {
|
package/.stylelintrc.js
CHANGED
@@ -16,8 +16,13 @@ module.exports = {
|
|
16
16
|
'max-line-length': null,
|
17
17
|
'no-descending-specificity': null,
|
18
18
|
'no-extra-semicolons': null, // fix GH-1832 - workaround for wikimedia/less.php parser
|
19
|
+
'number-max-precision': 5,
|
19
20
|
'rule-empty-line-before': null,
|
20
21
|
|
22
|
+
// TODO rules to be removed/fixed in v2.10.0 as fixes are not compatible with IE11
|
23
|
+
'alpha-value-notation': 'number', // https://caniuse.com/mdn-css_properties_opacity_percentages
|
24
|
+
'color-function-notation': 'legacy', // https://caniuse.com/mdn-css_types_color_rgba_space_separated_parameters
|
25
|
+
|
21
26
|
// TODO
|
22
27
|
'string-quotes': null, // 1676 errors
|
23
28
|
'at-rule-no-unknown': null, // 1081 errors
|
@@ -31,22 +36,15 @@ module.exports = {
|
|
31
36
|
'import-notation': null, // 56 errors
|
32
37
|
'keyframes-name-pattern': null, // 50 errors
|
33
38
|
'property-no-vendor-prefix': null, // 49 errors
|
34
|
-
'number-leading-zero': null, // 49 errors
|
35
|
-
'color-function-notation': null, // 32 errors
|
36
|
-
'alpha-value-notation': null, // 32 errors
|
37
|
-
'color-hex-case': null, // 32 errors
|
38
39
|
'block-no-empty': null, // 25 errors
|
39
40
|
'selector-no-vendor-prefix': null, // 19 errors
|
40
41
|
'selector-class-pattern': null, // 19 errors
|
41
|
-
'number-no-trailing-zeros': null, // 16 errors
|
42
42
|
'font-family-name-quotes': null, // 13 errors
|
43
43
|
'declaration-block-no-redundant-longhand-properties': null, // 12 errors
|
44
44
|
'value-keyword-case': null, // 12 errors
|
45
45
|
'value-no-vendor-prefix': null, // 9 errors
|
46
|
-
'color-hex-length': null, // 9 errors
|
47
46
|
'no-empty-source': null, // 8 errors
|
48
47
|
'font-family-no-missing-generic-family-keyword': null, // 8 errors
|
49
|
-
'number-max-precision': null, // 7 errors
|
50
48
|
'selector-attribute-quotes': null, // 7 errors
|
51
49
|
'shorthand-property-no-redundant-values': null, // 5 errors
|
52
50
|
'function-url-quotes': null, // 5 errors
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.23+27384cb - Accordion
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -15,7 +15,7 @@
|
|
15
15
|
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
16
16
|
}
|
17
17
|
|
18
|
-
window = (
|
18
|
+
window = (window !== undefined && window.Math === Math)
|
19
19
|
? window
|
20
20
|
: globalThis;
|
21
21
|
|
@@ -23,11 +23,11 @@
|
|
23
23
|
var
|
24
24
|
$allModules = $(this),
|
25
25
|
|
26
|
-
time =
|
26
|
+
time = Date.now(),
|
27
27
|
performance = [],
|
28
28
|
|
29
29
|
query = arguments[0],
|
30
|
-
methodInvoked = (typeof query
|
30
|
+
methodInvoked = (typeof query === 'string'),
|
31
31
|
queryArguments = [].slice.call(arguments, 1),
|
32
32
|
|
33
33
|
returnedValue
|
@@ -427,7 +427,7 @@
|
|
427
427
|
previousTime
|
428
428
|
;
|
429
429
|
if (settings.performance) {
|
430
|
-
currentTime =
|
430
|
+
currentTime = Date.now();
|
431
431
|
previousTime = time || currentTime;
|
432
432
|
executionTime = currentTime - previousTime;
|
433
433
|
time = currentTime;
|
@@ -478,8 +478,8 @@
|
|
478
478
|
;
|
479
479
|
passedArguments = passedArguments || queryArguments;
|
480
480
|
context = context || element;
|
481
|
-
if (typeof query
|
482
|
-
query = query.split(/[
|
481
|
+
if (typeof query === 'string' && object !== undefined) {
|
482
|
+
query = query.split(/[ .]/);
|
483
483
|
maxDepth = query.length - 1;
|
484
484
|
$.each(query, function (depth, value) {
|
485
485
|
var camelCaseValue = (depth != maxDepth)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.9.1-beta.
|
2
|
+
* # Fomantic UI - 2.9.1-beta.23+27384cb
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(T,
|
11
|
+
!function(k,T,A){"use strict";T=T!==A&&T.Math===Math?T:globalThis,k.fn.accordion=function(m){var v,h=k(this),b=Date.now(),y=[],C=m,O="string"==typeof C,x=[].slice.call(arguments,1);return h.each(function(){var e,a=k.isPlainObject(m)?k.extend(!0,{},k.fn.accordion.settings,m):k.extend({},k.fn.accordion.settings),s=a.className,n=a.namespace,l=a.selector,r=a.error,t="."+n,i="module-"+n,o=h.selector||"",c=k(this),d=c.find(l.title),u=c.find(l.content),g=this,p=c.data(i),f={initialize:function(){f.debug("Initializing",c),f.bind.events(),a.observeChanges&&f.observeChanges(),f.instantiate()},instantiate:function(){p=f,c.data(i,f)},destroy:function(){f.debug("Destroying previous instance",c),c.off(t).removeData(i)},refresh:function(){d=c.find(l.title),u=c.find(l.content)},observeChanges:function(){"MutationObserver"in T&&((e=new MutationObserver(function(e){f.debug("DOM tree modified, updating selector cache"),f.refresh()})).observe(g,{childList:!0,subtree:!0}),f.debug("Setting up mutation observer",e))},bind:{events:function(){f.debug("Binding delegated events"),c.on(a.on+t,l.trigger,f.event.click)}},event:{click:function(e){0===k(e.target).closest(l.ignore).length&&f.toggle.call(this)}},toggle:function(e){var e=e!==A?"number"==typeof e?d.eq(e):k(e).closest(l.title):k(this).closest(l.title),n=e.next(u),t=n.hasClass(s.animating),n=n.hasClass(s.active),i=n&&!t,n=!n&&t;f.debug("Toggling visibility of content",e),i||n?a.collapsible?f.close.call(e):f.debug("Cannot close accordion content collapsing is disabled"):f.open.call(e)},open:function(e){var e=e!==A?"number"==typeof e?d.eq(e):k(e).closest(l.title):k(this).closest(l.title),n=e.next(u),t=n.hasClass(s.animating);n.hasClass(s.active)||t?f.debug("Accordion already open, skipping",n):(f.debug("Opening accordion content",e),a.onOpening.call(n),a.onChanging.call(n),a.exclusive&&f.closeOthers.call(e),e.addClass(s.active),n.stop(!0,!0).addClass(s.animating),a.animateChildren&&(k.fn.transition!==A&&c.transition("is supported")?n.children().transition({animation:"fade in",queue:!1,useFailSafe:!0,debug:a.debug,verbose:a.verbose,silent:a.silent,duration:a.duration,skipInlineHidden:!0,onComplete:function(){n.children().removeClass(s.transition)}}):n.children().stop(!0,!0).animate({opacity:1},a.duration,f.resetOpacity)),n.slideDown(a.duration,a.easing,function(){n.removeClass(s.animating).addClass(s.active),f.reset.display.call(this),a.onOpen.call(this),a.onChange.call(this)}))},close:function(e){var e=e!==A?"number"==typeof e?d.eq(e):k(e).closest(l.title):k(this).closest(l.title),n=e.next(u),t=n.hasClass(s.animating),i=n.hasClass(s.active);!i&&!(!i&&t)||i&&t||(f.debug("Closing accordion content",n),a.onClosing.call(n),a.onChanging.call(n),e.removeClass(s.active),n.stop(!0,!0).addClass(s.animating),a.animateChildren&&(k.fn.transition!==A&&c.transition("is supported")?n.children().transition({animation:"fade out",queue:!1,useFailSafe:!0,debug:a.debug,verbose:a.verbose,silent:a.silent,duration:a.duration,skipInlineHidden:!0}):n.children().stop(!0,!0).animate({opacity:0},a.duration,f.resetOpacity)),n.slideUp(a.duration,a.easing,function(){n.removeClass(s.animating).removeClass(s.active),f.reset.display.call(this),a.onClose.call(this),a.onChange.call(this)}))},closeOthers:function(e){var n,e=e!==A?d.eq(e):k(this).closest(l.title),t=e.parents(l.content).prev(l.title),e=e.closest(l.accordion),i=l.title+"."+s.active+":visible",o=l.content+"."+s.active+":visible",o=a.closeNested?(n=e.find(i).not(t)).next(u):(n=e.find(i).not(t),e=e.find(o).find(i).not(t),(n=n.not(e)).next(u));0<n.length&&(f.debug("Exclusive enabled, closing other content",n),n.removeClass(s.active),o.removeClass(s.animating).stop(!0,!0),a.animateChildren&&(k.fn.transition!==A&&c.transition("is supported")?o.children().transition({animation:"fade out",useFailSafe:!0,debug:a.debug,verbose:a.verbose,silent:a.silent,duration:a.duration,skipInlineHidden:!0}):o.children().stop(!0,!0).animate({opacity:0},a.duration,f.resetOpacity)),o.slideUp(a.duration,a.easing,function(){k(this).removeClass(s.active),f.reset.display.call(this)}))},reset:{display:function(){f.verbose("Removing inline display from element",this);var e=k(this);e.css("display",""),""===e.attr("style")&&e.attr("style","").removeAttr("style")},opacity:function(){f.verbose("Removing inline opacity from element",this);var e=k(this);e.css("opacity",""),""===e.attr("style")&&e.attr("style","").removeAttr("style")}},setting:function(e,n){if(f.debug("Changing setting",e,n),k.isPlainObject(e))k.extend(!0,a,e);else{if(n===A)return a[e];k.isPlainObject(a[e])?k.extend(!0,a[e],n):a[e]=n}},internal:function(e,n){if(f.debug("Changing internal",e,n),n===A)return f[e];k.isPlainObject(e)?k.extend(!0,f,e):f[e]=n},debug:function(){!a.silent&&a.debug&&(a.performance?f.performance.log(arguments):(f.debug=Function.prototype.bind.call(console.info,console,a.name+":"),f.debug.apply(console,arguments)))},verbose:function(){!a.silent&&a.verbose&&a.debug&&(a.performance?f.performance.log(arguments):(f.verbose=Function.prototype.bind.call(console.info,console,a.name+":"),f.verbose.apply(console,arguments)))},error:function(){a.silent||(f.error=Function.prototype.bind.call(console.error,console,a.name+":"),f.error.apply(console,arguments))},performance:{log:function(e){var n,t;a.performance&&(t=(n=Date.now())-(b||n),b=n,y.push({Name:e[0],Arguments:[].slice.call(e,1)||"",Element:g,"Execution Time":t})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(f.performance.display,500)},display:function(){var e=a.name+":",t=0;b=!1,clearTimeout(f.performance.timer),k.each(y,function(e,n){t+=n["Execution Time"]}),e+=" "+t+"ms",o&&(e+=" '"+o+"'"),(console.group!==A||console.table!==A)&&0<y.length&&(console.groupCollapsed(e),console.table?console.table(y):k.each(y,function(e,n){console.log(n.Name+": "+n["Execution Time"]+"ms")}),console.groupEnd()),y=[]}},invoke:function(i,e,n){var o,a,t,s,l=p;return e=e||x,n=n||g,"string"==typeof i&&l!==A&&(i=i.split(/[ .]/),o=i.length-1,k.each(i,function(e,n){var t=e!=o?n+i[e+1].charAt(0).toUpperCase()+i[e+1].slice(1):i;if(k.isPlainObject(l[t])&&e!=o)l=l[t];else{if(l[t]!==A)return a=l[t],!1;{if(!k.isPlainObject(l[n])||e==o)return l[n]!==A?a=l[n]:f.error(r.method,i),!1;l=l[n]}}})),"function"==typeof(s=a)&&"number"!=typeof s.nodeType?t=a.apply(n,e):a!==A&&(t=a),Array.isArray(v)?v.push(t):v!==A?v=[v,t]:t!==A&&(v=t),a}};O?(p===A&&f.initialize(),f.invoke(C)):(p!==A&&p.invoke("destroy"),f.initialize())}),v!==A?v:this},k.fn.accordion.settings={name:"Accordion",namespace:"accordion",silent:!1,debug:!1,verbose:!1,performance:!0,on:"click",observeChanges:!0,exclusive:!0,collapsible:!0,closeNested:!1,animateChildren:!0,duration:350,easing:"easeOutQuad",onOpening:function(){},onClosing:function(){},onChanging:function(){},onOpen:function(){},onClose:function(){},onChange:function(){},error:{method:"The method you called is not defined"},className:{active:"active",animating:"animating",transition:"transition"},selector:{accordion:".accordion",title:".title",trigger:".title",ignore:".ui.dropdown",content:".content"}},k.extend(k.easing,{easeOutQuad:function(e){return 1-(1-e)*(1-e)}})}(jQuery,window,void document);
|
package/dist/components/ad.css
CHANGED
package/dist/components/api.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
/*!
|
2
|
-
* # Fomantic-UI 2.9.1-beta.
|
2
|
+
* # Fomantic-UI 2.9.1-beta.23+27384cb - API
|
3
3
|
* https://github.com/fomantic/Fomantic-UI/
|
4
4
|
*
|
5
5
|
*
|
@@ -19,22 +19,22 @@
|
|
19
19
|
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
20
20
|
}
|
21
21
|
|
22
|
-
window = (
|
22
|
+
window = (window !== undefined && window.Math === Math)
|
23
23
|
? window
|
24
24
|
: globalThis;
|
25
25
|
|
26
|
-
$.
|
26
|
+
$.fn.api = function (parameters) {
|
27
27
|
var
|
28
28
|
// use window context if none specified
|
29
29
|
$allModules = isFunction(this)
|
30
30
|
? $(window)
|
31
31
|
: $(this),
|
32
32
|
moduleSelector = $allModules.selector || '',
|
33
|
-
time =
|
33
|
+
time = Date.now(),
|
34
34
|
performance = [],
|
35
35
|
|
36
36
|
query = arguments[0],
|
37
|
-
methodInvoked = (typeof query
|
37
|
+
methodInvoked = (typeof query === 'string'),
|
38
38
|
queryArguments = [].slice.call(arguments, 1),
|
39
39
|
|
40
40
|
returnedValue
|
@@ -126,7 +126,7 @@
|
|
126
126
|
|
127
127
|
decode: {
|
128
128
|
json: function (response) {
|
129
|
-
if (response !== undefined && typeof response
|
129
|
+
if (response !== undefined && typeof response === 'string') {
|
130
130
|
try {
|
131
131
|
response = JSON.parse(response);
|
132
132
|
} catch (e) {
|
@@ -207,10 +207,10 @@
|
|
207
207
|
module.error(error.beforeSend);
|
208
208
|
|
209
209
|
return;
|
210
|
-
} else {
|
211
|
-
module.cancelled = false;
|
212
210
|
}
|
213
211
|
|
212
|
+
module.cancelled = false;
|
213
|
+
|
214
214
|
// get url
|
215
215
|
url = module.get.templatedURL();
|
216
216
|
|
@@ -304,11 +304,11 @@
|
|
304
304
|
module.verbose('XHR request determined to be aborted');
|
305
305
|
|
306
306
|
return true;
|
307
|
-
} else {
|
308
|
-
module.verbose('XHR request was not aborted');
|
309
|
-
|
310
|
-
return false;
|
311
307
|
}
|
308
|
+
|
309
|
+
module.verbose('XHR request was not aborted');
|
310
|
+
|
311
|
+
return false;
|
312
312
|
},
|
313
313
|
validResponse: function (response) {
|
314
314
|
if ((!module.is.expectingJSON()) || !isFunction(settings.successTest)) {
|
@@ -321,11 +321,11 @@
|
|
321
321
|
module.debug('Response passed success test', response);
|
322
322
|
|
323
323
|
return true;
|
324
|
-
} else {
|
325
|
-
module.debug('Response failed success test', response);
|
326
|
-
|
327
|
-
return false;
|
328
324
|
}
|
325
|
+
|
326
|
+
module.debug('Response failed success test', response);
|
327
|
+
|
328
|
+
return false;
|
329
329
|
},
|
330
330
|
},
|
331
331
|
|
@@ -376,13 +376,13 @@
|
|
376
376
|
url = false;
|
377
377
|
|
378
378
|
return false;
|
379
|
-
} else {
|
380
|
-
module.verbose('Found required variable', variable, value);
|
381
|
-
value = (settings.encodeParameters)
|
382
|
-
? module.get.urlEncodedValue(value)
|
383
|
-
: value;
|
384
|
-
url = url.replace(templatedString, value);
|
385
379
|
}
|
380
|
+
|
381
|
+
module.verbose('Found required variable', variable, value);
|
382
|
+
value = (settings.encodeParameters)
|
383
|
+
? module.get.urlEncodedValue(value)
|
384
|
+
: value;
|
385
|
+
url = url.replace(templatedString, value);
|
386
386
|
});
|
387
387
|
}
|
388
388
|
if (optionalVariables) {
|
@@ -408,11 +408,9 @@
|
|
408
408
|
} else {
|
409
409
|
module.verbose('Optional variable not found', variable);
|
410
410
|
// remove preceding slash if set
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
url = url.replace(templatedString, '');
|
415
|
-
}
|
411
|
+
url = url.indexOf('/' + templatedString) !== -1
|
412
|
+
? url.replace('/' + templatedString, '')
|
413
|
+
: url.replace(templatedString, '');
|
416
414
|
}
|
417
415
|
});
|
418
416
|
}
|
@@ -431,8 +429,8 @@
|
|
431
429
|
|
432
430
|
if (useFormDataApi) {
|
433
431
|
formData = new FormData($form[0]);
|
434
|
-
settings.processData =
|
435
|
-
settings.contentType =
|
432
|
+
settings.processData = settings.processData !== undefined ? settings.processData : false;
|
433
|
+
settings.contentType = settings.contentType !== undefined ? settings.contentType : false;
|
436
434
|
} else {
|
437
435
|
var
|
438
436
|
formArray = $form.serializeArray(),
|
@@ -463,8 +461,7 @@
|
|
463
461
|
? floatValue
|
464
462
|
: (el.value === 'false' ? false : el.value)),
|
465
463
|
nameKeys = el.name.match(settings.regExp.key) || [],
|
466
|
-
|
467
|
-
pushKey = el.name.replace(/\[\]$/, '')
|
464
|
+
pushKey = el.name.replace(/\[]$/, '')
|
468
465
|
;
|
469
466
|
if (!(pushKey in pushes)) {
|
470
467
|
pushes[pushKey] = 0;
|
@@ -478,7 +475,9 @@
|
|
478
475
|
value = pushValues[pushKey];
|
479
476
|
}
|
480
477
|
|
481
|
-
while (
|
478
|
+
while (nameKeys.length > 0) {
|
479
|
+
var k = nameKeys.pop();
|
480
|
+
|
482
481
|
if (k == '' && !Array.isArray(value)) { // foo[]
|
483
482
|
value = build([], pushes[pushKey]++, value);
|
484
483
|
} else if (settings.regExp.fixed.test(k)) { // foo[n]
|
@@ -537,7 +536,7 @@
|
|
537
536
|
done: function (response, textStatus, xhr) {
|
538
537
|
var
|
539
538
|
context = this,
|
540
|
-
elapsedTime = (
|
539
|
+
elapsedTime = (Date.now() - requestStartTime),
|
541
540
|
timeLeft = (settings.loadingDuration - elapsedTime),
|
542
541
|
translatedResponse = (isFunction(settings.onResponse))
|
543
542
|
? module.is.expectingJSON() && !settings.rawResponse
|
@@ -566,7 +565,7 @@
|
|
566
565
|
fail: function (xhr, status, httpMessage) {
|
567
566
|
var
|
568
567
|
context = this,
|
569
|
-
elapsedTime = (
|
568
|
+
elapsedTime = (Date.now() - requestStartTime),
|
570
569
|
timeLeft = (settings.loadingDuration - elapsedTime)
|
571
570
|
;
|
572
571
|
timeLeft = (timeLeft > 0)
|
@@ -620,7 +619,8 @@
|
|
620
619
|
settings.onAbort.call(context, status, $module, xhr);
|
621
620
|
|
622
621
|
return true;
|
623
|
-
}
|
622
|
+
}
|
623
|
+
if (status == 'invalid') {
|
624
624
|
module.debug('JSON did not pass success test. A server-side error has most likely occurred', response);
|
625
625
|
} else if (status == 'error') {
|
626
626
|
if (xhr !== undefined) {
|
@@ -727,7 +727,7 @@
|
|
727
727
|
loading: function () {
|
728
728
|
module.verbose('Adding loading state to element', $context);
|
729
729
|
$context.addClass(className.loading);
|
730
|
-
requestStartTime =
|
730
|
+
requestStartTime = Date.now();
|
731
731
|
},
|
732
732
|
},
|
733
733
|
|
@@ -821,9 +821,7 @@
|
|
821
821
|
if (!isWindow(element)) {
|
822
822
|
if (module.is.input()) {
|
823
823
|
data.value = $module.val();
|
824
|
-
} else if (module.is.form()) {
|
825
|
-
|
826
|
-
} else {
|
824
|
+
} else if (!module.is.form()) {
|
827
825
|
data.text = $module.text();
|
828
826
|
}
|
829
827
|
}
|
@@ -835,21 +833,23 @@
|
|
835
833
|
module.debug('API called without element, no events attached');
|
836
834
|
|
837
835
|
return false;
|
838
|
-
}
|
836
|
+
}
|
837
|
+
if (settings.on == 'auto') {
|
839
838
|
if ($module.is('input')) {
|
840
839
|
return (element.oninput !== undefined)
|
841
840
|
? 'input'
|
842
841
|
: (element.onpropertychange !== undefined)
|
843
842
|
? 'propertychange'
|
844
843
|
: 'keyup';
|
845
|
-
}
|
844
|
+
}
|
845
|
+
if ($module.is('form')) {
|
846
846
|
return 'submit';
|
847
|
-
} else {
|
848
|
-
return 'click';
|
849
847
|
}
|
850
|
-
|
851
|
-
return
|
848
|
+
|
849
|
+
return 'click';
|
852
850
|
}
|
851
|
+
|
852
|
+
return settings.on;
|
853
853
|
},
|
854
854
|
templatedURL: function (action) {
|
855
855
|
action = action || $module.data(metadata.action) || settings.action || false;
|
@@ -949,7 +949,7 @@
|
|
949
949
|
previousTime
|
950
950
|
;
|
951
951
|
if (settings.performance) {
|
952
|
-
currentTime =
|
952
|
+
currentTime = Date.now();
|
953
953
|
previousTime = time || currentTime;
|
954
954
|
executionTime = currentTime - previousTime;
|
955
955
|
time = currentTime;
|
@@ -1000,8 +1000,8 @@
|
|
1000
1000
|
;
|
1001
1001
|
passedArguments = passedArguments || queryArguments;
|
1002
1002
|
context = context || element;
|
1003
|
-
if (typeof query
|
1004
|
-
query = query.split(/[
|
1003
|
+
if (typeof query === 'string' && object !== undefined) {
|
1004
|
+
query = query.split(/[ .]/);
|
1005
1005
|
maxDepth = query.length - 1;
|
1006
1006
|
$.each(query, function (depth, value) {
|
1007
1007
|
var camelCaseValue = (depth != maxDepth)
|
@@ -1061,6 +1061,7 @@
|
|
1061
1061
|
? returnedValue
|
1062
1062
|
: this;
|
1063
1063
|
};
|
1064
|
+
$.api = $.fn.api;
|
1064
1065
|
|
1065
1066
|
$.api.settings = {
|
1066
1067
|
|
@@ -1186,13 +1187,13 @@
|
|
1186
1187
|
},
|
1187
1188
|
|
1188
1189
|
regExp: {
|
1189
|
-
required:
|
1190
|
-
optional:
|
1191
|
-
validate: /^[
|
1192
|
-
key: /[
|
1190
|
+
required: /{\$*[\da-z]+}/gi,
|
1191
|
+
optional: /{\/\$*[\da-z]+}/gi,
|
1192
|
+
validate: /^[_a-z][\w-]*(?:\[[\w-]*])*$/i,
|
1193
|
+
key: /[\w-]+|(?=\[])/gi,
|
1193
1194
|
push: /^$/,
|
1194
1195
|
fixed: /^\d+$/,
|
1195
|
-
named: /^[
|
1196
|
+
named: /^[\w-]+$/i,
|
1196
1197
|
},
|
1197
1198
|
|
1198
1199
|
className: {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* # Fomantic UI - 2.9.1-beta.
|
2
|
+
* # Fomantic UI - 2.9.1-beta.23+27384cb
|
3
3
|
* https://github.com/fomantic/Fomantic-UI
|
4
4
|
* https://fomantic-ui.com/
|
5
5
|
*
|
@@ -8,4 +8,4 @@
|
|
8
8
|
* https://opensource.org/licenses/MIT
|
9
9
|
*
|
10
10
|
*/
|
11
|
-
!function(P,w,j,C){"use strict";function E(e){return null!=e&&e===e.window}function F(e){return"function"==typeof e&&"number"!=typeof e.nodeType}w=void 0!==w&&w.Math==Math?w:globalThis,P.api=P.fn.api=function(q){var x,e=F(this)?P(w):P(this),A=e.selector||"",k=(new Date).getTime(),S=[],T=q,D="string"==typeof T,O=[].slice.call(arguments,1);return e.each(function(){var a,n,r,e,s,o,f=P.isPlainObject(q)?P.extend(!0,{},P.fn.api.settings,q):P.extend({},P.fn.api.settings),t=f.namespace,i=f.metadata,u=f.selector,c=f.error,d=f.className,l="."+t,p="module-"+t,g=P(this),m=g.closest(u.form),b=f.stateContext?[w,j].indexOf(f.stateContext)<0?P(j).find(f.stateContext):P(f.stateContext):g,v=this,h=b[0],y=g.data(p),R={initialize:function(){D||(o=f.data,R.bind.events()),R.instantiate()},instantiate:function(){R.verbose("Storing instance of module",R),y=R,g.data(p,y)},destroy:function(){R.verbose("Destroying previous module for",v),g.removeData(p).off(l)},bind:{events:function(){var e=R.get.event();e?(R.verbose("Attaching API events to element",e),g.on(e+l,R.event.trigger)):"now"==f.on&&(R.debug("Querying API endpoint immediately"),R.query())}},decode:{json:function(e){if(e!==C&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}},read:{cachedResponse:function(e){var t;if(w.Storage!==C)return t=sessionStorage.getItem(e+R.get.normalizedData()),R.debug("Using cached response",e,f.data,t),R.decode.json(t);R.error(c.noStorage)}},write:{cachedResponse:function(e,t){w.Storage===C?R.error(c.noStorage):(P.isPlainObject(t)&&(t=JSON.stringify(t)),sessionStorage.setItem(e+R.get.normalizedData(),t),R.verbose("Storing cached response for url",e,f.data,t))}},query:function(){if(R.is.disabled())R.debug("Element is disabled API request aborted");else{if(R.is.loading()){if(!f.interruptRequests)return void R.debug("Cancelling request, previous request is still pending");R.debug("Interrupting previous request"),R.abort()}if(f.defaultData&&P.extend(!0,f.urlData,R.get.defaultData()),f.serializeForm&&(f.data=R.add.formData(o||f.data)),!1===(n=R.get.settings()))return R.cancelled=!0,void R.error(c.beforeSend);if(R.cancelled=!1,(r=R.get.templatedURL())||R.is.mocked()){if((r=R.add.urlData(r))||R.is.mocked()){if(n.url=f.base+r,a=P.extend(!0,{},f,{type:f.method||f.type,data:e,url:f.base+r,beforeSend:f.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),R.debug("Querying URL",a.url),R.verbose("Using AJAX settings",a),"local"===f.cache&&R.read.cachedResponse(r))return R.debug("Response returned from local cache"),R.request=R.create.request(),void R.request.resolveWith(h,[R.read.cachedResponse(r)]);f.throttle?f.throttleFirstRequest||R.timer?(R.debug("Throttling request",f.throttle),clearTimeout(R.timer),R.timer=setTimeout(function(){R.timer&&delete R.timer,R.debug("Sending throttled request",e,a.method),R.send.request()},f.throttle)):(R.debug("Sending request",e,a.method),R.send.request(),R.timer=setTimeout(function(){},f.throttle)):(R.debug("Sending request",e,a.method),R.send.request())}}else R.error(c.missingURL)}},should:{removeError:function(){return!0===f.hideError||"auto"===f.hideError&&!R.is.form()}},is:{disabled:function(){return 0<g.filter(u.disabled).length},expectingJSON:function(){return"json"===f.dataType||"jsonp"===f.dataType},form:function(){return g.is("form")||b.is("form")},mocked:function(){return f.mockResponse||f.mockResponseAsync||f.response||f.responseAsync},input:function(){return g.is("input")},loading:function(){return!!R.request&&"pending"==R.request.state()},abortedRequest:function(e){return e&&e.readyState!==C&&0===e.readyState?(R.verbose("XHR request determined to be aborted"),!0):(R.verbose("XHR request was not aborted"),!1)},validResponse:function(e){return R.is.expectingJSON()&&F(f.successTest)?(R.debug("Checking JSON returned success",f.successTest,e),f.successTest(e)?(R.debug("Response passed success test",e),!0):(R.debug("Response failed success test",e),!1)):(R.verbose("Response is not JSON, skipping validation",f.successTest,e),!0)}},was:{cancelled:function(){return R.cancelled||!1},successful:function(){return R.request&&"resolved"==R.request.state()},failure:function(){return R.request&&"rejected"==R.request.state()},complete:function(){return R.request&&("resolved"==R.request.state()||"rejected"==R.request.state())}},add:{urlData:function(o,a){var e,t;return o&&(e=o.match(f.regExp.required),t=o.match(f.regExp.optional),a=a||f.urlData,e&&(R.debug("Looking for required URL variables",e),P.each(e,function(e,t){var r=-1!==t.indexOf("$")?t.slice(2,-1):t.slice(1,-1),n=P.isPlainObject(a)&&a[r]!==C?a[r]:g.data(r)!==C?g.data(r):b.data(r)!==C?b.data(r):a[r];if(n===C)return R.error(c.requiredParameter,r,o),o=!1;R.verbose("Found required variable",r,n),n=f.encodeParameters?R.get.urlEncodedValue(n):n,o=o.replace(t,n)})),t&&(R.debug("Looking for optional URL variables",e),P.each(t,function(e,t){var r=-1!==t.indexOf("$")?t.slice(3,-1):t.slice(2,-1),n=P.isPlainObject(a)&&a[r]!==C?a[r]:g.data(r)!==C?g.data(r):b.data(r)!==C?b.data(r):a[r];o=n!==C?(R.verbose("Optional variable Found",r,n),o.replace(t,n)):(R.verbose("Optional variable not found",r),-1!==o.indexOf("/"+t)?o.replace("/"+t,""):o.replace(t,""))}))),o},formData:function(r){var e,n,u,c,d,l={},t="formdata"===f.serializeForm;return r=r||o||f.data,e=P.isPlainObject(r),t?(l=new FormData(m[0]),f.processData=void 0!==f.processData&&f.processData,f.contentType=void 0!==f.contentType&&f.contentType):(n=m.serializeArray(),u={},c={},d=function(e,t,r){return e[t]=r,e},P.each(P('input[type="file"]',m),function(e,r){P.each(P(r)[0].files,function(e,t){n.push({name:r.name,value:t})})}),P.each(n,function(e,t){if(f.regExp.validate.test(t.name)){var r,n="checkbox"===P('[name="'+t.name+'"]',m).attr("type"),o=parseFloat(t.value),a=n&&"on"===t.value||"true"===t.value||(String(o)===t.value?o:"false"!==t.value&&t.value),s=t.name.match(f.regExp.key)||[],i=t.name.replace(/\[\]$/,"");i in u?Array.isArray(c[i])?c[i].push(a):c[i]=[c[i],a]:(u[i]=0,c[i]=a),-1===i.indexOf("[]")&&(a=c[i]);for(;(r=s.pop())!==C;)""!=r||Array.isArray(a)?f.regExp.fixed.test(r)?a=d([],r,a):f.regExp.named.test(r)&&(a=d({},r,a)):a=d([],u[i]++,a);l=P.extend(!0,l,a)}})),r=e?(R.debug("Extending existing data with form data",r,l),t?(P.each(Object.keys(r),function(e,t){l.append(t,r[t])}),l):P.extend(!0,{},r,l)):(R.debug("Adding form data",l),l)}},send:{request:function(){R.set.loading(),R.request=R.create.request(),R.is.mocked()?R.mockedXHR=R.create.mockedXHR():R.xhr=R.create.xhr(),f.onRequest.call(h,R.request,R.xhr)}},event:{trigger:function(e){R.query(),"submit"!=e.type&&"click"!=e.type||e.preventDefault()},xhr:{always:function(){},done:function(e,t,r){var n=this,o=(new Date).getTime()-s,o=f.loadingDuration-o,a=!!F(f.onResponse)&&(R.is.expectingJSON()&&!f.rawResponse?f.onResponse.call(n,P.extend(!0,{},e)):f.onResponse.call(n,e)),o=0<o?o:0;a&&(R.debug("Modified API response in onResponse callback",f.onResponse,a,e),e=a),0<o&&R.debug("Response completed early delaying state change by",o),setTimeout(function(){R.is.validResponse(e)?R.request.resolveWith(n,[e,r]):R.request.rejectWith(n,[r,"invalid"])},o)},fail:function(e,t,r){var n=this,o=(new Date).getTime()-s,o=f.loadingDuration-o;0<(o=0<o?o:0)&&R.debug("Response completed early delaying state change by",o),setTimeout(function(){R.is.abortedRequest(e)?R.request.rejectWith(n,[e,"aborted",r]):R.request.rejectWith(n,[e,"error",t,r])},o)}},request:{done:function(e,t){R.debug("Successful API Response",e),"local"===f.cache&&r&&(R.write.cachedResponse(r,e),R.debug("Saving server response locally",R.cache)),f.onSuccess.call(h,e,g,t)},complete:function(e,t){var r,n;R.was.successful()?(n=e,r=t):n=R.get.responseFromXHR(r=e),R.remove.loading(),f.onComplete.call(h,n,g,r)},fail:function(e,t,r){var n=R.get.responseFromXHR(e),o=R.get.errorFromRequest(n,t,r);if("aborted"==t)return R.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)",t,r),f.onAbort.call(h,t,g,e),!0;"invalid"==t?R.debug("JSON did not pass success test. A server-side error has most likely occurred",n):"error"==t&&e!==C&&(R.debug("XHR produced a server error",t,r),(e.status<200||300<=e.status)&&r!==C&&""!==r&&R.error(c.statusMessage+r,a.url),f.onError.call(h,o,g,e)),f.errorDuration&&"aborted"!==t&&(R.debug("Adding error state"),R.set.error(),R.should.removeError()&&setTimeout(R.remove.error,f.errorDuration)),R.debug("API Request failed",o,e),f.onFailure.call(h,n,g,e)}}},create:{request:function(){return P.Deferred().always(R.event.request.complete).done(R.event.request.done).fail(R.event.request.fail)},mockedXHR:function(){var e=f.mockResponse||f.response,t=f.mockResponseAsync||f.responseAsync,r=P.Deferred().always(R.event.xhr.complete).done(R.event.xhr.done).fail(R.event.xhr.fail);return e?(e=F(e)?(R.debug("Using specified synchronous callback",e),e.call(h,n)):(R.debug("Using settings specified response",e),e),r.resolveWith(h,[e,!1,{responseText:e}])):F(t)&&(e=function(e){R.debug("Async callback returned response",e),e?r.resolveWith(h,[e,!1,{responseText:e}]):r.rejectWith(h,[{responseText:e},!1,!1])},R.debug("Using specified async response callback",t),t.call(h,n,e)),r},xhr:function(){var e=P.ajax(a).always(R.event.xhr.always).done(R.event.xhr.done).fail(R.event.xhr.fail);return R.verbose("Created server request",e,a),e}},set:{error:function(){R.verbose("Adding error state to element",b),b.addClass(d.error)},loading:function(){R.verbose("Adding loading state to element",b),b.addClass(d.loading),s=(new Date).getTime()}},remove:{error:function(){R.verbose("Removing error state from element",b),b.removeClass(d.error)},loading:function(){R.verbose("Removing loading state from element",b),b.removeClass(d.loading)}},get:{normalizedData:function(){return"string"==typeof f.data?f.data:JSON.stringify(f.data,Object.keys(f.data).sort())},responseFromXHR:function(e){return!!P.isPlainObject(e)&&(R.is.expectingJSON()?R.decode.json(e.responseText):e.responseText)},errorFromRequest:function(e,t,r){return P.isPlainObject(e)&&e.error!==C?e.error:f.error[t]!==C?f.error[t]:r},request:function(){return R.request||!1},xhr:function(){return R.xhr||!1},settings:function(){var e=f.beforeSend.call(g,f);return e&&(e.success!==C&&(R.debug("Legacy success callback detected",e),R.error(c.legacyParameters,e.success),e.onSuccess=e.success),e.failure!==C&&(R.debug("Legacy failure callback detected",e),R.error(c.legacyParameters,e.failure),e.onFailure=e.failure),e.complete!==C&&(R.debug("Legacy complete callback detected",e),R.error(c.legacyParameters,e.complete),e.onComplete=e.complete)),e===C&&R.error(c.noReturnedValue),!1===e?e:e!==C?P.extend(!0,{},e):P.extend(!0,{},f)},urlEncodedValue:function(e){var t=w.decodeURIComponent(e),r=w.encodeURIComponent(e);return t!==e?(R.debug("URL value is already encoded, avoiding double encoding",e),e):(R.verbose("Encoding value using encodeURIComponent",e,r),r)},defaultData:function(){var e={};return E(v)||(R.is.input()?e.value=g.val():R.is.form()||(e.text=g.text())),e},event:function(){return E(v)||"now"==f.on?(R.debug("API called without element, no events attached"),!1):"auto"==f.on?g.is("input")?v.oninput!==C?"input":v.onpropertychange!==C?"propertychange":"keyup":g.is("form")?"submit":"click":f.on},templatedURL:function(e){if(e=e||g.data(i.action)||f.action||!1,r=g.data(i.url)||f.url||!1)return R.debug("Using specified url",r),r;if(e){if(R.debug("Looking up url for action",e,f.api),f.api[e]===C&&!R.is.mocked())return void R.error(c.missingAction,f.action,f.api);r=f.api[e]}else R.is.form()&&(r=g.attr("action")||b.attr("action")||!1,R.debug("No url or action specified, defaulting to form action",r));return r}},abort:function(){var e=R.get.xhr();e&&"resolved"!==e.state()&&(R.debug("Cancelling API request"),e.abort())},reset:function(){R.remove.error(),R.remove.loading()},setting:function(e,t){if(R.debug("Changing setting",e,t),P.isPlainObject(e))P.extend(!0,f,e);else{if(t===C)return f[e];P.isPlainObject(f[e])?P.extend(!0,f[e],t):f[e]=t}},internal:function(e,t){if(P.isPlainObject(e))P.extend(!0,R,e);else{if(t===C)return R[e];R[e]=t}},debug:function(){!f.silent&&f.debug&&(f.performance?R.performance.log(arguments):(R.debug=Function.prototype.bind.call(console.info,console,f.name+":"),R.debug.apply(console,arguments)))},verbose:function(){!f.silent&&f.verbose&&f.debug&&(f.performance?R.performance.log(arguments):(R.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),R.verbose.apply(console,arguments)))},error:function(){f.silent||(R.error=Function.prototype.bind.call(console.error,console,f.name+":"),R.error.apply(console,arguments))},performance:{log:function(e){var t,r;f.performance&&(r=(t=(new Date).getTime())-(k||t),k=t,S.push({Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":r})),clearTimeout(R.performance.timer),R.performance.timer=setTimeout(R.performance.display,500)},display:function(){var e=f.name+":",r=0;k=!1,clearTimeout(R.performance.timer),P.each(S,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",A&&(e+=" '"+A+"'"),(console.group!==C||console.table!==C)&&0<S.length&&(console.groupCollapsed(e),console.table?console.table(S):P.each(S,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),S=[]}},invoke:function(n,e,t){var o,a,r,s=y;return e=e||O,t=t||v,"string"==typeof n&&s!==C&&(n=n.split(/[\. ]/),o=n.length-1,P.each(n,function(e,t){var r=e!=o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(P.isPlainObject(s[r])&&e!=o)s=s[r];else{if(s[r]!==C)return a=s[r],!1;{if(!P.isPlainObject(s[t])||e==o)return s[t]!==C?a=s[t]:R.error(c.method,n),!1;s=s[t]}}})),F(a)?r=a.apply(t,e):a!==C&&(r=a),Array.isArray(x)?x.push(r):x!==C?x=[x,r]:r!==C&&(x=r),a}};D?(y===C&&R.initialize(),R.invoke(T)):(y!==C&&y.invoke("destroy"),R.initialize())}),x!==C?x:this},P.api.settings={name:"API",namespace:"api",debug:!1,verbose:!1,performance:!0,api:{},cache:!0,interruptRequests:!0,on:"auto",stateContext:!1,loadingDuration:0,hideError:"auto",errorDuration:2e3,encodeParameters:!0,action:!1,url:!1,base:"",urlData:{},defaultData:!0,serializeForm:!1,throttle:0,throttleFirstRequest:!0,method:"get",data:{},dataType:"json",mockResponse:!1,mockResponseAsync:!1,response:!1,responseAsync:!1,rawResponse:!0,beforeSend:function(e){return e},beforeXHR:function(e){},onRequest:function(e,t){},onResponse:!1,onSuccess:function(e,t){},onComplete:function(e,t){},onFailure:function(e,t){},onError:function(e,t){},onAbort:function(e,t){},successTest:!1,error:{beforeSend:"The before send function has aborted the request",error:"There was an error with your request",exitConditions:"API Request Aborted. Exit conditions met",JSONParse:"JSON could not be parsed during error handling",legacyParameters:"You are using legacy API success callback names",method:"The method you called is not defined",missingAction:"API action used but no url was defined",missingURL:"No URL specified for api event",noReturnedValue:"The beforeSend callback must return a settings object, beforeSend ignored.",noStorage:"Caching responses locally requires session storage",parseError:"There was an error parsing your request",requiredParameter:"Missing a required URL parameter: ",statusMessage:"Server gave an error: ",timeout:"Your request timed out"},regExp:{required:/\{\$*[a-z0-9]+\}/gi,optional:/\{\/\$*[a-z0-9]+\}/gi,validate:/^[a-z_][a-z0-9_-]*(?:\[[a-z0-9_-]*\])*$/i,key:/[a-z0-9_-]+|(?=\[\])/gi,push:/^$/,fixed:/^\d+$/,named:/^[a-z0-9_-]+$/i},className:{loading:"loading",error:"error"},selector:{disabled:".disabled",form:"form"},metadata:{action:"action",url:"url"}}}(jQuery,window,document);
|
11
|
+
!function(O,P,j,C){"use strict";function E(e){return null!=e&&e===e.window}function F(e){return"function"==typeof e&&"number"!=typeof e.nodeType}P=P!==C&&P.Math===Math?P:globalThis,O.fn.api=function(q){var x,e=F(this)?O(P):O(this),A=e.selector||"",k=Date.now(),S=[],T=q,w="string"==typeof T,D=[].slice.call(arguments,1);return e.each(function(){var a,n,r,e,s,o,f=O.isPlainObject(q)?O.extend(!0,{},O.fn.api.settings,q):O.extend({},O.fn.api.settings),t=f.namespace,i=f.metadata,u=f.selector,c=f.error,d=f.className,l="."+t,p="module-"+t,g=O(this),m=g.closest(u.form),b=f.stateContext?[P,j].indexOf(f.stateContext)<0?O(j).find(f.stateContext):O(f.stateContext):g,v=this,h=b[0],y=g.data(p),R={initialize:function(){w||(o=f.data,R.bind.events()),R.instantiate()},instantiate:function(){R.verbose("Storing instance of module",R),y=R,g.data(p,y)},destroy:function(){R.verbose("Destroying previous module for",v),g.removeData(p).off(l)},bind:{events:function(){var e=R.get.event();e?(R.verbose("Attaching API events to element",e),g.on(e+l,R.event.trigger)):"now"==f.on&&(R.debug("Querying API endpoint immediately"),R.query())}},decode:{json:function(e){if(e!==C&&"string"==typeof e)try{e=JSON.parse(e)}catch(e){}return e}},read:{cachedResponse:function(e){var t;if(P.Storage!==C)return t=sessionStorage.getItem(e+R.get.normalizedData()),R.debug("Using cached response",e,f.data,t),R.decode.json(t);R.error(c.noStorage)}},write:{cachedResponse:function(e,t){P.Storage===C?R.error(c.noStorage):(O.isPlainObject(t)&&(t=JSON.stringify(t)),sessionStorage.setItem(e+R.get.normalizedData(),t),R.verbose("Storing cached response for url",e,f.data,t))}},query:function(){if(R.is.disabled())R.debug("Element is disabled API request aborted");else{if(R.is.loading()){if(!f.interruptRequests)return void R.debug("Cancelling request, previous request is still pending");R.debug("Interrupting previous request"),R.abort()}if(f.defaultData&&O.extend(!0,f.urlData,R.get.defaultData()),f.serializeForm&&(f.data=R.add.formData(o||f.data)),!1===(n=R.get.settings()))return R.cancelled=!0,void R.error(c.beforeSend);if(R.cancelled=!1,(r=R.get.templatedURL())||R.is.mocked()){if((r=R.add.urlData(r))||R.is.mocked()){if(n.url=f.base+r,a=O.extend(!0,{},f,{type:f.method||f.type,data:e,url:f.base+r,beforeSend:f.beforeXHR,success:function(){},failure:function(){},complete:function(){}}),R.debug("Querying URL",a.url),R.verbose("Using AJAX settings",a),"local"===f.cache&&R.read.cachedResponse(r))return R.debug("Response returned from local cache"),R.request=R.create.request(),void R.request.resolveWith(h,[R.read.cachedResponse(r)]);f.throttle?f.throttleFirstRequest||R.timer?(R.debug("Throttling request",f.throttle),clearTimeout(R.timer),R.timer=setTimeout(function(){R.timer&&delete R.timer,R.debug("Sending throttled request",e,a.method),R.send.request()},f.throttle)):(R.debug("Sending request",e,a.method),R.send.request(),R.timer=setTimeout(function(){},f.throttle)):(R.debug("Sending request",e,a.method),R.send.request())}}else R.error(c.missingURL)}},should:{removeError:function(){return!0===f.hideError||"auto"===f.hideError&&!R.is.form()}},is:{disabled:function(){return 0<g.filter(u.disabled).length},expectingJSON:function(){return"json"===f.dataType||"jsonp"===f.dataType},form:function(){return g.is("form")||b.is("form")},mocked:function(){return f.mockResponse||f.mockResponseAsync||f.response||f.responseAsync},input:function(){return g.is("input")},loading:function(){return!!R.request&&"pending"==R.request.state()},abortedRequest:function(e){return e&&e.readyState!==C&&0===e.readyState?(R.verbose("XHR request determined to be aborted"),!0):(R.verbose("XHR request was not aborted"),!1)},validResponse:function(e){return R.is.expectingJSON()&&F(f.successTest)?(R.debug("Checking JSON returned success",f.successTest,e),f.successTest(e)?(R.debug("Response passed success test",e),!0):(R.debug("Response failed success test",e),!1)):(R.verbose("Response is not JSON, skipping validation",f.successTest,e),!0)}},was:{cancelled:function(){return R.cancelled||!1},successful:function(){return R.request&&"resolved"==R.request.state()},failure:function(){return R.request&&"rejected"==R.request.state()},complete:function(){return R.request&&("resolved"==R.request.state()||"rejected"==R.request.state())}},add:{urlData:function(o,a){var e,t;return o&&(e=o.match(f.regExp.required),t=o.match(f.regExp.optional),a=a||f.urlData,e&&(R.debug("Looking for required URL variables",e),O.each(e,function(e,t){var r=-1!==t.indexOf("$")?t.slice(2,-1):t.slice(1,-1),n=O.isPlainObject(a)&&a[r]!==C?a[r]:g.data(r)!==C?g.data(r):b.data(r)!==C?b.data(r):a[r];if(n===C)return R.error(c.requiredParameter,r,o),o=!1;R.verbose("Found required variable",r,n),n=f.encodeParameters?R.get.urlEncodedValue(n):n,o=o.replace(t,n)})),t&&(R.debug("Looking for optional URL variables",e),O.each(t,function(e,t){var r=-1!==t.indexOf("$")?t.slice(3,-1):t.slice(2,-1),n=O.isPlainObject(a)&&a[r]!==C?a[r]:g.data(r)!==C?g.data(r):b.data(r)!==C?b.data(r):a[r];o=n!==C?(R.verbose("Optional variable Found",r,n),o.replace(t,n)):(R.verbose("Optional variable not found",r),-1!==o.indexOf("/"+t)?o.replace("/"+t,""):o.replace(t,""))}))),o},formData:function(r){var e,n,u,c,d,l={},t="formdata"===f.serializeForm;return r=r||o||f.data,e=O.isPlainObject(r),t?(l=new FormData(m[0]),f.processData=f.processData!==C&&f.processData,f.contentType=f.contentType!==C&&f.contentType):(n=m.serializeArray(),u={},c={},d=function(e,t,r){return e[t]=r,e},O.each(O('input[type="file"]',m),function(e,r){O.each(O(r)[0].files,function(e,t){n.push({name:r.name,value:t})})}),O.each(n,function(e,t){if(f.regExp.validate.test(t.name)){var r="checkbox"===O('[name="'+t.name+'"]',m).attr("type"),n=parseFloat(t.value),o=r&&"on"===t.value||"true"===t.value||(String(n)===t.value?n:"false"!==t.value&&t.value),a=t.name.match(f.regExp.key)||[],s=t.name.replace(/\[]$/,"");s in u?Array.isArray(c[s])?c[s].push(o):c[s]=[c[s],o]:(u[s]=0,c[s]=o),-1===s.indexOf("[]")&&(o=c[s]);for(;0<a.length;){var i=a.pop();""!=i||Array.isArray(o)?f.regExp.fixed.test(i)?o=d([],i,o):f.regExp.named.test(i)&&(o=d({},i,o)):o=d([],u[s]++,o)}l=O.extend(!0,l,o)}})),r=e?(R.debug("Extending existing data with form data",r,l),t?(O.each(Object.keys(r),function(e,t){l.append(t,r[t])}),l):O.extend(!0,{},r,l)):(R.debug("Adding form data",l),l)}},send:{request:function(){R.set.loading(),R.request=R.create.request(),R.is.mocked()?R.mockedXHR=R.create.mockedXHR():R.xhr=R.create.xhr(),f.onRequest.call(h,R.request,R.xhr)}},event:{trigger:function(e){R.query(),"submit"!=e.type&&"click"!=e.type||e.preventDefault()},xhr:{always:function(){},done:function(e,t,r){var n=this,o=Date.now()-s,o=f.loadingDuration-o,a=!!F(f.onResponse)&&(R.is.expectingJSON()&&!f.rawResponse?f.onResponse.call(n,O.extend(!0,{},e)):f.onResponse.call(n,e)),o=0<o?o:0;a&&(R.debug("Modified API response in onResponse callback",f.onResponse,a,e),e=a),0<o&&R.debug("Response completed early delaying state change by",o),setTimeout(function(){R.is.validResponse(e)?R.request.resolveWith(n,[e,r]):R.request.rejectWith(n,[r,"invalid"])},o)},fail:function(e,t,r){var n=this,o=Date.now()-s,o=f.loadingDuration-o;0<(o=0<o?o:0)&&R.debug("Response completed early delaying state change by",o),setTimeout(function(){R.is.abortedRequest(e)?R.request.rejectWith(n,[e,"aborted",r]):R.request.rejectWith(n,[e,"error",t,r])},o)}},request:{done:function(e,t){R.debug("Successful API Response",e),"local"===f.cache&&r&&(R.write.cachedResponse(r,e),R.debug("Saving server response locally",R.cache)),f.onSuccess.call(h,e,g,t)},complete:function(e,t){var r,n;R.was.successful()?(n=e,r=t):n=R.get.responseFromXHR(r=e),R.remove.loading(),f.onComplete.call(h,n,g,r)},fail:function(e,t,r){var n=R.get.responseFromXHR(e),o=R.get.errorFromRequest(n,t,r);if("aborted"==t)return R.debug("XHR Aborted (Most likely caused by page navigation or CORS Policy)",t,r),f.onAbort.call(h,t,g,e),!0;"invalid"==t?R.debug("JSON did not pass success test. A server-side error has most likely occurred",n):"error"==t&&e!==C&&(R.debug("XHR produced a server error",t,r),(e.status<200||300<=e.status)&&r!==C&&""!==r&&R.error(c.statusMessage+r,a.url),f.onError.call(h,o,g,e)),f.errorDuration&&"aborted"!==t&&(R.debug("Adding error state"),R.set.error(),R.should.removeError()&&setTimeout(R.remove.error,f.errorDuration)),R.debug("API Request failed",o,e),f.onFailure.call(h,n,g,e)}}},create:{request:function(){return O.Deferred().always(R.event.request.complete).done(R.event.request.done).fail(R.event.request.fail)},mockedXHR:function(){var e=f.mockResponse||f.response,t=f.mockResponseAsync||f.responseAsync,r=O.Deferred().always(R.event.xhr.complete).done(R.event.xhr.done).fail(R.event.xhr.fail);return e?(e=F(e)?(R.debug("Using specified synchronous callback",e),e.call(h,n)):(R.debug("Using settings specified response",e),e),r.resolveWith(h,[e,!1,{responseText:e}])):F(t)&&(e=function(e){R.debug("Async callback returned response",e),e?r.resolveWith(h,[e,!1,{responseText:e}]):r.rejectWith(h,[{responseText:e},!1,!1])},R.debug("Using specified async response callback",t),t.call(h,n,e)),r},xhr:function(){var e=O.ajax(a).always(R.event.xhr.always).done(R.event.xhr.done).fail(R.event.xhr.fail);return R.verbose("Created server request",e,a),e}},set:{error:function(){R.verbose("Adding error state to element",b),b.addClass(d.error)},loading:function(){R.verbose("Adding loading state to element",b),b.addClass(d.loading),s=Date.now()}},remove:{error:function(){R.verbose("Removing error state from element",b),b.removeClass(d.error)},loading:function(){R.verbose("Removing loading state from element",b),b.removeClass(d.loading)}},get:{normalizedData:function(){return"string"==typeof f.data?f.data:JSON.stringify(f.data,Object.keys(f.data).sort())},responseFromXHR:function(e){return!!O.isPlainObject(e)&&(R.is.expectingJSON()?R.decode.json(e.responseText):e.responseText)},errorFromRequest:function(e,t,r){return O.isPlainObject(e)&&e.error!==C?e.error:f.error[t]!==C?f.error[t]:r},request:function(){return R.request||!1},xhr:function(){return R.xhr||!1},settings:function(){var e=f.beforeSend.call(g,f);return e&&(e.success!==C&&(R.debug("Legacy success callback detected",e),R.error(c.legacyParameters,e.success),e.onSuccess=e.success),e.failure!==C&&(R.debug("Legacy failure callback detected",e),R.error(c.legacyParameters,e.failure),e.onFailure=e.failure),e.complete!==C&&(R.debug("Legacy complete callback detected",e),R.error(c.legacyParameters,e.complete),e.onComplete=e.complete)),e===C&&R.error(c.noReturnedValue),!1===e?e:e!==C?O.extend(!0,{},e):O.extend(!0,{},f)},urlEncodedValue:function(e){var t=P.decodeURIComponent(e),r=P.encodeURIComponent(e);return t!==e?(R.debug("URL value is already encoded, avoiding double encoding",e),e):(R.verbose("Encoding value using encodeURIComponent",e,r),r)},defaultData:function(){var e={};return E(v)||(R.is.input()?e.value=g.val():R.is.form()||(e.text=g.text())),e},event:function(){return E(v)||"now"==f.on?(R.debug("API called without element, no events attached"),!1):"auto"==f.on?g.is("input")?v.oninput!==C?"input":v.onpropertychange!==C?"propertychange":"keyup":g.is("form")?"submit":"click":f.on},templatedURL:function(e){if(e=e||g.data(i.action)||f.action||!1,r=g.data(i.url)||f.url||!1)return R.debug("Using specified url",r),r;if(e){if(R.debug("Looking up url for action",e,f.api),f.api[e]===C&&!R.is.mocked())return void R.error(c.missingAction,f.action,f.api);r=f.api[e]}else R.is.form()&&(r=g.attr("action")||b.attr("action")||!1,R.debug("No url or action specified, defaulting to form action",r));return r}},abort:function(){var e=R.get.xhr();e&&"resolved"!==e.state()&&(R.debug("Cancelling API request"),e.abort())},reset:function(){R.remove.error(),R.remove.loading()},setting:function(e,t){if(R.debug("Changing setting",e,t),O.isPlainObject(e))O.extend(!0,f,e);else{if(t===C)return f[e];O.isPlainObject(f[e])?O.extend(!0,f[e],t):f[e]=t}},internal:function(e,t){if(O.isPlainObject(e))O.extend(!0,R,e);else{if(t===C)return R[e];R[e]=t}},debug:function(){!f.silent&&f.debug&&(f.performance?R.performance.log(arguments):(R.debug=Function.prototype.bind.call(console.info,console,f.name+":"),R.debug.apply(console,arguments)))},verbose:function(){!f.silent&&f.verbose&&f.debug&&(f.performance?R.performance.log(arguments):(R.verbose=Function.prototype.bind.call(console.info,console,f.name+":"),R.verbose.apply(console,arguments)))},error:function(){f.silent||(R.error=Function.prototype.bind.call(console.error,console,f.name+":"),R.error.apply(console,arguments))},performance:{log:function(e){var t,r;f.performance&&(r=(t=Date.now())-(k||t),k=t,S.push({Name:e[0],Arguments:[].slice.call(e,1)||"","Execution Time":r})),clearTimeout(R.performance.timer),R.performance.timer=setTimeout(R.performance.display,500)},display:function(){var e=f.name+":",r=0;k=!1,clearTimeout(R.performance.timer),O.each(S,function(e,t){r+=t["Execution Time"]}),e+=" "+r+"ms",A&&(e+=" '"+A+"'"),(console.group!==C||console.table!==C)&&0<S.length&&(console.groupCollapsed(e),console.table?console.table(S):O.each(S,function(e,t){console.log(t.Name+": "+t["Execution Time"]+"ms")}),console.groupEnd()),S=[]}},invoke:function(n,e,t){var o,a,r,s=y;return e=e||D,t=t||v,"string"==typeof n&&s!==C&&(n=n.split(/[ .]/),o=n.length-1,O.each(n,function(e,t){var r=e!=o?t+n[e+1].charAt(0).toUpperCase()+n[e+1].slice(1):n;if(O.isPlainObject(s[r])&&e!=o)s=s[r];else{if(s[r]!==C)return a=s[r],!1;{if(!O.isPlainObject(s[t])||e==o)return s[t]!==C?a=s[t]:R.error(c.method,n),!1;s=s[t]}}})),F(a)?r=a.apply(t,e):a!==C&&(r=a),Array.isArray(x)?x.push(r):x!==C?x=[x,r]:r!==C&&(x=r),a}};w?(y===C&&R.initialize(),R.invoke(T)):(y!==C&&y.invoke("destroy"),R.initialize())}),x!==C?x:this},O.api=O.fn.api,O.api.settings={name:"API",namespace:"api",debug:!1,verbose:!1,performance:!0,api:{},cache:!0,interruptRequests:!0,on:"auto",stateContext:!1,loadingDuration:0,hideError:"auto",errorDuration:2e3,encodeParameters:!0,action:!1,url:!1,base:"",urlData:{},defaultData:!0,serializeForm:!1,throttle:0,throttleFirstRequest:!0,method:"get",data:{},dataType:"json",mockResponse:!1,mockResponseAsync:!1,response:!1,responseAsync:!1,rawResponse:!0,beforeSend:function(e){return e},beforeXHR:function(e){},onRequest:function(e,t){},onResponse:!1,onSuccess:function(e,t){},onComplete:function(e,t){},onFailure:function(e,t){},onError:function(e,t){},onAbort:function(e,t){},successTest:!1,error:{beforeSend:"The before send function has aborted the request",error:"There was an error with your request",exitConditions:"API Request Aborted. Exit conditions met",JSONParse:"JSON could not be parsed during error handling",legacyParameters:"You are using legacy API success callback names",method:"The method you called is not defined",missingAction:"API action used but no url was defined",missingURL:"No URL specified for api event",noReturnedValue:"The beforeSend callback must return a settings object, beforeSend ignored.",noStorage:"Caching responses locally requires session storage",parseError:"There was an error parsing your request",requiredParameter:"Missing a required URL parameter: ",statusMessage:"Server gave an error: ",timeout:"Your request timed out"},regExp:{required:/{\$*[\da-z]+}/gi,optional:/{\/\$*[\da-z]+}/gi,validate:/^[_a-z][\w-]*(?:\[[\w-]*])*$/i,key:/[\w-]+|(?=\[])/gi,push:/^$/,fixed:/^\d+$/,named:/^[\w-]+$/i},className:{loading:"loading",error:"error"},selector:{disabled:".disabled",form:"form"},metadata:{action:"action",url:"url"}}}(jQuery,window,document);
|