forked from boyska/radiomanifest.js
demo website uses shows
This commit is contained in:
parent
eab5da1ec7
commit
d3fed0c424
2 changed files with 26 additions and 0 deletions
|
@ -1,6 +1,9 @@
|
|||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<style>
|
||||
#show-info {border: 1px solid gray; max-width: 20em; padding: 0.3em; font-family: monospace;}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
Ciao
|
||||
|
@ -11,5 +14,11 @@
|
|||
<audio controls>
|
||||
</audio>
|
||||
</div>
|
||||
<div id="show-info">
|
||||
</div>
|
||||
<div id="shows">
|
||||
<ul>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
17
ui.js
17
ui.js
|
@ -17,6 +17,23 @@ async function fai () {
|
|||
console.log('src', srcEl, url)
|
||||
audioEl.appendChild(srcEl)
|
||||
})
|
||||
|
||||
const showList = document.querySelector('#shows > ul')
|
||||
for (const show of radio.getShows()) {
|
||||
const item = document.createElement('li')
|
||||
const link = document.createElement('a')
|
||||
link.dataset['show'] = show.getName()
|
||||
link.textContent = show.getName()
|
||||
link.setAttribute('href', show.getWebsite())
|
||||
item.appendChild(link)
|
||||
showList.appendChild(item)
|
||||
}
|
||||
showList.addEventListener('mouseenter', function (evt) {
|
||||
if (evt.target.dataset['show'] === undefined)
|
||||
return;
|
||||
const info = document.querySelector('#show-info')
|
||||
info.textContent = radio.getShowByName(evt.target.dataset['show']).getFeed()
|
||||
}, true)
|
||||
}
|
||||
|
||||
fai()
|
||||
|
|
Loading…
Reference in a new issue