-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path404.html
145 lines (139 loc) · 7.79 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
---
permalink: /404.html
---
<!doctype html>
<html lang="en">
<head>
<script src="https://www.gstatic.com/firebasejs/5.5.8/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/5.5.8/firebase-database.js"></script>
<script>
firebase.initializeApp({apiKey: "AIzaSyBpAWpSB1sSjuV1qR8woZoamGVonMgYN_Y",authDomain: "red-irector.firebaseapp.com",databaseURL: "https://red-irector.firebaseio.com",projectId: "red-irector",storageBucket: "red-irector.appspot.com",messagingSenderId: "578371314492"});
console.log(window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1));
try{
firebase.database().ref(window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1).toLowerCase()+"/url").once('value').then(function(snapshot) {
try {
var testURL = new URL(snapshot.val());
window.location.replace(testURL);
if (document.readyState != "loading") {
var urlEle = document.getElementById("url");
var websiteUrlEle = document.getElementById("weburls");
urlEle.innerHTML = testURL;
urlEle.setAttribute("href", testURL);
websiteUrlEle.setAttribute("href", testURL);
websiteUrlEle.innerHTML = websiteUrlEle.hostname;
setTimeout(function(){
document.getElementById("yesUrl").style.display = "block"
document.getElementById("logo").style.display = "block";
},500);
document.getElementById("content").style.display = "none";
}else{
document.onreadystatechange = function () {
//Exact same code from above
if (document.readyState != "loading") {
var urlEle = document.getElementById("url");
var websiteUrlEle = document.getElementById("weburls");
urlEle.innerHTML = testURL;
urlEle.setAttribute("href", testURL);
websiteUrlEle.setAttribute("href", testURL);
websiteUrlEle.innerHTML = websiteUrlEle.hostname;
setTimeout(function(){
document.getElementById("yesUrl").style.display = "block"
document.getElementById("logo").style.display = "block";
},1000);
document.getElementById("content").style.display = "none";
}
}
}
}catch(error){
if (document.readyState != "loading") {
if(snapshot.val()==undefined){
document.getElementById("noneUrl").style.display = "block";
document.getElementById("yesUrl").style.display = "none";
document.getElementById("logo").style.display = "block";
document.getElementById("content").style.display = "none";
}else{
document.getElementById("noUrl").style.display = "block";
document.getElementById("yesUrl").style.display = "none";
document.getElementById("failedUrl").innerHTML = snapshot.val();
document.getElementById("logo").style.display = "block";
document.getElementById("content").style.display = "none";
}
}else{
document.onreadystatechange = function () {
//Exact same code from above
if (document.readyState != "loading") {
if(snapshot.val()==undefined){
document.getElementById("noneUrl").style.display = "block";
document.getElementById("yesUrl").style.display = "none";
document.getElementById("logo").style.display = "block";
document.getElementById("content").style.display = "none";
}else{
document.getElementById("noUrl").style.display = "block";
document.getElementById("yesUrl").style.display = "none";
document.getElementById("failedUrl").innerHTML = snapshot.val();
document.getElementById("logo").style.display = "block";
document.getElementById("content").style.display = "none";
}
}
}
}
}
});
}catch(error){
//var urlp = window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1);
//if(urlp.val().contains(".")||urlp.val().contains("#")||urlp.val().contains("$")||urlp.val().contains("[")||urlp.val().contains("]")){
window.onload = function() {
document.getElementById("noneUrl").style.display = "block";
document.getElementById("yesUrl").style.display = "none";
document.getElementById("register").innerHTML="invalid REDurl";
document.getElementById("register").classList.add("disabled");
document.getElementById("register").classList.remove("btn-success");
document.getElementById("register").classList.add("btn-danger");
document.getElementById("logo").style.display = "block";
document.getElementById("content").style.display = "none";
}
//}
}
</script>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" integrity="sha384-WskhaSGFgHYWDcbwN70/dfYBj47jz9qbsMId/iRN3ewGhXQFZCSftd1LZCfmhktB" crossorigin="anonymous">
<title>REDirector</title>
</head>
<body>
<div id="content">
<p>Redirecting...</p>
<a onclick="more();" href="javascript:void(0);">More</a>
</div>
<div id="logo" class="container rounded-10" style="background-color:grey; border-radius: 20px;display:none;">
<h1 class="text-center" style="font-size:70px; color:#840909;"><span style="color:red">RED</span>irector</h1>
</div>
<div id = "yesUrl" class="container" style="display:none">
<h2>You are being redirected to <a id = "weburls">a website</a>.</h2>
<p>This is supposed to happen instantaneously but if you are currently reading this, you can click the link to be taken there: <kbd><a id = "url">[URL hasn’t been resolved yet]</a></kbd></p>
<p>If that doesn't work for some reason, you can always just copy and paste the address into an address bar.</p>
</div>
<div id ="noUrl" class="container" style="display:none">
<h2>The URL you were supposed to be redirected to was not valid.</h2>
<p>Here is where the creator of this REDurl wanted you to go: <kbd id="failedUrl">[URL hasn’t been resolved yet]</kbd></p>
</div>
<div id ="noneUrl" class="container" style="display:none">
<h2>This REDurl doesn't point anywhere</h2>
<p>Perhaps it was entered incorrectly.</p>
<button id = "register" type="button" onclick="createRED()" class="btn btn-success btn-lg">Click Here to register the REDurl</button>
</div>
<script>
function createRED(){
if(!document.getElementById("register").classList.contains("disabled"))
window.location.assign(window.location.protocol+"//"+window.location.hostname + window.location.pathname.substring(0,window.location.pathname.lastIndexOf("/"))+"?REDurl="+window.location.pathname.substring(window.location.pathname.lastIndexOf("/")+1).toLowerCase());
}
function more(){
document.getElementById("yesUrl").style.display = "block";
document.getElementById("logo").style.display = "block";
document.getElementById("content").style.display = "none";
}
</script>
</body>
</html>