/
realurl.js
29 lines (29 loc) · 945 Bytes
/
realurl.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Generated by CoffeeScript 1.12.7
chrome.storage.sync.get(["password1", "password2", "password3", "address1", "address2", "address3"], function(item) {
var newurl, url;
url = location.href;
newurl = null;
if (!/forwarded_by_real_url/.exec(url)) {
if (item.password1 !== "" && url.indexOf(item.address1) >= 0) {
newurl = crypturl(url, item.password1);
} else if (item.password2 !== "" && url.indexOf(item.address2) >= 0) {
newurl = crypturl(url, item.password2);
} else if (item.password3 !== "" && url.indexOf(item.address3) >= 0) {
newurl = crypturl(url, item.password3);
}
if (newurl) {
newurl += '#forwarded_by_real_url';
return $.ajax({
type: 'GET',
statusCode: {
404: function() {
return location.href = newurl;
},
403: function() {
return location.href = newurl;
}
}
});
}
}
});