fix up html formatting

This commit is contained in:
oat 2020-10-12 01:24:33 +03:00
parent 73d5962c5c
commit 6b07ef943d
Signed by: oat
GPG key ID: DD83A9617A252385
3 changed files with 38 additions and 38 deletions

View file

@ -1,14 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index</title>
</head>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index</title>
</head>
<body>
<h1>Hi</h1>
</body>
<body>
<h1>Hi</h1>
</body>
</html>

View file

@ -1,37 +1,37 @@
<!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>
<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>
<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 = `${doc.artist} - ${doc.title} by ${doc.credit} <a href="files/${doc.id}.zip">download</a>`;
el.insertAdjacentElement('beforeend', p);
<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 = `${doc.artist} - ${doc.title} by ${doc.credit} <a href="files/${doc.id}.zip">download</a>`;
el.insertAdjacentElement('beforeend', p);
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>
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>
</html>