obscura_linka 0.4.0 → 0.4.1

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: 87940eb35c44494e0ba548efa919c1ec43f97ce0
4
- data.tar.gz: a2687812acacbbbe611910a4b3def03f27923831
3
+ metadata.gz: ba27d10d316c6e166945ef8fb1b2e263751a12ae
4
+ data.tar.gz: 9482ee490b8f428b5fee898eea86b1c6e3ae79d4
5
5
  SHA512:
6
- metadata.gz: 6b80b5c21e5649c70ffc0fed61f3ded6977320fdd864d2b14e267423b96769809a747df277e8832cc63017520e80cc46d8f3729014b02e9363645a4ec97c65d0
7
- data.tar.gz: 1cc4670e1d21be2b7501610c8bfd915d5a6f28eec8282f77fd853fc1a378042f049fbca1a19c6842b0be009d77e3b4a5f3f71b5347045bfdea8726b45bfa791a
6
+ metadata.gz: f20160f186ca0030d40501d7c8e1eecbdec2dc371868c74f61bbcc1dcb43be42cde6c5d07d689e470b3614601f1558ab65ae26989e5c857b8ad883434d8d1bab
7
+ data.tar.gz: 1b4aa9a6e0b0a3f32cf86fd18a861dceb828b76e64644bde2c4952c019a9d39cafcacc5399e5b6a9bfabf44f07c63e2053db94a0fcffdbd963cc7fb898b1916d
@@ -14,15 +14,30 @@
14
14
 
15
15
  ObscuraLinka = {
16
16
  initialize: function() {
17
- var rot_elements = document.getElementsByClassName("rot13_link");
17
+ var rot_elements = document.querySelectorAll(".rot13_link");
18
18
 
19
19
  for (var i = 0; i < rot_elements.length ; i++) {
20
- rot_elements[i].addEventListener("click",
21
- function (event) {
22
- event.preventDefault();
23
- window.location = ObscuraLinka.rot13(this.getAttribute("data-href"));
24
- }, false);
20
+ // Is an old browser? Such as IE8
21
+ if (rot_elements[i].addEventListener) {
22
+ var obscured_link = rot_elements[i].getAttribute("data-href");
23
+ rot_elements[i].addEventListener("click", function (e) {
24
+ ObscuraLinka.go_to_url(e, obscured_link) }, false);
25
+ } else {
26
+ var obscured_link = rot_elements[i].attributes["data-href"].nodeValue;
27
+ rot_elements[i].attachEvent("onclick", function (e) {
28
+ ObscuraLinka.go_to_url(e, obscured_link) });
29
+ }
30
+ }
31
+ },
32
+
33
+ go_to_url: function(event, obscured_link) {
34
+ // Is an old browser? Such as IE8
35
+ if (event.preventDefault) {
36
+ event.preventDefault();
37
+ } else {
38
+ event.returnValue = false;
25
39
  }
40
+ window.location = ObscuraLinka.rot13(obscured_link);
26
41
  },
27
42
 
28
43
  rot: function( t, u, v ) {
@@ -49,4 +64,4 @@ ObscuraLinka = {
49
64
  }
50
65
  };
51
66
 
52
- $(window).load = ObscuraLinka.initialize();
67
+ window.onload = function() { ObscuraLinka.initialize() };
@@ -1,3 +1,3 @@
1
1
  module ObscuraLinka
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obscura_linka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Austin Fonacier
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-07-02 00:00:00.000000000 Z
13
+ date: 2014-07-14 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails