mapcomplete/all_themes_index.ts

58 lines
2 KiB
TypeScript
Raw Normal View History

2022-10-27 01:50:41 +02:00
import MinimapImplementation from "./UI/Base/MinimapImplementation"
2022-09-20 16:03:28 +02:00
import { Utils } from "./Utils"
2022-09-08 21:40:48 +02:00
import AllThemesGui from "./UI/AllThemesGui"
import { QueryParameters } from "./Logic/Web/QueryParameters"
import StatisticsGUI from "./UI/StatisticsGUI"
import { FixedUiElement } from "./UI/Base/FixedUiElement"
2022-10-27 01:50:41 +02:00
import { PdfExportGui } from "./UI/BigComponents/PdfExportGui"
const layout = QueryParameters.GetQueryParameter("layout", undefined).data ?? ""
const customLayout = QueryParameters.GetQueryParameter("userlayout", undefined).data ?? ""
2022-09-08 21:40:48 +02:00
const l = window.location
2022-01-26 21:40:38 +01:00
if (layout !== "") {
if (window.location.host.startsWith("127.0.0.1")) {
2022-09-08 21:40:48 +02:00
window.location.replace(
l.protocol +
"//" +
window.location.host +
"/theme.html" +
l.search +
"&layout=" +
layout +
l.hash
)
2022-01-26 21:40:38 +01:00
} else {
2022-09-08 21:40:48 +02:00
window.location.replace(
l.protocol + "//" + window.location.host + "/" + layout + ".html" + l.search + l.hash
)
}
2022-01-26 21:40:38 +01:00
} else if (customLayout !== "") {
2022-09-08 21:40:48 +02:00
window.location.replace(
l.protocol + "//" + window.location.host + "/theme.html" + l.search + l.hash
)
}
2021-12-21 18:35:15 +01:00
Utils.DisableLongPresses()
2022-09-08 21:40:48 +02:00
document.getElementById("decoration-desktop").remove()
const mode = QueryParameters.GetQueryParameter(
"mode",
"map",
"The mode the application starts in, e.g. 'statistics'"
)
2022-08-24 16:02:16 +02:00
if (mode.data === "statistics") {
console.log("Statistics mode!")
new FixedUiElement("").AttachTo("centermessage")
2022-08-30 14:34:22 +02:00
new StatisticsGUI().SetClass("w-full h-full pointer-events-auto").AttachTo("topleft-tools")
2022-10-27 01:50:41 +02:00
} else if (mode.data === "pdf") {
MinimapImplementation.initialize()
2022-09-18 15:26:27 +02:00
new FixedUiElement("").AttachTo("centermessage")
const div = document.createElement("div")
div.id = "extra_div_for_maps"
2022-09-20 16:03:28 +02:00
new PdfExportGui(div.id).SetClass("pointer-events-auto").AttachTo("topleft-tools")
2022-09-18 15:26:27 +02:00
document.getElementById("topleft-tools").appendChild(div)
2022-09-08 21:40:48 +02:00
} else {
new AllThemesGui().setup()
2022-08-24 16:02:16 +02:00
}