forked from nelsontky/gh-pages-url-shortener
-
Notifications
You must be signed in to change notification settings - Fork 0
/
404.html
207 lines (199 loc) · 8.05 KB
/
404.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
206
207
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta
name="facebook-domain-verification"
content="ixov7jdh0y0aez1cg3mmpbom3unr9x"
/>
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width"
/>
<title>Redirecting...</title>
<style>
html,
body {
width: 100%;
overflow-x: hidden;
height: 100%;
max-width: 100%;
max-height: 100%;
}
.preloader {
height: 48px;
width: 48px;
color: blue;
position: relative;
display: inline-block;
border: 4px solid;
border-radius: 50%;
border-top-color: transparent;
animation: rotate 0.7s linear infinite;
opacity: 0;
margin-bottom: 20px;
position: fixed;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
left: 0;
right: 0;
margin: auto;
text-align: center;
transition: opacity 0.2s ease-in-out;
will-change: transform, opacity;
opacity: 1;
}
@-webkit-keyframes rotate {
0% {
-webkit-transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
}
}
@keyframes rotate {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<script>
/**
* Configuration goes here
*/
// Format: https://api.github.com/repos/{owner}/{repo}/issues/
var GITHUB_ISSUES_LINK =
'https://api.github.com/repos/sentienhq/Sentien-shortener-db/issues/';
var HOMEPAGE = 'https://sentienhq.com/';
// alert(document.referrer);
!(function (f, b, e, v, n, t, s) {
if (f.fbq) return;
n = f.fbq = function () {
n.callMethod
? n.callMethod.apply(n, arguments)
: n.queue.push(arguments);
};
if (!f._fbq) f._fbq = n;
n.push = n;
n.loaded = !0;
n.version = '2.0';
n.queue = [];
t = b.createElement(e);
t.async = !0;
t.src = v;
s = b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t, s);
})(
window,
document,
'script',
'https://connect.facebook.net/en_US/fbevents.js',
);
fbq('init', '275949140366976');
fbq('init', '193338219222528');
/**
* DO NOT TOUCH ANYTHING BELOW THIS COMMENT UNLESS YOU KNOW WHAT YOU ARE DOING
*/
function isUrl(url) {
// Regex from https://stackoverflow.com/a/3809435, with a modification to allow for TLDs of up to 24 characters
return /^https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,24}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)+$/.test(
url,
);
}
function redirect() {
var location = window.location;
var issueNumber = location.pathname.split('/')[1];
var xhr = new XMLHttpRequest();
xhr.onload = function () {
try {
var payload = JSON.parse(xhr.response);
var message = payload.message;
var title = payload.title;
var url = document.createElement('a');
url.setAttribute('href', title);
var isInvalidUrl =
message === 'Not Found' || !title || !isUrl(title);
if (isInvalidUrl) {
location.replace(HOMEPAGE);
} else {
if (issueNumber == 12 || issueNumber == 15) {
fbq('track', 'SHORTENER_KS_BUY');
fbq(
'track',
'SHORTENER_https://www.kickstarter.com/projects/sentien/sentien-audio/pledge/new',
);
} else {
fbq('track', 'SHORTENER_' + title);
}
if (issueNumber == 16) {
fbq('track', 'SHORTENER_DAREK_ADS');
}
MAX = 350;
i = 0;
(function wait() {
if (
typeof fbq === 'function' &&
typeof fbq.loadPlugin !== 'undefined'
) {
if (
issueNumber == 12 ||
issueNumber == 15
) {
var ref = document.referrer;
if (typeof ref !== 'undefined') {
var arr = ref.split('?');
if (arr.length > 1) {
title = title + '?' + arr[1];
}
location.replace(title);
}
} else {
location.replace(title);
}
} else {
if (i < MAX) {
i++;
setTimeout(wait, 10);
} else {
if (
issueNumber == 12 ||
issueNumber == 15
) {
var ref = document.referrer;
if (typeof ref !== 'undefined') {
var arr = ref.split('?');
if (arr.length > 1) {
title =
title + '?' + arr[1];
}
location.replace(title);
}
} else {
location.replace(title);
}
}
}
})();
}
} catch (e) {
location.replace(HOMEPAGE);
}
};
xhr.onerror = function () {
location.replace(HOMEPAGE);
};
xhr.open('GET', GITHUB_ISSUES_LINK + issueNumber);
xhr.send();
}
redirect();
</script>
</head>
<body>
<div class="preloader" id="js-preloader"></div>
</body>
</html>