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 +4 -4
- data/app/assets/javascripts/obscura_linka/application.js +22 -7
- data/lib/obscura_linka/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ba27d10d316c6e166945ef8fb1b2e263751a12ae
|
4
|
+
data.tar.gz: 9482ee490b8f428b5fee898eea86b1c6e3ae79d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
17
|
+
var rot_elements = document.querySelectorAll(".rot13_link");
|
18
18
|
|
19
19
|
for (var i = 0; i < rot_elements.length ; i++) {
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
-
|
67
|
+
window.onload = function() { ObscuraLinka.initialize() };
|
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.
|
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-
|
13
|
+
date: 2014-07-14 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|