Simpliest frontend UI
This commit is contained in:
parent
44fc039ac9
commit
e1ef74cc1c
3 changed files with 62 additions and 1 deletions
|
@ -1 +1,33 @@
|
|||
<!-- TODO: simple web ui, websockets -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>musicdlp</title>
|
||||
<link rel="stylesheet" href="/style.css">
|
||||
<script src="/script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<input type="text" id="url" placeholder="Playlist or track URL">
|
||||
<button type="button" id="guess-site-btn">Guess site</button>
|
||||
</div>
|
||||
<div>
|
||||
<select id="site-select">
|
||||
<option value="youtube" selected>YouTube</option>
|
||||
<option value="yt_proxied">YT proxied</option>
|
||||
<option value="yandex">Yandex Music</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<button type="button" id="items-btn">Get playlist items</button>
|
||||
</div>
|
||||
<div id="items-container"></div>
|
||||
<div>
|
||||
<button type="button">Download</button>
|
||||
</div>
|
||||
<div>
|
||||
<label>Progress: <span id="progress">not implemented</span></label>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
18
frontend/script.js
Normal file
18
frontend/script.js
Normal file
|
@ -0,0 +1,18 @@
|
|||
addEventListener('DOMContentLoaded', () => {
|
||||
/** @type{HTMLInputElement} */
|
||||
const urlField = document.getElementById('url')
|
||||
/** @type{HTMLSelectElement} */
|
||||
const site = document.getElementById('site-select')
|
||||
|
||||
document.getElementById('guess-site-btn').addEventListener('click', () => {
|
||||
const url = urlField.value
|
||||
if (url.includes('/watch?v=') || url.includes('/playlist?list=')) {
|
||||
if (site.value == 'yt_proxied') {
|
||||
return
|
||||
}
|
||||
site.value = 'youtube'
|
||||
} else if (url.includes('://music.yandex.')) {
|
||||
site.value = 'yandex'
|
||||
}
|
||||
})
|
||||
})
|
11
frontend/style.css
Normal file
11
frontend/style.css
Normal file
|
@ -0,0 +1,11 @@
|
|||
body {
|
||||
margin: 0;
|
||||
padding: 0.5rem;
|
||||
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
row-gap: 0.25rem;
|
||||
|
||||
font-family: 'Noto Sans', 'Roboto', 'Ubuntu', sans-serif;
|
||||
}
|
Loading…
Reference in a new issue