sweetalert-rails 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
YmUyZWQ5YmIyYjljOTk0OWMyMDAxZTEyOWZkNTU2ZDE0Mjk1M2JiMw==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 874cb28987e88129206cd764638eb5af23f6f1b8
|
4
|
+
data.tar.gz: e32dbf0719aa7b892f5d8bf9da215b6f92d0cc4e
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MDUwNjFkYWZkMTNhM2RiZmJiNjg0M2FlMWQ3MmQ1NTFkYWMxMTEwZmRiZTM0
|
11
|
-
ZmM5NjUwNzY1Zjk1YzdhYzYyM2I4MTRmYjlkZTQ1MmJhNWMxNjQ=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
MTc1ZTIxMDdjNjM5NDdiOGNmOWQwNmYxYmMxOWE0YzAzN2FkM2IxZmUxZTVj
|
14
|
-
YzM5MjY2MGE0NWRhMjBhYzRkZjI3NjUwN2E4YjI1YWY2NzE2NjU5ZTE1ZGFi
|
15
|
-
ZjUzZTZlZDZiMGNjYTliYTkxZTcyYzc0NTA3MjI0ZDgwOWI3NjA=
|
6
|
+
metadata.gz: 16092033322d78b529de17c11887e1f9bba3b13fef3db3a10451a9874b457d39c4569f49cb68278244c14b4dec8aa26e8081a699726d88317ecabfd8ccefd0d9
|
7
|
+
data.tar.gz: 8cf08e710937f66c6782f89e4fd715a385e81ef1909badd1dcb3ace4b3ff97833f4662c145821cf56d2b8acb6468d1ad83e279ac6311019a96fbc28143f7d071
|
@@ -1,7 +1,7 @@
|
|
1
1
|
// SweetAlert
|
2
2
|
// 2014 (c) - Tristan Edwards
|
3
3
|
// github.com/t4t5/sweetalert
|
4
|
-
(function(window, document) {
|
4
|
+
;(function(window, document) {
|
5
5
|
|
6
6
|
var modalClass = '.sweet-alert',
|
7
7
|
overlayClass = '.sweet-overlay',
|
@@ -93,15 +93,20 @@
|
|
93
93
|
elem.style.left = '-9999px';
|
94
94
|
elem.style.display = 'block';
|
95
95
|
|
96
|
-
var height = elem.clientHeight
|
97
|
-
|
96
|
+
var height = elem.clientHeight,
|
97
|
+
padding;
|
98
|
+
if (typeof getComputedStyle !== "undefined") { /* IE 8 */
|
99
|
+
padding = parseInt(getComputedStyle(elem).getPropertyValue('padding'), 10);
|
100
|
+
} else{
|
101
|
+
padding = parseInt(elem.currentStyle.padding);
|
102
|
+
}
|
98
103
|
|
99
104
|
elem.style.left = '';
|
100
105
|
elem.style.display = 'none';
|
101
106
|
return ('-' + parseInt(height / 2 + padding) + 'px');
|
102
107
|
},
|
103
108
|
fadeIn = function(elem, interval) {
|
104
|
-
if(+elem.style.opacity < 1) {
|
109
|
+
if (+elem.style.opacity < 1) {
|
105
110
|
interval = interval || 16;
|
106
111
|
elem.style.opacity = 0;
|
107
112
|
elem.style.display = 'block';
|
@@ -116,6 +121,7 @@
|
|
116
121
|
};
|
117
122
|
tick();
|
118
123
|
}
|
124
|
+
elem.style.display = 'block'; //fallback IE8
|
119
125
|
},
|
120
126
|
fadeOut = function(elem, interval) {
|
121
127
|
interval = interval || 16;
|
@@ -183,16 +189,7 @@
|
|
183
189
|
|
184
190
|
// For readability: check sweet-alert.html
|
185
191
|
document.body.appendChild(sweetWrap);
|
186
|
-
|
187
|
-
// For development use only!
|
188
|
-
/*jQuery.ajax({
|
189
|
-
url: '../lib/sweet-alert.html', // Change path depending on file location
|
190
|
-
dataType: 'html'
|
191
|
-
})
|
192
|
-
.done(function(html) {
|
193
|
-
jQuery('body').append(html);
|
194
|
-
});*/
|
195
|
-
}
|
192
|
+
};
|
196
193
|
|
197
194
|
/*
|
198
195
|
* Global sweetAlert function
|
@@ -256,8 +253,8 @@
|
|
256
253
|
var modal = getModal();
|
257
254
|
|
258
255
|
// Mouse interactions
|
259
|
-
var onButtonEvent = function(
|
260
|
-
|
256
|
+
var onButtonEvent = function(event) {
|
257
|
+
var e = event || window.event;
|
261
258
|
var target = e.target || e.srcElement,
|
262
259
|
targetedConfirm = (target.className === 'confirm'),
|
263
260
|
modalIsVisible = hasClass(modal, 'visible'),
|
@@ -266,22 +263,22 @@
|
|
266
263
|
switch (e.type) {
|
267
264
|
case ("mouseover"):
|
268
265
|
if (targetedConfirm) {
|
269
|
-
|
266
|
+
target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
|
270
267
|
}
|
271
268
|
break;
|
272
269
|
case ("mouseout"):
|
273
270
|
if (targetedConfirm) {
|
274
|
-
|
271
|
+
target.style.backgroundColor = params.confirmButtonColor;
|
275
272
|
}
|
276
273
|
break;
|
277
274
|
case ("mousedown"):
|
278
275
|
if (targetedConfirm) {
|
279
|
-
|
276
|
+
target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.14);
|
280
277
|
}
|
281
278
|
break;
|
282
279
|
case ("mouseup"):
|
283
280
|
if (targetedConfirm) {
|
284
|
-
|
281
|
+
target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
|
285
282
|
}
|
286
283
|
break;
|
287
284
|
case ("focus"):
|
@@ -335,11 +332,12 @@
|
|
335
332
|
|
336
333
|
// Remember the current document.onclick event.
|
337
334
|
previousDocumentClick = document.onclick;
|
338
|
-
document.onclick = function(
|
335
|
+
document.onclick = function(event) {
|
336
|
+
var e = event || window.event;
|
339
337
|
var target = e.target || e.srcElement;
|
340
338
|
|
341
339
|
var clickedOnModal = (modal === target),
|
342
|
-
clickedOnModalChild = isDescendant(modal,
|
340
|
+
clickedOnModalChild = isDescendant(modal, target),
|
343
341
|
modalIsVisible = hasClass(modal, 'visible'),
|
344
342
|
outsideClickIsAllowed = modal.getAttribute('data-allow-ouside-click') === 'true';
|
345
343
|
|
@@ -355,7 +353,8 @@
|
|
355
353
|
$modalButtons = modal.querySelectorAll('button:not([type=hidden])');
|
356
354
|
|
357
355
|
|
358
|
-
function handleKeyDown(
|
356
|
+
function handleKeyDown(event) {
|
357
|
+
var e = event || window.event;
|
359
358
|
var keyCode = e.keyCode || e.which;
|
360
359
|
|
361
360
|
if ([9,13,32,27].indexOf(keyCode) === -1) {
|
@@ -417,7 +416,8 @@
|
|
417
416
|
previousWindowKeyDown = window.onkeydown;
|
418
417
|
window.onkeydown = handleKeyDown;
|
419
418
|
|
420
|
-
function handleOnBlur(
|
419
|
+
function handleOnBlur(event) {
|
420
|
+
var e = event || window.event;
|
421
421
|
var $targetElement = e.target || e.srcElement,
|
422
422
|
$focusElement = e.relatedTarget,
|
423
423
|
modalIsVisible = hasClass(modal, 'visible');
|
@@ -663,8 +663,9 @@
|
|
663
663
|
}, 500);
|
664
664
|
|
665
665
|
var timer = modal.getAttribute('data-timer');
|
666
|
-
|
667
|
-
|
666
|
+
|
667
|
+
if (timer !== "null" && timer !== "") {
|
668
|
+
modal.timeout = setTimeout(function() {
|
668
669
|
closeModal();
|
669
670
|
}, timer);
|
670
671
|
}
|
@@ -703,6 +704,7 @@
|
|
703
704
|
previousActiveElement.focus();
|
704
705
|
}
|
705
706
|
lastFocusedButton = undefined;
|
707
|
+
clearTimeout(modal.timeout);
|
706
708
|
}
|
707
709
|
|
708
710
|
|
@@ -724,18 +726,18 @@
|
|
724
726
|
|
725
727
|
(function () {
|
726
728
|
if (document.readyState === "complete" || document.readyState === "interactive" && document.body) {
|
727
|
-
sweetAlertInitialize();
|
729
|
+
window.sweetAlertInitialize();
|
728
730
|
} else {
|
729
731
|
if (document.addEventListener) {
|
730
732
|
document.addEventListener('DOMContentLoaded', function factorial() {
|
731
733
|
document.removeEventListener('DOMContentLoaded', arguments.callee, false);
|
732
|
-
sweetAlertInitialize();
|
734
|
+
window.sweetAlertInitialize();
|
733
735
|
}, false);
|
734
736
|
} else if (document.attachEvent) {
|
735
737
|
document.attachEvent('onreadystatechange', function() {
|
736
738
|
if (document.readyState === 'complete') {
|
737
739
|
document.detachEvent('onreadystatechange', arguments.callee);
|
738
|
-
sweetAlertInitialize();
|
740
|
+
window.sweetAlertInitialize();
|
739
741
|
}
|
740
742
|
});
|
741
743
|
}
|
@@ -37,7 +37,11 @@
|
|
37
37
|
text-align: center;
|
38
38
|
font-weight: 600;
|
39
39
|
text-transform: none;
|
40
|
-
position: relative;
|
40
|
+
position: relative;
|
41
|
+
margin: 25px 0;
|
42
|
+
padding: 0;
|
43
|
+
line-height: 25px;
|
44
|
+
display: block; }
|
41
45
|
.sweet-alert p {
|
42
46
|
color: #797979;
|
43
47
|
font-size: 16px;
|
@@ -45,6 +49,7 @@
|
|
45
49
|
font-weight: 300;
|
46
50
|
position: relative;
|
47
51
|
margin: 0;
|
52
|
+
padding: 0;
|
48
53
|
line-height: normal; }
|
49
54
|
.sweet-alert button {
|
50
55
|
background-color: #AEDEF4;
|
@@ -82,6 +87,7 @@
|
|
82
87
|
border: 4px solid gray;
|
83
88
|
border-radius: 50%;
|
84
89
|
margin: 20px auto;
|
90
|
+
padding: 0;
|
85
91
|
position: relative;
|
86
92
|
box-sizing: content-box; }
|
87
93
|
.sweet-alert .icon.error {
|
@@ -557,13 +563,6 @@
|
|
557
563
|
-moz-animation: animateXMark 0.5s;
|
558
564
|
animation: animateXMark 0.5s; }
|
559
565
|
|
560
|
-
/*@include keyframes(simpleRotate) {
|
561
|
-
0% { transform: rotateY(0deg); }
|
562
|
-
100% { transform: rotateY(-360deg); }
|
563
|
-
}
|
564
|
-
.simpleRotate {
|
565
|
-
@include animation('simpleRotate 0.75s');
|
566
|
-
}*/
|
567
566
|
@-webkit-keyframes pulseWarning {
|
568
567
|
0% {
|
569
568
|
border-color: #F8D486; }
|
metadata
CHANGED
@@ -1,27 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sweetalert-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.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: 2014-
|
11
|
+
date: 2014-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 3.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 3.1.0
|
27
27
|
description: This gem provides SweerAlert for your Rails application.
|
@@ -31,7 +31,7 @@ executables: []
|
|
31
31
|
extensions: []
|
32
32
|
extra_rdoc_files: []
|
33
33
|
files:
|
34
|
-
- .gitignore
|
34
|
+
- ".gitignore"
|
35
35
|
- Gemfile
|
36
36
|
- LICENSE.txt
|
37
37
|
- README.md
|
@@ -52,12 +52,12 @@ require_paths:
|
|
52
52
|
- lib
|
53
53
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- -
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
57
|
version: '0'
|
58
58
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
59
|
requirements:
|
60
|
-
- -
|
60
|
+
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
62
|
version: '0'
|
63
63
|
requirements: []
|