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> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Index</title> <title>Index</title>
</head> </head>
<body> <body>
<h1>Hi</h1> <h1>Hi</h1>
</body> </body>
</html> </html>

View File

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

View File

@ -19,7 +19,7 @@
const file = document.getElementById('file'); const file = document.getElementById('file');
if (file.files.length) { if (file.files.length) {
console.log(file.files[0]); console.log(file.files[0]);
const formData = new FormData(); const formData = new FormData();
formData.append('file', file.files[0]); formData.append('file', file.files[0]);
try { try {