sweet-alert 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e9430cbfd0bdcdf5d1b48b953a2ef9b214dad829
|
4
|
+
data.tar.gz: 490b5f2c793d36652d30034a924a824162cf8acc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0154ae171ad2ef2f7c4b364d597f8548232e0fccca66e6560279dd6006beabff282729fa91dbca3855a8e233d3dd708a7894c93169b5d5534fb66a91f2098f2e
|
7
|
+
data.tar.gz: a5f78868c6e0f81de045292f56029bb785d9e18302ca0dc5a302e1be6d1a071e0756a39a8c99f76fb607f920a8d2d464f829495d4db67da742c4c28d68c08860
|
@@ -0,0 +1,303 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var _interopRequireWildcard = function (obj) { return obj && obj.__esModule ? obj : { 'default': obj }; };
|
4
|
+
|
5
|
+
Object.defineProperty(exports, '__esModule', {
|
6
|
+
value: true
|
7
|
+
});
|
8
|
+
// SweetAlert
|
9
|
+
// 2014-2015 (c) - Tristan Edwards
|
10
|
+
// github.com/t4t5/sweetalert
|
11
|
+
|
12
|
+
/*
|
13
|
+
* jQuery-like functions for manipulating the DOM
|
14
|
+
*/
|
15
|
+
|
16
|
+
var _hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation = require('./modules/handle-dom');
|
17
|
+
|
18
|
+
/*
|
19
|
+
* Handy utilities
|
20
|
+
*/
|
21
|
+
|
22
|
+
var _extend$hexToRgb$isIE8$logStr$colorLuminance = require('./modules/utils');
|
23
|
+
|
24
|
+
/*
|
25
|
+
* Handle sweetAlert's DOM elements
|
26
|
+
*/
|
27
|
+
|
28
|
+
var _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition = require('./modules/handle-swal-dom');
|
29
|
+
|
30
|
+
// Handle button events and keyboard events
|
31
|
+
|
32
|
+
var _handleButton$handleConfirm$handleCancel = require('./modules/handle-click');
|
33
|
+
|
34
|
+
var _handleKeyDown = require('./modules/handle-key');
|
35
|
+
|
36
|
+
var _handleKeyDown2 = _interopRequireWildcard(_handleKeyDown);
|
37
|
+
|
38
|
+
// Default values
|
39
|
+
|
40
|
+
var _defaultParams = require('./modules/default-params');
|
41
|
+
|
42
|
+
var _defaultParams2 = _interopRequireWildcard(_defaultParams);
|
43
|
+
|
44
|
+
var _setParameters = require('./modules/set-params');
|
45
|
+
|
46
|
+
var _setParameters2 = _interopRequireWildcard(_setParameters);
|
47
|
+
|
48
|
+
/*
|
49
|
+
* Remember state in cases where opening and handling a modal will fiddle with it.
|
50
|
+
* (We also use window.previousActiveElement as a global variable)
|
51
|
+
*/
|
52
|
+
var previousWindowKeyDown;
|
53
|
+
var lastFocusedButton;
|
54
|
+
|
55
|
+
/*
|
56
|
+
* Global sweetAlert function
|
57
|
+
* (this is what the user calls)
|
58
|
+
*/
|
59
|
+
var sweetAlert, swal;
|
60
|
+
|
61
|
+
exports['default'] = sweetAlert = swal = function () {
|
62
|
+
var customizations = arguments[0];
|
63
|
+
|
64
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.addClass(document.body, 'stop-scrolling');
|
65
|
+
_sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.resetInput();
|
66
|
+
|
67
|
+
/*
|
68
|
+
* Use argument if defined or default value from params object otherwise.
|
69
|
+
* Supports the case where a default value is boolean true and should be
|
70
|
+
* overridden by a corresponding explicit argument which is boolean false.
|
71
|
+
*/
|
72
|
+
function argumentOrDefault(key) {
|
73
|
+
var args = customizations;
|
74
|
+
return args[key] === undefined ? _defaultParams2['default'][key] : args[key];
|
75
|
+
}
|
76
|
+
|
77
|
+
if (customizations === undefined) {
|
78
|
+
_extend$hexToRgb$isIE8$logStr$colorLuminance.logStr('SweetAlert expects at least 1 attribute!');
|
79
|
+
return false;
|
80
|
+
}
|
81
|
+
|
82
|
+
var params = _extend$hexToRgb$isIE8$logStr$colorLuminance.extend({}, _defaultParams2['default']);
|
83
|
+
|
84
|
+
switch (typeof customizations) {
|
85
|
+
|
86
|
+
// Ex: swal("Hello", "Just testing", "info");
|
87
|
+
case 'string':
|
88
|
+
params.title = customizations;
|
89
|
+
params.text = arguments[1] || '';
|
90
|
+
params.type = arguments[2] || '';
|
91
|
+
break;
|
92
|
+
|
93
|
+
// Ex: swal({ title:"Hello", text: "Just testing", type: "info" });
|
94
|
+
case 'object':
|
95
|
+
if (customizations.title === undefined) {
|
96
|
+
_extend$hexToRgb$isIE8$logStr$colorLuminance.logStr('Missing "title" argument!');
|
97
|
+
return false;
|
98
|
+
}
|
99
|
+
|
100
|
+
params.title = customizations.title;
|
101
|
+
|
102
|
+
for (var customName in _defaultParams2['default']) {
|
103
|
+
params[customName] = argumentOrDefault(customName);
|
104
|
+
}
|
105
|
+
|
106
|
+
// Show "Confirm" instead of "OK" if cancel button is visible
|
107
|
+
params.confirmButtonText = params.showCancelButton ? 'Confirm' : _defaultParams2['default'].confirmButtonText;
|
108
|
+
params.confirmButtonText = argumentOrDefault('confirmButtonText');
|
109
|
+
|
110
|
+
// Callback function when clicking on "OK"/"Cancel"
|
111
|
+
params.doneFunction = arguments[1] || null;
|
112
|
+
|
113
|
+
break;
|
114
|
+
|
115
|
+
default:
|
116
|
+
_extend$hexToRgb$isIE8$logStr$colorLuminance.logStr('Unexpected type of argument! Expected "string" or "object", got ' + typeof customizations);
|
117
|
+
return false;
|
118
|
+
|
119
|
+
}
|
120
|
+
|
121
|
+
_setParameters2['default'](params);
|
122
|
+
_sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.fixVerticalPosition();
|
123
|
+
_sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.openModal(arguments[1]);
|
124
|
+
|
125
|
+
// Modal interactions
|
126
|
+
var modal = _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getModal();
|
127
|
+
|
128
|
+
/*
|
129
|
+
* Make sure all modal buttons respond to all events
|
130
|
+
*/
|
131
|
+
var $buttons = modal.querySelectorAll('button');
|
132
|
+
var buttonEvents = ['onclick', 'onmouseover', 'onmouseout', 'onmousedown', 'onmouseup', 'onfocus'];
|
133
|
+
var onButtonEvent = function onButtonEvent(e) {
|
134
|
+
return _handleButton$handleConfirm$handleCancel.handleButton(e, params, modal);
|
135
|
+
};
|
136
|
+
|
137
|
+
for (var btnIndex = 0; btnIndex < $buttons.length; btnIndex++) {
|
138
|
+
for (var evtIndex = 0; evtIndex < buttonEvents.length; evtIndex++) {
|
139
|
+
var btnEvt = buttonEvents[evtIndex];
|
140
|
+
$buttons[btnIndex][btnEvt] = onButtonEvent;
|
141
|
+
}
|
142
|
+
}
|
143
|
+
|
144
|
+
// Clicking outside the modal dismisses it (if allowed by user)
|
145
|
+
_sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getOverlay().onclick = onButtonEvent;
|
146
|
+
|
147
|
+
previousWindowKeyDown = window.onkeydown;
|
148
|
+
|
149
|
+
var onKeyEvent = function onKeyEvent(e) {
|
150
|
+
return _handleKeyDown2['default'](e, params, modal);
|
151
|
+
};
|
152
|
+
window.onkeydown = onKeyEvent;
|
153
|
+
|
154
|
+
window.onfocus = function () {
|
155
|
+
// When the user has focused away and focused back from the whole window.
|
156
|
+
setTimeout(function () {
|
157
|
+
// Put in a timeout to jump out of the event sequence.
|
158
|
+
// Calling focus() in the event sequence confuses things.
|
159
|
+
if (lastFocusedButton !== undefined) {
|
160
|
+
lastFocusedButton.focus();
|
161
|
+
lastFocusedButton = undefined;
|
162
|
+
}
|
163
|
+
}, 0);
|
164
|
+
};
|
165
|
+
|
166
|
+
// Show alert with enabled buttons always
|
167
|
+
swal.enableButtons();
|
168
|
+
};
|
169
|
+
|
170
|
+
/*
|
171
|
+
* Set default params for each popup
|
172
|
+
* @param {Object} userParams
|
173
|
+
*/
|
174
|
+
sweetAlert.setDefaults = swal.setDefaults = function (userParams) {
|
175
|
+
if (!userParams) {
|
176
|
+
throw new Error('userParams is required');
|
177
|
+
}
|
178
|
+
if (typeof userParams !== 'object') {
|
179
|
+
throw new Error('userParams has to be a object');
|
180
|
+
}
|
181
|
+
|
182
|
+
_extend$hexToRgb$isIE8$logStr$colorLuminance.extend(_defaultParams2['default'], userParams);
|
183
|
+
};
|
184
|
+
|
185
|
+
/*
|
186
|
+
* Animation when closing modal
|
187
|
+
*/
|
188
|
+
sweetAlert.close = swal.close = function () {
|
189
|
+
var modal = _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getModal();
|
190
|
+
|
191
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.fadeOut(_sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getOverlay(), 5);
|
192
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.fadeOut(modal, 5);
|
193
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass(modal, 'showSweetAlert');
|
194
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.addClass(modal, 'hideSweetAlert');
|
195
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass(modal, 'visible');
|
196
|
+
|
197
|
+
/*
|
198
|
+
* Reset icon animations
|
199
|
+
*/
|
200
|
+
var $successIcon = modal.querySelector('.sa-icon.sa-success');
|
201
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($successIcon, 'animate');
|
202
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($successIcon.querySelector('.sa-tip'), 'animateSuccessTip');
|
203
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($successIcon.querySelector('.sa-long'), 'animateSuccessLong');
|
204
|
+
|
205
|
+
var $errorIcon = modal.querySelector('.sa-icon.sa-error');
|
206
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($errorIcon, 'animateErrorIcon');
|
207
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($errorIcon.querySelector('.sa-x-mark'), 'animateXMark');
|
208
|
+
|
209
|
+
var $warningIcon = modal.querySelector('.sa-icon.sa-warning');
|
210
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($warningIcon, 'pulseWarning');
|
211
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($warningIcon.querySelector('.sa-body'), 'pulseWarningIns');
|
212
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($warningIcon.querySelector('.sa-dot'), 'pulseWarningIns');
|
213
|
+
|
214
|
+
// Reset custom class (delay so that UI changes aren't visible)
|
215
|
+
setTimeout(function () {
|
216
|
+
var customClass = modal.getAttribute('data-custom-class');
|
217
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass(modal, customClass);
|
218
|
+
}, 300);
|
219
|
+
|
220
|
+
// Make page scrollable again
|
221
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass(document.body, 'stop-scrolling');
|
222
|
+
|
223
|
+
// Reset the page to its previous state
|
224
|
+
window.onkeydown = previousWindowKeyDown;
|
225
|
+
if (window.previousActiveElement) {
|
226
|
+
window.previousActiveElement.focus();
|
227
|
+
}
|
228
|
+
lastFocusedButton = undefined;
|
229
|
+
clearTimeout(modal.timeout);
|
230
|
+
|
231
|
+
return true;
|
232
|
+
};
|
233
|
+
|
234
|
+
/*
|
235
|
+
* Validation of the input field is done by user
|
236
|
+
* If something is wrong => call showInputError with errorMessage
|
237
|
+
*/
|
238
|
+
sweetAlert.showInputError = swal.showInputError = function (errorMessage) {
|
239
|
+
var modal = _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getModal();
|
240
|
+
|
241
|
+
var $errorIcon = modal.querySelector('.sa-input-error');
|
242
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.addClass($errorIcon, 'show');
|
243
|
+
|
244
|
+
var $errorContainer = modal.querySelector('.sa-error-container');
|
245
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.addClass($errorContainer, 'show');
|
246
|
+
|
247
|
+
$errorContainer.querySelector('p').innerHTML = errorMessage;
|
248
|
+
|
249
|
+
setTimeout(function () {
|
250
|
+
sweetAlert.enableButtons();
|
251
|
+
}, 1);
|
252
|
+
|
253
|
+
modal.querySelector('input').focus();
|
254
|
+
};
|
255
|
+
|
256
|
+
/*
|
257
|
+
* Reset input error DOM elements
|
258
|
+
*/
|
259
|
+
sweetAlert.resetInputError = swal.resetInputError = function (event) {
|
260
|
+
// If press enter => ignore
|
261
|
+
if (event && event.keyCode === 13) {
|
262
|
+
return false;
|
263
|
+
}
|
264
|
+
|
265
|
+
var $modal = _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getModal();
|
266
|
+
|
267
|
+
var $errorIcon = $modal.querySelector('.sa-input-error');
|
268
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($errorIcon, 'show');
|
269
|
+
|
270
|
+
var $errorContainer = $modal.querySelector('.sa-error-container');
|
271
|
+
_hasClass$addClass$removeClass$escapeHtml$_show$show$_hide$hide$isDescendant$getTopMargin$fadeIn$fadeOut$fireClick$stopEventPropagation.removeClass($errorContainer, 'show');
|
272
|
+
};
|
273
|
+
|
274
|
+
/*
|
275
|
+
* Disable confirm and cancel buttons
|
276
|
+
*/
|
277
|
+
sweetAlert.disableButtons = swal.disableButtons = function (event) {
|
278
|
+
var modal = _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getModal();
|
279
|
+
var $confirmButton = modal.querySelector('button.confirm');
|
280
|
+
var $cancelButton = modal.querySelector('button.cancel');
|
281
|
+
$confirmButton.disabled = true;
|
282
|
+
$cancelButton.disabled = true;
|
283
|
+
};
|
284
|
+
|
285
|
+
/*
|
286
|
+
* Enable confirm and cancel buttons
|
287
|
+
*/
|
288
|
+
sweetAlert.enableButtons = swal.enableButtons = function (event) {
|
289
|
+
var modal = _sweetAlertInitialize$getModal$getOverlay$getInput$setFocusStyle$openModal$resetInput$fixVerticalPosition.getModal();
|
290
|
+
var $confirmButton = modal.querySelector('button.confirm');
|
291
|
+
var $cancelButton = modal.querySelector('button.cancel');
|
292
|
+
$confirmButton.disabled = false;
|
293
|
+
$cancelButton.disabled = false;
|
294
|
+
};
|
295
|
+
|
296
|
+
if (typeof window !== 'undefined') {
|
297
|
+
// The 'handle-click' module requires
|
298
|
+
// that 'sweetAlert' was set as global.
|
299
|
+
window.sweetAlert = window.swal = sweetAlert;
|
300
|
+
} else {
|
301
|
+
_extend$hexToRgb$isIE8$logStr$colorLuminance.logStr('SweetAlert is a frontend module!');
|
302
|
+
}
|
303
|
+
module.exports = exports['default'];
|
data/sweet-alert-rails.gemspec
CHANGED
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
3
3
|
|
4
4
|
Gem::Specification.new do |s|
|
5
5
|
s.name = 'sweet-alert'
|
6
|
-
s.version = '0.0.
|
6
|
+
s.version = '0.0.9'
|
7
7
|
s.summary = "The awesome replacement for Javascript's alert"
|
8
8
|
s.authors = ["Najtmare"]
|
9
9
|
s.email = 'millan@sino.net'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweet-alert
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Najtmare
|
@@ -22,7 +22,7 @@ files:
|
|
22
22
|
- README.md
|
23
23
|
- Rakefile
|
24
24
|
- app/assets/javascripts/sweet-alert/index.js
|
25
|
-
- app/assets/javascripts/sweet-alert/sweet-alert.
|
25
|
+
- app/assets/javascripts/sweet-alert/sweet-alert.js
|
26
26
|
- app/assets/stylesheets/sweet-alert/index.css
|
27
27
|
- app/assets/stylesheets/sweet-alert/sweet-alert.scss
|
28
28
|
- lib/sweet-alert.rb
|
@@ -1 +0,0 @@
|
|
1
|
-
!function(e,t,n){"use strict";!function o(e,t,n){function a(s,l){if(!t[s]){if(!e[s]){var i="function"==typeof require&&require;if(!l&&i)return i(s,!0);if(r)return r(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var c=t[s]={exports:{}};e[s][0].call(c.exports,function(t){var n=e[s][1][t];return a(n?n:t)},c,c.exports,o,e,t,n)}return t[s].exports}for(var r="function"==typeof require&&require,s=0;s<n.length;s++)a(n[s]);return a}({1:[function(o,a,r){var s=function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(r,"__esModule",{value:!0});var l,i,u,c,d=o("./modules/handle-dom"),f=o("./modules/utils"),p=o("./modules/handle-swal-dom"),m=o("./modules/handle-click"),v=o("./modules/handle-key"),y=s(v),h=o("./modules/default-params"),b=s(h),g=o("./modules/set-params"),w=s(g);r["default"]=u=c=function(){function o(e){var t=a;return t[e]===n?b["default"][e]:t[e]}var a=arguments[0];if(d.addClass(t.body,"stop-scrolling"),p.resetInput(),a===n)return f.logStr("SweetAlert expects at least 1 attribute!"),!1;var r=f.extend({},b["default"]);switch(typeof a){case"string":r.title=a,r.text=arguments[1]||"",r.type=arguments[2]||"";break;case"object":if(a.title===n)return f.logStr('Missing "title" argument!'),!1;r.title=a.title;for(var s in b["default"])r[s]=o(s);r.confirmButtonText=r.showCancelButton?"Confirm":b["default"].confirmButtonText,r.confirmButtonText=o("confirmButtonText"),r.doneFunction=arguments[1]||null;break;default:return f.logStr('Unexpected type of argument! Expected "string" or "object", got '+typeof a),!1}w["default"](r),p.fixVerticalPosition(),p.openModal(arguments[1]);for(var u=p.getModal(),v=u.querySelectorAll("button"),h=["onclick","onmouseover","onmouseout","onmousedown","onmouseup","onfocus"],g=function(e){return m.handleButton(e,r,u)},C=0;C<v.length;C++)for(var S=0;S<h.length;S++){var x=h[S];v[C][x]=g}p.getOverlay().onclick=g,l=e.onkeydown;var k=function(e){return y["default"](e,r,u)};e.onkeydown=k,e.onfocus=function(){setTimeout(function(){i!==n&&(i.focus(),i=n)},0)},c.enableButtons()},u.setDefaults=c.setDefaults=function(e){if(!e)throw new Error("userParams is required");if("object"!=typeof e)throw new Error("userParams has to be a object");f.extend(b["default"],e)},u.close=c.close=function(){var o=p.getModal();d.fadeOut(p.getOverlay(),5),d.fadeOut(o,5),d.removeClass(o,"showSweetAlert"),d.addClass(o,"hideSweetAlert"),d.removeClass(o,"visible");var a=o.querySelector(".sa-icon.sa-success");d.removeClass(a,"animate"),d.removeClass(a.querySelector(".sa-tip"),"animateSuccessTip"),d.removeClass(a.querySelector(".sa-long"),"animateSuccessLong");var r=o.querySelector(".sa-icon.sa-error");d.removeClass(r,"animateErrorIcon"),d.removeClass(r.querySelector(".sa-x-mark"),"animateXMark");var s=o.querySelector(".sa-icon.sa-warning");return d.removeClass(s,"pulseWarning"),d.removeClass(s.querySelector(".sa-body"),"pulseWarningIns"),d.removeClass(s.querySelector(".sa-dot"),"pulseWarningIns"),setTimeout(function(){var e=o.getAttribute("data-custom-class");d.removeClass(o,e)},300),d.removeClass(t.body,"stop-scrolling"),e.onkeydown=l,e.previousActiveElement&&e.previousActiveElement.focus(),i=n,clearTimeout(o.timeout),!0},u.showInputError=c.showInputError=function(e){var t=p.getModal(),n=t.querySelector(".sa-input-error");d.addClass(n,"show");var o=t.querySelector(".sa-error-container");d.addClass(o,"show"),o.querySelector("p").innerHTML=e,setTimeout(function(){u.enableButtons()},1),t.querySelector("input").focus()},u.resetInputError=c.resetInputError=function(e){if(e&&13===e.keyCode)return!1;var t=p.getModal(),n=t.querySelector(".sa-input-error");d.removeClass(n,"show");var o=t.querySelector(".sa-error-container");d.removeClass(o,"show")},u.disableButtons=c.disableButtons=function(){var e=p.getModal(),t=e.querySelector("button.confirm"),n=e.querySelector("button.cancel");t.disabled=!0,n.disabled=!0},u.enableButtons=c.enableButtons=function(){var e=p.getModal(),t=e.querySelector("button.confirm"),n=e.querySelector("button.cancel");t.disabled=!1,n.disabled=!1},"undefined"!=typeof e?e.sweetAlert=e.swal=u:f.logStr("SweetAlert is a frontend module!"),a.exports=r["default"]},{"./modules/default-params":2,"./modules/handle-click":3,"./modules/handle-dom":4,"./modules/handle-key":5,"./modules/handle-swal-dom":6,"./modules/set-params":8,"./modules/utils":9}],2:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var o={title:"",text:"",type:null,allowOutsideClick:!1,showConfirmButton:!0,showCancelButton:!1,closeOnConfirm:!0,closeOnCancel:!0,confirmButtonText:"OK",confirmButtonColor:"#8CD4F5",cancelButtonText:"Cancel",imageUrl:null,imageSize:null,timer:null,customClass:"",html:!1,animation:!0,allowEscapeKey:!0,inputType:"text",inputPlaceholder:"",inputValue:"",showLoaderOnConfirm:!1};n["default"]=o,t.exports=n["default"]},{}],3:[function(t,n,o){Object.defineProperty(o,"__esModule",{value:!0});var a=t("./utils"),r=(t("./handle-swal-dom"),t("./handle-dom")),s=function(t,n,o){function s(e){m&&n.confirmButtonColor&&(p.style.backgroundColor=e)}var u,c,d,f=t||e.event,p=f.target||f.srcElement,m=-1!==p.className.indexOf("confirm"),v=-1!==p.className.indexOf("sweet-overlay"),y=r.hasClass(o,"visible"),h=n.doneFunction&&"true"===o.getAttribute("data-has-done-function");switch(m&&n.confirmButtonColor&&(u=n.confirmButtonColor,c=a.colorLuminance(u,-.04),d=a.colorLuminance(u,-.14)),f.type){case"mouseover":s(c);break;case"mouseout":s(u);break;case"mousedown":s(d);break;case"mouseup":s(c);break;case"focus":var b=o.querySelector("button.confirm"),g=o.querySelector("button.cancel");m?g.style.boxShadow="none":b.style.boxShadow="none";break;case"click":var w=o===p,C=r.isDescendant(o,p);if(!w&&!C&&y&&!n.allowOutsideClick)break;m&&h&&y?l(o,n):h&&y||v?i(o,n):r.isDescendant(o,p)&&"BUTTON"===p.tagName&&sweetAlert.close()}},l=function(e,t){var n=!0;r.hasClass(e,"show-input")&&(n=e.querySelector("input").value,n||(n="")),t.doneFunction(n),t.closeOnConfirm&&sweetAlert.close(),t.showLoaderOnConfirm&&sweetAlert.disableButtons()},i=function(e,t){var n=String(t.doneFunction).replace(/\s/g,""),o="function("===n.substring(0,9)&&")"!==n.substring(9,10);o&&t.doneFunction(!1),t.closeOnCancel&&sweetAlert.close()};o["default"]={handleButton:s,handleConfirm:l,handleCancel:i},n.exports=o["default"]},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],4:[function(n,o,a){Object.defineProperty(a,"__esModule",{value:!0});var r=function(e,t){return new RegExp(" "+t+" ").test(" "+e.className+" ")},s=function(e,t){r(e,t)||(e.className+=" "+t)},l=function(e,t){var n=" "+e.className.replace(/[\t\r\n]/g," ")+" ";if(r(e,t)){for(;n.indexOf(" "+t+" ")>=0;)n=n.replace(" "+t+" "," ");e.className=n.replace(/^\s+|\s+$/g,"")}},i=function(e){var n=t.createElement("div");return n.appendChild(t.createTextNode(e)),n.innerHTML},u=function(e){e.style.opacity="",e.style.display="block"},c=function(e){if(e&&!e.length)return u(e);for(var t=0;t<e.length;++t)u(e[t])},d=function(e){e.style.opacity="",e.style.display="none"},f=function(e){if(e&&!e.length)return d(e);for(var t=0;t<e.length;++t)d(e[t])},p=function(e,t){for(var n=t.parentNode;null!==n;){if(n===e)return!0;n=n.parentNode}return!1},m=function(e){e.style.left="-9999px",e.style.display="block";var t,n=e.clientHeight;return t="undefined"!=typeof getComputedStyle?parseInt(getComputedStyle(e).getPropertyValue("padding-top"),10):parseInt(e.currentStyle.padding),e.style.left="",e.style.display="none","-"+parseInt((n+t)/2)+"px"},v=function(e,t){if(+e.style.opacity<1){t=t||16,e.style.opacity=0,e.style.display="block";var n=+new Date,o=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){e.style.opacity=+e.style.opacity+(new Date-n)/100,n=+new Date,+e.style.opacity<1&&setTimeout(o,t)});o()}e.style.display="block"},y=function(e,t){t=t||16,e.style.opacity=1;var n=+new Date,o=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){e.style.opacity=+e.style.opacity-(new Date-n)/100,n=+new Date,+e.style.opacity>0?setTimeout(o,t):e.style.display="none"});o()},h=function(n){if("function"==typeof MouseEvent){var o=new MouseEvent("click",{view:e,bubbles:!1,cancelable:!0});n.dispatchEvent(o)}else if(t.createEvent){var a=t.createEvent("MouseEvents");a.initEvent("click",!1,!1),n.dispatchEvent(a)}else t.createEventObject?n.fireEvent("onclick"):"function"==typeof n.onclick&&n.onclick()},b=function(t){"function"==typeof t.stopPropagation?(t.stopPropagation(),t.preventDefault()):e.event&&e.event.hasOwnProperty("cancelBubble")&&(e.event.cancelBubble=!0)};a.hasClass=r,a.addClass=s,a.removeClass=l,a.escapeHtml=i,a._show=u,a.show=c,a._hide=d,a.hide=f,a.isDescendant=p,a.getTopMargin=m,a.fadeIn=v,a.fadeOut=y,a.fireClick=h,a.stopEventPropagation=b},{}],5:[function(t,o,a){Object.defineProperty(a,"__esModule",{value:!0});var r=t("./handle-dom"),s=t("./handle-swal-dom"),l=function(t,o,a){var l=t||e.event,i=l.keyCode||l.which,u=a.querySelector("button.confirm"),c=a.querySelector("button.cancel"),d=a.querySelectorAll("button[tabindex]");if(-1!==[9,13,32,27].indexOf(i)){for(var f=l.target||l.srcElement,p=-1,m=0;m<d.length;m++)if(f===d[m]){p=m;break}9===i?(f=-1===p?u:p===d.length-1?d[0]:d[p+1],r.stopEventPropagation(l),f.focus(),o.confirmButtonColor&&s.setFocusStyle(f,o.confirmButtonColor)):13===i?("INPUT"===f.tagName&&(f=u,u.focus()),f=-1===p?u:n):27===i&&o.allowEscapeKey===!0?(f=c,r.fireClick(f,l)):f=n}};a["default"]=l,o.exports=a["default"]},{"./handle-dom":4,"./handle-swal-dom":6}],6:[function(n,o,a){var r=function(e){return e&&e.__esModule?e:{"default":e}};Object.defineProperty(a,"__esModule",{value:!0});var s=n("./utils"),l=n("./handle-dom"),i=n("./default-params"),u=r(i),c=n("./injected-html"),d=r(c),f=".sweet-alert",p=".sweet-overlay",m=function(){var e=t.createElement("div");for(e.innerHTML=d["default"];e.firstChild;)t.body.appendChild(e.firstChild)},v=function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){var e=t.querySelector(f);return e||(m(),e=v()),e}),y=function(){var e=v();return e?e.querySelector("input"):void 0},h=function(){return t.querySelector(p)},b=function(e,t){var n=s.hexToRgb(t);e.style.boxShadow="0 0 2px rgba("+n+", 0.8), inset 0 0 0 1px rgba(0, 0, 0, 0.05)"},g=function(n){var o=v();l.fadeIn(h(),10),l.show(o),l.addClass(o,"showSweetAlert"),l.removeClass(o,"hideSweetAlert"),e.previousActiveElement=t.activeElement;var a=o.querySelector("button.confirm");a.focus(),setTimeout(function(){l.addClass(o,"visible")},500);var r=o.getAttribute("data-timer");if("null"!==r&&""!==r){var s=n;o.timeout=setTimeout(function(){var e=(s||null)&&"true"===o.getAttribute("data-has-done-function");e?s(null):sweetAlert.close()},r)}},w=function(){var e=v(),t=y();l.removeClass(e,"show-input"),t.value=u["default"].inputValue,t.setAttribute("type",u["default"].inputType),t.setAttribute("placeholder",u["default"].inputPlaceholder),C()},C=function(e){if(e&&13===e.keyCode)return!1;var t=v(),n=t.querySelector(".sa-input-error");l.removeClass(n,"show");var o=t.querySelector(".sa-error-container");l.removeClass(o,"show")},S=function(){var e=v();e.style.marginTop=l.getTopMargin(v())};a.sweetAlertInitialize=m,a.getModal=v,a.getOverlay=h,a.getInput=y,a.setFocusStyle=b,a.openModal=g,a.resetInput=w,a.resetInputError=C,a.fixVerticalPosition=S},{"./default-params":2,"./handle-dom":4,"./injected-html":7,"./utils":9}],7:[function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0});var o='<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error">\n <span class="sa-x-mark">\n <span class="sa-line sa-left"></span>\n <span class="sa-line sa-right"></span>\n </span>\n </div><div class="sa-icon sa-warning">\n <span class="sa-body"></span>\n <span class="sa-dot"></span>\n </div><div class="sa-icon sa-info"></div><div class="sa-icon sa-success">\n <span class="sa-line sa-tip"></span>\n <span class="sa-line sa-long"></span>\n\n <div class="sa-placeholder"></div>\n <div class="sa-fix"></div>\n </div><div class="sa-icon sa-custom"></div><h2>Title</h2>\n <p>Text</p>\n <fieldset>\n <input type="text" tabIndex="3" />\n <div class="sa-input-error"></div>\n </fieldset><div class="sa-error-container">\n <div class="icon">!</div>\n <p>Not valid!</p>\n </div><div class="sa-button-container">\n <button class="cancel" tabIndex="2">Cancel</button>\n <div class="sa-confirm-button-container">\n <button class="confirm" tabIndex="1">OK</button><div class="la-ball-fall">\n <div></div>\n <div></div>\n <div></div>\n </div>\n </div>\n </div></div>';n["default"]=o,t.exports=n["default"]},{}],8:[function(e,t,o){Object.defineProperty(o,"__esModule",{value:!0});var a=e("./utils"),r=e("./handle-swal-dom"),s=e("./handle-dom"),l=["error","warning","info","success","input","prompt"],i=function(e){var t=r.getModal(),o=t.querySelector("h2"),i=t.querySelector("p"),u=t.querySelector("button.cancel"),c=t.querySelector("button.confirm");if(o.innerHTML=e.html?e.title:s.escapeHtml(e.title).split("\n").join("<br>"),i.innerHTML=e.html?e.text:s.escapeHtml(e.text||"").split("\n").join("<br>"),e.text&&s.show(i),e.customClass)s.addClass(t,e.customClass),t.setAttribute("data-custom-class",e.customClass);else{var d=t.getAttribute("data-custom-class");s.removeClass(t,d),t.setAttribute("data-custom-class","")}if(s.hide(t.querySelectorAll(".sa-icon")),e.type&&!a.isIE8()){var f=function(){for(var o=!1,a=0;a<l.length;a++)if(e.type===l[a]){o=!0;break}if(!o)return logStr("Unknown alert type: "+e.type),{v:!1};var i=["success","error","warning","info"],u=n;-1!==i.indexOf(e.type)&&(u=t.querySelector(".sa-icon.sa-"+e.type),s.show(u));var c=r.getInput();switch(e.type){case"success":s.addClass(u,"animate"),s.addClass(u.querySelector(".sa-tip"),"animateSuccessTip"),s.addClass(u.querySelector(".sa-long"),"animateSuccessLong");break;case"error":s.addClass(u,"animateErrorIcon"),s.addClass(u.querySelector(".sa-x-mark"),"animateXMark");break;case"warning":s.addClass(u,"pulseWarning"),s.addClass(u.querySelector(".sa-body"),"pulseWarningIns"),s.addClass(u.querySelector(".sa-dot"),"pulseWarningIns");break;case"input":case"prompt":c.setAttribute("type",e.inputType),c.value=e.inputValue,c.setAttribute("placeholder",e.inputPlaceholder),s.addClass(t,"show-input"),setTimeout(function(){c.focus(),c.addEventListener("keyup",swal.resetInputError)},400)}}();if("object"==typeof f)return f.v}if(e.imageUrl){var p=t.querySelector(".sa-icon.sa-custom");p.style.backgroundImage="url("+e.imageUrl+")",s.show(p);var m=80,v=80;if(e.imageSize){var y=e.imageSize.toString().split("x"),h=y[0],b=y[1];h&&b?(m=h,v=b):logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got "+e.imageSize)}p.setAttribute("style",p.getAttribute("style")+"width:"+m+"px; height:"+v+"px")}t.setAttribute("data-has-cancel-button",e.showCancelButton),e.showCancelButton?u.style.display="inline-block":s.hide(u),t.setAttribute("data-has-confirm-button",e.showConfirmButton),e.showConfirmButton?c.style.display="inline-block":s.hide(c),e.cancelButtonText&&(u.innerHTML=s.escapeHtml(e.cancelButtonText)),e.confirmButtonText&&(c.innerHTML=s.escapeHtml(e.confirmButtonText)),e.confirmButtonColor&&(c.style.backgroundColor=e.confirmButtonColor,c.style.borderLeftColor=e.confirmLoadingButtonColor,c.style.borderRightColor=e.confirmLoadingButtonColor,r.setFocusStyle(c,e.confirmButtonColor)),t.setAttribute("data-allow-outside-click",e.allowOutsideClick);var g=e.doneFunction?!0:!1;t.setAttribute("data-has-done-function",g),e.animation?"string"==typeof e.animation?t.setAttribute("data-animation",e.animation):t.setAttribute("data-animation","pop"):t.setAttribute("data-animation","none"),t.setAttribute("data-timer",e.timer)};o["default"]=i,t.exports=o["default"]},{"./handle-dom":4,"./handle-swal-dom":6,"./utils":9}],9:[function(t,n,o){Object.defineProperty(o,"__esModule",{value:!0});var a=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},r=function(e){var t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);return t?parseInt(t[1],16)+", "+parseInt(t[2],16)+", "+parseInt(t[3],16):null},s=function(){return e.attachEvent&&!e.addEventListener},l=function(t){e.console&&e.console.log("SweetAlert: "+t)},i=function(e,t){e=String(e).replace(/[^0-9a-f]/gi,""),e.length<6&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),t=t||0;var n,o,a="#";for(o=0;3>o;o++)n=parseInt(e.substr(2*o,2),16),n=Math.round(Math.min(Math.max(0,n+n*t),255)).toString(16),a+=("00"+n).substr(n.length);return a};o.extend=a,o.hexToRgb=r,o.isIE8=s,o.logStr=l,o.colorLuminance=i},{}]},{},[1]),"function"==typeof define&&define.amd?define(function(){return sweetAlert}):"undefined"!=typeof module&&module.exports&&(module.exports=sweetAlert)}(window,document);
|