import CONFIG from "./config.json"; import createDebug from "debug"; import {gateway_connect, GatewayClient} from "./gateway.ts"; const logger = createDebug("main"); logger(`Hello, world! StarKingdoms ${APP_VERSION} (${COMMIT_HASH}) at your service`); export interface GlobalData { client: GatewayClient | null } export const global: GlobalData = { client: null } const version_string = `StarKingdoms ${APP_VERSION} (${COMMIT_HASH}) made with by the StarKingdoms team`; document.getElementById("footer")!.innerHTML = version_string; // Dropdown stuff const custom_select = document.querySelector(".fm-select")!; const custom_select_btn = document.querySelector(".fm-select-button")!; custom_select_btn.addEventListener("click", (e) => { e.preventDefault(); custom_select.classList.toggle("active"); custom_select_btn.setAttribute("aria-expanded", custom_select_btn.getAttribute("aria-expanded") === "true" ? "false" : "true"); }); const selected_value = document.querySelector(".fm-selected-value")!; // Populate the main page server selector interface ConfigServer { name: string; url: string; api: string; } let inverse_server_lookup: {[name: string]: string} = {}; const dropdown = document.getElementById("fm-select-dropdown")!; for (let server_id in CONFIG.servers) { // @ts-ignore not sure why this complains let server: ConfigServer = CONFIG.servers[server_id]; let is_first = Object.keys(inverse_server_lookup).length == 0; let html_text = `