Update index.html

Closes #10
This commit is contained in:
Shiny Nematoda
2023-08-15 10:42:05 +00:00
parent 15b7d06f90
commit 83b843c8f6
+23 -12
View File
@@ -16,8 +16,9 @@
padding: 0;
}
body {
padding: 1rem;
margin: 0 auto;
max-width: 1280px;
max-width: 900px;
}
h1 {
padding: 2rem;
@@ -55,6 +56,7 @@
}
footer a {
padding: 0 0.25rem;
text-decoration: none;
}
</style>
</head>
@@ -74,24 +76,33 @@
</table>
</main>
<footer>
<a target="_blank" href="https://codeberg.org/Hyperpipe/pages">add</a>
<a target="_blank" href="https://codeberg.org/Hyperpipe/Hyperpipe">source</a>
<a target="_blank" href="https://codeberg.org/Hyperpipe/pages" title="add a new instance">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16" width="16" stroke="#fff" stroke-width="2" fill="none">
<path d="M8 0 V16 M0 8 H16" />
</svg>
</a>
<a target="_blank" href="https://codeberg.org/Hyperpipe/Hyperpipe" title="hyperpipe's code">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" height="16" width="16" stroke="#fff" stroke-width="2" fill="none">
<path d="M1 1 h14 v14 h-14 v-15 m7 1 v14" />
</svg>
</a>
</footer>
<script>
try {
const tbody = document.getElementById('table').getElementsByTagName('tbody')[0];
const tbody = document.getElementById('table').getElementsByTagName('tbody')[0],
el = document.createElement.bind(document);
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'),
const row = el('tr'),
name = el('td'),
url = el('td'),
privacy = el('td'),
link = el('a'),
policy = el('a'),
nameNode = document.createTextNode(i.name);
link.href = i.url + location.hash.replace('#', '');
@@ -110,8 +121,8 @@
tbody.append(row);
}
}).catch(err => { alert(err) })
}).catch(err => { alert(err) })
}).catch(err => alert(err))
}).catch(err => alert(err))
} catch (err) { alert(err) }
</script>
</body>