This repository has been archived by the owner on Aug 13, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path404.html
45 lines (42 loc) · 1.83 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
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="ShortLinker by DamionGans">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<title>Redirecting...</title>
</head>
<body>
<h1>ShortLinker by Damion Gans</h1>
<p id="result">Looking up ShortLink...</p>
<script>
const keyword = window.location.pathname.replace('/','').toLowerCase();
const firstCharacter = keyword[0];
async function redirectToUrl() {
try {
const response = await fetch(`https://dam.gs/${firstCharacter}.txt`);
const data = await response.text();
const entries = data.split('\n');
let found = false;
for (let i = 0; i < entries.length; i++) {
const [entryKeyword, entryUrl] = entries[i].split(' ');
if (entryKeyword === keyword) {
document.getElementById('result').textContent = `ShortLink ${keyword} found, redirecting...`;
window.location.href = entryUrl;
found = true;
break;
}
}
if (!found) {
document.getElementById('result').textContent = `Could not find ShortLink ${keyword}.`;
}
} catch (error) {
console.error('Error fetching or processing data:', error);
document.getElementById('result').textContent = `Could not find ShortLink ${keyword}.`;
}
}
redirectToUrl();
</script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
</body>
</html>