aboutsummaryrefslogtreecommitdiff
path: root/webAO/dom/musicListClick.ts
blob: 5a29dc4f9f4595c5c43df4575fed5f9b85f711ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.sender.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;