-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
145 lines (145 loc) · 4.18 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>hicetnunc.art</title>
</head>
<body>
<style>
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
background-color: #1d1d1d;
margin: 0;
font-family: monospace
}
button {
font-family: monospace;
background: black;
color: white;
border: none;
border-radius: 6px;
padding: 8px 16px;
margin: 8px;
cursor: pointer;
font-size: 1.2em;
}
input {
padding: 8px 16px;
font-family: monospace;
border: 1px solid #ccc;
border-radius: 6px;
}
h1 {
font-size: 2em;
color: #eee;
line-height: 1.2em;
position: relative;
margin-top: -2em;
letter-spacing: 16px;
font-weight: 100;
}
p {
font-size: 1.5em;
margin: 26px 8px 16px;
max-width: 20em;
margin: 0 auto 10px;
}
#content {
width: 100%;
max-width: 500px;
background-color: #fff;
border-radius: 6px;
padding: 20px;
box-shadow: 0 0 10px rgba(0,0,0,0.1);
text-align: center;
}
#redirecting {
display: none;
position: fixed;
z-index: 9;
top: 0;
left: 0;
width: 100%;
height: 100vh;
background-color: black;
transition: all 0.5s ease;
color: white;
justify-content: center;
align-items: center;
flex-direction: column;
}
</style>
<div id="redirecting">
<h1>hicetnunc.art</h1>
<h2></h2>
(click anywhere cancel)
</div>
<div id="content">
<h1>hicetnunc.art</h1>
<p>Choose you preferred platform, we'll redirect you there in the future:</p>
<div class="default-options">
<button onclick="choose('hicetnunc.xyz')">hicetnunc.xyz</button>
<button onclick="choose('teia.art')">teia.art</button>
</div>
<button onclick="choose('other')">other:</button>
<input type="text" id="other" placeholder="other domain">
<script>
var urlpath = (new URLSearchParams(window.location.search)).get('url') || ''
function choose(choice) {
var url
if (choice == 'other') {
url = document.getElementById('other').value
if (url == '') {
alert('Please enter a domain')
return
}
// ensure protocol is specified
if (url.indexOf('http') == -1) {
url = 'https://' + url
}
// check if url is valid by fetching
fetch(url)
.then(function(response) {
if (response.status != 200) {
alert('Invalid domain')
}
})
} else {
url = choice
// ensure protocol is specified
if (url.indexOf('http') == -1) {
url = 'https://' + url
}
}
// set local storage
localStorage.setItem('redirect_url', url);
// redirect
window.location.href = url + urlpath;
}
var redirecting = document.getElementById('redirecting')
var cancel = false
document.addEventListener('click', function() {
cancel = true
redirecting.style.opacity = 0
redirecting.style.pointerEvents = 'none'
})
if (localStorage.getItem('redirect_url')) {
var redirect_url = localStorage.getItem('redirect_url') + urlpath
redirecting.style.display = 'flex'
document.querySelector('h2').innerHTML = 'Redirecting to ' + redirect_url
// redirect in 5 seconds if not clicked
setTimeout(function() {
if (!cancel) {
window.location.href = redirect_url
}
}, 5000)
}
</script>
</div>
</body>
</html>