2020-08-31 02:59:47 +02:00
|
|
|
import {UIEventSource} from "./Logic/UIEventSource";
|
2020-09-02 11:37:34 +02:00
|
|
|
import {GenerateEmpty} from "./UI/CustomGenerator/GenerateEmpty";
|
2020-09-10 19:33:06 +02:00
|
|
|
import {TagRendering} from "./UI/TagRendering";
|
2020-09-03 00:00:37 +02:00
|
|
|
import {LayoutConfigJson} from "./Customizations/JSON/LayoutConfigJson";
|
2020-09-03 16:44:48 +02:00
|
|
|
import {OsmConnection} from "./Logic/Osm/OsmConnection";
|
|
|
|
import CustomGeneratorPanel from "./UI/CustomGenerator/CustomGeneratorPanel";
|
|
|
|
import {LocalStorageSource} from "./Logic/Web/LocalStorageSource";
|
2020-08-31 02:59:47 +02:00
|
|
|
|
2020-09-03 02:05:09 +02:00
|
|
|
let layout = GenerateEmpty.createEmptyLayout();
|
2020-09-03 16:44:48 +02:00
|
|
|
if (window.location.hash.length > 10) {
|
2020-09-03 00:00:37 +02:00
|
|
|
layout = JSON.parse(atob(window.location.hash.substr(1))) as LayoutConfigJson;
|
2020-09-03 16:44:48 +02:00
|
|
|
} else {
|
|
|
|
const hash = LocalStorageSource.Get("last-custom-theme").data
|
|
|
|
if (hash !== undefined) {
|
2020-09-03 19:05:18 +02:00
|
|
|
console.log("Using theme from local storage")
|
2020-09-03 16:44:48 +02:00
|
|
|
layout = JSON.parse(atob(hash)) as LayoutConfigJson;
|
|
|
|
}
|
2020-09-03 00:00:37 +02:00
|
|
|
}
|
2020-08-31 02:59:47 +02:00
|
|
|
|
2020-09-02 11:37:34 +02:00
|
|
|
TagRendering.injectFunction();
|
2020-08-31 02:59:47 +02:00
|
|
|
|
2020-09-03 16:44:48 +02:00
|
|
|
const connection = new OsmConnection(false, new UIEventSource<string>(undefined), "customGenerator", false);
|
2020-09-02 11:37:34 +02:00
|
|
|
|
2020-09-03 16:44:48 +02:00
|
|
|
new CustomGeneratorPanel(connection, layout)
|
2020-09-02 11:37:34 +02:00
|
|
|
.AttachTo("maindiv");
|
2020-08-08 21:17:17 +02:00
|
|
|
|