From f81de078f7ac9ad8115102b46b5eb972fad429f9 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 23 Oct 2020 02:15:58 +0200 Subject: [PATCH] Small improvements to 'createLayouts'-script --- Customizations/Layout.ts | 4 ++++ State.ts | 2 +- assets/themes/fritures/fritures.json | 4 ++-- createLayouts.ts | 9 +++++++++ index.html | 1 + 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Customizations/Layout.ts b/Customizations/Layout.ts index 70bc7dc..46252c6 100644 --- a/Customizations/Layout.ts +++ b/Customizations/Layout.ts @@ -18,6 +18,10 @@ export class Layout { public description: string | UIElement; public changesetMessage: string; public socialImage: string = ""; + /** + * Custom CSS link + */ + public customCss: string = undefined; public layers: (LayerDefinition | string)[]; public welcomeMessage: UIElement; diff --git a/State.ts b/State.ts index 43a88e0..f8e2909 100644 --- a/State.ts +++ b/State.ts @@ -23,7 +23,7 @@ export default class State { // The singleton of the global state public static state: State; - public static vNumber = "0.1.0g"; + public static vNumber = "0.1.1"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/assets/themes/fritures/fritures.json b/assets/themes/fritures/fritures.json index 6becab7..729974f 100644 --- a/assets/themes/fritures/fritures.json +++ b/assets/themes/fritures/fritures.json @@ -12,7 +12,7 @@ "fr" ], "maintainer": "", - "icon": "https://upload.wikimedia.org/wikipedia/commons/5/55/French_fries_juliane_kr_r.svg", + "icon": "./assets/themes/fritures/fries.svg", "version": "0", "startLat": 0, "startLon": 0, @@ -224,7 +224,7 @@ } ], "icon": { - "render": "https://upload.wikimedia.org/wikipedia/commons/5/55/French_fries_juliane_kr_r.svg" + "render": "./assets/themes/fritures/fries.svg" }, "width": { "render": "8" diff --git a/createLayouts.ts b/createLayouts.ts index 6032827..4bd7f59 100644 --- a/createLayouts.ts +++ b/createLayouts.ts @@ -1,6 +1,7 @@ import {UIElement} from "./UI/UIElement"; // We HAVE to mark this while importing UIElement.runningFromConsole = true; + import {AllKnownLayouts} from "./Customizations/AllKnownLayouts"; import {Layout} from "./Customizations/Layout"; import {readFileSync, writeFile, writeFileSync} from "fs"; @@ -206,6 +207,11 @@ function createLandingPage(layout: Layout) { const ogDescr = Translations.W(layout.description ?? "Easily add and edit geodata with OpenStreetMap")?.InnerRender(); const ogImage = layout.socialImage; + let customCss = ""; + if (layout.customCss !== undefined && layout.customCss !== "") { + customCss = ` @@ -214,6 +220,9 @@ function createLandingPage(layout: Layout) { let output = template .replace(`./manifest.manifest`, `./${enc(layout.id)}.webmanifest`) .replace("", og) + .replace(/.+?<\/title>/, `<title>${ogTitle}`) + .replace("Loading MapComplete, hang on...", `Loading MapComplete theme ${ogTitle}...`) + .replace("", customCss) .replace(``, ``); diff --git a/index.html b/index.html index ec97707..130f182 100644 --- a/index.html +++ b/index.html @@ -12,6 +12,7 @@ +