forked from MapComplete/MapComplete
More work on the custom theme generator, add aed template, move bookcases to json template
This commit is contained in:
parent
146552e62c
commit
560c8e1567
34 changed files with 1048 additions and 590 deletions
|
@ -3,12 +3,42 @@ import {VariableUiElement} from "./UI/Base/VariableUIElement";
|
|||
import {UIEventSource} from "./Logic/UIEventSource";
|
||||
import {ThemeGenerator} from "./UI/CustomThemeGenerator/ThemeGenerator";
|
||||
import {Preview} from "./UI/CustomThemeGenerator/Preview";
|
||||
import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
|
||||
import {createHash} from "crypto";
|
||||
import Combine from "./UI/Base/Combine";
|
||||
import {Button} from "./UI/Base/Button";
|
||||
|
||||
const connection = new OsmConnection(true, new UIEventSource<string>(undefined), false);
|
||||
connection.AttemptLogin();
|
||||
|
||||
let hash = window.location.hash?.substr(1);
|
||||
const localStorage = LocalStorageSource.Get("last-custom-save");
|
||||
console.log("hash", hash)
|
||||
console.log("Saved: ", localStorage.data)
|
||||
|
||||
const themeGenerator = new ThemeGenerator(connection, window.location.hash?.substr(1));
|
||||
themeGenerator.AttachTo("layoutCreator")
|
||||
if (hash === undefined || hash === "") {
|
||||
const previous = localStorage.data.split("#");
|
||||
hash = previous[1];
|
||||
console.log("Using previously saved data ", hash)
|
||||
}
|
||||
|
||||
new Preview(themeGenerator.url, themeGenerator.themeObject).AttachTo("preview");
|
||||
const themeGenerator = new ThemeGenerator(connection, hash);
|
||||
themeGenerator.AttachTo("layoutCreator");
|
||||
themeGenerator.url.syncWith(localStorage);
|
||||
|
||||
new Combine([
|
||||
new Preview(themeGenerator.url, themeGenerator.themeObject),
|
||||
"<h2>Danger zone</h2>",
|
||||
new Button("Clear theme", () => {
|
||||
themeGenerator.themeObject.data.title = undefined;
|
||||
themeGenerator.themeObject.data.description = undefined;
|
||||
themeGenerator.themeObject.data.icon = undefined;
|
||||
themeGenerator.themeObject.data.language = ["en"];
|
||||
themeGenerator.themeObject.data.name = undefined;
|
||||
themeGenerator.themeObject.data.startLat = 0;
|
||||
themeGenerator.themeObject.data.startLon = 0;
|
||||
themeGenerator.themeObject.data.startZoom = 12;
|
||||
themeGenerator.themeObject.data.maintainer = connection.userDetails.data.name;
|
||||
themeGenerator.themeObject.data.layers = [];
|
||||
themeGenerator.themeObject.ping();
|
||||
})]).AttachTo("preview");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue