2020-09-03 22:18:43 +00:00
<!DOCTYPE html>
< html lang = "en" >
2020-10-11 22:24:33 +00:00
< head >
< meta charset = "UTF-8" >
< meta name = "viewport" content = "width=device-width, initial-scale=1.0" >
< title > list< / title >
< / head >
2020-09-03 22:18:43 +00:00
2020-10-11 22:24:33 +00:00
< body >
< div id = "doc-list" >
< / div >
2020-09-03 22:18:43 +00:00
2020-10-11 22:24:33 +00:00
< 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');
2020-10-12 00:27:47 +00:00
p.innerHTML = `${doc.artist} - ${doc.title} by ${doc.credit}\nuploaded by ${doc.uploader} ${doc.uploaderJSON.username}#${doc.uploaderJSON.discriminator}\n< a href = "files/${doc.id}.zip" > download< / a > `;
2020-10-11 22:24:33 +00:00
el.insertAdjacentElement('beforeend', p);
2020-09-03 22:18:43 +00:00
2020-10-11 22:24:33 +00:00
let charts = document.createElement('ul');
for (const chart of doc.charts) {
let l = document.createElement('li');
l.innerText = `${chart.difficulty} ${chart.rating} - ${chart.name}\n` +
`${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 >
2020-09-03 22:18:43 +00:00
< / html >