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>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<style>
|
||||||
|
#show-info {border: 1px solid gray; max-width: 20em; padding: 0.3em; font-family: monospace;}
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Ciao
|
Ciao
|
||||||
|
@ -11,5 +14,11 @@
|
||||||
<audio controls>
|
<audio controls>
|
||||||
</audio>
|
</audio>
|
||||||
</div>
|
</div>
|
||||||
|
<div id="show-info">
|
||||||
|
</div>
|
||||||
|
<div id="shows">
|
||||||
|
<ul>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
17
ui.js
17
ui.js
|
@ -17,6 +17,23 @@ async function fai () {
|
||||||
console.log('src', srcEl, url)
|
console.log('src', srcEl, url)
|
||||||
audioEl.appendChild(srcEl)
|
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()
|
fai()
|
||||||
|
|
Loading…
Reference in a new issue