sweet-alert 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25afb8f75d4bc1974f5c7b8c0e3fd9beae8a9469
4
- data.tar.gz: 9fe98ba7dc12bb73cae8e0e11178ac28d00d923a
3
+ metadata.gz: d92f1e1869ae8edc75cf4cbd1b8eebf72def3a17
4
+ data.tar.gz: 388395f7322b9c1a4e4d9b390c949720e3042494
5
5
  SHA512:
6
- metadata.gz: 201016af60556fe287dfb24af9d796ca3255aaf2c0084366a79053f705cf28c4fefee9b3c2475038350df4cc60999594fa9d4b45c6a8d27656644456dfbba0fb
7
- data.tar.gz: 95f0143c275d132dae53c73a5bac6812b0cc720db58b60299d197b2e39a038f09a3ef47aa956572e448a27c8c4fec6d6610fb445465a23acd9b1726ad9556075
6
+ metadata.gz: 6d2dfc24a803e5e834027bd6f721ba708867e2724b27a7e0099d8912093483bb758d5d5bd10f5715e50f4ceca3f2bfc73858e0415cc84c1f5ee9d7ff3e9b4d88
7
+ data.tar.gz: 1caa844bf4c89dbf3dac78af2da8d57b63b4b83424df8a4270089b7548833e9008228f398f81d4891d129de4387706a0a05ea47980a211caa2f924692c33454f
data/.gitignore CHANGED
File without changes
data/Gemfile CHANGED
File without changes
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
File without changes
data/Rakefile CHANGED
File without changes
@@ -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
- var padding = parseInt(getComputedStyle(elem).getPropertyValue('padding'), 10);
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(e) {
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
- e.target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
266
+ target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
270
267
  }
271
268
  break;
272
269
  case ("mouseout"):
273
270
  if (targetedConfirm) {
274
- e.target.style.backgroundColor = params.confirmButtonColor;
271
+ target.style.backgroundColor = params.confirmButtonColor;
275
272
  }
276
273
  break;
277
274
  case ("mousedown"):
278
275
  if (targetedConfirm) {
279
- e.target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.14);
276
+ target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.14);
280
277
  }
281
278
  break;
282
279
  case ("mouseup"):
283
280
  if (targetedConfirm) {
284
- e.target.style.backgroundColor = colorLuminance(params.confirmButtonColor, -0.04);
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(e) {
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, e.target),
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(e) {
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(e) {
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
- if (timer !== "null") {
667
- setTimeout(function() {
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; }
@@ -54,6 +54,10 @@
54
54
  font-weight: 600;
55
55
  text-transform: none;
56
56
  position: relative;
57
+ margin: 25px 0;
58
+ padding: 0;
59
+ line-height: 25px;
60
+ display: block;
57
61
  }
58
62
 
59
63
  p {
@@ -63,6 +67,7 @@
63
67
  font-weight: 300;
64
68
  position: relative;
65
69
  margin: 0;
70
+ padding: 0;
66
71
  line-height: normal;
67
72
  }
68
73
 
@@ -126,6 +131,7 @@
126
131
  border: 4px solid gray;
127
132
  border-radius: 50%;
128
133
  margin: 20px auto;
134
+ padding: 0;
129
135
  position: relative;
130
136
  box-sizing: content-box;
131
137
 
@@ -404,17 +410,6 @@
404
410
  @include animation('animateXMark 0.5s');
405
411
  }
406
412
 
407
-
408
- // Warning and info animation
409
-
410
- /*@include keyframes(simpleRotate) {
411
- 0% { transform: rotateY(0deg); }
412
- 100% { transform: rotateY(-360deg); }
413
- }
414
- .simpleRotate {
415
- @include animation('simpleRotate 0.75s');
416
- }*/
417
-
418
413
  @include keyframes(pulseWarning) {
419
414
  0% { border-color: #F8D486; }
420
415
  100% { border-color: #F8BB86; }
File without changes
File without changes
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = 'sweet-alert'
6
- s.version = '0.0.4'
6
+ s.version = '0.0.5'
7
7
  s.summary = "The awesome replacement for Javascript's alert"
8
8
  s.authors = ["Najtmare"]
9
9
  s.email = 'millan@sino.net'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sweet-alert
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Najtmare
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-24 00:00:00.000000000 Z
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description:
14
14
  email: millan@sino.net
@@ -16,7 +16,7 @@ executables: []
16
16
  extensions: []
17
17
  extra_rdoc_files: []
18
18
  files:
19
- - .gitignore
19
+ - ".gitignore"
20
20
  - Gemfile
21
21
  - LICENSE
22
22
  - README.md
@@ -28,7 +28,6 @@ files:
28
28
  - app/assets/stylesheets/sweet-alert/sweet-alert.scss
29
29
  - lib/sweet-alert.rb
30
30
  - lib/sweet-alert/engine.rb
31
- - lib/sweet-alert/version.rb
32
31
  - sweet-alert-rails.gemspec
33
32
  homepage: http://rubygems.org/gems/sweet-alert
34
33
  licenses:
@@ -40,17 +39,17 @@ require_paths:
40
39
  - lib
41
40
  required_ruby_version: !ruby/object:Gem::Requirement
42
41
  requirements:
43
- - - '>='
42
+ - - ">="
44
43
  - !ruby/object:Gem::Version
45
44
  version: '0'
46
45
  required_rubygems_version: !ruby/object:Gem::Requirement
47
46
  requirements:
48
- - - '>='
47
+ - - ">="
49
48
  - !ruby/object:Gem::Version
50
49
  version: '0'
51
50
  requirements: []
52
51
  rubyforge_project:
53
- rubygems_version: 2.0.2
52
+ rubygems_version: 2.2.2
54
53
  signing_key:
55
54
  specification_version: 4
56
55
  summary: The awesome replacement for Javascript's alert
@@ -1,3 +0,0 @@
1
- module SweetAlert
2
- VERSION = '0.0.4'
3
- end