sweetalert-rails 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 362b640331014d286a6603db2e48dd50651ea6b6
4
- data.tar.gz: c087c7c72fdef39b9d26f7700aef3074866b0e03
3
+ metadata.gz: bedb3cb7dea956573e5ebabf0fc76e57ff76ecdf
4
+ data.tar.gz: 77020c476a8083b6bf7f01a2f6671e0f30b81b2d
5
5
  SHA512:
6
- metadata.gz: fb16b284129c82c97162d2a145bead79d3cb3965ed44cb0f13cf6b01cf1ba4d692aa4304a54543707beca0b61fcb07626712f1e1fff804dec5ead0e918cebb87
7
- data.tar.gz: 0550f808081e336889335fab36dce0497cbefb532dcb08dfb29c48c3642c4f9d5fd14c06bac04b50a7a48ef8bb7658c9e648efb421ab7d11240f44c47595d1ad
6
+ metadata.gz: 6d7f168a2bcae6ca2bcb724243798a778b69a53d53e55230d64e6726256828cf329f9ac8606b2b4fe5c638bfe86dc98f36bfdd1c437adf96d946f67307782bea
7
+ data.tar.gz: 815827fec644094a29685d816c4e13b7626e4dc9d833fa292ff2bda81186fd7c01505194492b6e5d3b167b3871075a58619c92483776f850290b203dd570c15e
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # SweetAlert RubyOnRails integration gem
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/sweetalert-rails.svg)](http://badge.fury.io/rb/sweetalert-rails)
4
+
3
5
  Use [SweetAlert](http://tristanedwards.me/sweetalert) with Rails 3.1+
4
6
 
5
7
  ## Installation
@@ -1,3 +1,3 @@
1
1
  module SweetAlert
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -11,6 +11,7 @@
11
11
  text: '',
12
12
  type: null,
13
13
  allowOutsideClick: false,
14
+ showConfirmButton: true,
14
15
  showCancelButton: false,
15
16
  closeOnConfirm: true,
16
17
  closeOnCancel: true,
@@ -32,7 +33,14 @@
32
33
  */
33
34
 
34
35
  var getModal = function() {
35
- return document.querySelector(modalClass);
36
+ var $modal = document.querySelector(modalClass);
37
+
38
+ if (!$modal) {
39
+ sweetAlertInitialize();
40
+ $modal = getModal();
41
+ }
42
+
43
+ return $modal;
36
44
  },
37
45
  getOverlay = function() {
38
46
  return document.querySelector(overlayClass);
@@ -146,7 +154,7 @@
146
154
  fireClick = function(node) {
147
155
  // Taken from http://www.nonobtrusive.com/2011/11/29/programatically-fire-crossbrowser-click-event-with-javascript/
148
156
  // Then fixed for today's Chrome browser.
149
- if (MouseEvent) {
157
+ if (typeof MouseEvent === 'function') {
150
158
  // Up-to-date approach
151
159
  var mevt = new MouseEvent('click', {
152
160
  view: window,
@@ -186,14 +194,14 @@
186
194
  * Add modal + overlay to DOM
187
195
  */
188
196
 
189
- window.sweetAlertInitialize = function() {
190
- var sweetHTML = '<div class="sweet-overlay" tabIndex="-1"></div><div class="sweet-alert" tabIndex="-1"><div class="icon error"><span class="x-mark"><span class="line left"></span><span class="line right"></span></span></div><div class="icon warning"> <span class="body"></span> <span class="dot"></span> </div> <div class="icon info"></div> <div class="icon success"> <span class="line tip"></span> <span class="line long"></span> <div class="placeholder"></div> <div class="fix"></div> </div> <div class="icon custom"></div> <h2>Title</h2><p>Text</p><button class="cancel" tabIndex="2">Cancel</button><button class="confirm" tabIndex="1">OK</button></div>',
197
+ 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>',
191
199
  sweetWrap = document.createElement('div');
192
200
 
193
201
  sweetWrap.innerHTML = sweetHTML;
194
202
 
195
203
  // Append elements to body
196
- while(sweetWrap.firstChild) {
204
+ while (sweetWrap.firstChild) {
197
205
  document.body.appendChild(sweetWrap.firstChild);
198
206
  }
199
207
  };
@@ -202,28 +210,11 @@
202
210
  /*
203
211
  * Global sweetAlert function
204
212
  */
205
-
206
- window.sweetAlert = window.swal = function() {
207
- // Copy arguments to the local args variable
208
- var args = arguments;
209
- if (getModal() !== null) {
210
- // If getModal returns values then continue
211
- modalDependant.apply(this, args);
212
- } else {
213
- // If getModal returns null i.e. no matches, then set up a interval event to check the return value until it is not null
214
- var modalCheckInterval = setInterval(function() {
215
- if (getModal() !== null) {
216
- clearInterval(modalCheckInterval);
217
- modalDependant.apply(this, args);
218
- }
219
- }, 100);
220
- }
221
- };
222
-
223
- function modalDependant() {
224
-
213
+ var sweetAlert, swal;
214
+
215
+ sweetAlert = swal = function() {
225
216
  var customizations = arguments[0];
226
-
217
+
227
218
  /*
228
219
  * Use argument if defined or default value from params object otherwise.
229
220
  * Supports the case where a default value is boolean true and should be
@@ -233,16 +224,14 @@
233
224
  var args = customizations;
234
225
 
235
226
  if (typeof args[key] !== 'undefined') {
236
- console.log(key + " is " + args[key]);
237
227
  return args[key];
238
228
  } else {
239
- console.log(key + " is " + defaultParams[key]);
240
229
  return defaultParams[key];
241
230
  }
242
231
  }
243
232
 
244
233
  if (arguments[0] === undefined) {
245
- window.console.error('SweetAlert expects at least 1 attribute!');
234
+ logStr('SweetAlert expects at least 1 attribute!');
246
235
  return false;
247
236
  }
248
237
 
@@ -261,21 +250,22 @@
261
250
  // Ex: swal({title:"Hello", text: "Just testing", type: "info"});
262
251
  case 'object':
263
252
  if (arguments[0].title === undefined) {
264
- window.console.error('Missing "title" argument!');
253
+ logStr('Missing "title" argument!');
265
254
  return false;
266
255
  }
267
256
 
268
257
  params.title = arguments[0].title;
269
258
 
270
259
  var availableCustoms = [
271
- 'text',
272
- 'type',
273
- 'customClass',
274
- 'allowOutsideClick',
275
- 'showCancelButton',
276
- 'closeOnConfirm',
277
- 'closeOnCancel',
278
- 'timer',
260
+ 'text',
261
+ 'type',
262
+ 'customClass',
263
+ 'allowOutsideClick',
264
+ 'showConfirmButton',
265
+ 'showCancelButton',
266
+ 'closeOnConfirm',
267
+ 'closeOnCancel',
268
+ 'timer',
279
269
  'confirmButtonColor',
280
270
  'cancelButtonText',
281
271
  'imageUrl',
@@ -284,9 +274,12 @@
284
274
  'animation',
285
275
  'allowEscapeKey'];
286
276
 
287
- availableCustoms.forEach(function(customName) {
277
+ // It would be nice to just use .forEach here, but IE8... :(
278
+ var numCustoms = availableCustoms.length;
279
+ for (var customIndex = 0; customIndex < numCustoms; customIndex++) {
280
+ var customName = availableCustoms[customIndex];
288
281
  params[customName] = argumentOrDefault(customName);
289
- });
282
+ }
290
283
 
291
284
  // Show "Confirm" instead of "OK" if cancel button is visible
292
285
  params.confirmButtonText = (params.showCancelButton) ? 'Confirm' : defaultParams.confirmButtonText;
@@ -294,11 +287,11 @@
294
287
 
295
288
  // Function to call when clicking on cancel/OK
296
289
  params.doneFunction = arguments[1] || null;
297
-
290
+
298
291
  break;
299
292
 
300
293
  default:
301
- window.console.error('Unexpected type of argument! Expected "string" or "object", got ' + typeof arguments[0]);
294
+ logStr('Unexpected type of argument! Expected "string" or "object", got ' + typeof arguments[0]);
302
295
  return false;
303
296
 
304
297
  }
@@ -356,7 +349,7 @@
356
349
  params.doneFunction(true);
357
350
 
358
351
  if (params.closeOnConfirm) {
359
- window.sweetAlert.close();
352
+ sweetAlert.close();
360
353
  }
361
354
  } else if (doneFunctionExists && modalIsVisible) { // Clicked "cancel"
362
355
 
@@ -369,10 +362,10 @@
369
362
  }
370
363
 
371
364
  if (params.closeOnCancel) {
372
- window.sweetAlert.close();
365
+ sweetAlert.close();
373
366
  }
374
367
  } else {
375
- window.sweetAlert.close();
368
+ sweetAlert.close();
376
369
  }
377
370
 
378
371
  break;
@@ -401,7 +394,7 @@
401
394
  outsideClickIsAllowed = modal.getAttribute('data-allow-ouside-click') === 'true';
402
395
 
403
396
  if (!clickedOnModal && !clickedOnModalChild && modalIsVisible && outsideClickIsAllowed) {
404
- window.sweetAlert.close();
397
+ sweetAlert.close();
405
398
  }
406
399
  };
407
400
 
@@ -409,7 +402,7 @@
409
402
  // Keyboard interactions
410
403
  var $okButton = modal.querySelector('button.confirm'),
411
404
  $cancelButton = modal.querySelector('button.cancel'),
412
- $modalButtons = modal.querySelectorAll('button:not([type=hidden])');
405
+ $modalButtons = modal.querySelectorAll('button[tabindex]');
413
406
 
414
407
 
415
408
  function handleKeyDown(event) {
@@ -518,14 +511,14 @@
518
511
  }
519
512
  }, 0);
520
513
  };
521
- }
514
+ };
522
515
 
523
516
 
524
517
  /*
525
518
  * Set default params for each popup
526
519
  * @param {Object} userParams
527
520
  */
528
- window.sweetAlert.setDefaults = window.swal.setDefaults = function(userParams) {
521
+ sweetAlert.setDefaults = swal.setDefaults = function(userParams) {
529
522
  if (!userParams) {
530
523
  throw new Error('userParams is required');
531
524
  }
@@ -554,7 +547,7 @@
554
547
 
555
548
  // Text
556
549
  $text.innerHTML = (params.html) ? params.text : escapeHtml(params.text || '').split("\n").join("<br>");
557
-
550
+
558
551
  if (params.text) {
559
552
  show($text);
560
553
  }
@@ -571,8 +564,8 @@
571
564
  }
572
565
 
573
566
  // Icon
574
- hide(modal.querySelectorAll('.icon'));
575
- if (params.type) {
567
+ hide(modal.querySelectorAll('.sa-icon'));
568
+ if (params.type && !isIE8()) {
576
569
  var validType = false;
577
570
  for (var i = 0; i < alertTypes.length; i++) {
578
571
  if (params.type === alertTypes[i]) {
@@ -581,35 +574,34 @@
581
574
  }
582
575
  }
583
576
  if (!validType) {
584
- window.console.error('Unknown alert type: ' + params.type);
577
+ logStr('Unknown alert type: ' + params.type);
585
578
  return false;
586
579
  }
587
- var $icon = modal.querySelector('.icon.' + params.type);
580
+ var $icon = modal.querySelector('.sa-icon.' + 'sa-' + params.type);
588
581
  show($icon);
589
582
 
590
583
  // Animate icon
591
584
  switch (params.type) {
592
585
  case "success":
593
586
  addClass($icon, 'animate');
594
- addClass($icon.querySelector('.tip'), 'animateSuccessTip');
595
- addClass($icon.querySelector('.long'), 'animateSuccessLong');
587
+ addClass($icon.querySelector('.sa-tip'), 'animateSuccessTip');
588
+ addClass($icon.querySelector('.sa-long'), 'animateSuccessLong');
596
589
  break;
597
590
  case "error":
598
591
  addClass($icon, 'animateErrorIcon');
599
- addClass($icon.querySelector('.x-mark'), 'animateXMark');
592
+ addClass($icon.querySelector('.sa-x-mark'), 'animateXMark');
600
593
  break;
601
594
  case "warning":
602
595
  addClass($icon, 'pulseWarning');
603
- addClass($icon.querySelector('.body'), 'pulseWarningIns');
604
- addClass($icon.querySelector('.dot'), 'pulseWarningIns');
596
+ addClass($icon.querySelector('.sa-body'), 'pulseWarningIns');
597
+ addClass($icon.querySelector('.sa-dot'), 'pulseWarningIns');
605
598
  break;
606
599
  }
607
-
608
600
  }
609
601
 
610
602
  // Custom image
611
603
  if (params.imageUrl) {
612
- var $customIcon = modal.querySelector('.icon.custom');
604
+ var $customIcon = modal.querySelector('.sa-icon.sa-custom');
613
605
 
614
606
  $customIcon.style.backgroundImage = 'url(' + params.imageUrl + ')';
615
607
  show($customIcon);
@@ -618,25 +610,21 @@
618
610
  _imgHeight = 80;
619
611
 
620
612
  if (params.imageSize) {
621
- var imgWidth = params.imageSize.split('x')[0];
622
- var imgHeight = params.imageSize.split('x')[1];
613
+ var dimensions = params.imageSize.toString().split('x');
614
+ var imgWidth = dimensions[0];
615
+ var imgHeight = dimensions[1];
623
616
 
624
617
  if (!imgWidth || !imgHeight) {
625
- window.console.error("Parameter imageSize expects value with format WIDTHxHEIGHT, got " + params.imageSize);
618
+ logStr("Parameter imageSize expects value with format WIDTHxHEIGHT, got " + params.imageSize);
626
619
  } else {
627
620
  _imgWidth = imgWidth;
628
621
  _imgHeight = imgHeight;
629
-
630
- $customIcon.css({
631
- 'width': imgWidth + 'px',
632
- 'height': imgHeight + 'px'
633
- });
634
622
  }
635
623
  }
636
624
  $customIcon.setAttribute('style', $customIcon.getAttribute('style') + 'width:' + _imgWidth + 'px; height:' + _imgHeight + 'px');
637
625
  }
638
626
 
639
- // Cancel button
627
+ // Show cancel button?
640
628
  modal.setAttribute('data-has-cancel-button', params.showCancelButton);
641
629
  if (params.showCancelButton) {
642
630
  $cancelBtn.style.display = 'inline-block';
@@ -644,6 +632,14 @@
644
632
  hide($cancelBtn);
645
633
  }
646
634
 
635
+ // Show confirm button?
636
+ modal.setAttribute('data-has-confirm-button', params.showConfirmButton);
637
+ if (params.showConfirmButton) {
638
+ $confirmBtn.style.display = 'inline-block';
639
+ } else {
640
+ hide($confirmBtn);
641
+ }
642
+
647
643
  // Edit text on cancel and confirm buttons
648
644
  if (params.cancelButtonText) {
649
645
  $cancelBtn.innerHTML = escapeHtml(params.cancelButtonText);
@@ -722,11 +718,7 @@
722
718
  }
723
719
 
724
720
 
725
-
726
- /*
727
- * Animations
728
- */
729
-
721
+ // Animation when opening modal
730
722
  function openModal() {
731
723
  var modal = getModal();
732
724
  fadeIn(getOverlay(), 10);
@@ -746,17 +738,14 @@
746
738
 
747
739
  if (timer !== "null" && timer !== "") {
748
740
  modal.timeout = setTimeout(function() {
749
- window.sweetAlert.close();
741
+ sweetAlert.close();
750
742
  }, timer);
751
743
  }
752
744
  }
753
745
 
754
746
 
755
- /*
756
- * Close sweetAlert modal programatically
757
- */
758
-
759
- window.sweetAlert.close = window.swal.close = function() {
747
+ // Aninmation when closing modal
748
+ sweetAlert.close = swal.close = function() {
760
749
  var modal = getModal();
761
750
  fadeOut(getOverlay(), 5);
762
751
  fadeOut(modal, 5);
@@ -767,19 +756,19 @@
767
756
 
768
757
  // Reset icon animations
769
758
 
770
- var $successIcon = modal.querySelector('.icon.success');
759
+ var $successIcon = modal.querySelector('.sa-icon.sa-success');
771
760
  removeClass($successIcon, 'animate');
772
- removeClass($successIcon.querySelector('.tip'), 'animateSuccessTip');
773
- removeClass($successIcon.querySelector('.long'), 'animateSuccessLong');
761
+ removeClass($successIcon.querySelector('.sa-tip'), 'animateSuccessTip');
762
+ removeClass($successIcon.querySelector('.sa-long'), 'animateSuccessLong');
774
763
 
775
- var $errorIcon = modal.querySelector('.icon.error');
764
+ var $errorIcon = modal.querySelector('.sa-icon.sa-error');
776
765
  removeClass($errorIcon, 'animateErrorIcon');
777
- removeClass($errorIcon.querySelector('.x-mark'), 'animateXMark');
766
+ removeClass($errorIcon.querySelector('.sa-x-mark'), 'animateXMark');
778
767
 
779
- var $warningIcon = modal.querySelector('.icon.warning');
768
+ var $warningIcon = modal.querySelector('.sa-icon.sa-warning');
780
769
  removeClass($warningIcon, 'pulseWarning');
781
- removeClass($warningIcon.querySelector('.body'), 'pulseWarningIns');
782
- removeClass($warningIcon.querySelector('.dot'), 'pulseWarningIns');
770
+ removeClass($warningIcon.querySelector('.sa-body'), 'pulseWarningIns');
771
+ removeClass($warningIcon.querySelector('.sa-dot'), 'pulseWarningIns');
783
772
 
784
773
 
785
774
  // Reset the page to its previous state
@@ -803,30 +792,28 @@
803
792
  modal.style.marginTop = getTopMargin(getModal());
804
793
  }
805
794
 
795
+ // If browser is Internet Explorer 8
796
+ function isIE8() {
797
+ if (window.attachEvent && !window.addEventListener) {
798
+ return true;
799
+ } else {
800
+ return false;
801
+ }
802
+ }
806
803
 
804
+ // Error messages for developers
805
+ function logStr(string) {
806
+ if (window.console) { // IE...
807
+ window.console.log("SweetAlert: " + string);
808
+ }
809
+ }
807
810
 
808
- /*
809
- * If library is injected after page has loaded
810
- */
811
-
812
- (function () {
813
- if (document.readyState === "complete" || document.readyState === "interactive" && document.body) {
814
- window.sweetAlertInitialize();
815
- } else {
816
- if (document.addEventListener) {
817
- document.addEventListener('DOMContentLoaded', function handler() {
818
- document.removeEventListener('DOMContentLoaded', handler, false);
819
- window.sweetAlertInitialize();
820
- }, false);
821
- } else if (document.attachEvent) {
822
- document.attachEvent('onreadystatechange', function handler() {
823
- if (document.readyState === 'complete') {
824
- document.detachEvent('onreadystatechange', handler);
825
- window.sweetAlertInitialize();
826
- }
827
- });
828
- }
829
- }
830
- })();
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
+ }
831
818
 
832
819
  })(window, document);
@@ -1,550 +1 @@
1
- .sweet-overlay {
2
- background-color: rgba(0, 0, 0, 0.4);
3
- position: fixed;
4
- left: 0;
5
- right: 0;
6
- top: 0;
7
- bottom: 0;
8
- display: none;
9
- z-index: 10000; }
10
-
11
- .sweet-alert {
12
- background-color: white;
13
- font-family: 'Open Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif;
14
- width: 478px;
15
- padding: 17px;
16
- border-radius: 5px;
17
- text-align: center;
18
- position: fixed;
19
- left: 50%;
20
- top: 50%;
21
- margin-left: -256px;
22
- margin-top: -200px;
23
- overflow: hidden;
24
- display: none;
25
- z-index: 99999; }
26
- @media all and (max-width: 540px) {
27
- .sweet-alert {
28
- width: auto;
29
- margin-left: 0;
30
- margin-right: 0;
31
- left: 15px;
32
- right: 15px; } }
33
- .sweet-alert h2 {
34
- color: #575757;
35
- font-size: 30px;
36
- text-align: center;
37
- font-weight: 600;
38
- text-transform: none;
39
- position: relative;
40
- margin: 25px 0;
41
- padding: 0;
42
- line-height: 40px;
43
- display: block; }
44
- .sweet-alert p {
45
- color: #797979;
46
- font-size: 16px;
47
- text-align: center;
48
- font-weight: 300;
49
- position: relative;
50
- text-align: inherit;
51
- float: none;
52
- margin: 0;
53
- padding: 0;
54
- line-height: normal; }
55
- .sweet-alert button {
56
- background-color: #AEDEF4;
57
- color: white;
58
- border: none;
59
- box-shadow: none;
60
- font-size: 17px;
61
- font-weight: 500;
62
- border-radius: 5px;
63
- padding: 10px 32px;
64
- margin: 26px 5px 0 5px;
65
- cursor: pointer; }
66
- .sweet-alert button:focus {
67
- outline: none;
68
- box-shadow: 0 0 2px rgba(128, 179, 235, 0.5), inset 0 0 0 1px rgba(0, 0, 0, 0.05); }
69
- .sweet-alert button:hover {
70
- background-color: #a1d9f2; }
71
- .sweet-alert button:active {
72
- background-color: #81ccee; }
73
- .sweet-alert button.cancel {
74
- background-color: #D0D0D0; }
75
- .sweet-alert button.cancel:hover {
76
- background-color: #c8c8c8; }
77
- .sweet-alert button.cancel:active {
78
- background-color: #b6b6b6; }
79
- .sweet-alert button.cancel:focus {
80
- box-shadow: rgba(197, 205, 211, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.0470588) 0px 0px 0px 1px inset !important; }
81
- .sweet-alert button::-moz-focus-inner {
82
- border: 0; }
83
- .sweet-alert[data-has-cancel-button=false] button {
84
- box-shadow: none !important; }
85
- .sweet-alert .icon {
86
- width: 80px;
87
- height: 80px;
88
- border: 4px solid gray;
89
- border-radius: 50%;
90
- margin: 20px auto;
91
- padding: 0;
92
- position: relative;
93
- box-sizing: content-box; }
94
- .sweet-alert .icon.error {
95
- border-color: #F27474; }
96
- .sweet-alert .icon.error .x-mark {
97
- position: relative;
98
- display: block; }
99
- .sweet-alert .icon.error .line {
100
- position: absolute;
101
- height: 5px;
102
- width: 47px;
103
- background-color: #F27474;
104
- display: block;
105
- top: 37px;
106
- border-radius: 2px; }
107
- .sweet-alert .icon.error .line.left {
108
- -webkit-transform: rotate(45deg);
109
- transform: rotate(45deg);
110
- left: 17px; }
111
- .sweet-alert .icon.error .line.right {
112
- -webkit-transform: rotate(-45deg);
113
- transform: rotate(-45deg);
114
- right: 16px; }
115
- .sweet-alert .icon.warning {
116
- border-color: #F8BB86; }
117
- .sweet-alert .icon.warning .body {
118
- position: absolute;
119
- width: 5px;
120
- height: 47px;
121
- left: 50%;
122
- top: 10px;
123
- border-radius: 2px;
124
- margin-left: -2px;
125
- background-color: #F8BB86; }
126
- .sweet-alert .icon.warning .dot {
127
- position: absolute;
128
- width: 7px;
129
- height: 7px;
130
- border-radius: 50%;
131
- margin-left: -3px;
132
- left: 50%;
133
- bottom: 10px;
134
- background-color: #F8BB86; }
135
- .sweet-alert .icon.info {
136
- border-color: #C9DAE1; }
137
- .sweet-alert .icon.info::before {
138
- content: "";
139
- position: absolute;
140
- width: 5px;
141
- height: 29px;
142
- left: 50%;
143
- bottom: 17px;
144
- border-radius: 2px;
145
- margin-left: -2px;
146
- background-color: #C9DAE1; }
147
- .sweet-alert .icon.info::after {
148
- content: "";
149
- position: absolute;
150
- width: 7px;
151
- height: 7px;
152
- border-radius: 50%;
153
- margin-left: -3px;
154
- top: 19px;
155
- background-color: #C9DAE1; }
156
- .sweet-alert .icon.success {
157
- border-color: #A5DC86; }
158
- .sweet-alert .icon.success::before, .sweet-alert .icon.success::after {
159
- content: '';
160
- border-radius: 50%;
161
- position: absolute;
162
- width: 60px;
163
- height: 120px;
164
- background: white;
165
- -webkit-transform: rotate(45deg);
166
- transform: rotate(45deg); }
167
- .sweet-alert .icon.success::before {
168
- border-radius: 120px 0 0 120px;
169
- top: -7px;
170
- left: -33px;
171
- -webkit-transform: rotate(-45deg);
172
- transform: rotate(-45deg);
173
- -webkit-transform-origin: 60px 60px;
174
- transform-origin: 60px 60px; }
175
- .sweet-alert .icon.success::after {
176
- border-radius: 0 120px 120px 0;
177
- top: -11px;
178
- left: 30px;
179
- -webkit-transform: rotate(-45deg);
180
- transform: rotate(-45deg);
181
- -webkit-transform-origin: 0px 60px;
182
- transform-origin: 0px 60px; }
183
- .sweet-alert .icon.success .placeholder {
184
- width: 80px;
185
- height: 80px;
186
- border: 4px solid rgba(165, 220, 134, 0.2);
187
- border-radius: 50%;
188
- box-sizing: content-box;
189
- position: absolute;
190
- left: -4px;
191
- top: -4px;
192
- z-index: 2; }
193
- .sweet-alert .icon.success .fix {
194
- width: 5px;
195
- height: 90px;
196
- background-color: white;
197
- position: absolute;
198
- left: 28px;
199
- top: 8px;
200
- z-index: 1;
201
- -webkit-transform: rotate(-45deg);
202
- transform: rotate(-45deg); }
203
- .sweet-alert .icon.success .line {
204
- height: 5px;
205
- background-color: #A5DC86;
206
- display: block;
207
- border-radius: 2px;
208
- position: absolute;
209
- z-index: 2; }
210
- .sweet-alert .icon.success .line.tip {
211
- width: 25px;
212
- left: 14px;
213
- top: 46px;
214
- -webkit-transform: rotate(45deg);
215
- transform: rotate(45deg); }
216
- .sweet-alert .icon.success .line.long {
217
- width: 47px;
218
- right: 8px;
219
- top: 38px;
220
- -webkit-transform: rotate(-45deg);
221
- transform: rotate(-45deg); }
222
- .sweet-alert .icon.custom {
223
- background-size: contain;
224
- border-radius: 0;
225
- border: none;
226
- background-position: center center;
227
- background-repeat: no-repeat; }
228
-
229
- /*
230
- * Animations
231
- */
232
- @-webkit-keyframes showSweetAlert {
233
- 0% {
234
- transform: scale(0.7);
235
- -webkit-transform: scale(0.7); }
236
-
237
- 45% {
238
- transform: scale(1.05);
239
- -webkit-transform: scale(1.05); }
240
-
241
- 80% {
242
- transform: scale(0.95);
243
- -webkit-tranform: scale(0.95); }
244
-
245
- 100% {
246
- transform: scale(1);
247
- -webkit-transform: scale(1); } }
248
-
249
- @keyframes showSweetAlert {
250
- 0% {
251
- transform: scale(0.7);
252
- -webkit-transform: scale(0.7); }
253
-
254
- 45% {
255
- transform: scale(1.05);
256
- -webkit-transform: scale(1.05); }
257
-
258
- 80% {
259
- transform: scale(0.95);
260
- -webkit-tranform: scale(0.95); }
261
-
262
- 100% {
263
- transform: scale(1);
264
- -webkit-transform: scale(1); } }
265
-
266
- @-webkit-keyframes hideSweetAlert {
267
- 0% {
268
- transform: scale(1);
269
- -webkit-transform: scale(1); }
270
-
271
- 100% {
272
- transform: scale(0.5);
273
- -webkit-transform: scale(0.5); } }
274
-
275
- @keyframes hideSweetAlert {
276
- 0% {
277
- transform: scale(1);
278
- -webkit-transform: scale(1); }
279
-
280
- 100% {
281
- transform: scale(0.5);
282
- -webkit-transform: scale(0.5); } }
283
-
284
- .showSweetAlert {
285
- -webkit-animation: showSweetAlert 0.3s;
286
- animation: showSweetAlert 0.3s; }
287
- .showSweetAlert[data-animation=none] {
288
- -webkit-animation: none;
289
- animation: none; }
290
-
291
- .hideSweetAlert {
292
- -webkit-animation: hideSweetAlert 0.2s;
293
- animation: hideSweetAlert 0.2s; }
294
- .hideSweetAlert[data-animation=none] {
295
- -webkit-animation: none;
296
- animation: none; }
297
-
298
- @-webkit-keyframes animateSuccessTip {
299
- 0% {
300
- width: 0;
301
- left: 1px;
302
- top: 19px; }
303
-
304
- 54% {
305
- width: 0;
306
- left: 1px;
307
- top: 19px; }
308
-
309
- 70% {
310
- width: 50px;
311
- left: -8px;
312
- top: 37px; }
313
-
314
- 84% {
315
- width: 17px;
316
- left: 21px;
317
- top: 48px; }
318
-
319
- 100% {
320
- width: 25px;
321
- left: 14px;
322
- top: 45px; } }
323
-
324
- @keyframes animateSuccessTip {
325
- 0% {
326
- width: 0;
327
- left: 1px;
328
- top: 19px; }
329
-
330
- 54% {
331
- width: 0;
332
- left: 1px;
333
- top: 19px; }
334
-
335
- 70% {
336
- width: 50px;
337
- left: -8px;
338
- top: 37px; }
339
-
340
- 84% {
341
- width: 17px;
342
- left: 21px;
343
- top: 48px; }
344
-
345
- 100% {
346
- width: 25px;
347
- left: 14px;
348
- top: 45px; } }
349
-
350
- @-webkit-keyframes animateSuccessLong {
351
- 0% {
352
- width: 0;
353
- right: 46px;
354
- top: 54px; }
355
-
356
- 65% {
357
- width: 0;
358
- right: 46px;
359
- top: 54px; }
360
-
361
- 84% {
362
- width: 55px;
363
- right: 0px;
364
- top: 35px; }
365
-
366
- 100% {
367
- width: 47px;
368
- right: 8px;
369
- top: 38px; } }
370
-
371
- @keyframes animateSuccessLong {
372
- 0% {
373
- width: 0;
374
- right: 46px;
375
- top: 54px; }
376
-
377
- 65% {
378
- width: 0;
379
- right: 46px;
380
- top: 54px; }
381
-
382
- 84% {
383
- width: 55px;
384
- right: 0px;
385
- top: 35px; }
386
-
387
- 100% {
388
- width: 47px;
389
- right: 8px;
390
- top: 38px; } }
391
-
392
- @-webkit-keyframes rotatePlaceholder {
393
- 0% {
394
- transform: rotate(-45deg);
395
- -webkit-transform: rotate(-45deg); }
396
-
397
- 5% {
398
- transform: rotate(-45deg);
399
- -webkit-transform: rotate(-45deg); }
400
-
401
- 12% {
402
- transform: rotate(-405deg);
403
- -webkit-transform: rotate(-405deg); }
404
-
405
- 100% {
406
- transform: rotate(-405deg);
407
- -webkit-transform: rotate(-405deg); } }
408
-
409
- @keyframes rotatePlaceholder {
410
- 0% {
411
- transform: rotate(-45deg);
412
- -webkit-transform: rotate(-45deg); }
413
-
414
- 5% {
415
- transform: rotate(-45deg);
416
- -webkit-transform: rotate(-45deg); }
417
-
418
- 12% {
419
- transform: rotate(-405deg);
420
- -webkit-transform: rotate(-405deg); }
421
-
422
- 100% {
423
- transform: rotate(-405deg);
424
- -webkit-transform: rotate(-405deg); } }
425
-
426
- .animateSuccessTip {
427
- -webkit-animation: animateSuccessTip 0.75s;
428
- animation: animateSuccessTip 0.75s; }
429
-
430
- .animateSuccessLong {
431
- -webkit-animation: animateSuccessLong 0.75s;
432
- animation: animateSuccessLong 0.75s; }
433
-
434
- .icon.success.animate::after {
435
- -webkit-animation: rotatePlaceholder 4.25s ease-in;
436
- animation: rotatePlaceholder 4.25s ease-in; }
437
-
438
- @-webkit-keyframes animateErrorIcon {
439
- 0% {
440
- transform: rotateX(100deg);
441
- -webkit-transform: rotateX(100deg);
442
- opacity: 0; }
443
-
444
- 100% {
445
- transform: rotateX(0deg);
446
- -webkit-transform: rotateX(0deg);
447
- opacity: 1; } }
448
-
449
- @keyframes animateErrorIcon {
450
- 0% {
451
- transform: rotateX(100deg);
452
- -webkit-transform: rotateX(100deg);
453
- opacity: 0; }
454
-
455
- 100% {
456
- transform: rotateX(0deg);
457
- -webkit-transform: rotateX(0deg);
458
- opacity: 1; } }
459
-
460
- .animateErrorIcon {
461
- -webkit-animation: animateErrorIcon 0.5s;
462
- animation: animateErrorIcon 0.5s; }
463
-
464
- @-webkit-keyframes animateXMark {
465
- 0% {
466
- transform: scale(0.4);
467
- -webkit-transform: scale(0.4);
468
- margin-top: 26px;
469
- opacity: 0; }
470
-
471
- 50% {
472
- transform: scale(0.4);
473
- -webkit-transform: scale(0.4);
474
- margin-top: 26px;
475
- opacity: 0; }
476
-
477
- 80% {
478
- transform: scale(1.15);
479
- -webkit-transform: scale(1.15);
480
- margin-top: -6px; }
481
-
482
- 100% {
483
- transform: scale(1);
484
- -webkit-transform: scale(1);
485
- margin-top: 0;
486
- opacity: 1; } }
487
-
488
- @keyframes animateXMark {
489
- 0% {
490
- transform: scale(0.4);
491
- -webkit-transform: scale(0.4);
492
- margin-top: 26px;
493
- opacity: 0; }
494
-
495
- 50% {
496
- transform: scale(0.4);
497
- -webkit-transform: scale(0.4);
498
- margin-top: 26px;
499
- opacity: 0; }
500
-
501
- 80% {
502
- transform: scale(1.15);
503
- -webkit-transform: scale(1.15);
504
- margin-top: -6px; }
505
-
506
- 100% {
507
- transform: scale(1);
508
- -webkit-transform: scale(1);
509
- margin-top: 0;
510
- opacity: 1; } }
511
-
512
- .animateXMark {
513
- -webkit-animation: animateXMark 0.5s;
514
- animation: animateXMark 0.5s; }
515
-
516
- @-webkit-keyframes pulseWarning {
517
- 0% {
518
- border-color: #F8D486; }
519
-
520
- 100% {
521
- border-color: #F8BB86; } }
522
-
523
- @keyframes pulseWarning {
524
- 0% {
525
- border-color: #F8D486; }
526
-
527
- 100% {
528
- border-color: #F8BB86; } }
529
-
530
- .pulseWarning {
531
- -webkit-animation: pulseWarning 0.75s infinite alternate;
532
- animation: pulseWarning 0.75s infinite alternate; }
533
-
534
- @-webkit-keyframes pulseWarningIns {
535
- 0% {
536
- background-color: #F8D486; }
537
-
538
- 100% {
539
- background-color: #F8BB86; } }
540
-
541
- @keyframes pulseWarningIns {
542
- 0% {
543
- background-color: #F8D486; }
544
-
545
- 100% {
546
- background-color: #F8BB86; } }
547
-
548
- .pulseWarningIns {
549
- -webkit-animation: pulseWarningIns 0.75s infinite alternate;
550
- animation: pulseWarningIns 0.75s infinite alternate; }
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}
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.0
4
+ version: 0.4.2
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-01-19 00:00:00.000000000 Z
11
+ date: 2015-02-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties