export default class Helpers { //@ts-expect-error readonly chatListScroll = $("#chatlist").tinyscrollbar(); isColor(strColor: string): boolean { const s = new Option().style; s.color = strColor; return s.color !== ""; } suicide(msg: string): void { document.body.innerHTML = /* html */ `
${msg}
`; throw new Error( "This page has committed suicide by design, that's a feature!" ); } updateScrollbar(update: string) { $(this.chatListScroll).data().plugin_tinyscrollbar.update(update); } get getRandomColor(): string { return "#" + (Math.random().toString(16) + "000000").substring(2, 8); } get getUsername(): string { let username = prompt("Gimme your name: "); if (username === null) { this.suicide("You should give me your name!"); throw new Error("NoNameError"); } username = username.trim(); if (username === "Server") { this.suicide("That name is illegal!"); throw new Error("IllegalNameError"); } return username; } }