diff options
| author | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-04 00:02:19 -0400 |
|---|---|---|
| committer | Caleb <caleb.mabry.15@cnu.edu> | 2022-09-04 00:02:19 -0400 |
| commit | 67314a8bc22ea198b8e3de788282a0ca0151cb1e (patch) | |
| tree | 92d827d3acd06bc1e33fc94c45a0be3613a95ae3 /webAO/dom/musicListClick.ts | |
| parent | d20994bd7c244cc84ab138cec441b05c261a83e4 (diff) | |
Several functions moved
Diffstat (limited to 'webAO/dom/musicListClick.ts')
| -rw-r--r-- | webAO/dom/musicListClick.ts | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/webAO/dom/musicListClick.ts b/webAO/dom/musicListClick.ts new file mode 100644 index 0000000..1eb6619 --- /dev/null +++ b/webAO/dom/musicListClick.ts @@ -0,0 +1,21 @@ +import { client } from "../client"; +/** + * Triggered when an item on the music list is clicked. + * @param {MouseEvent} event + */ +export function musiclist_click(_event: Event) { + const playtrack = (<HTMLInputElement>( + document.getElementById("client_musiclist") + )).value; + client.sendMusicChange(playtrack); + + // This is here so you can't actually select multiple tracks, + // even though the select tag has the multiple option to render differently + const musiclist_elements = (<HTMLSelectElement>( + document.getElementById("client_musiclist") + )).selectedOptions; + for (let i = 0; i < musiclist_elements.length; i++) { + musiclist_elements[i].selected = false; + } +} +window.musiclist_click = musiclist_click;
\ No newline at end of file |
