aboutsummaryrefslogtreecommitdiff
path: root/webAO/client/addTrack.ts
blob: bba4b088f38927606af55dd9214b2a70bcfa9137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import { client } from "../client";
import { unescapeChat } from "../encoding";
import { getFilenameFromPath } from "../utils/paths";

export const addTrack = (trackname: string) => {
  const newentry = <HTMLOptionElement>document.createElement("OPTION");
  const songName = getFilenameFromPath(trackname);
  newentry.text = unescapeChat(songName);
  newentry.value = trackname;
  (<HTMLSelectElement>document.getElementById("client_musiclist")).options.add(
    newentry,
  );
  client.musics.push(trackname);
};