42 lines
No EOL
1.3 KiB
HTML
42 lines
No EOL
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>list</title>
|
|
</head>
|
|
|
|
<body>
|
|
<div id="doc-list">
|
|
</div>
|
|
|
|
<script src="https://cdn.jsdelivr.net/npm/axios@0.20.0/dist/axios.min.js"></script>
|
|
<script>
|
|
axios.get('/api/list').then(({ data }) => {
|
|
console.log(data);
|
|
const el = document.getElementById('doc-list');
|
|
for (const doc of data) {
|
|
let p = document.createElement('p');
|
|
p.innerHTML = `<b>${doc.artist} - ${doc.title}</b> by ${doc.credit}\nuploaded by ${doc.uploaderJSON.username}#${doc.uploaderJSON.discriminator}\n<a href="files/${doc.id}.zip">download</a>`;
|
|
|
|
if (doc.editable) {
|
|
p.innerHTML += ` <a href="../${doc.id}/edit">edit</a>`
|
|
}
|
|
|
|
el.insertAdjacentElement('beforeend', p);
|
|
|
|
let charts = document.createElement('ul');
|
|
for (const chart of doc.charts) {
|
|
let l = document.createElement('li');
|
|
l.innerHTML = `${chart.difficulty} ${chart.rating} - <b>${chart.name}</b><br>` +
|
|
`${chart.steps} steps, ${chart.mines} mines, ${chart.jumps} jumps, ${chart.hands} hands, ${chart.holds} holds, ${chart.rolls} rolls`
|
|
charts.insertAdjacentElement('beforeend', l);
|
|
}
|
|
el.insertAdjacentElement('beforeend', charts);
|
|
}
|
|
});
|
|
</script>
|
|
</body>
|
|
|
|
</html> |