mirror of
https://codeberg.org/Hyperpipe/pages
synced 2024-12-06 19:16:42 +01:00
100 lines
2.4 KiB
HTML
100 lines
2.4 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1"/>
|
|
<title>Instances</title>
|
|
<style>
|
|
HTML, body {
|
|
font-family: Sans-Serif;
|
|
background-color: #111;
|
|
color: #eee;
|
|
}
|
|
body {
|
|
max-width: 1280px;
|
|
}
|
|
h1 {
|
|
padding: 2rem;
|
|
}
|
|
td {
|
|
max-width: 50vw;
|
|
overflow-wrap: break-word;
|
|
}
|
|
h1, td {
|
|
text-align: center;
|
|
}
|
|
main {
|
|
overflow-x: auto;
|
|
}
|
|
main, table {
|
|
width: 100%;
|
|
}
|
|
th,
|
|
td {
|
|
font-size: 1rem;
|
|
margin: 0.25rem 0.5rem;
|
|
padding: 0.5rem 0.75rem;
|
|
border-radius: 0.125rem;
|
|
background-color: #212121;
|
|
}
|
|
th {
|
|
font-weight: bolder;
|
|
}
|
|
a {
|
|
color: #eee;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h1>Instances</h1>
|
|
<h2 id="to"></h2>
|
|
<main>
|
|
<table id="table">
|
|
<thead>
|
|
<tr>
|
|
<th>Name</th>
|
|
<th>URL</th>
|
|
<th>Privacy Policy</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody></tbody>
|
|
</table>
|
|
</main>
|
|
<script defer>
|
|
try {
|
|
const tbody = document.getElementById('table').getElementsByTagName('tbody')[0];
|
|
|
|
document.getElementById('to').textContent = location.hash.replace('#','')
|
|
|
|
fetch('https://raw.codeberg.page/Hyperpipe/pages/api/frontend.json').then(res => {
|
|
res.json().then(json => {
|
|
for (let i of json) {
|
|
const row = document.createElement('tr'),
|
|
name = document.createElement('td'),
|
|
url = document.createElement('td'),
|
|
privacy = document.createElement('td'),
|
|
link = document.createElement('a'),
|
|
policy = document.createElement('a'),
|
|
nameNode = document.createTextNode(i.name);
|
|
|
|
link.href = i.url + location.hash.replace('#', '');
|
|
link.textContent = "Visit"
|
|
|
|
policy.href = i.privacy;
|
|
policy.textContent = 'Visit'
|
|
|
|
name.append(nameNode);
|
|
url.append(link);
|
|
privacy.append(policy)
|
|
|
|
row.append(name);
|
|
row.append(url);
|
|
row.append(privacy)
|
|
|
|
tbody.append(row);
|
|
}
|
|
}).catch(err => { alert(err) })
|
|
}).catch(err => { alert(err) })
|
|
} catch (err) { alert(err) }
|
|
</script>
|
|
</body>
|
|
</html> |