From 02ce4e5d7e99c5e490d42006e1b174f8bca727cd Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 23 Nov 2020 03:13:52 +0100 Subject: [PATCH] Small workaround for share api which does not share the hash --- InitUiElements.ts | 5 +++++ State.ts | 2 +- UI/ShareButton.ts | 3 +++ assets/layers/bike_shop/bike_shop.json | 3 ++- css/fullscreenmessagebox.css | 2 +- css/tagrendering.css | 1 + 6 files changed, 13 insertions(+), 3 deletions(-) diff --git a/InitUiElements.ts b/InitUiElements.ts index 6af20b870..711e1a6c7 100644 --- a/InitUiElements.ts +++ b/InitUiElements.ts @@ -85,6 +85,11 @@ export class InitUiElements { throw "Incorrect layout" } + const hashContent = QueryParameters.GetQueryParameter("hash_content", "", "A workaround for the share-api which doesn't share the hash..."); + if((hashContent.data ?? "") !== ""){ + window.location.hash = hashContent.data; + } + console.log("Using layout: ", layoutToUse.id, "LayoutFromBase64 is ", layoutFromBase64); State.state = new State(layoutToUse); diff --git a/State.ts b/State.ts index d39363069..235227ac1 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.2.2"; + public static vNumber = "0.2.2a"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/UI/ShareButton.ts b/UI/ShareButton.ts index 9fadc9451..a94c55da0 100644 --- a/UI/ShareButton.ts +++ b/UI/ShareButton.ts @@ -12,6 +12,9 @@ export default class ShareButton extends UIElement{ super(); this._embedded = embedded; this._shareData = shareData; + if(this._shareData.url.indexOf("#")> 0){ + this._shareData.url = this._shareData.url.replace("#","&hash_content="); + } } InnerRender(): string { diff --git a/assets/layers/bike_shop/bike_shop.json b/assets/layers/bike_shop/bike_shop.json index 1a931461c..3d1d6c988 100644 --- a/assets/layers/bike_shop/bike_shop.json +++ b/assets/layers/bike_shop/bike_shop.json @@ -197,7 +197,8 @@ }, "phonelink", "wikipedialink", - "osmlink" + "osmlink", + "sharelink" ], "description": { "en": "A shop specifically selling bicycles or related items", diff --git a/css/fullscreenmessagebox.css b/css/fullscreenmessagebox.css index dba3e476d..97dc0d5e8 100644 --- a/css/fullscreenmessagebox.css +++ b/css/fullscreenmessagebox.css @@ -31,7 +31,7 @@ padding: 0.5em; width: 100%; box-sizing: border-box; - border-bottom: 2px solid var(--foreground-color); + } .to-the-map span { diff --git a/css/tagrendering.css b/css/tagrendering.css index c8e0f687c..76bbf9282 100644 --- a/css/tagrendering.css +++ b/css/tagrendering.css @@ -24,6 +24,7 @@ font-weight: bold; display: flex; justify-content: space-between; + border-bottom: 2px solid var(--foreground-color); } .featureinfobox-content {