mirror of
https://codeberg.org/Hyperpipe/pages
synced 2024-12-06 19:16:42 +01:00
Added index.html
Signed-off-by: Shiny Nematoda <snematoda@noreply.codeberg.org>
This commit is contained in:
+89
@@ -0,0 +1,89 @@
|
||||
<!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;
|
||||
}
|
||||
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>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</main>
|
||||
<script defer>
|
||||
try {
|
||||
const tbody = document.getElementById('table').getElementsByTagName('tbody')[0];
|
||||
|
||||
document.getElementById('to').innerText = 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'),
|
||||
a = document.createElement('a'),
|
||||
nameNode = document.createTextNode(i.name),
|
||||
urlNode = document.createTextNode(i.url);
|
||||
|
||||
a.href = i.url + location.hash.replace('#', '');
|
||||
a.appendChild(urlNode);
|
||||
|
||||
name.append(nameNode);
|
||||
url.append(a);
|
||||
|
||||
row.append(name);
|
||||
row.append(url);
|
||||
|
||||
tbody.append(row);
|
||||
}
|
||||
}).catch(err => { alert(err) })
|
||||
}).catch(err => { alert(err) })
|
||||
} catch (err) { alert(err) }
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user