forked from MapComplete/MapComplete
Fixed some typos, fixed legacy loading in non-legacy settings, also show attribution when layer control is disabled
This commit is contained in:
parent
4a3537f925
commit
b441e6e8a5
8 changed files with 75 additions and 60 deletions
26
index.ts
26
index.ts
|
@ -70,13 +70,19 @@ let layoutToUse: LayoutConfig = AllKnownLayouts.allKnownLayouts.get(defaultLayou
|
|||
const userLayoutParam = QueryParameters.GetQueryParameter("userlayout", "false", "If not 'false', a custom (non-official) theme is loaded. This custom layout can be done in multiple ways: \n\n- The hash of the URL contains a base64-encoded .json-file containing the theme definition\n- The hash of the URL contains a lz-compressed .json-file, as generated by the custom theme generator\n- The parameter itself is an URL, in which case that URL will be downloaded. It should point to a .json of a theme");
|
||||
|
||||
// Workaround/legacy to keep the old paramters working as I renamed some of them
|
||||
if(layoutToUse?.id === "cyclofix"){
|
||||
QueryParameters.GetQueryParameter("layer-bike_shops", "true", "Legacy - keep De Fietsambassade working").syncWith(
|
||||
QueryParameters.GetQueryParameter("layer-bike_shop","true","Legacy - keep De Fietsambassade working")
|
||||
)
|
||||
const bikecafes = QueryParameters.GetQueryParameter("layer-bike_cafes", "true", "Legacy - keep De Fietsambassade working").syncWith(
|
||||
QueryParameters.GetQueryParameter("layer-bike_cafe","true","Legacy - keep De Fietsambassade working")
|
||||
)
|
||||
if (layoutToUse?.id === "cyclofix") {
|
||||
const legacy = QueryParameters.GetQueryParameter("layer-bike_shops", "true", "Legacy - keep De Fietsambassade working");
|
||||
const correct = QueryParameters.GetQueryParameter("layer-bike_shop", "true", "Legacy - keep De Fietsambassade working")
|
||||
if(legacy.data !== "true"){
|
||||
correct.setData(legacy.data)
|
||||
}
|
||||
console.log("layer-bike_shop toggles: legacy:",legacy.data, "new:", correct.data)
|
||||
|
||||
const legacyCafe = QueryParameters.GetQueryParameter("layer-bike_cafes", "true", "Legacy - keep De Fietsambassade working")
|
||||
const correctCafe = QueryParameters.GetQueryParameter("layer-bike_cafe", "true", "Legacy - keep De Fietsambassade working")
|
||||
if(legacyCafe.data !== "true"){
|
||||
correctCafe.setData(legacy.data)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,7 +104,7 @@ if (layoutFromBase64.startsWith("http")) {
|
|||
try {
|
||||
console.log("Received ", data)
|
||||
let parsed = data;
|
||||
if(typeof parsed == "string"){
|
||||
if (typeof parsed == "string") {
|
||||
parsed = JSON.parse(data);
|
||||
}
|
||||
// Overwrite the id to the wiki:value
|
||||
|
@ -129,10 +135,10 @@ if (layoutFromBase64.startsWith("http")) {
|
|||
// This is the default case: a builtin theme
|
||||
InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout);
|
||||
} else {
|
||||
// We fall through: no theme loaded: just show a few buttons
|
||||
// We fall through: no theme loaded: just show an overview of layouts
|
||||
State.state = new State(undefined);
|
||||
new Combine([new MoreScreen(true),
|
||||
Translations.t.general.aboutMapcomplete
|
||||
Translations.t.general.aboutMapcomplete.SetClass("link-underline")
|
||||
]).SetClass("block m-5 lg:w-3/4 lg:ml-40")
|
||||
.SetStyle("pointer-events: all;")
|
||||
.AttachTo("topleft-tools");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue