sweetalert-rails 0.4.2 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bedb3cb7dea956573e5ebabf0fc76e57ff76ecdf
4
- data.tar.gz: 77020c476a8083b6bf7f01a2f6671e0f30b81b2d
3
+ metadata.gz: 1b7c0811ae39b1bf0b7b6c94cbf77471314696c5
4
+ data.tar.gz: 0724f96d60f35217ee5b7e74c5e56cb9b2b389a6
5
5
  SHA512:
6
- metadata.gz: 6d7f168a2bcae6ca2bcb724243798a778b69a53d53e55230d64e6726256828cf329f9ac8606b2b4fe5c638bfe86dc98f36bfdd1c437adf96d946f67307782bea
7
- data.tar.gz: 815827fec644094a29685d816c4e13b7626e4dc9d833fa292ff2bda81186fd7c01505194492b6e5d3b167b3871075a58619c92483776f850290b203dd570c15e
6
+ metadata.gz: 5f12696d9ed920cdadb0bc6cdbfaa97225479bfbb0cade5321e2fcfe20a820d96291dd8010621eb14e6ad1860c1ad9bf26321ffdf53d34ecf9a913e3266438b6
7
+ data.tar.gz: ea2a4241937ed1f2a95d6e60767201afa2800f46328f8ce351ae1a0a51f17bc0a33c4976eb705efaf65c13cc3d40dd45cca748e75ebf39ec76b2fefdba0bb7ae
data/README.md CHANGED
@@ -42,7 +42,7 @@ sweetAlert("Awesome!");
42
42
 
43
43
  ## Contributing
44
44
 
45
- 1. Fork it ( https://github.com/[my-github-username]/sweetalert-rails/fork )
45
+ 1. Fork it ( https://github.com/sharshenov/sweetalert-rails/fork )
46
46
  2. Create your feature branch (`git checkout -b my-new-feature`)
47
47
  3. Commit your changes (`git commit -am 'Add some feature'`)
48
48
  4. Push to the branch (`git push origin my-new-feature`)
@@ -1,3 +1,3 @@
1
1
  module SweetAlert
2
- VERSION = "0.4.2"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -1,11 +1,11 @@
1
1
  // SweetAlert
2
- // 2014 (c) - Tristan Edwards
2
+ // 2014-2015 (c) - Tristan Edwards
3
3
  // github.com/t4t5/sweetalert
4
4
  ;(function(window, document, undefined) {
5
5
 
6
6
  var modalClass = '.sweet-alert',
7
7
  overlayClass = '.sweet-overlay',
8
- alertTypes = ['error', 'warning', 'info', 'success'],
8
+ alertTypes = ['error', 'warning', 'info', 'success', 'input', 'prompt'],
9
9
  defaultParams = {
10
10
  title: '',
11
11
  text: '',
@@ -24,7 +24,8 @@
24
24
  customClass: '',
25
25
  html: false,
26
26
  animation: true,
27
- allowEscapeKey: true
27
+ allowEscapeKey: true,
28
+ inputType: 'text'
28
29
  };
29
30
 
30
31
 
@@ -33,159 +34,165 @@
33
34
  */
34
35
 
35
36
  var getModal = function() {
36
- var $modal = document.querySelector(modalClass);
37
+ var $modal = document.querySelector(modalClass);
37
38
 
38
- if (!$modal) {
39
- sweetAlertInitialize();
40
- $modal = getModal();
41
- }
39
+ if (!$modal) {
40
+ sweetAlertInitialize();
41
+ $modal = getModal();
42
+ }
42
43
 
43
- return $modal;
44
- },
45
- getOverlay = function() {
46
- return document.querySelector(overlayClass);
47
- },
48
- hasClass = function(elem, className) {
49
- return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
50
- },
51
- addClass = function(elem, className) {
52
- if (!hasClass(elem, className)) {
53
- elem.className += ' ' + className;
54
- }
55
- },
56
- removeClass = function(elem, className) {
57
- var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' ';
58
- if (hasClass(elem, className)) {
59
- while (newClass.indexOf(' ' + className + ' ') >= 0) {
60
- newClass = newClass.replace(' ' + className + ' ', ' ');
61
- }
62
- elem.className = newClass.replace(/^\s+|\s+$/g, '');
63
- }
64
- },
65
- escapeHtml = function(str) {
66
- var div = document.createElement('div');
67
- div.appendChild(document.createTextNode(str));
68
- return div.innerHTML;
69
- },
70
- _show = function(elem) {
71
- elem.style.opacity = '';
72
- elem.style.display = 'block';
73
- },
74
- show = function(elems) {
75
- if (elems && !elems.length) {
76
- return _show(elems);
77
- }
78
- for (var i = 0; i < elems.length; ++i) {
79
- _show(elems[i]);
80
- }
81
- },
82
- _hide = function(elem) {
83
- elem.style.opacity = '';
84
- elem.style.display = 'none';
85
- },
86
- hide = function(elems) {
87
- if (elems && !elems.length) {
88
- return _hide(elems);
89
- }
90
- for (var i = 0; i < elems.length; ++i) {
91
- _hide(elems[i]);
92
- }
93
- },
94
- isDescendant = function(parent, child) {
95
- var node = child.parentNode;
96
- while (node !== null) {
97
- if (node === parent) {
98
- return true;
99
- }
100
- node = node.parentNode;
101
- }
102
- return false;
103
- },
104
- getTopMargin = function(elem) {
105
- elem.style.left = '-9999px';
106
- elem.style.display = 'block';
44
+ return $modal;
45
+ };
107
46
 
108
- var height = elem.clientHeight,
109
- padding;
110
- if (typeof getComputedStyle !== "undefined") { /* IE 8 */
111
- padding = parseInt(getComputedStyle(elem).getPropertyValue('padding'), 10);
112
- } else {
113
- padding = parseInt(elem.currentStyle.padding);
47
+ var getInput = function() {
48
+ var modal = getModal();
49
+ if (modal) {
50
+ return modal.querySelector('input');
51
+ }
52
+ },
53
+ getOverlay = function() {
54
+ return document.querySelector(overlayClass);
55
+ },
56
+ hasClass = function(elem, className) {
57
+ return new RegExp(' ' + className + ' ').test(' ' + elem.className + ' ');
58
+ },
59
+ addClass = function(elem, className) {
60
+ if (!hasClass(elem, className)) {
61
+ elem.className += ' ' + className;
62
+ }
63
+ },
64
+ removeClass = function(elem, className) {
65
+ var newClass = ' ' + elem.className.replace(/[\t\r\n]/g, ' ') + ' ';
66
+ if (hasClass(elem, className)) {
67
+ while (newClass.indexOf(' ' + className + ' ') >= 0) {
68
+ newClass = newClass.replace(' ' + className + ' ', ' ');
114
69
  }
115
-
116
- elem.style.left = '';
117
- elem.style.display = 'none';
118
- return ('-' + parseInt(height / 2 + padding) + 'px');
119
- },
120
- fadeIn = function(elem, interval) {
121
- if (+elem.style.opacity < 1) {
122
- interval = interval || 16;
123
- elem.style.opacity = 0;
124
- elem.style.display = 'block';
125
- var last = +new Date();
126
- var tick = function() {
127
- elem.style.opacity = +elem.style.opacity + (new Date() - last) / 100;
128
- last = +new Date();
129
-
130
- if (+elem.style.opacity < 1) {
131
- setTimeout(tick, interval);
132
- }
133
- };
134
- tick();
70
+ elem.className = newClass.replace(/^\s+|\s+$/g, '');
71
+ }
72
+ },
73
+ escapeHtml = function(str) {
74
+ var div = document.createElement('div');
75
+ div.appendChild(document.createTextNode(str));
76
+ return div.innerHTML;
77
+ },
78
+ _show = function(elem) {
79
+ elem.style.opacity = '';
80
+ elem.style.display = 'block';
81
+ },
82
+ show = function(elems) {
83
+ if (elems && !elems.length) {
84
+ return _show(elems);
85
+ }
86
+ for (var i = 0; i < elems.length; ++i) {
87
+ _show(elems[i]);
88
+ }
89
+ },
90
+ _hide = function(elem) {
91
+ elem.style.opacity = '';
92
+ elem.style.display = 'none';
93
+ },
94
+ hide = function(elems) {
95
+ if (elems && !elems.length) {
96
+ return _hide(elems);
97
+ }
98
+ for (var i = 0; i < elems.length; ++i) {
99
+ _hide(elems[i]);
100
+ }
101
+ },
102
+ isDescendant = function(parent, child) {
103
+ var node = child.parentNode;
104
+ while (node !== null) {
105
+ if (node === parent) {
106
+ return true;
135
107
  }
136
- elem.style.display = 'block'; //fallback IE8
137
- },
138
- fadeOut = function(elem, interval) {
108
+ node = node.parentNode;
109
+ }
110
+ return false;
111
+ },
112
+ getTopMargin = function(elem) {
113
+ elem.style.left = '-9999px';
114
+ elem.style.display = 'block';
115
+
116
+ var height = elem.clientHeight,
117
+ padding;
118
+ if (typeof getComputedStyle !== "undefined") { // IE 8
119
+ padding = parseInt(getComputedStyle(elem).getPropertyValue('padding-top'), 10);
120
+ } else {
121
+ padding = parseInt(elem.currentStyle.padding);
122
+ }
123
+
124
+ elem.style.left = '';
125
+ elem.style.display = 'none';
126
+ return ('-' + parseInt((height + padding) / 2) + 'px');
127
+ },
128
+ fadeIn = function(elem, interval) {
129
+ if (+elem.style.opacity < 1) {
139
130
  interval = interval || 16;
140
- elem.style.opacity = 1;
131
+ elem.style.opacity = 0;
132
+ elem.style.display = 'block';
141
133
  var last = +new Date();
142
134
  var tick = function() {
143
- elem.style.opacity = +elem.style.opacity - (new Date() - last) / 100;
135
+ elem.style.opacity = +elem.style.opacity + (new Date() - last) / 100;
144
136
  last = +new Date();
145
137
 
146
- if (+elem.style.opacity > 0) {
138
+ if (+elem.style.opacity < 1) {
147
139
  setTimeout(tick, interval);
148
- } else {
149
- elem.style.display = 'none';
150
140
  }
151
141
  };
152
142
  tick();
153
- },
154
- fireClick = function(node) {
155
- // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
156
- // Then fixed for today's Chrome browser.
157
- if (typeof MouseEvent === 'function') {
158
- // Up-to-date approach
159
- var mevt = new MouseEvent('click', {
160
- view: window,
161
- bubbles: false,
162
- cancelable: true
163
- });
164
- node.dispatchEvent(mevt);
165
- } else if ( document.createEvent ) {
166
- // Fallback
167
- var evt = document.createEvent('MouseEvents');
168
- evt.initEvent('click', false, false);
169
- node.dispatchEvent(evt);
170
- } else if( document.createEventObject ) {
171
- node.fireEvent('onclick') ;
172
- } else if (typeof node.onclick === 'function' ) {
173
- node.onclick();
174
- }
175
- },
176
- stopEventPropagation = function(e) {
177
- // In particular, make sure the space bar doesn't scroll the main window.
178
- if (typeof e.stopPropagation === 'function') {
179
- e.stopPropagation();
180
- e.preventDefault();
181
- } else if (window.event && window.event.hasOwnProperty('cancelBubble')) {
182
- window.event.cancelBubble = true;
143
+ }
144
+ elem.style.display = 'block'; //fallback IE8
145
+ },
146
+ fadeOut = function(elem, interval) {
147
+ interval = interval || 16;
148
+ elem.style.opacity = 1;
149
+ var last = +new Date();
150
+ var tick = function() {
151
+ elem.style.opacity = +elem.style.opacity - (new Date() - last) / 100;
152
+ last = +new Date();
153
+
154
+ if (+elem.style.opacity > 0) {
155
+ setTimeout(tick, interval);
156
+ } else {
157
+ elem.style.display = 'none';
183
158
  }
184
159
  };
160
+ tick();
161
+ },
162
+ fireClick = function(node) {
163
+ // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
164
+ // Then fixed for today's Chrome browser.
165
+ if (typeof MouseEvent === 'function') {
166
+ // Up-to-date approach
167
+ var mevt = new MouseEvent('click', {
168
+ view: window,
169
+ bubbles: false,
170
+ cancelable: true
171
+ });
172
+ node.dispatchEvent(mevt);
173
+ } else if ( document.createEvent ) {
174
+ // Fallback
175
+ var evt = document.createEvent('MouseEvents');
176
+ evt.initEvent('click', false, false);
177
+ node.dispatchEvent(evt);
178
+ } else if (document.createEventObject) {
179
+ node.fireEvent('onclick') ;
180
+ } else if (typeof node.onclick === 'function' ) {
181
+ node.onclick();
182
+ }
183
+ },
184
+ stopEventPropagation = function(e) {
185
+ // In particular, make sure the space bar doesn't scroll the main window.
186
+ if (typeof e.stopPropagation === 'function') {
187
+ e.stopPropagation();
188
+ e.preventDefault();
189
+ } else if (window.event && window.event.hasOwnProperty('cancelBubble')) {
190
+ window.event.cancelBubble = true;
191
+ }
192
+ };
185
193
 
186
194
  // Remember state in cases where opening and handling a modal will fiddle with it.
187
195
  var previousActiveElement,
188
- previousDocumentClick,
189
196
  previousWindowKeyDown,
190
197
  lastFocusedButton;
191
198
 
@@ -195,7 +202,7 @@
195
202
  */
196
203
 
197
204
  var sweetAlertInitialize = function() {
198
- var sweetHTML = '<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert" tabIndex="-1"><div class="sa-icon sa-error"><span class="sa-x-mark"><span class="sa-line sa-left"></span><span class="sa-line sa-right"></span></span></div><div class="sa-icon sa-warning"> <span class="sa-body"></span> <span class="sa-dot"></span> </div> <div class="sa-icon sa-info"></div> <div class="sa-icon sa-success"> <span class="sa-line sa-tip"></span> <span class="sa-line sa-long"></span> <div class="sa-placeholder"></div> <div class="sa-fix"></div> </div> <div class="sa-icon sa-custom"></div> <h2>Title</h2><p>Text</p><button class="cancel" tabIndex="2">Cancel</button><button class="confirm" tabIndex="1">OK</button></div>',
205
+ var sweetHTML = '<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert"><div class="sa-icon sa-error"><span class="sa-x-mark"><span class="sa-line sa-left"></span><span class="sa-line sa-right"></span></span></div><div class="sa-icon sa-warning"> <span class="sa-body"></span> <span class="sa-dot"></span> </div> <div class="sa-icon sa-info"></div> <div class="sa-icon sa-success"> <span class="sa-line sa-tip"></span> <span class="sa-line sa-long"></span> <div class="sa-placeholder"></div> <div class="sa-fix"></div> </div> <div class="sa-icon sa-custom"></div> <h2>Title</h2><p>Text</p><fieldset><input type="text" tabIndex="3" /><div class="sa-input-error"></div></fieldset> <div class="sa-error-container"><div class="icon">!</div> <p>Not valid!</p></div> <button class="cancel" tabIndex="2">Cancel</button><button class="confirm" tabIndex="1">OK</button></div>',
199
206
  sweetWrap = document.createElement('div');
200
207
 
201
208
  sweetWrap.innerHTML = sweetHTML;
@@ -207,6 +214,7 @@
207
214
  };
208
215
 
209
216
 
217
+
210
218
  /*
211
219
  * Global sweetAlert function
212
220
  */
@@ -215,6 +223,10 @@
215
223
  sweetAlert = swal = function() {
216
224
  var customizations = arguments[0];
217
225
 
226
+ addClass(document.body, 'stop-scrolling');
227
+
228
+ resetInput();
229
+
218
230
  /*
219
231
  * Use argument if defined or default value from params object otherwise.
220
232
  * Supports the case where a default value is boolean true and should be
@@ -272,7 +284,8 @@
272
284
  'imageSize',
273
285
  'html',
274
286
  'animation',
275
- 'allowEscapeKey'];
287
+ 'allowEscapeKey',
288
+ 'inputType'];
276
289
 
277
290
  // It would be nice to just use .forEach here, but IE8... :(
278
291
  var numCustoms = availableCustoms.length;
@@ -309,27 +322,28 @@
309
322
  var e = event || window.event;
310
323
  var target = e.target || e.srcElement,
311
324
  targetedConfirm = (target.className.indexOf("confirm") !== -1),
325
+ targetedOverlay = (target.className.indexOf("sweet-overlay") !== -1),
312
326
  modalIsVisible = hasClass(modal, 'visible'),
313
327
  doneFunctionExists = (params.doneFunction && modal.getAttribute('data-has-done-function') === 'true');
314
328
 
315
329
  switch (e.type) {
316
330
  case ("mouseover"):
317
- if (targetedConfirm) {
331
+ if (targetedConfirm && params.confirmButtonColor) {
318
332
  target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
319
333
  }
320
334
  break;
321
335
  case ("mouseout"):
322
- if (targetedConfirm) {
336
+ if (targetedConfirm && params.confirmButtonColor) {
323
337
  target.style.backgroundColor = params.confirmButtonColor;
324
338
  }
325
339
  break;
326
340
  case ("mousedown"):
327
- if (targetedConfirm) {
341
+ if (targetedConfirm && params.confirmButtonColor) {
328
342
  target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.14);
329
343
  }
330
344
  break;
331
345
  case ("mouseup"):
332
- if (targetedConfirm) {
346
+ if (targetedConfirm && params.confirmButtonColor) {
333
347
  target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
334
348
  }
335
349
  break;
@@ -345,32 +359,47 @@
345
359
  break;
346
360
  case ("click"):
347
361
  if (targetedConfirm && doneFunctionExists && modalIsVisible) { // Clicked "confirm"
362
+ handleConfirm();
363
+ } else if ((doneFunctionExists && modalIsVisible) || targetedOverlay) { // Clicked "cancel"
364
+ handleCancel();
365
+ } else if (isDescendant(modal, target) && target.tagName === "BUTTON") {
366
+ sweetAlert.close();
367
+ }
368
+ break;
369
+ }
370
+ };
348
371
 
349
- params.doneFunction(true);
372
+ function handleConfirm() {
373
+ var callbackValue = true;
350
374
 
351
- if (params.closeOnConfirm) {
352
- sweetAlert.close();
353
- }
354
- } else if (doneFunctionExists && modalIsVisible) { // Clicked "cancel"
375
+ if (hasClass(modal, 'show-input')) {
376
+ callbackValue = modal.querySelector('input').value;
377
+
378
+ if (!callbackValue) {
379
+ callbackValue = "";
380
+ }
381
+ }
355
382
 
356
- // Check if callback function expects a parameter (to track cancel actions)
357
- var functionAsStr = String(params.doneFunction).replace(/\s/g, '');
358
- var functionHandlesCancel = functionAsStr.substring(0, 9) === "function(" && functionAsStr.substring(9, 10) !== ")";
383
+ params.doneFunction(callbackValue);
359
384
 
360
- if (functionHandlesCancel) {
361
- params.doneFunction(false);
362
- }
385
+ if (params.closeOnConfirm) {
386
+ sweetAlert.close();
387
+ }
388
+ }
363
389
 
364
- if (params.closeOnCancel) {
365
- sweetAlert.close();
366
- }
367
- } else {
368
- sweetAlert.close();
369
- }
390
+ function handleCancel() {
391
+ // Check if callback function expects a parameter (to track cancel actions)
392
+ var functionAsStr = String(params.doneFunction).replace(/\s/g, '');
393
+ var functionHandlesCancel = functionAsStr.substring(0, 9) === "function(" && functionAsStr.substring(9, 10) !== ")";
370
394
 
371
- break;
395
+ if (functionHandlesCancel) {
396
+ params.doneFunction(false);
372
397
  }
373
- };
398
+
399
+ if (params.closeOnCancel) {
400
+ sweetAlert.close();
401
+ }
402
+ }
374
403
 
375
404
  var $buttons = modal.querySelectorAll('button');
376
405
  for (var i = 0; i < $buttons.length; i++) {
@@ -378,25 +407,11 @@
378
407
  $buttons[i].onmouseover = onButtonEvent;
379
408
  $buttons[i].onmouseout = onButtonEvent;
380
409
  $buttons[i].onmousedown = onButtonEvent;
381
- //$buttons[i].onmouseup = onButtonEvent;
410
+ $buttons[i].onmouseup = onButtonEvent;
382
411
  $buttons[i].onfocus = onButtonEvent;
383
412
  }
384
413
 
385
- // Remember the current document.onclick event.
386
- previousDocumentClick = document.onclick;
387
- document.onclick = function(event) {
388
- var e = event || window.event;
389
- var target = e.target || e.srcElement;
390
-
391
- var clickedOnModal = (modal === target),
392
- clickedOnModalChild = isDescendant(modal, target),
393
- modalIsVisible = hasClass(modal, 'visible'),
394
- outsideClickIsAllowed = modal.getAttribute('data-allow-ouside-click') === 'true';
395
-
396
- if (!clickedOnModal && !clickedOnModalChild && modalIsVisible && outsideClickIsAllowed) {
397
- sweetAlert.close();
398
- }
399
- };
414
+ getOverlay().onclick = onButtonEvent;
400
415
 
401
416
 
402
417
  // Keyboard interactions
@@ -440,27 +455,32 @@
440
455
 
441
456
  stopEventPropagation(e);
442
457
  $targetElement.focus();
443
- setFocusStyle($targetElement, params.confirmButtonColor); // TODO
458
+
459
+ if (params.confirmButtonColor) {
460
+ setFocusStyle($targetElement, params.confirmButtonColor);
461
+ }
444
462
 
445
463
  } else {
446
- if (keyCode === 13 || keyCode === 32) {
447
- if (btnIndex === -1) {
448
- // ENTER/SPACE clicked outside of a button.
449
- $targetElement = $okButton;
450
- } else {
451
- // Do nothing - let the browser handle it.
452
- $targetElement = undefined;
453
- }
464
+ if (keyCode === 13) {
465
+ if ($targetElement.tagName === "INPUT") {
466
+ $targetElement = $okButton;
467
+ $okButton.focus();
468
+ }
469
+
470
+ if (btnIndex === -1) {
471
+ // ENTER/SPACE clicked outside of a button.
472
+ $targetElement = $okButton;
473
+ } else {
474
+ // Do nothing - let the browser handle it.
475
+ $targetElement = undefined;
476
+ }
454
477
  } else if (keyCode === 27 && params.allowEscapeKey === true) {
455
478
  $targetElement = $cancelButton;
479
+ fireClick($targetElement, e);
456
480
  } else {
457
481
  // Fallback - let the browser handle it.
458
482
  $targetElement = undefined;
459
483
  }
460
-
461
- if ($targetElement !== undefined) {
462
- fireClick($targetElement, e);
463
- }
464
484
  }
465
485
  }
466
486
 
@@ -468,37 +488,42 @@
468
488
 
469
489
  window.onkeydown = handleKeyDown;
470
490
 
471
- function handleOnBlur(event) {
472
- var e = event || window.event;
473
- var $targetElement = e.target || e.srcElement,
474
- $focusElement = e.relatedTarget,
475
- modalIsVisible = hasClass(modal, 'visible');
476
-
477
- if (modalIsVisible) {
478
- var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
479
-
480
- if ($focusElement !== null) {
481
- // If we picked something in the DOM to focus to, let's see if it was a button.
482
- for (var i = 0; i < $modalButtons.length; i++) {
483
- if ($focusElement === $modalButtons[i]) {
484
- btnIndex = i;
485
- break;
486
- }
487
- }
488
491
 
489
- if (btnIndex === -1) {
490
- // Something in the dom, but not a visible button. Focus back on the button.
491
- $targetElement.focus();
492
- }
493
- } else {
494
- // Exiting the DOM (e.g. clicked in the URL bar);
495
- lastFocusedButton = $targetElement;
496
- }
497
- }
498
- }
492
+ /*
493
+ * Makes stuff unselectable. Is it needed? -->
494
+ */
499
495
 
500
- $okButton.onblur = handleOnBlur;
501
- $cancelButton.onblur = handleOnBlur;
496
+ // function handleOnBlur(event) {
497
+ // var e = event || window.event;
498
+ // var $targetElement = e.target || e.srcElement,
499
+ // $focusElement = e.relatedTarget,
500
+ // modalIsVisible = hasClass(modal, 'visible');
501
+
502
+ // if (modalIsVisible) {
503
+ // var btnIndex = -1; // Find the button - note, this is a nodelist, not an array.
504
+
505
+ // if ($focusElement !== null) {
506
+ // // If we picked something in the DOM to focus to, let's see if it was a button.
507
+ // for (var i = 0; i < $modalButtons.length; i++) {
508
+ // if ($focusElement === $modalButtons[i]) {
509
+ // btnIndex = i;
510
+ // break;
511
+ // }
512
+ // }
513
+
514
+ // if (btnIndex === -1) {
515
+ // // Something in the dom, but not a visible button. Focus back on the button.
516
+ // $targetElement.focus();
517
+ // }
518
+ // } else {
519
+ // // Exiting the DOM (e.g. clicked in the URL bar);
520
+ // lastFocusedButton = $targetElement;
521
+ // }
522
+ // }
523
+ // }
524
+
525
+ // $okButton.onblur = handleOnBlur;
526
+ // $cancelButton.onblur = handleOnBlur;
502
527
 
503
528
  window.onfocus = function() {
504
529
  // When the user has focused away and focused back from the whole window.
@@ -577,25 +602,46 @@
577
602
  logStr('Unknown alert type: ' + params.type);
578
603
  return false;
579
604
  }
580
- var $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type);
581
- show($icon);
605
+
606
+ var typesWithIcons = ['success', 'error', 'warning', 'info'];
607
+ var $icon;
608
+
609
+ if (typesWithIcons.indexOf(params.type) !== -1) {
610
+ $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type);
611
+ show($icon);
612
+ }
613
+
614
+ var $input = getInput();
582
615
 
583
616
  // Animate icon
584
617
  switch (params.type) {
618
+
585
619
  case "success":
586
620
  addClass($icon, 'animate');
587
621
  addClass($icon.querySelector('.sa-tip'), 'animateSuccessTip');
588
622
  addClass($icon.querySelector('.sa-long'), 'animateSuccessLong');
589
623
  break;
624
+
590
625
  case "error":
591
626
  addClass($icon, 'animateErrorIcon');
592
627
  addClass($icon.querySelector('.sa-x-mark'), 'animateXMark');
593
628
  break;
629
+
594
630
  case "warning":
595
631
  addClass($icon, 'pulseWarning');
596
632
  addClass($icon.querySelector('.sa-body'), 'pulseWarningIns');
597
633
  addClass($icon.querySelector('.sa-dot'), 'pulseWarningIns');
598
634
  break;
635
+
636
+ case "input":
637
+ case "prompt":
638
+ $input.setAttribute('type', params.inputType);
639
+ addClass(modal, 'show-input');
640
+ setTimeout(function() {
641
+ $input.focus();
642
+ $input.addEventListener('keyup', swal.resetInputError);
643
+ }, 400);
644
+ break;
599
645
  }
600
646
  }
601
647
 
@@ -611,8 +657,8 @@
611
657
 
612
658
  if (params.imageSize) {
613
659
  var dimensions = params.imageSize.toString().split('x');
614
- var imgWidth = dimensions[0];
615
- var imgHeight = dimensions[1];
660
+ var imgWidth = dimensions[0];
661
+ var imgHeight = dimensions[1];
616
662
 
617
663
  if (!imgWidth || !imgHeight) {
618
664
  logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got " + params.imageSize);
@@ -648,11 +694,13 @@
648
694
  $confirmBtn.innerHTML = escapeHtml(params.confirmButtonText);
649
695
  }
650
696
 
651
- // Set confirm button to selected background color
652
- $confirmBtn.style.backgroundColor = params.confirmButtonColor;
697
+ if (params.confirmButtonColor) {
698
+ // Set confirm button to selected background color
699
+ $confirmBtn.style.backgroundColor = params.confirmButtonColor;
653
700
 
654
- // Set box-shadow to default focused button
655
- setFocusStyle($confirmBtn, params.confirmButtonColor);
701
+ // Set box-shadow to default focused button
702
+ setFocusStyle($confirmBtn, params.confirmButtonColor);
703
+ }
656
704
 
657
705
  // Allow outside click?
658
706
  modal.setAttribute('data-allow-ouside-click', params.allowOutsideClick);
@@ -661,10 +709,11 @@
661
709
  var hasDoneFunction = (params.doneFunction) ? true : false;
662
710
  modal.setAttribute('data-has-done-function', hasDoneFunction);
663
711
 
664
- // Prevent modal from animating
665
- if (!params.animation){
712
+ if (!params.animation) { // No animation
666
713
  modal.setAttribute('data-animation', 'none');
667
- } else{
714
+ } else if (typeof(params.animation) === "string") {
715
+ modal.setAttribute('data-animation', params.animation); // Custom animation
716
+ } else {
668
717
  modal.setAttribute('data-animation', 'pop');
669
718
  }
670
719
 
@@ -747,6 +796,7 @@
747
796
  // Aninmation when closing modal
748
797
  sweetAlert.close = swal.close = function() {
749
798
  var modal = getModal();
799
+
750
800
  fadeOut(getOverlay(), 5);
751
801
  fadeOut(modal, 5);
752
802
  removeClass(modal, 'showSweetAlert');
@@ -771,9 +821,10 @@
771
821
  removeClass($warningIcon.querySelector('.sa-dot'), 'pulseWarningIns');
772
822
 
773
823
 
824
+ removeClass(document.body, 'stop-scrolling');
825
+
774
826
  // Reset the page to its previous state
775
827
  window.onkeydown = previousWindowKeyDown;
776
- document.onclick = previousDocumentClick;
777
828
  if (previousActiveElement) {
778
829
  previousActiveElement.focus();
779
830
  }
@@ -782,6 +833,53 @@
782
833
  };
783
834
 
784
835
 
836
+ /*
837
+ * Validation of the input field is done by user
838
+ * If something is wrong => call showInputError with errorMessage
839
+ */
840
+
841
+ sweetAlert.showInputError = swal.showInputError = function(errorMessage) {
842
+ var modal = getModal();
843
+
844
+ var $errorIcon = modal.querySelector('.sa-input-error');
845
+ addClass($errorIcon, 'show');
846
+
847
+ var $errorContainer = modal.querySelector('.sa-error-container');
848
+ addClass($errorContainer, 'show');
849
+
850
+ $errorContainer.querySelector('p').innerHTML = errorMessage;
851
+
852
+ modal.querySelector('input').focus();
853
+ };
854
+
855
+ function resetInput() {
856
+ var $modal = getModal();
857
+ var $input = getInput();
858
+
859
+ removeClass($modal, 'show-input');
860
+ $input.value = "";
861
+ $input.setAttribute('type', defaultParams.inputType);
862
+
863
+ swal.resetInputError();
864
+ }
865
+
866
+ sweetAlert.resetInputError = swal.resetInputError = function(event) {
867
+ // If press enter => ignore
868
+ if (event && event.keyCode === 13) {
869
+ return false;
870
+ }
871
+
872
+ var $modal = getModal();
873
+
874
+ var $errorIcon = $modal.querySelector('.sa-input-error');
875
+ removeClass($errorIcon, 'show');
876
+
877
+ var $errorContainer = $modal.querySelector('.sa-error-container');
878
+ removeClass($errorContainer, 'show');
879
+ };
880
+
881
+
882
+
785
883
  /*
786
884
  * Set "margin-top"-property on modal based on its computed height
787
885
  */
@@ -808,12 +906,12 @@
808
906
  }
809
907
  }
810
908
 
811
- if (typeof define === 'function' && define.amd) {
812
- define(function() { return sweetAlert; });
813
- } else if (typeof module !== 'undefined' && module.exports) {
814
- module.exports = sweetAlert;
815
- } else if (typeof window !== 'undefined') {
816
- window.sweetAlert = window.swal = sweetAlert;
817
- }
909
+ if (typeof define === 'function' && define.amd) {
910
+ define(function() { return sweetAlert; });
911
+ } else if (typeof module !== 'undefined' && module.exports) {
912
+ module.exports = sweetAlert;
913
+ } else if (typeof window !== 'undefined') {
914
+ window.sweetAlert = window.swal = sweetAlert;
915
+ }
818
916
 
819
917
  })(window, document);
@@ -1 +1 @@
1
- .sweet-overlay{background-color:#000;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";background-color:rgba(0,0,0,.4);position:fixed;left:0;right:0;top:0;bottom:0;display:none;z-index:10000}.sweet-alert{background-color:#fff;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;width:478px;padding:17px;border-radius:5px;text-align:center;position:fixed;left:50%;top:50%;margin-left:-256px;margin-top:-200px;overflow:hidden;display:none;z-index:99999}@media all and (max-width:540px){.sweet-alert{width:auto;margin-left:0;margin-right:0;left:15px;right:15px}}.sweet-alert h2{color:#575757;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:25px 0;padding:0;line-height:40px;display:block}.sweet-alert p{color:#797979;font-size:16px;font-weight:300;position:relative;text-align:inherit;float:none;margin:0;padding:0;line-height:normal}.sweet-alert button{background-color:#AEDEF4;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}.sweet-alert button:focus{outline:0;box-shadow:0 0 2px rgba(128,179,235,.5),inset 0 0 0 1px rgba(0,0,0,.05)}.sweet-alert button:hover{background-color:#a1d9f2}.sweet-alert button:active{background-color:#81ccee}.sweet-alert button.cancel{background-color:#D0D0D0}.sweet-alert button.cancel:hover{background-color:#c8c8c8}.sweet-alert button.cancel:active{background-color:#b6b6b6}.sweet-alert button.cancel:focus{box-shadow:rgba(197,205,211,.8) 0 0 2px,rgba(0,0,0,.0470588) 0 0 0 1px inset!important}.sweet-alert button::-moz-focus-inner{border:0}.sweet-alert[data-has-cancel-button=false] button{box-shadow:none!important}.sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false]{padding-bottom:40px}.sweet-alert .sa-icon{width:80px;height:80px;border:4px solid gray;-webkit-border-radius:40px;border-radius:50%;margin:20px auto;padding:0;position:relative;box-sizing:content-box}.sweet-alert .sa-icon.sa-error{border-color:#F27474}.sweet-alert .sa-icon.sa-error .sa-x-mark{position:relative;display:block}.sweet-alert .sa-icon.sa-error .sa-line{position:absolute;height:5px;width:47px;background-color:#F27474;display:block;top:37px;border-radius:2px}.sweet-alert .sa-icon.sa-error .sa-line.sa-left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.sweet-alert .sa-icon.sa-error .sa-line.sa-right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.sweet-alert .sa-icon.sa-warning{border-color:#F8BB86}.sweet-alert .sa-icon.sa-warning .sa-body{position:absolute;width:5px;height:47px;left:50%;top:10px;-webkit-border-radius:2px;border-radius:2px;margin-left:-2px;background-color:#F8BB86}.sweet-alert .sa-icon.sa-warning .sa-dot{position:absolute;width:7px;height:7px;-webkit-border-radius:50%;border-radius:50%;margin-left:-3px;left:50%;bottom:10px;background-color:#F8BB86}.sweet-alert .sa-icon.sa-info{border-color:#C9DAE1}.sweet-alert .sa-icon.sa-info::before{content:"";position:absolute;width:5px;height:29px;left:50%;bottom:17px;border-radius:2px;margin-left:-2px;background-color:#C9DAE1}.sweet-alert .sa-icon.sa-info::after{content:"";position:absolute;width:7px;height:7px;border-radius:50%;margin-left:-3px;top:19px;background-color:#C9DAE1}.sweet-alert .sa-icon.sa-success{border-color:#A5DC86}.sweet-alert .sa-icon.sa-success::after,.sweet-alert .sa-icon.sa-success::before{content:'';position:absolute;width:60px;height:120px;background:#fff;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.sweet-alert .sa-icon.sa-success::before{-webkit-border-radius:120px 0 0 120px;border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.sweet-alert .sa-icon.sa-success::after{-webkit-border-radius:0 120px 120px 0;border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px}.sweet-alert .sa-icon.sa-success .sa-placeholder{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);-webkit-border-radius:40px;border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.sweet-alert .sa-icon.sa-success .sa-fix{width:5px;height:90px;background-color:#fff;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.sweet-alert .sa-icon.sa-success .sa-line{height:5px;background-color:#A5DC86;display:block;border-radius:2px;position:absolute;z-index:2}.sweet-alert .sa-icon.sa-success .sa-line.sa-tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.sweet-alert .sa-icon.sa-success .sa-line.sa-long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.sweet-alert .sa-icon.sa-custom{background-size:contain;border-radius:0;border:none;background-position:center center;background-repeat:no-repeat}@-webkit-keyframes showSweetAlert{0%{transform:scale(.7);-webkit-transform:scale(.7)}45%{transform:scale(1.05);-webkit-transform:scale(1.05)}80%{transform:scale(.95);-webkit-tranform:scale(.95)}100%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes showSweetAlert{0%{transform:scale(.7);-webkit-transform:scale(.7)}45%{transform:scale(1.05);-webkit-transform:scale(1.05)}80%{transform:scale(.95);-webkit-tranform:scale(.95)}100%{transform:scale(1);-webkit-transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{transform:scale(1);-webkit-transform:scale(1)}100%{transform:scale(.5);-webkit-transform:scale(.5)}}@keyframes hideSweetAlert{0%{transform:scale(1);-webkit-transform:scale(1)}100%{transform:scale(.5);-webkit-transform:scale(.5)}}.showSweetAlert{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.showSweetAlert[data-animation=none]{-webkit-animation:none;animation:none}.hideSweetAlert{-webkit-animation:hideSweetAlert .2s;animation:hideSweetAlert .2s}.hideSweetAlert[data-animation=none]{-webkit-animation:none;animation:none}@-webkit-keyframes animateSuccessTip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animateSuccessTip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animateSuccessLong{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animateSuccessLong{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}100%,12%{transform:rotate(-405deg);-webkit-transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}100%,12%{transform:rotate(-405deg);-webkit-transform:rotate(-405deg)}}.animateSuccessTip{-webkit-animation:animateSuccessTip .75s;animation:animateSuccessTip .75s}.animateSuccessLong{-webkit-animation:animateSuccessLong .75s;animation:animateSuccessLong .75s}.sa-icon.sa-success.animate::after{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animateErrorIcon{0%{transform:rotateX(100deg);-webkit-transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);-webkit-transform:rotateX(0deg);opacity:1}}@keyframes animateErrorIcon{0%{transform:rotateX(100deg);-webkit-transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);-webkit-transform:rotateX(0deg);opacity:1}}.animateErrorIcon{-webkit-animation:animateErrorIcon .5s;animation:animateErrorIcon .5s}@-webkit-keyframes animateXMark{0%,50%{transform:scale(.4);-webkit-transform:scale(.4);margin-top:26px;opacity:0}80%{transform:scale(1.15);-webkit-transform:scale(1.15);margin-top:-6px}100%{transform:scale(1);-webkit-transform:scale(1);margin-top:0;opacity:1}}@keyframes animateXMark{0%,50%{transform:scale(.4);-webkit-transform:scale(.4);margin-top:26px;opacity:0}80%{transform:scale(1.15);-webkit-transform:scale(1.15);margin-top:-6px}100%{transform:scale(1);-webkit-transform:scale(1);margin-top:0;opacity:1}}.animateXMark{-webkit-animation:animateXMark .5s;animation:animateXMark .5s}@-webkit-keyframes pulseWarning{0%{border-color:#F8D486}100%{border-color:#F8BB86}}@keyframes pulseWarning{0%{border-color:#F8D486}100%{border-color:#F8BB86}}.pulseWarning{-webkit-animation:pulseWarning .75s infinite alternate;animation:pulseWarning .75s infinite alternate}@-webkit-keyframes pulseWarningIns{0%{background-color:#F8D486}100%{background-color:#F8BB86}}@keyframes pulseWarningIns{0%{background-color:#F8D486}100%{background-color:#F8BB86}}.pulseWarningIns{-webkit-animation:pulseWarningIns .75s infinite alternate;animation:pulseWarningIns .75s infinite alternate}
1
+ body.stop-scrolling{height:100%;overflow:hidden}.sweet-overlay{background-color:#000;-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=40)";background-color:rgba(0,0,0,.4);position:fixed;left:0;right:0;top:0;bottom:0;display:none;z-index:10000}.sweet-alert{background-color:#fff;font-family:'Open Sans','Helvetica Neue',Helvetica,Arial,sans-serif;width:478px;padding:17px;border-radius:5px;text-align:center;position:fixed;left:50%;top:50%;margin-left:-256px;margin-top:-200px;overflow:hidden;display:none;z-index:99999}@media all and (max-width:540px){.sweet-alert{width:auto;margin-left:0;margin-right:0;left:15px;right:15px}}.sweet-alert h2{color:#575757;font-size:30px;text-align:center;font-weight:600;text-transform:none;position:relative;margin:25px 0;padding:0;line-height:40px;display:block}.sweet-alert p{color:#797979;font-size:16px;font-weight:300;position:relative;text-align:inherit;float:none;margin:0;padding:0;line-height:normal}.sweet-alert fieldset{border:none;position:relative}.sweet-alert .sa-error-container{background-color:#f1f1f1;margin-left:-17px;margin-right:-17px;overflow:hidden;padding:0 10px;max-height:0;webkit-transition:padding .15s,max-height .15s;transition:padding .15s,max-height .15s}.sweet-alert .sa-error-container.show{padding:10px 0;max-height:100px;webkit-transition:padding .2s,max-height .2s;transition:padding .25s,max-height .25s}.sweet-alert .sa-error-container .icon{display:inline-block;width:24px;height:24px;border-radius:50%;background-color:#ea7d7d;color:#fff;line-height:24px;text-align:center;margin-right:3px}.sweet-alert .sa-error-container p{display:inline-block}.sweet-alert .sa-input-error{position:absolute;top:29px;right:26px;width:20px;height:20px;opacity:0;-webkit-transform:scale(.5);transform:scale(.5);-webkit-transform-origin:50% 50%;transform-origin:50% 50%;-webkit-transition:all .1s;transition:all .1s}.sweet-alert .sa-input-error::after,.sweet-alert .sa-input-error::before{content:"";width:20px;height:6px;background-color:#f06e57;border-radius:3px;position:absolute;top:50%;margin-top:-4px;left:50%;margin-left:-9px}.sweet-alert .sa-input-error::before{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.sweet-alert .sa-input-error::after{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.sweet-alert .sa-input-error.show{opacity:1;-webkit-transform:scale(1);transform:scale(1)}.sweet-alert input{width:100%;box-sizing:border-box;border-radius:3px;border:1px solid #d7d7d7;height:43px;margin-top:10px;margin-bottom:17px;font-size:18px;box-shadow:inset 0 1px 1px rgba(0,0,0,.06);padding:0 12px;display:none;-webkit-transition:all .3s;transition:all .3s}.sweet-alert input:focus{outline:0;box-shadow:0 0 3px #c4e6f5;border:1px solid #b4dbed}.sweet-alert.show-input input{display:block}.sweet-alert button{background-color:#AEDEF4;color:#fff;border:none;box-shadow:none;font-size:17px;font-weight:500;-webkit-border-radius:4px;border-radius:5px;padding:10px 32px;margin:26px 5px 0;cursor:pointer}.sweet-alert button:focus{outline:0;box-shadow:0 0 2px rgba(128,179,235,.5),inset 0 0 0 1px rgba(0,0,0,.05)}.sweet-alert button:hover{background-color:#a1d9f2}.sweet-alert button:active{background-color:#81ccee}.sweet-alert button.cancel{background-color:#D0D0D0}.sweet-alert button.cancel:hover{background-color:#c8c8c8}.sweet-alert button.cancel:active{background-color:#b6b6b6}.sweet-alert button.cancel:focus{box-shadow:rgba(197,205,211,.8) 0 0 2px,rgba(0,0,0,.0470588) 0 0 0 1px inset!important}.sweet-alert button::-moz-focus-inner{border:0}.sweet-alert[data-has-cancel-button=false] button{box-shadow:none!important}.sweet-alert[data-has-confirm-button=false][data-has-cancel-button=false]{padding-bottom:40px}.sweet-alert .sa-icon{width:80px;height:80px;border:4px solid gray;-webkit-border-radius:40px;border-radius:50%;margin:20px auto;padding:0;position:relative;box-sizing:content-box}.sweet-alert .sa-icon.sa-error{border-color:#F27474}.sweet-alert .sa-icon.sa-error .sa-x-mark{position:relative;display:block}.sweet-alert .sa-icon.sa-error .sa-line{position:absolute;height:5px;width:47px;background-color:#F27474;display:block;top:37px;border-radius:2px}.sweet-alert .sa-icon.sa-error .sa-line.sa-left{-webkit-transform:rotate(45deg);transform:rotate(45deg);left:17px}.sweet-alert .sa-icon.sa-error .sa-line.sa-right{-webkit-transform:rotate(-45deg);transform:rotate(-45deg);right:16px}.sweet-alert .sa-icon.sa-warning{border-color:#F8BB86}.sweet-alert .sa-icon.sa-warning .sa-body{position:absolute;width:5px;height:47px;left:50%;top:10px;-webkit-border-radius:2px;border-radius:2px;margin-left:-2px;background-color:#F8BB86}.sweet-alert .sa-icon.sa-warning .sa-dot{position:absolute;width:7px;height:7px;-webkit-border-radius:50%;border-radius:50%;margin-left:-3px;left:50%;bottom:10px;background-color:#F8BB86}.sweet-alert .sa-icon.sa-info{border-color:#C9DAE1}.sweet-alert .sa-icon.sa-info::before{content:"";position:absolute;width:5px;height:29px;left:50%;bottom:17px;border-radius:2px;margin-left:-2px;background-color:#C9DAE1}.sweet-alert .sa-icon.sa-info::after{content:"";position:absolute;width:7px;height:7px;border-radius:50%;margin-left:-3px;top:19px;background-color:#C9DAE1}.sweet-alert .sa-icon.sa-success{border-color:#A5DC86}.sweet-alert .sa-icon.sa-success::after,.sweet-alert .sa-icon.sa-success::before{content:'';position:absolute;width:60px;height:120px;background:#fff;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.sweet-alert .sa-icon.sa-success::before{-webkit-border-radius:120px 0 0 120px;border-radius:120px 0 0 120px;top:-7px;left:-33px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:60px 60px;transform-origin:60px 60px}.sweet-alert .sa-icon.sa-success::after{-webkit-border-radius:0 120px 120px 0;border-radius:0 120px 120px 0;top:-11px;left:30px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg);-webkit-transform-origin:0 60px;transform-origin:0 60px}.sweet-alert .sa-icon.sa-success .sa-placeholder{width:80px;height:80px;border:4px solid rgba(165,220,134,.2);-webkit-border-radius:40px;border-radius:50%;box-sizing:content-box;position:absolute;left:-4px;top:-4px;z-index:2}.sweet-alert .sa-icon.sa-success .sa-fix{width:5px;height:90px;background-color:#fff;position:absolute;left:28px;top:8px;z-index:1;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.sweet-alert .sa-icon.sa-success .sa-line{height:5px;background-color:#A5DC86;display:block;border-radius:2px;position:absolute;z-index:2}.sweet-alert .sa-icon.sa-success .sa-line.sa-tip{width:25px;left:14px;top:46px;-webkit-transform:rotate(45deg);transform:rotate(45deg)}.sweet-alert .sa-icon.sa-success .sa-line.sa-long{width:47px;right:8px;top:38px;-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.sweet-alert .sa-icon.sa-custom{background-size:contain;border-radius:0;border:none;background-position:center center;background-repeat:no-repeat}@-webkit-keyframes showSweetAlert{0%{transform:scale(.7);-webkit-transform:scale(.7)}45%{transform:scale(1.05);-webkit-transform:scale(1.05)}80%{transform:scale(.95);-webkit-transform:scale(.95)}100%{transform:scale(1);-webkit-transform:scale(1)}}@keyframes showSweetAlert{0%{transform:scale(.7);-webkit-transform:scale(.7)}45%{transform:scale(1.05);-webkit-transform:scale(1.05)}80%{transform:scale(.95);-webkit-transform:scale(.95)}100%{transform:scale(1);-webkit-transform:scale(1)}}@-webkit-keyframes hideSweetAlert{0%{transform:scale(1);-webkit-transform:scale(1)}100%{transform:scale(.5);-webkit-transform:scale(.5)}}@keyframes hideSweetAlert{0%{transform:scale(1);-webkit-transform:scale(1)}100%{transform:scale(.5);-webkit-transform:scale(.5)}}@-webkit-keyframes slideFromTop{0%{top:0}100%{top:50%}}@keyframes slideFromTop{0%{top:0}100%{top:50%}}@-webkit-keyframes slideToTop{0%{top:50%}100%{top:0}}@keyframes slideToTop{0%{top:50%}100%{top:0}}@-webkit-keyframes slideFromBottom{0%{top:70%}100%{top:50%}}@keyframes slideFromBottom{0%{top:70%}100%{top:50%}}@-webkit-keyframes slideToBottom{0%{top:50%}100%{top:70%}}@keyframes slideToBottom{0%{top:50%}100%{top:70%}}.showSweetAlert[data-animation=pop]{-webkit-animation:showSweetAlert .3s;animation:showSweetAlert .3s}.showSweetAlert[data-animation=none]{-webkit-animation:none;animation:none}.showSweetAlert[data-animation=slide-from-top]{-webkit-animation:slideFromTop .3s;animation:slideFromTop .3s}.showSweetAlert[data-animation=slide-from-bottom]{-webkit-animation:slideFromBottom .3s;animation:slideFromBottom .3s}.hideSweetAlert[data-animation=pop]{-webkit-animation:hideSweetAlert .2s;animation:hideSweetAlert .2s}.hideSweetAlert[data-animation=none]{-webkit-animation:none;animation:none}.hideSweetAlert[data-animation=slide-from-top]{-webkit-animation:slideToTop .4s;animation:slideToTop .4s}.hideSweetAlert[data-animation=slide-from-bottom]{-webkit-animation:slideToBottom .3s;animation:slideToBottom .3s}@-webkit-keyframes animateSuccessTip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@keyframes animateSuccessTip{0%,54%{width:0;left:1px;top:19px}70%{width:50px;left:-8px;top:37px}84%{width:17px;left:21px;top:48px}100%{width:25px;left:14px;top:45px}}@-webkit-keyframes animateSuccessLong{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@keyframes animateSuccessLong{0%,65%{width:0;right:46px;top:54px}84%{width:55px;right:0;top:35px}100%{width:47px;right:8px;top:38px}}@-webkit-keyframes rotatePlaceholder{0%,5%{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}100%,12%{transform:rotate(-405deg);-webkit-transform:rotate(-405deg)}}@keyframes rotatePlaceholder{0%,5%{transform:rotate(-45deg);-webkit-transform:rotate(-45deg)}100%,12%{transform:rotate(-405deg);-webkit-transform:rotate(-405deg)}}.animateSuccessTip{-webkit-animation:animateSuccessTip .75s;animation:animateSuccessTip .75s}.animateSuccessLong{-webkit-animation:animateSuccessLong .75s;animation:animateSuccessLong .75s}.sa-icon.sa-success.animate::after{-webkit-animation:rotatePlaceholder 4.25s ease-in;animation:rotatePlaceholder 4.25s ease-in}@-webkit-keyframes animateErrorIcon{0%{transform:rotateX(100deg);-webkit-transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);-webkit-transform:rotateX(0deg);opacity:1}}@keyframes animateErrorIcon{0%{transform:rotateX(100deg);-webkit-transform:rotateX(100deg);opacity:0}100%{transform:rotateX(0deg);-webkit-transform:rotateX(0deg);opacity:1}}.animateErrorIcon{-webkit-animation:animateErrorIcon .5s;animation:animateErrorIcon .5s}@-webkit-keyframes animateXMark{0%,50%{transform:scale(.4);-webkit-transform:scale(.4);margin-top:26px;opacity:0}80%{transform:scale(1.15);-webkit-transform:scale(1.15);margin-top:-6px}100%{transform:scale(1);-webkit-transform:scale(1);margin-top:0;opacity:1}}@keyframes animateXMark{0%,50%{transform:scale(.4);-webkit-transform:scale(.4);margin-top:26px;opacity:0}80%{transform:scale(1.15);-webkit-transform:scale(1.15);margin-top:-6px}100%{transform:scale(1);-webkit-transform:scale(1);margin-top:0;opacity:1}}.animateXMark{-webkit-animation:animateXMark .5s;animation:animateXMark .5s}@-webkit-keyframes pulseWarning{0%{border-color:#F8D486}100%{border-color:#F8BB86}}@keyframes pulseWarning{0%{border-color:#F8D486}100%{border-color:#F8BB86}}.pulseWarning{-webkit-animation:pulseWarning .75s infinite alternate;animation:pulseWarning .75s infinite alternate}@-webkit-keyframes pulseWarningIns{0%{background-color:#F8D486}100%{background-color:#F8BB86}}@keyframes pulseWarningIns{0%{background-color:#F8D486}100%{background-color:#F8BB86}}.pulseWarningIns{-webkit-animation:pulseWarningIns .75s infinite alternate;animation:pulseWarningIns .75s infinite alternate}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweetalert-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Sharshenov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-11 00:00:00.000000000 Z
11
+ date: 2015-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties