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