Fix loading of the hash of a custom theme, even if the custom theme is not loaded via the URL. Fixes 352

This commit is contained in:
Pieter Vander Vennet 2021-06-17 00:37:57 +02:00
parent 9a73ae4c47
commit 6c3b8b2020
2 changed files with 5 additions and 7 deletions

View file

@ -5,7 +5,6 @@ import {QueryParameters} from "./Logic/Web/QueryParameters";
import {UIEventSource} from "./Logic/UIEventSource";
import * as $ from "jquery";
import LayoutConfig from "./Customizations/JSON/LayoutConfig";
import {Utils} from "./Utils";
import MoreScreen from "./UI/BigComponents/MoreScreen";
import State from "./State";
import Combine from "./UI/Base/Combine";
@ -34,7 +33,6 @@ if (location.href.indexOf("buurtnatuur.be") >= 0) {
}
let testing: UIEventSource<string>;
if (location.hostname === "localhost" || location.hostname === "127.0.0.1") {
testing = QueryParameters.GetQueryParameter("test", "true");
@ -88,7 +86,7 @@ new Combine(["Initializing... <br/>",
new FixedUiElement("<a>If this message persist, something went wrong - click here to try again</a>")
.SetClass("link-underline small")
.onClick(() => {
localStorage.clear();
localStorage.clear();
window.location.reload(true);
})])
@ -136,8 +134,8 @@ if (layoutFromBase64.startsWith("http")) {
});
} else if (layoutFromBase64 !== "false") {
layoutToUse = InitUiElements.LoadLayoutFromHash(userLayoutParam);
InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout, location.hash.substr(1));
let [layoutToUse, encoded] = InitUiElements.LoadLayoutFromHash(userLayoutParam);
InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout, encoded);
} else if (layoutToUse !== undefined) {
// This is the default case: a builtin theme
InitUiElements.InitAll(layoutToUse, layoutFromBase64, testing, defaultLayout);