rails-active-ui 0.3.0 → 0.3.2
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.
- checksums.yaml +4 -4
- data/app/javascript/ui/controllers/turbo_modal_controller.js +36 -0
- data/config/importmap.rb +1 -0
- data/formantic-ui/components/accordion.css +369 -0
- data/formantic-ui/components/accordion.js +595 -0
- data/formantic-ui/components/accordion.min.css +9 -0
- data/formantic-ui/components/accordion.min.js +11 -0
- data/formantic-ui/components/ad.css +264 -0
- data/formantic-ui/components/ad.min.css +10 -0
- data/formantic-ui/components/api.js +1225 -0
- data/formantic-ui/components/api.min.js +11 -0
- data/formantic-ui/components/breadcrumb.css +135 -0
- data/formantic-ui/components/breadcrumb.min.css +9 -0
- data/formantic-ui/components/button.css +4058 -0
- data/formantic-ui/components/button.min.css +9 -0
- data/formantic-ui/components/calendar.css +327 -0
- data/formantic-ui/components/calendar.js +2045 -0
- data/formantic-ui/components/calendar.min.css +9 -0
- data/formantic-ui/components/calendar.min.js +11 -0
- data/formantic-ui/components/card.css +1881 -0
- data/formantic-ui/components/card.min.css +9 -0
- data/formantic-ui/components/checkbox.css +785 -0
- data/formantic-ui/components/checkbox.js +888 -0
- data/formantic-ui/components/checkbox.min.css +9 -0
- data/formantic-ui/components/checkbox.min.js +11 -0
- data/formantic-ui/components/comment.css +283 -0
- data/formantic-ui/components/comment.min.css +9 -0
- data/formantic-ui/components/container.css +300 -0
- data/formantic-ui/components/container.min.css +9 -0
- data/formantic-ui/components/dimmer.css +367 -0
- data/formantic-ui/components/dimmer.js +732 -0
- data/formantic-ui/components/dimmer.min.css +9 -0
- data/formantic-ui/components/dimmer.min.js +11 -0
- data/formantic-ui/components/divider.css +287 -0
- data/formantic-ui/components/divider.min.css +9 -0
- data/formantic-ui/components/dropdown.css +2087 -0
- data/formantic-ui/components/dropdown.js +4432 -0
- data/formantic-ui/components/dropdown.min.css +9 -0
- data/formantic-ui/components/dropdown.min.js +11 -0
- data/formantic-ui/components/embed.css +155 -0
- data/formantic-ui/components/embed.js +688 -0
- data/formantic-ui/components/embed.min.css +9 -0
- data/formantic-ui/components/embed.min.js +11 -0
- data/formantic-ui/components/emoji.css +15311 -0
- data/formantic-ui/components/emoji.min.css +9 -0
- data/formantic-ui/components/feed.css +799 -0
- data/formantic-ui/components/feed.min.css +9 -0
- data/formantic-ui/components/flag.css +1149 -0
- data/formantic-ui/components/flag.min.css +9 -0
- data/formantic-ui/components/flyout.css +546 -0
- data/formantic-ui/components/flyout.js +1551 -0
- data/formantic-ui/components/flyout.min.css +9 -0
- data/formantic-ui/components/flyout.min.js +11 -0
- data/formantic-ui/components/form.css +1885 -0
- data/formantic-ui/components/form.js +2199 -0
- data/formantic-ui/components/form.min.css +9 -0
- data/formantic-ui/components/form.min.js +11 -0
- data/formantic-ui/components/grid.css +1952 -0
- data/formantic-ui/components/grid.min.css +9 -0
- data/formantic-ui/components/header.css +778 -0
- data/formantic-ui/components/header.min.css +9 -0
- data/formantic-ui/components/icon.css +7066 -0
- data/formantic-ui/components/icon.min.css +9 -0
- data/formantic-ui/components/image.css +315 -0
- data/formantic-ui/components/image.min.css +9 -0
- data/formantic-ui/components/input.css +1566 -0
- data/formantic-ui/components/input.min.css +9 -0
- data/formantic-ui/components/item.css +534 -0
- data/formantic-ui/components/item.min.css +9 -0
- data/formantic-ui/components/label.css +2114 -0
- data/formantic-ui/components/label.min.css +9 -0
- data/formantic-ui/components/list.css +955 -0
- data/formantic-ui/components/list.min.css +9 -0
- data/formantic-ui/components/loader.css +787 -0
- data/formantic-ui/components/loader.min.css +9 -0
- data/formantic-ui/components/menu.css +2131 -0
- data/formantic-ui/components/menu.min.css +9 -0
- data/formantic-ui/components/message.css +619 -0
- data/formantic-ui/components/message.min.css +9 -0
- data/formantic-ui/components/modal.css +779 -0
- data/formantic-ui/components/modal.js +1637 -0
- data/formantic-ui/components/modal.min.css +9 -0
- data/formantic-ui/components/modal.min.js +11 -0
- data/formantic-ui/components/nag.css +290 -0
- data/formantic-ui/components/nag.js +566 -0
- data/formantic-ui/components/nag.min.css +9 -0
- data/formantic-ui/components/nag.min.js +11 -0
- data/formantic-ui/components/placeholder.css +228 -0
- data/formantic-ui/components/placeholder.min.css +9 -0
- data/formantic-ui/components/popup.css +1184 -0
- data/formantic-ui/components/popup.js +1561 -0
- data/formantic-ui/components/popup.min.css +9 -0
- data/formantic-ui/components/popup.min.js +11 -0
- data/formantic-ui/components/progress.css +761 -0
- data/formantic-ui/components/progress.js +979 -0
- data/formantic-ui/components/progress.min.css +9 -0
- data/formantic-ui/components/progress.min.js +11 -0
- data/formantic-ui/components/rail.css +147 -0
- data/formantic-ui/components/rail.min.css +9 -0
- data/formantic-ui/components/rating.css +414 -0
- data/formantic-ui/components/rating.js +540 -0
- data/formantic-ui/components/rating.min.css +9 -0
- data/formantic-ui/components/rating.min.js +11 -0
- data/formantic-ui/components/reset.css +386 -0
- data/formantic-ui/components/reset.min.css +9 -0
- data/formantic-ui/components/reveal.css +277 -0
- data/formantic-ui/components/reveal.min.css +9 -0
- data/formantic-ui/components/search.css +541 -0
- data/formantic-ui/components/search.js +1641 -0
- data/formantic-ui/components/search.min.css +9 -0
- data/formantic-ui/components/search.min.js +11 -0
- data/formantic-ui/components/segment.css +1053 -0
- data/formantic-ui/components/segment.min.css +9 -0
- data/formantic-ui/components/shape.css +144 -0
- data/formantic-ui/components/shape.js +797 -0
- data/formantic-ui/components/shape.min.css +9 -0
- data/formantic-ui/components/shape.min.js +11 -0
- data/formantic-ui/components/sidebar.css +539 -0
- data/formantic-ui/components/sidebar.js +1054 -0
- data/formantic-ui/components/sidebar.min.css +9 -0
- data/formantic-ui/components/sidebar.min.js +11 -0
- data/formantic-ui/components/site.css +286 -0
- data/formantic-ui/components/site.js +455 -0
- data/formantic-ui/components/site.min.css +9 -0
- data/formantic-ui/components/site.min.js +11 -0
- data/formantic-ui/components/slider.css +926 -0
- data/formantic-ui/components/slider.js +1546 -0
- data/formantic-ui/components/slider.min.css +9 -0
- data/formantic-ui/components/slider.min.js +11 -0
- data/formantic-ui/components/state.js +697 -0
- data/formantic-ui/components/state.min.js +11 -0
- data/formantic-ui/components/statistic.css +586 -0
- data/formantic-ui/components/statistic.min.css +9 -0
- data/formantic-ui/components/step.css +1538 -0
- data/formantic-ui/components/step.min.css +9 -0
- data/formantic-ui/components/sticky.css +73 -0
- data/formantic-ui/components/sticky.js +917 -0
- data/formantic-ui/components/sticky.min.css +9 -0
- data/formantic-ui/components/sticky.min.js +11 -0
- data/formantic-ui/components/tab.css +84 -0
- data/formantic-ui/components/tab.js +967 -0
- data/formantic-ui/components/tab.min.css +9 -0
- data/formantic-ui/components/tab.min.js +11 -0
- data/formantic-ui/components/table.css +3473 -0
- data/formantic-ui/components/table.min.css +9 -0
- data/formantic-ui/components/text.css +155 -0
- data/formantic-ui/components/text.min.css +9 -0
- data/formantic-ui/components/toast.css +751 -0
- data/formantic-ui/components/toast.js +964 -0
- data/formantic-ui/components/toast.min.css +9 -0
- data/formantic-ui/components/toast.min.js +11 -0
- data/formantic-ui/components/transition.css +1148 -0
- data/formantic-ui/components/transition.js +1034 -0
- data/formantic-ui/components/transition.min.css +9 -0
- data/formantic-ui/components/transition.min.js +11 -0
- data/formantic-ui/components/visibility.js +1292 -0
- data/formantic-ui/components/visibility.min.js +11 -0
- data/formantic-ui/semantic.css +78485 -0
- data/formantic-ui/semantic.js +31036 -0
- data/formantic-ui/semantic.min.css +11 -0
- data/formantic-ui/semantic.min.js +11 -0
- data/formantic-ui/themes/basic/assets/fonts/LICENSE.txt +91 -0
- data/formantic-ui/themes/basic/assets/fonts/icons.woff +0 -0
- data/formantic-ui/themes/basic/assets/fonts/icons.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LICENSE_Lato.txt +94 -0
- data/formantic-ui/themes/default/assets/fonts/LICENSE_icons.txt +165 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Bold.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Bold.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-BoldItalic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Italic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Italic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Regular.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/Lato-Regular.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Bold.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-BoldItalic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Italic.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/LatoLatin-Regular.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/brand-icons.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/brand-icons.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/icons.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/icons.woff2 +0 -0
- data/formantic-ui/themes/default/assets/fonts/outline-icons.woff +0 -0
- data/formantic-ui/themes/default/assets/fonts/outline-icons.woff2 +0 -0
- data/formantic-ui/themes/famfamfam/assets/images/flags.png +0 -0
- data/formantic-ui/themes/github/assets/fonts/LICENSE.txt +94 -0
- data/formantic-ui/themes/github/assets/fonts/octicons.woff +0 -0
- data/formantic-ui/themes/github/assets/fonts/octicons.woff2 +0 -0
- data/formantic-ui/themes/material/assets/fonts/LICENSE.txt +202 -0
- data/formantic-ui/themes/material/assets/fonts/icons.woff +0 -0
- data/formantic-ui/themes/material/assets/fonts/icons.woff2 +0 -0
- data/lib/ui/version.rb +1 -1
- metadata +194 -1
|
@@ -0,0 +1,964 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* # Fomantic-UI 2.9.4 - Toast
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI/
|
|
4
|
+
*
|
|
5
|
+
*
|
|
6
|
+
* Released under the MIT license
|
|
7
|
+
* https://opensource.org/licenses/MIT
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
(function ($, window, document) {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
function isFunction(obj) {
|
|
15
|
+
return typeof obj === 'function' && typeof obj.nodeType !== 'number';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
window = window !== undefined && window.Math === Math
|
|
19
|
+
? window
|
|
20
|
+
: globalThis;
|
|
21
|
+
|
|
22
|
+
$.fn.toast = function (parameters) {
|
|
23
|
+
var
|
|
24
|
+
$allModules = $(this),
|
|
25
|
+
$body = $('body'),
|
|
26
|
+
|
|
27
|
+
time = Date.now(),
|
|
28
|
+
performance = [],
|
|
29
|
+
|
|
30
|
+
query = arguments[0],
|
|
31
|
+
methodInvoked = typeof query === 'string',
|
|
32
|
+
queryArguments = [].slice.call(arguments, 1),
|
|
33
|
+
contextCheck = function (context, win) {
|
|
34
|
+
var $context;
|
|
35
|
+
if ([window, document].indexOf(context) >= 0) {
|
|
36
|
+
$context = $(context);
|
|
37
|
+
} else {
|
|
38
|
+
$context = $(win.document).find(context);
|
|
39
|
+
if ($context.length === 0) {
|
|
40
|
+
$context = win.frameElement ? contextCheck(context, win.parent) : $body;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return $context;
|
|
45
|
+
},
|
|
46
|
+
returnedValue
|
|
47
|
+
;
|
|
48
|
+
$allModules.each(function () {
|
|
49
|
+
var
|
|
50
|
+
settings = $.isPlainObject(parameters)
|
|
51
|
+
? $.extend(true, {}, $.fn.toast.settings, parameters)
|
|
52
|
+
: $.extend({}, $.fn.toast.settings),
|
|
53
|
+
|
|
54
|
+
className = settings.className,
|
|
55
|
+
selector = settings.selector,
|
|
56
|
+
error = settings.error,
|
|
57
|
+
namespace = settings.namespace,
|
|
58
|
+
fields = settings.fields,
|
|
59
|
+
|
|
60
|
+
eventNamespace = '.' + namespace,
|
|
61
|
+
moduleNamespace = namespace + '-module',
|
|
62
|
+
|
|
63
|
+
$module = $(this),
|
|
64
|
+
$toastBox,
|
|
65
|
+
$toast,
|
|
66
|
+
$actions,
|
|
67
|
+
$progress,
|
|
68
|
+
$progressBar,
|
|
69
|
+
$animationObject,
|
|
70
|
+
$close,
|
|
71
|
+
$context = settings.context ? contextCheck(settings.context, window) : $body,
|
|
72
|
+
|
|
73
|
+
isToastComponent = $module.hasClass('toast') || $module.hasClass('message') || $module.hasClass('card'),
|
|
74
|
+
|
|
75
|
+
element = this,
|
|
76
|
+
instance = isToastComponent ? $module.data(moduleNamespace) : undefined,
|
|
77
|
+
|
|
78
|
+
id,
|
|
79
|
+
module
|
|
80
|
+
;
|
|
81
|
+
module = {
|
|
82
|
+
|
|
83
|
+
initialize: function () {
|
|
84
|
+
module.verbose('Initializing element');
|
|
85
|
+
module.create.id();
|
|
86
|
+
if (!module.has.container()) {
|
|
87
|
+
module.create.container();
|
|
88
|
+
}
|
|
89
|
+
if (isToastComponent || settings.message !== '' || settings.title !== '' || module.get.iconClass() !== '' || settings.showImage || module.has.configActions()) {
|
|
90
|
+
if (typeof settings.showProgress !== 'string' || [className.top, className.bottom].indexOf(settings.showProgress) === -1) {
|
|
91
|
+
settings.showProgress = false;
|
|
92
|
+
}
|
|
93
|
+
module.create.toast();
|
|
94
|
+
if (settings.closeOnClick && (settings.closeIcon || $($toast).find(selector.input).length > 0 || module.has.configActions())) {
|
|
95
|
+
settings.closeOnClick = false;
|
|
96
|
+
}
|
|
97
|
+
if (!settings.closeOnClick) {
|
|
98
|
+
$toastBox.addClass(className.unclickable);
|
|
99
|
+
}
|
|
100
|
+
module.bind.events();
|
|
101
|
+
}
|
|
102
|
+
module.instantiate();
|
|
103
|
+
if ($toastBox) {
|
|
104
|
+
module.show();
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
|
|
108
|
+
instantiate: function () {
|
|
109
|
+
module.verbose('Storing instance of toast');
|
|
110
|
+
instance = module;
|
|
111
|
+
$module
|
|
112
|
+
.data(moduleNamespace, instance)
|
|
113
|
+
;
|
|
114
|
+
},
|
|
115
|
+
|
|
116
|
+
destroy: function () {
|
|
117
|
+
if ($toastBox) {
|
|
118
|
+
module.debug('Removing toast', $toastBox);
|
|
119
|
+
module.unbind.events();
|
|
120
|
+
settings.onRemove.call($toastBox, element);
|
|
121
|
+
$toastBox.remove();
|
|
122
|
+
$toastBox = undefined;
|
|
123
|
+
$toast = undefined;
|
|
124
|
+
$animationObject = undefined;
|
|
125
|
+
$progress = undefined;
|
|
126
|
+
$progressBar = undefined;
|
|
127
|
+
$close = undefined;
|
|
128
|
+
}
|
|
129
|
+
$module
|
|
130
|
+
.removeData(moduleNamespace)
|
|
131
|
+
;
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
show: function (callback) {
|
|
135
|
+
if (settings.onShow.call($toastBox, element) === false) {
|
|
136
|
+
module.debug('onShow callback returned false, cancelling toast animation');
|
|
137
|
+
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
callback = callback || function () {};
|
|
141
|
+
module.debug('Showing toast');
|
|
142
|
+
module.animate.show(callback);
|
|
143
|
+
},
|
|
144
|
+
|
|
145
|
+
close: function (callback) {
|
|
146
|
+
if (settings.onHide.call($toastBox, element) === false) {
|
|
147
|
+
module.debug('onHide callback returned false, cancelling toast animation');
|
|
148
|
+
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
callback = callback || function () {};
|
|
152
|
+
module.debug('Closing toast');
|
|
153
|
+
module.remove.visible();
|
|
154
|
+
module.unbind.events();
|
|
155
|
+
module.animate.close(callback);
|
|
156
|
+
},
|
|
157
|
+
|
|
158
|
+
create: {
|
|
159
|
+
container: function () {
|
|
160
|
+
module.verbose('Creating container');
|
|
161
|
+
$context.append($('<div/>', {
|
|
162
|
+
class: settings.position + ' ' + className.container + ' '
|
|
163
|
+
+ (settings.horizontal ? className.horizontal : '') + ' '
|
|
164
|
+
+ (settings.context && settings.context !== 'body' ? className.absolute : ''),
|
|
165
|
+
}));
|
|
166
|
+
},
|
|
167
|
+
id: function () {
|
|
168
|
+
id = (Math.random().toString(16) + '000000000').slice(2, 10);
|
|
169
|
+
module.verbose('Creating unique id for element', id);
|
|
170
|
+
},
|
|
171
|
+
toast: function () {
|
|
172
|
+
$toastBox = $('<div/>', { class: className.box });
|
|
173
|
+
var iconClass = module.get.iconClass();
|
|
174
|
+
if (!isToastComponent) {
|
|
175
|
+
module.verbose('Creating toast');
|
|
176
|
+
$toast = $('<div/>', { role: 'alert' });
|
|
177
|
+
var $content = $('<div/>', { class: className.content });
|
|
178
|
+
if (iconClass !== '') {
|
|
179
|
+
$toast.append($('<i/>', { class: iconClass + ' ' + className.icon }));
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
if (settings.showImage) {
|
|
183
|
+
$toast.append($('<img>', {
|
|
184
|
+
class: className.image + ' ' + settings.classImage,
|
|
185
|
+
src: settings.showImage,
|
|
186
|
+
alt: settings.alt || '',
|
|
187
|
+
}));
|
|
188
|
+
}
|
|
189
|
+
if (settings.title !== '') {
|
|
190
|
+
var titleId = '_' + module.get.id() + 'title';
|
|
191
|
+
$toast.attr('aria-labelledby', titleId);
|
|
192
|
+
$content.append($('<div/>', {
|
|
193
|
+
class: className.title,
|
|
194
|
+
id: titleId,
|
|
195
|
+
html: module.helpers.escape(settings.title, settings.preserveHTML),
|
|
196
|
+
}));
|
|
197
|
+
}
|
|
198
|
+
var descId = '_' + module.get.id() + 'desc';
|
|
199
|
+
$toast.attr('aria-describedby', descId);
|
|
200
|
+
$content.append($('<div/>', {
|
|
201
|
+
class: className.message,
|
|
202
|
+
id: descId,
|
|
203
|
+
html: module.helpers.escape(settings.message, settings.preserveHTML),
|
|
204
|
+
}));
|
|
205
|
+
|
|
206
|
+
$toast
|
|
207
|
+
.addClass(settings.class + ' ' + className.toast)
|
|
208
|
+
.append($content)
|
|
209
|
+
;
|
|
210
|
+
$toast.css('opacity', String(settings.opacity));
|
|
211
|
+
if (settings.closeIcon) {
|
|
212
|
+
$close = $('<i/>', {
|
|
213
|
+
class: className.close + ' ' + (typeof settings.closeIcon === 'string' ? settings.closeIcon : ''),
|
|
214
|
+
role: 'button',
|
|
215
|
+
tabindex: 0,
|
|
216
|
+
'aria-label': settings.text.close,
|
|
217
|
+
});
|
|
218
|
+
if ($close.hasClass(className.left)) {
|
|
219
|
+
$toast.prepend($close);
|
|
220
|
+
} else {
|
|
221
|
+
$toast.append($close);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
} else {
|
|
225
|
+
$toast = settings.cloneModule ? $module.clone().removeAttr('id') : $module;
|
|
226
|
+
$close = $toast.find('> i' + module.helpers.toClass(className.close));
|
|
227
|
+
settings.closeIcon = $close.length > 0;
|
|
228
|
+
if (iconClass !== '') {
|
|
229
|
+
$toast.find(selector.icon).attr('class', iconClass + ' ' + className.icon);
|
|
230
|
+
}
|
|
231
|
+
if (settings.showImage) {
|
|
232
|
+
$toast.find(selector.image).attr('src', settings.showImage).attr('alt', settings.alt || '');
|
|
233
|
+
}
|
|
234
|
+
if (settings.title !== '') {
|
|
235
|
+
$toast.find(selector.title).html(module.helpers.escape(settings.title, settings.preserveHTML));
|
|
236
|
+
}
|
|
237
|
+
if (settings.message !== '') {
|
|
238
|
+
$toast.find(selector.message).html(module.helpers.escape(settings.message, settings.preserveHTML));
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if ($toast.hasClass(className.compact)) {
|
|
242
|
+
settings.compact = true;
|
|
243
|
+
}
|
|
244
|
+
if ($toast.hasClass('card')) {
|
|
245
|
+
settings.compact = false;
|
|
246
|
+
}
|
|
247
|
+
$actions = $toast.find('.actions');
|
|
248
|
+
if (module.has.configActions()) {
|
|
249
|
+
if ($actions.length === 0) {
|
|
250
|
+
$actions = $('<div/>', { class: className.actions + ' ' + (settings.classActions || '') }).appendTo($toast);
|
|
251
|
+
}
|
|
252
|
+
if ($toast.hasClass('card') && !$actions.hasClass(className.attached)) {
|
|
253
|
+
$actions.addClass(className.extraContent);
|
|
254
|
+
if ($actions.hasClass(className.vertical)) {
|
|
255
|
+
$actions.removeClass(className.vertical);
|
|
256
|
+
module.error(error.verticalCard);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
settings.actions.forEach(function (el) {
|
|
260
|
+
var
|
|
261
|
+
icon = el[fields.icon]
|
|
262
|
+
? '<i ' + (el[fields.text] ? 'aria-hidden="true"' : '')
|
|
263
|
+
+ ' class="' + module.helpers.deQuote(el[fields.icon]) + ' icon"></i>'
|
|
264
|
+
: '',
|
|
265
|
+
text = module.helpers.escape(el[fields.text] || '', settings.preserveHTML),
|
|
266
|
+
cls = module.helpers.deQuote(el[fields.class] || ''),
|
|
267
|
+
click = el[fields.click] && isFunction(el[fields.click])
|
|
268
|
+
? el[fields.click]
|
|
269
|
+
: function () {}
|
|
270
|
+
;
|
|
271
|
+
$actions.append($('<button/>', {
|
|
272
|
+
html: icon + text,
|
|
273
|
+
'aria-label': (el[fields.text] || el[fields.icon] || '').replace(/<[^>]+(>|$)/g, ''),
|
|
274
|
+
class: className.button + ' ' + cls,
|
|
275
|
+
on: {
|
|
276
|
+
click: function () {
|
|
277
|
+
var $button = $(this);
|
|
278
|
+
if ($button.is(selector.approve) || $button.is(selector.deny) || click.call(element, $module) === false) {
|
|
279
|
+
return;
|
|
280
|
+
}
|
|
281
|
+
module.close();
|
|
282
|
+
},
|
|
283
|
+
},
|
|
284
|
+
}));
|
|
285
|
+
});
|
|
286
|
+
}
|
|
287
|
+
if ($actions && $actions.hasClass(className.vertical)) {
|
|
288
|
+
$toast.addClass(className.vertical);
|
|
289
|
+
}
|
|
290
|
+
if ($actions.length > 0 && !$actions.hasClass(className.attached)) {
|
|
291
|
+
if ($actions && (!$actions.hasClass(className.basic) || $actions.hasClass(className.left))) {
|
|
292
|
+
$toast.addClass(className.actions);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
if (settings.displayTime === 'auto') {
|
|
296
|
+
settings.displayTime = Math.max(settings.minDisplayTime, ($toast.text().split(' ').length / settings.wordsPerMinute) * 60000);
|
|
297
|
+
}
|
|
298
|
+
$toastBox.append($toast);
|
|
299
|
+
|
|
300
|
+
if ($actions.length > 0 && $actions.hasClass(className.attached)) {
|
|
301
|
+
$actions.addClass(className.buttons);
|
|
302
|
+
$actions.detach();
|
|
303
|
+
$toast.addClass(className.attached);
|
|
304
|
+
if (!$actions.hasClass(className.vertical)) {
|
|
305
|
+
if ($actions.hasClass(className.top)) {
|
|
306
|
+
$toastBox.prepend($actions);
|
|
307
|
+
$toast.addClass(className.bottom);
|
|
308
|
+
} else {
|
|
309
|
+
$toastBox.append($actions);
|
|
310
|
+
$toast.addClass(className.top);
|
|
311
|
+
}
|
|
312
|
+
} else {
|
|
313
|
+
$toast.wrap(
|
|
314
|
+
$('<div/>', {
|
|
315
|
+
class: className.vertical + ' '
|
|
316
|
+
+ className.attached + ' '
|
|
317
|
+
+ (settings.compact ? className.compact : ''),
|
|
318
|
+
})
|
|
319
|
+
);
|
|
320
|
+
if ($actions.hasClass(className.left)) {
|
|
321
|
+
$toast.addClass(className.left).parent().addClass(className.left).prepend($actions);
|
|
322
|
+
} else {
|
|
323
|
+
$toast.parent().append($actions);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
if ($module !== $toast) {
|
|
328
|
+
$module = $toast;
|
|
329
|
+
element = $toast[0];
|
|
330
|
+
}
|
|
331
|
+
if (settings.displayTime > 0) {
|
|
332
|
+
var progressingClass = className.progressing + ' ' + (settings.pauseOnHover ? className.pausable : '');
|
|
333
|
+
if (settings.showProgress) {
|
|
334
|
+
$progress = $('<div/>', {
|
|
335
|
+
class: className.progress + ' ' + (settings.classProgress || settings.class),
|
|
336
|
+
'data-percent': '',
|
|
337
|
+
});
|
|
338
|
+
if (!settings.classProgress) {
|
|
339
|
+
if ($toast.hasClass('toast') && !$toast.hasClass(className.inverted)) {
|
|
340
|
+
$progress.addClass(className.inverted);
|
|
341
|
+
} else {
|
|
342
|
+
$progress.removeClass(className.inverted);
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
$progressBar = $('<div/>', { class: 'bar ' + (settings.progressUp ? 'up ' : 'down ') + progressingClass });
|
|
346
|
+
$progress
|
|
347
|
+
.addClass(settings.showProgress)
|
|
348
|
+
.append($progressBar)
|
|
349
|
+
;
|
|
350
|
+
if ($progress.hasClass(className.top)) {
|
|
351
|
+
$toastBox.prepend($progress);
|
|
352
|
+
} else {
|
|
353
|
+
$toastBox.append($progress);
|
|
354
|
+
}
|
|
355
|
+
$progressBar.css('animation-duration', settings.displayTime / 1000 + 's');
|
|
356
|
+
}
|
|
357
|
+
$animationObject = $('<span/>', { class: 'wait ' + progressingClass });
|
|
358
|
+
$animationObject.css('animation-duration', settings.displayTime / 1000 + 's');
|
|
359
|
+
$animationObject.appendTo($toast);
|
|
360
|
+
}
|
|
361
|
+
if (settings.compact) {
|
|
362
|
+
$toastBox.addClass(className.compact);
|
|
363
|
+
$toast.addClass(className.compact);
|
|
364
|
+
if ($progress) {
|
|
365
|
+
$progress.addClass(className.compact);
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
if (settings.newestOnTop) {
|
|
369
|
+
$toastBox.prependTo(module.get.container());
|
|
370
|
+
} else {
|
|
371
|
+
$toastBox.appendTo(module.get.container());
|
|
372
|
+
}
|
|
373
|
+
},
|
|
374
|
+
},
|
|
375
|
+
|
|
376
|
+
bind: {
|
|
377
|
+
events: function () {
|
|
378
|
+
module.debug('Binding events to toast');
|
|
379
|
+
if (settings.closeIcon) {
|
|
380
|
+
$close.on('click' + eventNamespace, module.event.close);
|
|
381
|
+
}
|
|
382
|
+
$toast.on('click' + eventNamespace, module.event.click);
|
|
383
|
+
if ($animationObject) {
|
|
384
|
+
$animationObject.on('animationend' + eventNamespace, module.event.close);
|
|
385
|
+
}
|
|
386
|
+
$toastBox
|
|
387
|
+
.on('click' + eventNamespace, selector.approve, module.event.approve)
|
|
388
|
+
.on('click' + eventNamespace, selector.deny, module.event.deny)
|
|
389
|
+
;
|
|
390
|
+
},
|
|
391
|
+
},
|
|
392
|
+
|
|
393
|
+
unbind: {
|
|
394
|
+
events: function () {
|
|
395
|
+
module.debug('Unbinding events to toast');
|
|
396
|
+
if (settings.closeIcon) {
|
|
397
|
+
$close.off('click' + eventNamespace);
|
|
398
|
+
}
|
|
399
|
+
$toast.off('click' + eventNamespace);
|
|
400
|
+
if ($animationObject) {
|
|
401
|
+
$animationObject.off('animationend' + eventNamespace);
|
|
402
|
+
}
|
|
403
|
+
$toastBox
|
|
404
|
+
.off('click' + eventNamespace)
|
|
405
|
+
;
|
|
406
|
+
},
|
|
407
|
+
},
|
|
408
|
+
|
|
409
|
+
animate: {
|
|
410
|
+
show: function (callback) {
|
|
411
|
+
callback = isFunction(callback) ? callback : function () {};
|
|
412
|
+
if (settings.transition && module.can.useElement('transition')) {
|
|
413
|
+
module.set.visible();
|
|
414
|
+
$toastBox
|
|
415
|
+
.transition({
|
|
416
|
+
animation: settings.transition.showMethod + ' in',
|
|
417
|
+
queue: false,
|
|
418
|
+
debug: settings.debug,
|
|
419
|
+
verbose: settings.verbose,
|
|
420
|
+
silent: settings.silent,
|
|
421
|
+
duration: settings.transition.showDuration,
|
|
422
|
+
onComplete: function () {
|
|
423
|
+
callback.call($toastBox, element);
|
|
424
|
+
settings.onVisible.call($toastBox, element);
|
|
425
|
+
},
|
|
426
|
+
})
|
|
427
|
+
;
|
|
428
|
+
}
|
|
429
|
+
},
|
|
430
|
+
close: function (callback) {
|
|
431
|
+
callback = isFunction(callback) ? callback : function () {};
|
|
432
|
+
if (settings.transition && $.fn.transition !== undefined) {
|
|
433
|
+
$toastBox
|
|
434
|
+
.transition({
|
|
435
|
+
animation: settings.transition.hideMethod + ' out',
|
|
436
|
+
queue: false,
|
|
437
|
+
duration: settings.transition.hideDuration,
|
|
438
|
+
debug: settings.debug,
|
|
439
|
+
verbose: settings.verbose,
|
|
440
|
+
silent: settings.silent,
|
|
441
|
+
interval: 50,
|
|
442
|
+
|
|
443
|
+
onBeforeHide: function (callback) {
|
|
444
|
+
callback = isFunction(callback) ? callback : function () {};
|
|
445
|
+
if (settings.transition.closeEasing !== '') {
|
|
446
|
+
if ($toastBox) {
|
|
447
|
+
$toastBox.css('opacity', '0');
|
|
448
|
+
$toastBox.wrap('<div/>').parent().hide(settings.transition.closeDuration, settings.transition.closeEasing, function () {
|
|
449
|
+
if ($toastBox) {
|
|
450
|
+
$toastBox.parent().remove();
|
|
451
|
+
callback.call($toastBox);
|
|
452
|
+
}
|
|
453
|
+
});
|
|
454
|
+
}
|
|
455
|
+
} else {
|
|
456
|
+
callback.call($toastBox);
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
onComplete: function () {
|
|
460
|
+
callback.call($toastBox, element);
|
|
461
|
+
settings.onHidden.call($toastBox, element);
|
|
462
|
+
module.destroy();
|
|
463
|
+
},
|
|
464
|
+
})
|
|
465
|
+
;
|
|
466
|
+
} else {
|
|
467
|
+
module.error(error.noTransition);
|
|
468
|
+
}
|
|
469
|
+
},
|
|
470
|
+
pause: function () {
|
|
471
|
+
$animationObject.css('animationPlayState', 'paused');
|
|
472
|
+
if ($progressBar) {
|
|
473
|
+
$progressBar.css('animationPlayState', 'paused');
|
|
474
|
+
}
|
|
475
|
+
},
|
|
476
|
+
continue: function () {
|
|
477
|
+
$animationObject.css('animationPlayState', 'running');
|
|
478
|
+
if ($progressBar) {
|
|
479
|
+
$progressBar.css('animationPlayState', 'running');
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
|
|
484
|
+
has: {
|
|
485
|
+
container: function () {
|
|
486
|
+
module.verbose('Determining if there is already a container');
|
|
487
|
+
|
|
488
|
+
return module.get.containers().length > 0;
|
|
489
|
+
},
|
|
490
|
+
toast: function () {
|
|
491
|
+
return !!module.get.toast();
|
|
492
|
+
},
|
|
493
|
+
toasts: function () {
|
|
494
|
+
return module.get.toasts().length > 0;
|
|
495
|
+
},
|
|
496
|
+
configActions: function () {
|
|
497
|
+
return Array.isArray(settings.actions) && settings.actions.length > 0;
|
|
498
|
+
},
|
|
499
|
+
},
|
|
500
|
+
|
|
501
|
+
get: {
|
|
502
|
+
id: function () {
|
|
503
|
+
return id;
|
|
504
|
+
},
|
|
505
|
+
containers: function () {
|
|
506
|
+
return $context.children(module.helpers.toClass(settings.position) + selector.container
|
|
507
|
+
+ (settings.horizontal
|
|
508
|
+
? module.helpers.toClass(className.horizontal)
|
|
509
|
+
: ':not(' + module.helpers.toClass(className.horizontal) + ')')
|
|
510
|
+
+ (settings.context && settings.context !== 'body'
|
|
511
|
+
? module.helpers.toClass(className.absolute)
|
|
512
|
+
: ':not(' + module.helpers.toClass(className.absolute) + ')'));
|
|
513
|
+
},
|
|
514
|
+
container: function () {
|
|
515
|
+
return module.get.containers()[0];
|
|
516
|
+
},
|
|
517
|
+
toastBox: function () {
|
|
518
|
+
return $toastBox || null;
|
|
519
|
+
},
|
|
520
|
+
toast: function () {
|
|
521
|
+
return $toast || null;
|
|
522
|
+
},
|
|
523
|
+
toasts: function () {
|
|
524
|
+
return $(module.get.container()).find(selector.box);
|
|
525
|
+
},
|
|
526
|
+
iconClass: function () {
|
|
527
|
+
return typeof settings.showIcon === 'string'
|
|
528
|
+
? settings.showIcon
|
|
529
|
+
: (settings.showIcon && settings.icons[settings.class]
|
|
530
|
+
? settings.icons[settings.class]
|
|
531
|
+
: '');
|
|
532
|
+
},
|
|
533
|
+
remainingTime: function () {
|
|
534
|
+
return $animationObject ? $animationObject.css('opacity') * settings.displayTime : 0;
|
|
535
|
+
},
|
|
536
|
+
},
|
|
537
|
+
|
|
538
|
+
set: {
|
|
539
|
+
visible: function () {
|
|
540
|
+
$toast.addClass(className.visible);
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
|
|
544
|
+
remove: {
|
|
545
|
+
visible: function () {
|
|
546
|
+
$toast.removeClass(className.visible);
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
|
|
550
|
+
event: {
|
|
551
|
+
close: function () {
|
|
552
|
+
module.close();
|
|
553
|
+
},
|
|
554
|
+
click: function (event) {
|
|
555
|
+
if ($(event.target).closest(selector.clickable).length === 0) {
|
|
556
|
+
if (settings.onClick.call($toastBox, element) === false || !settings.closeOnClick) {
|
|
557
|
+
module.verbose('Click callback returned false or close denied by setting cancelling close');
|
|
558
|
+
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
module.close();
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
approve: function () {
|
|
565
|
+
if (settings.onApprove.call(element, $module) === false) {
|
|
566
|
+
module.verbose('Approve callback returned false cancelling close');
|
|
567
|
+
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
module.close();
|
|
571
|
+
},
|
|
572
|
+
deny: function () {
|
|
573
|
+
if (settings.onDeny.call(element, $module) === false) {
|
|
574
|
+
module.verbose('Deny callback returned false cancelling close');
|
|
575
|
+
|
|
576
|
+
return;
|
|
577
|
+
}
|
|
578
|
+
module.close();
|
|
579
|
+
},
|
|
580
|
+
},
|
|
581
|
+
|
|
582
|
+
helpers: {
|
|
583
|
+
toClass: function (selector) {
|
|
584
|
+
var
|
|
585
|
+
classes = selector.trim().split(/\s+/),
|
|
586
|
+
result = ''
|
|
587
|
+
;
|
|
588
|
+
|
|
589
|
+
classes.forEach(function (element) {
|
|
590
|
+
result += '.' + element;
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
return result;
|
|
594
|
+
},
|
|
595
|
+
deQuote: function (string) {
|
|
596
|
+
return String(string).replace(/"/g, '');
|
|
597
|
+
},
|
|
598
|
+
escape: function (string, preserveHTML) {
|
|
599
|
+
if (preserveHTML) {
|
|
600
|
+
return string;
|
|
601
|
+
}
|
|
602
|
+
var
|
|
603
|
+
badChars = /["'<>`]/g,
|
|
604
|
+
shouldEscape = /["&'<>`]/,
|
|
605
|
+
escape = {
|
|
606
|
+
'<': '<',
|
|
607
|
+
'>': '>',
|
|
608
|
+
'"': '"',
|
|
609
|
+
"'": ''',
|
|
610
|
+
'`': '`',
|
|
611
|
+
},
|
|
612
|
+
escapedChar = function (chr) {
|
|
613
|
+
return escape[chr];
|
|
614
|
+
}
|
|
615
|
+
;
|
|
616
|
+
if (shouldEscape.test(string)) {
|
|
617
|
+
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
|
|
618
|
+
|
|
619
|
+
return string.replace(badChars, escapedChar);
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
return string;
|
|
623
|
+
},
|
|
624
|
+
},
|
|
625
|
+
|
|
626
|
+
can: {
|
|
627
|
+
useElement: function (element) {
|
|
628
|
+
if ($.fn[element] !== undefined) {
|
|
629
|
+
return true;
|
|
630
|
+
}
|
|
631
|
+
module.error(error.noElement.replace('{element}', element));
|
|
632
|
+
|
|
633
|
+
return false;
|
|
634
|
+
},
|
|
635
|
+
},
|
|
636
|
+
|
|
637
|
+
setting: function (name, value) {
|
|
638
|
+
module.debug('Changing setting', name, value);
|
|
639
|
+
if ($.isPlainObject(name)) {
|
|
640
|
+
$.extend(true, settings, name);
|
|
641
|
+
} else if (value !== undefined) {
|
|
642
|
+
if ($.isPlainObject(settings[name])) {
|
|
643
|
+
$.extend(true, settings[name], value);
|
|
644
|
+
} else {
|
|
645
|
+
settings[name] = value;
|
|
646
|
+
}
|
|
647
|
+
} else {
|
|
648
|
+
return settings[name];
|
|
649
|
+
}
|
|
650
|
+
},
|
|
651
|
+
internal: function (name, value) {
|
|
652
|
+
if ($.isPlainObject(name)) {
|
|
653
|
+
$.extend(true, module, name);
|
|
654
|
+
} else if (value !== undefined) {
|
|
655
|
+
module[name] = value;
|
|
656
|
+
} else {
|
|
657
|
+
return module[name];
|
|
658
|
+
}
|
|
659
|
+
},
|
|
660
|
+
debug: function () {
|
|
661
|
+
if (!settings.silent && settings.debug) {
|
|
662
|
+
if (settings.performance) {
|
|
663
|
+
module.performance.log(arguments);
|
|
664
|
+
} else {
|
|
665
|
+
module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
666
|
+
module.debug.apply(console, arguments);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
},
|
|
670
|
+
verbose: function () {
|
|
671
|
+
if (!settings.silent && settings.verbose && settings.debug) {
|
|
672
|
+
if (settings.performance) {
|
|
673
|
+
module.performance.log(arguments);
|
|
674
|
+
} else {
|
|
675
|
+
module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':');
|
|
676
|
+
module.verbose.apply(console, arguments);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
error: function () {
|
|
681
|
+
if (!settings.silent) {
|
|
682
|
+
module.error = Function.prototype.bind.call(console.error, console, settings.name + ':');
|
|
683
|
+
module.error.apply(console, arguments);
|
|
684
|
+
}
|
|
685
|
+
},
|
|
686
|
+
performance: {
|
|
687
|
+
log: function (message) {
|
|
688
|
+
var
|
|
689
|
+
currentTime,
|
|
690
|
+
executionTime,
|
|
691
|
+
previousTime
|
|
692
|
+
;
|
|
693
|
+
if (settings.performance) {
|
|
694
|
+
currentTime = Date.now();
|
|
695
|
+
previousTime = time || currentTime;
|
|
696
|
+
executionTime = currentTime - previousTime;
|
|
697
|
+
time = currentTime;
|
|
698
|
+
performance.push({
|
|
699
|
+
Name: message[0],
|
|
700
|
+
Arguments: [].slice.call(message, 1) || '',
|
|
701
|
+
Element: element,
|
|
702
|
+
'Execution Time': executionTime,
|
|
703
|
+
});
|
|
704
|
+
}
|
|
705
|
+
clearTimeout(module.performance.timer);
|
|
706
|
+
module.performance.timer = setTimeout(function () {
|
|
707
|
+
module.performance.display();
|
|
708
|
+
}, 500);
|
|
709
|
+
},
|
|
710
|
+
display: function () {
|
|
711
|
+
var
|
|
712
|
+
title = settings.name + ':',
|
|
713
|
+
totalTime = 0
|
|
714
|
+
;
|
|
715
|
+
time = false;
|
|
716
|
+
clearTimeout(module.performance.timer);
|
|
717
|
+
$.each(performance, function (index, data) {
|
|
718
|
+
totalTime += data['Execution Time'];
|
|
719
|
+
});
|
|
720
|
+
title += ' ' + totalTime + 'ms';
|
|
721
|
+
if (performance.length > 0) {
|
|
722
|
+
console.groupCollapsed(title);
|
|
723
|
+
if (console.table) {
|
|
724
|
+
console.table(performance);
|
|
725
|
+
} else {
|
|
726
|
+
$.each(performance, function (index, data) {
|
|
727
|
+
console.log(data.Name + ': ' + data['Execution Time'] + 'ms');
|
|
728
|
+
});
|
|
729
|
+
}
|
|
730
|
+
console.groupEnd();
|
|
731
|
+
}
|
|
732
|
+
performance = [];
|
|
733
|
+
},
|
|
734
|
+
},
|
|
735
|
+
invoke: function (query, passedArguments, context) {
|
|
736
|
+
var
|
|
737
|
+
object = instance,
|
|
738
|
+
maxDepth,
|
|
739
|
+
found,
|
|
740
|
+
response
|
|
741
|
+
;
|
|
742
|
+
passedArguments = passedArguments || queryArguments;
|
|
743
|
+
context = context || element;
|
|
744
|
+
if (typeof query === 'string' && object !== undefined) {
|
|
745
|
+
query = query.split(/[ .]/);
|
|
746
|
+
maxDepth = query.length - 1;
|
|
747
|
+
$.each(query, function (depth, value) {
|
|
748
|
+
var camelCaseValue = depth !== maxDepth
|
|
749
|
+
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
|
|
750
|
+
: query
|
|
751
|
+
;
|
|
752
|
+
if ($.isPlainObject(object[camelCaseValue]) && (depth !== maxDepth)) {
|
|
753
|
+
object = object[camelCaseValue];
|
|
754
|
+
} else if (object[camelCaseValue] !== undefined) {
|
|
755
|
+
found = object[camelCaseValue];
|
|
756
|
+
|
|
757
|
+
return false;
|
|
758
|
+
} else if ($.isPlainObject(object[value]) && (depth !== maxDepth)) {
|
|
759
|
+
object = object[value];
|
|
760
|
+
} else if (object[value] !== undefined) {
|
|
761
|
+
found = object[value];
|
|
762
|
+
|
|
763
|
+
return false;
|
|
764
|
+
} else {
|
|
765
|
+
module.error(error.method, query);
|
|
766
|
+
|
|
767
|
+
return false;
|
|
768
|
+
}
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
if (isFunction(found)) {
|
|
772
|
+
response = found.apply(context, passedArguments);
|
|
773
|
+
} else if (found !== undefined) {
|
|
774
|
+
response = found;
|
|
775
|
+
}
|
|
776
|
+
if (Array.isArray(returnedValue)) {
|
|
777
|
+
returnedValue.push(response);
|
|
778
|
+
} else if (returnedValue !== undefined) {
|
|
779
|
+
returnedValue = [returnedValue, response];
|
|
780
|
+
} else if (response !== undefined) {
|
|
781
|
+
returnedValue = response;
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
return found;
|
|
785
|
+
},
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
if (methodInvoked) {
|
|
789
|
+
if (instance === undefined) {
|
|
790
|
+
module.initialize();
|
|
791
|
+
}
|
|
792
|
+
module.invoke(query);
|
|
793
|
+
} else {
|
|
794
|
+
if (instance !== undefined) {
|
|
795
|
+
instance.invoke('destroy');
|
|
796
|
+
}
|
|
797
|
+
module.initialize();
|
|
798
|
+
returnedValue = $module;
|
|
799
|
+
}
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
return returnedValue !== undefined
|
|
803
|
+
? returnedValue
|
|
804
|
+
: this;
|
|
805
|
+
};
|
|
806
|
+
$.toast = $.fn.toast;
|
|
807
|
+
|
|
808
|
+
$.fn.toast.settings = {
|
|
809
|
+
|
|
810
|
+
name: 'Toast',
|
|
811
|
+
namespace: 'toast',
|
|
812
|
+
|
|
813
|
+
silent: false,
|
|
814
|
+
debug: false,
|
|
815
|
+
verbose: false,
|
|
816
|
+
performance: true,
|
|
817
|
+
|
|
818
|
+
context: 'body',
|
|
819
|
+
|
|
820
|
+
position: 'top right',
|
|
821
|
+
horizontal: false,
|
|
822
|
+
class: 'neutral',
|
|
823
|
+
classProgress: false,
|
|
824
|
+
classActions: false,
|
|
825
|
+
classImage: 'mini',
|
|
826
|
+
|
|
827
|
+
title: '',
|
|
828
|
+
message: '',
|
|
829
|
+
displayTime: 3000, // set to zero to require manually dismissal, otherwise hides on its own
|
|
830
|
+
minDisplayTime: 1000, // minimum displaytime in case displayTime is set to 'auto'
|
|
831
|
+
wordsPerMinute: 120,
|
|
832
|
+
showIcon: false,
|
|
833
|
+
newestOnTop: false,
|
|
834
|
+
showProgress: false,
|
|
835
|
+
pauseOnHover: true,
|
|
836
|
+
progressUp: false, // if true, the bar will start at 0% and increase to 100%
|
|
837
|
+
opacity: 1,
|
|
838
|
+
compact: true,
|
|
839
|
+
closeIcon: false,
|
|
840
|
+
closeOnClick: true,
|
|
841
|
+
cloneModule: true,
|
|
842
|
+
actions: false,
|
|
843
|
+
preserveHTML: true,
|
|
844
|
+
showImage: false,
|
|
845
|
+
alt: false,
|
|
846
|
+
|
|
847
|
+
// transition settings
|
|
848
|
+
transition: {
|
|
849
|
+
showMethod: 'scale',
|
|
850
|
+
showDuration: 500,
|
|
851
|
+
hideMethod: 'scale',
|
|
852
|
+
hideDuration: 500,
|
|
853
|
+
closeEasing: 'easeOutCubic', // Set to empty string to stack the closed toast area immediately (old behaviour)
|
|
854
|
+
closeDuration: 500,
|
|
855
|
+
},
|
|
856
|
+
|
|
857
|
+
error: {
|
|
858
|
+
method: 'The method you called is not defined.',
|
|
859
|
+
noElement: 'This module requires ui {element}',
|
|
860
|
+
verticalCard: 'Vertical but not attached actions are not supported for card layout',
|
|
861
|
+
},
|
|
862
|
+
|
|
863
|
+
className: {
|
|
864
|
+
container: 'ui toast-container',
|
|
865
|
+
absolute: 'absolute',
|
|
866
|
+
box: 'floating toast-box',
|
|
867
|
+
progress: 'ui attached active progress',
|
|
868
|
+
toast: 'ui toast',
|
|
869
|
+
icon: 'centered icon',
|
|
870
|
+
visible: 'visible',
|
|
871
|
+
content: 'content',
|
|
872
|
+
title: 'ui header',
|
|
873
|
+
message: 'message',
|
|
874
|
+
actions: 'actions',
|
|
875
|
+
extraContent: 'extra content',
|
|
876
|
+
button: 'ui button',
|
|
877
|
+
buttons: 'ui buttons',
|
|
878
|
+
close: 'close icon',
|
|
879
|
+
image: 'ui image',
|
|
880
|
+
vertical: 'vertical',
|
|
881
|
+
horizontal: 'horizontal',
|
|
882
|
+
attached: 'attached',
|
|
883
|
+
inverted: 'inverted',
|
|
884
|
+
compact: 'compact',
|
|
885
|
+
pausable: 'pausable',
|
|
886
|
+
progressing: 'progressing',
|
|
887
|
+
top: 'top',
|
|
888
|
+
bottom: 'bottom',
|
|
889
|
+
left: 'left',
|
|
890
|
+
basic: 'basic',
|
|
891
|
+
unclickable: 'unclickable',
|
|
892
|
+
},
|
|
893
|
+
|
|
894
|
+
text: {
|
|
895
|
+
close: 'Close',
|
|
896
|
+
},
|
|
897
|
+
|
|
898
|
+
icons: {
|
|
899
|
+
info: 'info',
|
|
900
|
+
success: 'checkmark',
|
|
901
|
+
warning: 'warning',
|
|
902
|
+
error: 'times',
|
|
903
|
+
},
|
|
904
|
+
|
|
905
|
+
selector: {
|
|
906
|
+
container: '.ui.toast-container',
|
|
907
|
+
box: '.toast-box',
|
|
908
|
+
toast: '.ui.toast',
|
|
909
|
+
title: '.header',
|
|
910
|
+
message: '.message:not(.ui)',
|
|
911
|
+
image: '> img.image, > .image > img',
|
|
912
|
+
icon: '> i.icon',
|
|
913
|
+
input: 'input:not([type="hidden"]), textarea, select, button, .ui.button, ui.dropdown',
|
|
914
|
+
clickable: 'a, details, .ui.accordion',
|
|
915
|
+
approve: '.actions .positive, .actions .approve, .actions .ok',
|
|
916
|
+
deny: '.actions .negative, .actions .deny, .actions .cancel',
|
|
917
|
+
},
|
|
918
|
+
|
|
919
|
+
fields: {
|
|
920
|
+
class: 'class',
|
|
921
|
+
text: 'text',
|
|
922
|
+
icon: 'icon',
|
|
923
|
+
click: 'click',
|
|
924
|
+
},
|
|
925
|
+
|
|
926
|
+
// callbacks
|
|
927
|
+
onShow: function () {},
|
|
928
|
+
onVisible: function () {},
|
|
929
|
+
onClick: function () {},
|
|
930
|
+
onHide: function () {},
|
|
931
|
+
onHidden: function () {},
|
|
932
|
+
onRemove: function () {},
|
|
933
|
+
onApprove: function () {},
|
|
934
|
+
onDeny: function () {},
|
|
935
|
+
};
|
|
936
|
+
|
|
937
|
+
$.extend($.easing, {
|
|
938
|
+
easeOutBounce: function (x) {
|
|
939
|
+
var
|
|
940
|
+
n1 = 7.5625,
|
|
941
|
+
d1 = 2.75
|
|
942
|
+
;
|
|
943
|
+
if (x < 1 / d1) {
|
|
944
|
+
return n1 * x * x;
|
|
945
|
+
}
|
|
946
|
+
if (x < 2 / d1) {
|
|
947
|
+
x -= 1.5 / d1;
|
|
948
|
+
|
|
949
|
+
return n1 * x * x + 0.75;
|
|
950
|
+
}
|
|
951
|
+
if (x < 2.5 / d1) {
|
|
952
|
+
x -= 2.25 / d1;
|
|
953
|
+
|
|
954
|
+
return n1 * x * x + 0.9375;
|
|
955
|
+
}
|
|
956
|
+
x -= 2.625 / d1;
|
|
957
|
+
|
|
958
|
+
return n1 * x * x + 0.984375;
|
|
959
|
+
},
|
|
960
|
+
easeOutCubic: function (t) {
|
|
961
|
+
return --t * t * t + 1;
|
|
962
|
+
},
|
|
963
|
+
});
|
|
964
|
+
})(jQuery, window, document);
|