forked from AdguardTeam/AnonymousRedirect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
redirect.html
205 lines (176 loc) · 5.86 KB
/
redirect.html
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<!DOCTYPE html>
<html lang="en">
<head>
<title>Anonymous redirect</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- http://caniuse.com/#feat=referrer-policy -->
<meta name="referrer" content="no-referrer" />
<!-- For Edge and Safari -->
<meta name="referrer" content="never" />
<style>
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, Arial, sans-serif;
font-weight: 400;
font-size: 16px;
line-height: 1.428571429;
color: #4d4d4d;
}
.main {
padding: 70px 15px;
text-align: center;
}
.title {
margin: 0 0 30px;
line-height: 1.2;
}
.text {
max-width: 800px;
margin: 0 auto 20px;
line-height: 1.6;
}
code {
display: block;
word-break: break-word;
}
.button {
display: inline-block;
vertical-align: middle;
min-width: 200px;
margin-bottom: 30px;
background-image: none;
padding: 13px 15px;
font-family: inherit;
font-size: 15px;
font-weight: 400;
text-align: center;
text-transform: uppercase;
text-decoration: none;
white-space: nowrap;
color: #fff;
background-color: #67b279;
border-radius: 8px;
border: none;
cursor: pointer;
}
.button:hover,
.button:focus {
background-color: #58a273;
outline: 0;
}
footer {
max-width: 400px;
margin: 0 auto;
font-size: 13px;
}
.link {
color: #67b279;
}
.link:hover,
.link:focus {
text-decoration: none;
}
.wrap {
text-align: center;
}
</style>
</head>
<body>
<div class="main">
<h1 set-lan="html:title" class="title">
Anonymous redirect
</h1>
<p set-lan="html:text" class="text">
You are about to go to the following page:
<code id="currentUrl">https://example.org/</code>
</p>
<div class="wrap">
<button set-lan="html:button" type="button" class="button" id="redirectButton">
Take me there
</button>
</div>
<footer set-lan="html:footer">
The point of this page is to hide the source page from the target website to prevent all kinds of tracking.
<a set-lan="html:link" href="https://github.com/AdguardTeam/AnonymousRedirect" class="link" target="_blank">Source code</a>.
</footer>
</div>
<script type="text/javascript" src="https://cdn.staticfile.org/jquery/1.10.0/jquery.min.js"></script>
<script type="text/javascript">
if (!String.prototype.endsWith) {
Object.defineProperty(String.prototype, 'endsWith', {
value: function (searchString, position) {
var subjectString = this.toString();
if (position === undefined || position > subjectString.length) {
position = subjectString.length;
}
position -= searchString.length;
var lastIndex = subjectString.indexOf(searchString, position);
return lastIndex !== -1 && lastIndex === position;
},
});
}
function getParameterByName(name, url) {
if (!url) {
url = window.location.href;
}
name = name.replace(/[\[\]]/g, "\\$&");
var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
results = regex.exec(url);
if (!results) return null;
if (!results[2]) return '';
return decodeURIComponent(results[2].replace(/\+/g, " "));
}
function getHostname(url) {
if (!url) {
return '';
}
var hostname = '';
if (url.indexOf('//') > -1) {
hostname = url.split('/')[2];
} else {
hostname = url.split('/')[0];
}
hostname = hostname.split(':')[0];
hostname = hostname.split('?')[0];
return hostname;
}
var url = getParameterByName('url');
var host = getHostname(document.referrer);
if (host === 'uim.im' || host.endsWith('.uim.im')) {
performRedirect();
}
var currentUrl = document.getElementById('currentUrl');
if (currentUrl) {
currentUrl.innerText = url;
}
function performRedirect() {
// Rick-rolling in case of wrong URL
window.location.href = url || 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
}
var redirectButton = document.getElementById('redirectButton');
if (redirectButton) {
redirectButton.addEventListener('click', performRedirect);
}
function translate(lang){
var webtitle='';
var languages;
$.ajax({url:"lang.json",async:false,success:function(result){console.log(result);languages = result;}});
var t = languages[lang];
if(t==undefined) return true;
$('[set-lan]').each(function(){
var me = $(this);
var a = me.attr('set-lan').split(':');
var p = a[0];
var m = a[1];
webtitle = languages[lang]["title"];
if(m=="text"||m=="footer"){me.context.firstChild.textContent = t[m];}
else
{me.html(t[m]);}});
document.title=webtitle;}
var lang = navigator.language||navigator.userLanguage;
document.firstElementChild.lang=lang
translate(lang);
</script>
</body>
</html>