diff --git a/Logic/Actors/ImageSearcher.ts b/Logic/Actors/ImageSearcher.ts index 3ea510152..165442d6f 100644 --- a/Logic/Actors/ImageSearcher.ts +++ b/Logic/Actors/ImageSearcher.ts @@ -1,4 +1,4 @@ -import {ImagesInCategory, Wikidata, Wikimedia} from "../Web/Wikimedia"; +import {ImagesInCategory, Wikidata, Wikimedia} from "../ImageProviders/Wikimedia"; import {UIEventSource} from "../UIEventSource"; /** diff --git a/Logic/FeatureSource/DummyFeatureSource.ts b/Logic/FeatureSource/DummyFeatureSource.ts deleted file mode 100644 index 298f9e2c2..000000000 --- a/Logic/FeatureSource/DummyFeatureSource.ts +++ /dev/null @@ -1,12 +0,0 @@ -import FeatureSource from "./FeatureSource"; -import {UIEventSource} from "../UIEventSource"; - -export default class DummyFeatureSource implements FeatureSource{ - public readonly features: UIEventSource<{ feature: any; freshness: Date }[]>; - public readonly name: string = "Dummy (static) feature source"; - - constructor(features: UIEventSource<{ feature: any; freshness: Date }[]>) { - this.features = features; - } - -} \ No newline at end of file diff --git a/Logic/ImageProviders/AllImageProviders.ts b/Logic/ImageProviders/AllImageProviders.ts new file mode 100644 index 000000000..89ae0a142 --- /dev/null +++ b/Logic/ImageProviders/AllImageProviders.ts @@ -0,0 +1,9 @@ +import {Mapillary} from "./Mapillary"; +import {Wikimedia} from "./Wikimedia"; +import {Imgur} from "./Imgur"; + +export default class AllImageProviders{ + + public static ImageAttributionSource = [Imgur.singleton, Mapillary.singleton, Wikimedia.singleton] + +} \ No newline at end of file diff --git a/Logic/Web/ImageAttributionSource.ts b/Logic/ImageProviders/ImageAttributionSource.ts similarity index 91% rename from Logic/Web/ImageAttributionSource.ts rename to Logic/ImageProviders/ImageAttributionSource.ts index 689a32c46..451909cfb 100644 --- a/Logic/Web/ImageAttributionSource.ts +++ b/Logic/ImageProviders/ImageAttributionSource.ts @@ -5,7 +5,6 @@ import BaseUIElement from "../../UI/BaseUIElement"; export default abstract class ImageAttributionSource { - private _cache = new Map>() GetAttributionFor(url: string): UIEventSource { @@ -22,6 +21,7 @@ export default abstract class ImageAttributionSource { public abstract SourceIcon(backlinkSource?: string) : BaseUIElement; protected abstract DownloadAttribution(url: string): UIEventSource; + /*Converts a value to a URL. Can return null if not applicable*/ public PrepareUrl(value: string): string{ return value; } diff --git a/Logic/Web/Imgur.ts b/Logic/ImageProviders/Imgur.ts similarity index 100% rename from Logic/Web/Imgur.ts rename to Logic/ImageProviders/Imgur.ts diff --git a/Logic/Web/ImgurUploader.ts b/Logic/ImageProviders/ImgurUploader.ts similarity index 100% rename from Logic/Web/ImgurUploader.ts rename to Logic/ImageProviders/ImgurUploader.ts diff --git a/Logic/Web/Mapillary.ts b/Logic/ImageProviders/Mapillary.ts similarity index 100% rename from Logic/Web/Mapillary.ts rename to Logic/ImageProviders/Mapillary.ts diff --git a/Logic/Web/Wikimedia.ts b/Logic/ImageProviders/Wikimedia.ts similarity index 82% rename from Logic/Web/Wikimedia.ts rename to Logic/ImageProviders/Wikimedia.ts index 4668f3511..9d74b7769 100644 --- a/Logic/Web/Wikimedia.ts +++ b/Logic/ImageProviders/Wikimedia.ts @@ -4,6 +4,7 @@ import BaseUIElement from "../../UI/BaseUIElement"; import Svg from "../../Svg"; import {UIEventSource} from "../UIEventSource"; import Link from "../../UI/Base/Link"; +import {Utils} from "../../Utils"; /** * This module provides endpoints for wikipedia/wikimedia and others @@ -138,21 +139,28 @@ export class Wikimedia extends ImageAttributionSource { "api.php?action=query&prop=imageinfo&iiprop=extmetadata&" + "titles=" + filename + "&format=json&origin=*"; - console.log("Getting attribution at ", url) - $.getJSON(url, function (data) { - const licenseInfo = new LicenseInfo(); - const license = data.query.pages[-1].imageinfo[0].extmetadata; + Utils.downloadJson(url).then( + data =>{ + const licenseInfo = new LicenseInfo(); + const license = (data.query.pages[-1].imageinfo ?? [])[0]?.extmetadata; + if(license === undefined){ + console.error("This file has no usable metedata or license attached... Please fix the license info file yourself!") + source.setData(null) + return; + } - licenseInfo.artist = license.Artist?.value; - licenseInfo.license = license.License?.value; - licenseInfo.copyrighted = license.Copyrighted?.value; - licenseInfo.attributionRequired = license.AttributionRequired?.value; - licenseInfo.usageTerms = license.UsageTerms?.value; - licenseInfo.licenseShortName = license.LicenseShortName?.value; - licenseInfo.credit = license.Credit?.value; - licenseInfo.description = license.ImageDescription?.value; - source.setData(licenseInfo); - }); + licenseInfo.artist = license.Artist?.value; + licenseInfo.license = license.License?.value; + licenseInfo.copyrighted = license.Copyrighted?.value; + licenseInfo.attributionRequired = license.AttributionRequired?.value; + licenseInfo.usageTerms = license.UsageTerms?.value; + licenseInfo.licenseShortName = license.LicenseShortName?.value; + licenseInfo.credit = license.Credit?.value; + licenseInfo.description = license.ImageDescription?.value; + source.setData(licenseInfo); + } + ) + return source; } diff --git a/Logic/Osm/OsmPreferences.ts b/Logic/Osm/OsmPreferences.ts index cd688b89c..bff50eae6 100644 --- a/Logic/Osm/OsmPreferences.ts +++ b/Logic/Osm/OsmPreferences.ts @@ -97,7 +97,7 @@ export class OsmPreferences { public GetPreference(key: string, prefix: string = "mapcomplete-"): UIEventSource { key = prefix + key; - key = key.replace(/[:\\\/"' {}.%_]/g, '') + key = key.replace(/[:\\\/"' {}.%]/g, '') if (key.length >= 255) { throw "Preferences: key length to big"; } diff --git a/Models/Constants.ts b/Models/Constants.ts index 591d8d854..4bda2a0c3 100644 --- a/Models/Constants.ts +++ b/Models/Constants.ts @@ -2,7 +2,7 @@ import { Utils } from "../Utils"; export default class Constants { - public static vNumber = "0.8.0-rc2"; + public static vNumber = "0.8.0b"; // The user journey states thresholds when a new feature gets unlocked public static userJourney = { diff --git a/README.md b/README.md index 075cfc304..be23b733d 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ To develop or deploy a version of MapComplete, have a look [to the guide](Docs/D ## Translating MapComplete -The core strings and builting themes of MapComplete are translated on [Hosted Weblate](https://hosted.weblate.org/projects/mapcomplete/core/). +The core strings and builtin themes of MapComplete are translated on [Hosted Weblate](https://hosted.weblate.org/projects/mapcomplete/core/). You can easily make an account and start translating in their web-environment - no installation required. [![Translation status](https://hosted.weblate.org/widgets/mapcomplete/-/multi-blue.svg)](https://hosted.weblate.org/engage/mapcomplete/) diff --git a/UI/Image/AttributedImage.ts b/UI/Image/AttributedImage.ts index 260c5306f..43bfc3ea2 100644 --- a/UI/Image/AttributedImage.ts +++ b/UI/Image/AttributedImage.ts @@ -1,7 +1,7 @@ import Combine from "../Base/Combine"; import Attribution from "./Attribution"; import Img from "../Base/Img"; -import ImageAttributionSource from "../../Logic/Web/ImageAttributionSource"; +import ImageAttributionSource from "../../Logic/ImageProviders/ImageAttributionSource"; export class AttributedImage extends Combine { diff --git a/UI/Image/Attribution.ts b/UI/Image/Attribution.ts index 514bc475a..0fddcc6f3 100644 --- a/UI/Image/Attribution.ts +++ b/UI/Image/Attribution.ts @@ -3,7 +3,7 @@ import Translations from "../i18n/Translations"; import BaseUIElement from "../BaseUIElement"; import {VariableUiElement} from "../Base/VariableUIElement"; import {UIEventSource} from "../../Logic/UIEventSource"; -import {LicenseInfo} from "../../Logic/Web/Wikimedia"; +import {LicenseInfo} from "../../Logic/ImageProviders/Wikimedia"; export default class Attribution extends VariableUiElement { diff --git a/UI/Image/ImageCarousel.ts b/UI/Image/ImageCarousel.ts index a28d89a2c..7c5d90335 100644 --- a/UI/Image/ImageCarousel.ts +++ b/UI/Image/ImageCarousel.ts @@ -6,10 +6,9 @@ import {AttributedImage} from "./AttributedImage"; import BaseUIElement from "../BaseUIElement"; import Img from "../Base/Img"; import Toggle from "../Input/Toggle"; -import ImageAttributionSource from "../../Logic/Web/ImageAttributionSource"; -import {Wikimedia} from "../../Logic/Web/Wikimedia"; -import {Mapillary} from "../../Logic/Web/Mapillary"; -import {Imgur} from "../../Logic/Web/Imgur"; +import {Wikimedia} from "../../Logic/ImageProviders/Wikimedia"; +import {Imgur} from "../../Logic/ImageProviders/Imgur"; +import {Mapillary} from "../../Logic/ImageProviders/Mapillary"; export class ImageCarousel extends Toggle { diff --git a/UI/Image/ImageUploadFlow.ts b/UI/Image/ImageUploadFlow.ts index cf5881f64..58d9a3760 100644 --- a/UI/Image/ImageUploadFlow.ts +++ b/UI/Image/ImageUploadFlow.ts @@ -8,7 +8,7 @@ import BaseUIElement from "../BaseUIElement"; import LicensePicker from "../BigComponents/LicensePicker"; import Toggle from "../Input/Toggle"; import FileSelectorButton from "../Input/FileSelectorButton"; -import ImgurUploader from "../../Logic/Web/ImgurUploader"; +import ImgurUploader from "../../Logic/ImageProviders/ImgurUploader"; import UploadFlowStateUI from "../BigComponents/UploadFlowStateUI"; import LayerConfig from "../../Customizations/JSON/LayerConfig"; diff --git a/UI/ShowDataLayer.ts b/UI/ShowDataLayer.ts index 509ca2f5e..77e5eff9b 100644 --- a/UI/ShowDataLayer.ts +++ b/UI/ShowDataLayer.ts @@ -115,7 +115,7 @@ export default class ShowDataLayer { console.warn("No layer found for object (probably a now disabled layer)", feature, this._layerDict) return; } - if (layer.title === undefined && (layer.tagRenderings ?? []).length === 0) { + if (layer.title === undefined) { // No popup action defined -> Don't do anything return; } diff --git a/Utils.ts b/Utils.ts index 111939b1a..fa3e55ef8 100644 --- a/Utils.ts +++ b/Utils.ts @@ -1,5 +1,4 @@ import * as colors from "./assets/colors.json" -import {Util} from "leaflet"; export class Utils { @@ -324,6 +323,34 @@ export class Utils { } return result; } + + public static externalDownloadFunction: (url: string) => Promise; + + public static downloadJson(url: string): Promise{ + if(this.externalDownloadFunction !== undefined){ + return this.externalDownloadFunction(url) + } + + return new Promise( + (resolve, reject) => { + try{ + const xhr = new XMLHttpRequest(); + xhr.onload = () => { + if (xhr.status == 200) { + resolve(JSON.parse(xhr.response)) + } else { + reject(xhr.statusText) + } + }; + xhr.open('GET', url); + xhr.send(); + }catch(e){ + reject(e) + } + } + ) + + } /** * Triggers a 'download file' popup which will download the contents diff --git a/assets/contributors.json b/assets/contributors.json index 02c30c2ce..2b2edda4f 100644 --- a/assets/contributors.json +++ b/assets/contributors.json @@ -1 +1 @@ -{"contributors":[{"contributor":"Pieter Vander Vennet", "commits":738},{"contributor":"pietervdvn", "commits":718},{"contributor":"Weblate", "commits":35},{"contributor":"Tobias", "commits":35},{"contributor":"Christian Neumann", "commits":33},{"contributor":"Win Olario", "commits":31},{"contributor":"Pieter Fiers", "commits":31},{"contributor":"Sebastian Kürten", "commits":16},{"contributor":"Marco", "commits":16},{"contributor":"Joost", "commits":16},{"contributor":"ToastHawaii", "commits":15},{"contributor":"J. Lavoie", "commits":14},{"contributor":"Bavo Vanderghote", "commits":12},{"contributor":"Artem", "commits":12},{"contributor":"Supaplex", "commits":9},{"contributor":"Jacque Fresco", "commits":9},{"contributor":"Midgard", "commits":8},{"contributor":"Mateusz Konieczny", "commits":8},{"contributor":"yopaseopor", "commits":7},{"contributor":"Flo Edelmann", "commits":7},{"contributor":"Binnette", "commits":7},{"contributor":"Allan Nordhøy", "commits":7},{"contributor":"pelderson", "commits":6},{"contributor":"lvgx", "commits":6},{"contributor":"dependabot[bot]", "commits":6},{"contributor":"Alexey Shabanov", "commits":6},{"contributor":"SiegbjornSitumeang", "commits":4},{"contributor":"Polgár Sándor", "commits":4},{"contributor":"Hiroshi Miura", "commits":4},{"contributor":"vankos", "commits":3},{"contributor":"Léo Villeveygoux", "commits":3},{"contributor":"JCGF-OSM", "commits":3},{"contributor":"Jan Zabel", "commits":3},{"contributor":"Hosted Weblate", "commits":3},{"contributor":"David Haberthür", "commits":3},{"contributor":"快乐的老鼠宝宝", "commits":2},{"contributor":"Wiktor Przybylski", "commits":2},{"contributor":"Vinicius", "commits":2},{"contributor":"Stanislas Gueniffey", "commits":2},{"contributor":"Robin van der Linde", "commits":2},{"contributor":"riiga", "commits":2},{"contributor":"pbarban", "commits":2},{"contributor":"mic140", "commits":2},{"contributor":"Leo Alcaraz", "commits":2},{"contributor":"Jose Luis Infante", "commits":2},{"contributor":"Heiko", "commits":2},{"contributor":"graveelius", "commits":2},{"contributor":"Tomas Fiers", "commits":1},{"contributor":"Thibault Molleman", "commits":1},{"contributor":"tbowdecl97", "commits":1},{"contributor":"Sebastian", "commits":1},{"contributor":"Sean Young", "commits":1},{"contributor":"Schouppe Joost", "commits":1},{"contributor":"Noémie", "commits":1},{"contributor":"mozita", "commits":1},{"contributor":"Michał Targoński", "commits":1},{"contributor":"Iváns", "commits":1},{"contributor":"Eric Armijo", "commits":1},{"contributor":"Damian Pułka", "commits":1},{"contributor":"Carlos Ramos Carreño", "commits":1},{"contributor":"Beardhatcode", "commits":1}]} \ No newline at end of file +{"contributors":[{"contributor":"pietervdvn", "commits":794},{"contributor":"Pieter Vander Vennet", "commits":744},{"contributor":"Weblate", "commits":38},{"contributor":"Tobias", "commits":35},{"contributor":"Christian Neumann", "commits":33},{"contributor":"Win Olario", "commits":31},{"contributor":"Pieter Fiers", "commits":31},{"contributor":"Sebastian Kürten", "commits":17},{"contributor":"Joost", "commits":17},{"contributor":"Marco", "commits":16},{"contributor":"Artem", "commits":16},{"contributor":"Allan Nordhøy", "commits":16},{"contributor":"ToastHawaii", "commits":15},{"contributor":"Supaplex", "commits":14},{"contributor":"J. Lavoie", "commits":14},{"contributor":"Bavo Vanderghote", "commits":12},{"contributor":"Jacque Fresco", "commits":9},{"contributor":"Midgard", "commits":8},{"contributor":"Mateusz Konieczny", "commits":8},{"contributor":"yopaseopor", "commits":7},{"contributor":"Hosted Weblate", "commits":7},{"contributor":"Flo Edelmann", "commits":7},{"contributor":"Binnette", "commits":7},{"contributor":"pelderson", "commits":6},{"contributor":"lvgx", "commits":6},{"contributor":"dependabot[bot]", "commits":6},{"contributor":"Alexey Shabanov", "commits":6},{"contributor":"SiegbjornSitumeang", "commits":4},{"contributor":"Polgár Sándor", "commits":4},{"contributor":"Hiroshi Miura", "commits":4},{"contributor":"Wiktor Przybylski", "commits":3},{"contributor":"vankos", "commits":3},{"contributor":"Léo Villeveygoux", "commits":3},{"contributor":"JCGF-OSM", "commits":3},{"contributor":"Jan Zabel", "commits":3},{"contributor":"Erik Palm", "commits":3},{"contributor":"David Haberthür", "commits":3},{"contributor":"快乐的老鼠宝宝", "commits":2},{"contributor":"Vinicius", "commits":2},{"contributor":"Stanislas Gueniffey", "commits":2},{"contributor":"Robin van der Linde", "commits":2},{"contributor":"riiga", "commits":2},{"contributor":"pbarban", "commits":2},{"contributor":"mic140", "commits":2},{"contributor":"Leo Alcaraz", "commits":2},{"contributor":"Jose Luis Infante", "commits":2},{"contributor":"Heiko", "commits":2},{"contributor":"graveelius", "commits":2},{"contributor":"Damian Tokarski", "commits":2},{"contributor":"Tomas Fiers", "commits":1},{"contributor":"Thibault Molleman", "commits":1},{"contributor":"tbowdecl97", "commits":1},{"contributor":"Sebastian", "commits":1},{"contributor":"Sean Young", "commits":1},{"contributor":"Schouppe Joost", "commits":1},{"contributor":"Noémie", "commits":1},{"contributor":"mozita", "commits":1},{"contributor":"Michał Targoński", "commits":1},{"contributor":"liimee", "commits":1},{"contributor":"Jeff Huang", "commits":1},{"contributor":"Iváns", "commits":1},{"contributor":"Eric Armijo", "commits":1},{"contributor":"Damian Pułka", "commits":1},{"contributor":"Carlos Ramos Carreño", "commits":1},{"contributor":"Beardhatcode", "commits":1}]} \ No newline at end of file diff --git a/assets/themes/artwork/artwork.json b/assets/themes/artwork/artwork.json index 3ee69a002..d546c8250 100644 --- a/assets/themes/artwork/artwork.json +++ b/assets/themes/artwork/artwork.json @@ -378,7 +378,8 @@ "it": "Su quale sito web è possibile trovare altre informazioni riguardanti quest’opera?", "ru": "Есть ли сайт с более подробной информацией об этой работе?", "ja": "この作品についての詳しい情報はどのウェブサイトにありますか?", - "zh_Hant": "在那個網站能夠找到更多藝術品的資訊?" + "zh_Hant": "在那個網站能夠找到更多藝術品的資訊?", + "nb_NO": "Finnes det en nettside med mer info om dette kunstverket?" }, "render": { "en": "More information on this website", @@ -389,7 +390,8 @@ "it": "Ulteriori informazioni su questo sito web", "ru": "Больше информации на этом сайте", "ja": "Webサイトに詳細情報がある", - "zh_Hant": "這個網站有更多資訊" + "zh_Hant": "這個網站有更多資訊", + "nb_NO": "Mer info er å finne på denne nettsiden" }, "freeform": { "key": "website", @@ -398,14 +400,15 @@ }, { "question": { - "en": "Which wikidata-entry corresponds with this artwork?", - "nl": "Welk wikidata-item beschrijft dit kunstwerk?", - "fr": "Quelle entrée wikidata correspond à cette œuvre d'art ?", + "en": "Which Wikidata-entry corresponds with this artwork?", + "nl": "Welk Wikidata-item beschrijft dit kunstwerk?", + "fr": "Quelle entrée Wikidata correspond à cette œuvre d'art ?", "de": "Welcher Wikidata-Eintrag entspricht diesem Kunstwerk?", "it": "Quale elemento Wikidata corrisponde a quest’opera d’arte?", - "ru": "Какая запись в wikidata соответсвует этой работе?", - "ja": "このアートワークに関するwikidataのエントリーはどれですか?", - "zh_Hant": "這個藝術品有那個對應的 wikidata 項目?" + "ru": "Какая запись в Wikidata соответсвует этой работе?", + "ja": "このアートワークに関するWikidataのエントリーはどれですか?", + "zh_Hant": "這個藝術品有那個對應的 Wikidata 項目?", + "nb_NO": "Hvilken Wikipedia-oppføring samsvarer med dette kunstverket?" }, "render": { "en": "Corresponds with {wikidata}", @@ -415,7 +418,8 @@ "it": "Corrisponde a {wikidata}", "ru": "Запись об этой работе в wikidata: {wikidata}", "ja": "{wikidata}に関連する", - "zh_Hant": "與 {wikidata}對應" + "zh_Hant": "與 {wikidata}對應", + "nb_NO": "Samsvarer med {wikidata}" }, "freeform": { "key": "wikidata", diff --git a/assets/themes/climbing/climbing.json b/assets/themes/climbing/climbing.json index 774b5f3c0..13c2cbc73 100644 --- a/assets/themes/climbing/climbing.json +++ b/assets/themes/climbing/climbing.json @@ -437,14 +437,14 @@ "key": "description" } }, - {"#": "Rock type", + { + "#": "Rock type", "render": { "en": "The rock type is {_embedding_features_with_rock:rock} as stated on the surrounding crag" }, "freeform": { "key": "_embedding_features_with_rock:rock" } - }, "reviews" ], @@ -562,7 +562,7 @@ { "#": "Contained routes hist", "render": { - "en": "

Difficulties overview

{histogram(_difficulty_hist, , , 3.*:#56bd56, 4.*:#ffff59, 5.*:#ffad48, 6.*:#63a9ff, 7.*:#ff5858, 8.*:#000000, .*:#aaa )}" + "en": "

Difficulties overview

{histogram(_difficulty_hist)}" }, "condition": "_difficulty_hist!~\\[\\]" }, @@ -633,7 +633,8 @@ } ] }, - {"#": "Rock type (crag/rock/cliff only)", + { + "#": "Rock type (crag/rock/cliff only)", "question": { "en": "What is the rock type here?" }, @@ -652,9 +653,12 @@ } } ], - "condition": { - "or": ["climbing=crag","natural=cliff","natural=bare_rock"] + "or": [ + "climbing=crag", + "natural=cliff", + "natural=bare_rock" + ] } }, "reviews" @@ -731,15 +735,15 @@ }, "title": { "render": { - "en": "Possible climbing opportunity", - "nl": "Mogelijke klimgelegenheid", + "en": "Climbing opportunity?", + "nl": "Klimgelegenheid?", "de": "Klettermöglichkeit?", "ja": "登坂教室?", "nb_NO": "Klatremulighet?" } }, "description": { - "nl": "Een mogelijke klimgelegenheid?", + "nl": "Een klimgelegenheid?", "de": "Eine Klettergelegenheit?", "en": "A climbing opportunity?", "ja": "登坂教室?", diff --git a/assets/themes/speelplekken/license_info.json b/assets/themes/speelplekken/license_info.json index 6d463871d..24353cdc7 100644 --- a/assets/themes/speelplekken/license_info.json +++ b/assets/themes/speelplekken/license_info.json @@ -73,5 +73,25 @@ "sources": [ "https://www.antwerpen.be/" ] + }, + { + "authors": [ + "Createlli" + ], + "path": "social_image.jpg", + "license": "Logo (all rights reserved)", + "sources": [ + "" + ] + }, + { + "authors": [ + "Youtube.com" + ], + "path": "youtube.svg", + "license": "Logo (all rights reserved)", + "sources": [ + "Youtube.com" + ] } ] \ No newline at end of file diff --git a/assets/themes/speelplekken/social_image.jpg b/assets/themes/speelplekken/social_image.jpg new file mode 100644 index 000000000..f5aba81ec Binary files /dev/null and b/assets/themes/speelplekken/social_image.jpg differ diff --git a/assets/themes/speelplekken/speelplekken.json b/assets/themes/speelplekken/speelplekken.json index 998917e80..f5f1b98d9 100644 --- a/assets/themes/speelplekken/speelplekken.json +++ b/assets/themes/speelplekken/speelplekken.json @@ -4,13 +4,15 @@ "nl": "Welkom bij de groendoener!" }, "shortDescription": { + "*": "En jij? Wat ga jij doen in het groen?", "nl": "Speelplekken in de Antwerpse Zuidrand" }, "description": { "nl": "

Welkom bij de Groendoener!

De Zuidrand dat is spelen, ravotten, chillen, wandelen,… in het groen. Meer dan 200 grote en kleine speelplekken liggen er in parken, in bossen en op pleintjes te wachten om ontdekt te worden. De verschillende speelplekken werden getest én goedgekeurd door kinder- en jongerenreporters uit de Zuidrand. Met leuke challenges dagen de reporters jou uit om ook op ontdekking te gaan. Klik op een speelplek op de kaart, bekijk het filmpje en ga op verkenning!

Het project groendoener kadert binnen het strategisch project Beleefbare Open Ruimte in de Antwerpse Zuidrand en is een samenwerking tussen het departement Leefmilieu van provincie Antwerpen, Sportpret vzw, een OpenStreetMap-België Consultent en Createlli vzw. Het project kwam tot stand met steun van Departement Omgeving van de Vlaamse Overheid.
" }, "language": [ - "nl" + "nl", + "*" ], "maintainer": "MapComplete", "icon": "./assets/themes/speelplekken/logo.svg", @@ -21,7 +23,7 @@ "startLon": 4.449462, "startZoom": 12, "widenFactor": 0.05, - "socialImage": "", + "socialImage": "./assets/themes/speelplekken/social_image.jpg", "defaultBackgroundId": "CartoDB.Positron", "layers": [ { @@ -264,11 +266,13 @@ "render": "" } ], - "+iconOverlays": [{ - "if": "_video:id~*", - "then": "./assets/themes/speelplekken/youtube.svg", - "badge": true - }], + "+iconOverlays": [ + { + "if": "_video:id~*", + "then": "./assets/themes/speelplekken/youtube.svg", + "badge": true + } + ], "isShown": { "render": "yes", "mappings": [ diff --git a/langs/de.json b/langs/de.json index 8e15773ee..262610500 100644 --- a/langs/de.json +++ b/langs/de.json @@ -149,7 +149,7 @@ "codeContributionsBy": "MapComplete wurde von {contributors} und {hiddenCount} weiteren Beitragenden erstellt", "themeBy": "Thema betreut von {author}", "attributionContent": "

Alle Daten wurden bereitgestellt von OpenStreetMap, frei verwendbar unter der Open Database License.

" - } + } }, "favourite": { "panelIntro": "

Ihr persönliches Thema

Aktivieren Sie Ihre Lieblingsebenen aus allen offiziellen Themen", diff --git a/langs/en.json b/langs/en.json index 663c7887f..dda19d600 100644 --- a/langs/en.json +++ b/langs/en.json @@ -31,6 +31,7 @@ "loginWithOpenStreetMap": "Login with OpenStreetMap", "welcomeBack": "You are logged in, welcome back!", "loginToStart": "Login to answer this question", + "openStreetMapIntro": "

An Open Map

Wouldn't it be cool if there was a single map, which everyone could freely use and edit? A single place to store all geo-information? Then, all those websites with different, small and incompatible maps (which are always outdated) wouldn't be needed anymore.

OpenStreetMap is this map. The map data can be used for free (with attribution and publication of changes to that data). On top of that, everyone can freely add new data and fix errors. This website uses OpenStreetMap as well. All the data is from there, and your answers and corrections are added there as well.

A ton of people and application already use OpenStreetMap: Maps.me, OsmAnd, but also the maps at Facebook, Instagram, Apple-maps and Bing-maps are (partly) powered by OpenStreetMap. If you change something here, it'll be reflected in those applications too - after their next update!

", "search": { "search": "Search a location", "searching": "Searching…", @@ -71,6 +72,12 @@ "emailOf": "What is the email address of {category}?", "emailIs": "The email address of this {category} is {email}" }, + "morescreen": { + "intro": "

More thematic maps?

Do you enjoy collecting geodata?
There are more themes available.", + "requestATheme": "If you want a custom-built quest, request it in the issue tracker", + "streetcomplete": "Another, similar application is StreetComplete.", + "createYourOwnTheme": "Create your own MapComplete theme from scratch" + }, "sharescreen": { "intro": "

Share this map

Share this map by copying the link below and sending it to friends and family:", "addToHomeScreen": "

Add to your home screen

You can easily add this website to your smartphone home screen for a native feel. Click the 'add to home screen button' in the URL bar to do this.", @@ -90,11 +97,16 @@ "fsIncludeCurrentLayers": "Include the current layer choices", "fsIncludeCurrentLocation": "Include current location" }, - "morescreen": { - "intro": "

More thematic maps?

Do you enjoy collecting geodata?
There are more themes available.", - "requestATheme": "If you want a custom-built quest, request it in the issue tracker", - "streetcomplete": "Another, similar application is StreetComplete.", - "createYourOwnTheme": "Create your own MapComplete theme from scratch" + "attribution": { + "attributionTitle": "Attribution notice", + "attributionContent": "

All data is provided by OpenStreetMap, freely reusable under the Open DataBase License.

", + "themeBy": "Theme maintained by {author}", + "iconAttribution": { + "title": "Used icons" + }, + "mapContributionsBy": "The current visible data has edits made by {contributors}", + "mapContributionsByAndHidden": "The current visible data has edits made by {contributors} and {hiddenCount} more contributors", + "codeContributionsBy": "MapComplete has been built by {contributors} and {hiddenCount} more contributors" }, "readYourMessages": "Please, read all your OpenStreetMap-messages before adding a new point.", "fewChangesBefore": "Please, answer a few questions of existing points before adding a new point.", diff --git a/langs/themes/en.json b/langs/themes/en.json index 6f4d00ffb..62d68ac53 100644 --- a/langs/themes/en.json +++ b/langs/themes/en.json @@ -75,7 +75,7 @@ "render": "More information on this website" }, "4": { - "question": "Which wikidata-entry corresponds with this artwork?", + "question": "Which Wikidata-entry corresponds with this artwork?", "render": "Corresponds with {wikidata}" } } @@ -440,6 +440,21 @@ "4": { "question": "What is the difficulty of this climbing route according to the french/belgian system?", "render": "The difficulty is {climbing:grade:french} according to the french/belgian system" + }, + "5": { + "question": "How much bolts does this route have before reaching the moulinette?", + "render": "This route has {climbing:bolts} bolts", + "mappings": { + "0": { + "then": "This route is not bolted" + }, + "1": { + "then": "This route is not bolted" + } + } + }, + "7": { + "render": "The rock type is {_embedding_features_with_rock:rock} as stated on the surrounding crag" } }, "presets": { @@ -475,6 +490,9 @@ "3": { "render": "

Difficulties overview

{histogram(_difficulty_hist)}" }, + "4": { + "render": "

Contains {_contained_climbing_routes_count} routes

    {_contained_climbing_routes}
" + }, "5": { "render": "{name}", "question": "What is the name of this climbing opportunity?", @@ -493,6 +511,15 @@ "then": "A climbing crag - a single rock or cliff with at least a few climbing routes" } } + }, + "7": { + "question": "What is the rock type here?", + "render": "The rock type is {rock}", + "mappings": { + "0": { + "then": "Limestone" + } + } } }, "presets": { diff --git a/langs/themes/fr.json b/langs/themes/fr.json index 03b95f8c7..a20940d44 100644 --- a/langs/themes/fr.json +++ b/langs/themes/fr.json @@ -75,7 +75,7 @@ "render": "Plus d'info sûr ce site web" }, "4": { - "question": "Quelle entrée wikidata correspond à cette œuvre d'art ?", + "question": "Quelle entrée Wikidata correspond à cette œuvre d'art ?", "render": "Correspond à {wikidata}" } } diff --git a/langs/themes/ja.json b/langs/themes/ja.json index 05aaa6442..8253119ca 100644 --- a/langs/themes/ja.json +++ b/langs/themes/ja.json @@ -75,7 +75,7 @@ "render": "Webサイトに詳細情報がある" }, "4": { - "question": "このアートワークに関するwikidataのエントリーはどれですか?", + "question": "このアートワークに関するWikidataのエントリーはどれですか?", "render": "{wikidata}に関連する" } } diff --git a/langs/themes/nb_NO.json b/langs/themes/nb_NO.json index 13d398f25..de86503dd 100644 --- a/langs/themes/nb_NO.json +++ b/langs/themes/nb_NO.json @@ -60,6 +60,14 @@ "2": { "question": "Hvilken artist lagde dette?", "render": "Laget av {artist_name}" + }, + "3": { + "question": "Finnes det en nettside med mer info om dette kunstverket?", + "render": "Mer info er å finne på denne nettsiden" + }, + "4": { + "question": "Hvilken Wikipedia-oppføring samsvarer med dette kunstverket?", + "render": "Samsvarer med {wikidata}" } } } diff --git a/langs/themes/nl.json b/langs/themes/nl.json index 1bb42f8c5..057927163 100644 --- a/langs/themes/nl.json +++ b/langs/themes/nl.json @@ -79,7 +79,7 @@ "render": "Meer informatie op deze website" }, "4": { - "question": "Welk wikidata-item beschrijft dit kunstwerk?", + "question": "Welk Wikidata-item beschrijft dit kunstwerk?", "render": "Komt overeen met {wikidata}" } } @@ -239,7 +239,8 @@ } }, "campersite": { - "title": "Kampeersite" + "title": "Kampeersite", + "shortDescription": "Vind locaties waar je de nacht kan doorbrengen met je mobilehome" }, "climbing": { "title": "Open Klimkaart", @@ -347,6 +348,13 @@ "then": "Dit Klimgelegenheid heeft geen naam" } } + }, + "7": { + "mappings": { + "0": { + "then": "Kalksteen" + } + } } }, "presets": { @@ -361,7 +369,22 @@ "title": { "render": "Klimgelegenheid?" }, - "description": "Een klimgelegenheid?" + "description": "Een klimgelegenheid?", + "tagRenderings": { + "1": { + "mappings": { + "2": { + "then": "Klimmen is hier niet toegelaten" + }, + "1": { + "then": "Klimmen is hier niet toegelaten" + }, + "0": { + "then": "Klimmen is hier niet mogelijk" + } + } + } + } } }, "roamingRenderings": { @@ -449,6 +472,19 @@ "then": "Er zijn hier {climbing:speed} snelklimmuren" } } + }, + "1": { + "mappings": { + "1": { + "then": "Een omvattend element geeft aan dat een toelating nodig is om hier te klimmen
{_embedding_feature:access:description}" + }, + "0": { + "then": "Een omvattend element geeft aan dat dit publiek toegangkelijk is
{_embedding_feature:access:description}" + } + } + }, + "0": { + "question": "Is er een (onofficiële) website met meer informatie (b.v. met topos)?" } } }, @@ -939,4 +975,4 @@ } } } -} \ No newline at end of file +} diff --git a/langs/themes/ru.json b/langs/themes/ru.json index 316744512..99fc317db 100644 --- a/langs/themes/ru.json +++ b/langs/themes/ru.json @@ -75,7 +75,7 @@ "render": "Больше информации на этом сайте" }, "4": { - "question": "Какая запись в wikidata соответсвует этой работе?", + "question": "Какая запись в Wikidata соответсвует этой работе?", "render": "Запись об этой работе в wikidata: {wikidata}" } } diff --git a/langs/themes/zh_Hant.json b/langs/themes/zh_Hant.json index d1818cd10..73063a9d7 100644 --- a/langs/themes/zh_Hant.json +++ b/langs/themes/zh_Hant.json @@ -75,7 +75,7 @@ "render": "這個網站有更多資訊" }, "4": { - "question": "這個藝術品有那個對應的 wikidata 項目?", + "question": "這個藝術品有那個對應的 Wikidata 項目?", "render": "與 {wikidata}對應" } } diff --git a/preferences.ts b/preferences.ts index 4b1dce30a..1c1773a14 100644 --- a/preferences.ts +++ b/preferences.ts @@ -3,7 +3,6 @@ import Combine from "./UI/Base/Combine"; import {Button} from "./UI/Base/Button"; import {TextField} from "./UI/Input/TextField"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; -import {UIElement} from "./UI/UIElement"; import {UIEventSource} from "./Logic/UIEventSource"; import {Utils} from "./Utils"; import {SubtleButton} from "./UI/Base/SubtleButton"; diff --git a/scripts/ScriptUtils.ts b/scripts/ScriptUtils.ts index 220c9e280..86c358414 100644 --- a/scripts/ScriptUtils.ts +++ b/scripts/ScriptUtils.ts @@ -2,11 +2,20 @@ import {lstatSync, readdirSync, readFileSync} from "fs"; import * as https from "https"; import {LayerConfigJson} from "../Customizations/JSON/LayerConfigJson"; import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson"; +import * as fs from "fs"; +import {Utils} from "../Utils"; export default class ScriptUtils { + + + public static fixUtils() { + Utils.externalDownloadFunction = ScriptUtils.DownloadJSON + } + + public static readDirRecSync(path, maxDepth = 999): string[] { const result = [] - if(maxDepth <= 0){ + if (maxDepth <= 0) { return [] } for (const entry of readdirSync(path)) { @@ -23,6 +32,20 @@ export default class ScriptUtils { return result; } + public static DownloadFileTo(url, targetFilePath: string): void { + console.log("Downloading ", url, "to", targetFilePath) + https.get(url, (res) => { + const filePath = fs.createWriteStream(targetFilePath); + res.pipe(filePath); + filePath.on('finish', () => { + filePath.close(); + console.log('Download Completed'); + }) + + + }) + } + public static DownloadJSON(url): Promise { return new Promise((resolve, reject) => { try { @@ -77,7 +100,7 @@ export default class ScriptUtils { }) } - public static getThemeFiles() : {parsed: LayoutConfigJson, path: string}[] { + public static getThemeFiles(): { parsed: LayoutConfigJson, path: string }[] { return ScriptUtils.readDirRecSync("./assets/themes") .filter(path => path.endsWith(".json")) .filter(path => path.indexOf("license_info.json") < 0) diff --git a/scripts/fixTheme.ts b/scripts/fixTheme.ts index b3d040469..e11bce26e 100644 --- a/scripts/fixTheme.ts +++ b/scripts/fixTheme.ts @@ -1,14 +1,18 @@ - /* * This script attempt to automatically fix some basic issues when a theme from the custom generator is loaded */ import {Utils} from "../Utils" Utils.runningFromConsole = true; + import {readFileSync, writeFileSync} from "fs"; import {LayoutConfigJson} from "../Customizations/JSON/LayoutConfigJson"; -import {Layer} from "leaflet"; import LayerConfig from "../Customizations/JSON/LayerConfig"; import SmallLicense from "../Models/smallLicense"; +import ScriptUtils from "./ScriptUtils"; +import AllImageProviders from "../Logic/ImageProviders/AllImageProviders"; + + +ScriptUtils.fixUtils() if(process.argv.length == 2){ console.log("USAGE: ts-node scripts/fixTheme ") @@ -22,7 +26,6 @@ console.log("Fixing up ", path) const themeConfigJson : LayoutConfigJson = JSON.parse(readFileSync(path, "UTF8")) -const linuxHints = [] const licenses : SmallLicense[] = [] const replacements: {source: string, destination: string}[] = [] @@ -40,15 +43,32 @@ for (const layerConfigJson of themeConfigJson.layers) { const layerConfig = new LayerConfig(layerConfigJson, true) const images : string[] = Array.from(layerConfig.ExtractImages()) const remoteImages = images.filter(img => img.startsWith("http")) + for (const remoteImage of remoteImages) { - linuxHints.push("wget " + remoteImage) + + + const filename = remoteImage.substring(remoteImage.lastIndexOf("/")) + ScriptUtils.DownloadFileTo(remoteImage, dir + "/" + filename) + + const imgPath = remoteImage.substring(remoteImage.lastIndexOf("/") + 1) - licenses.push({ - path: imgPath, - license: "", - authors: [], - sources: [remoteImage] - }) + + for (const attributionSrc of AllImageProviders.ImageAttributionSource) { + try { + attributionSrc.GetAttributionFor(remoteImage).addCallbackAndRun(license => { + console.log("Downloaded an attribution!") + licenses.push({ + path: imgPath, + license: license?.license ?? "", + authors:Utils.NoNull([license?.artist]), + sources: [remoteImage] + }) + }) + }catch(e){ + // Hush hush + } + } + replacements.push({source: remoteImage, destination: `${dir}/${imgPath}`}) } } @@ -58,13 +78,9 @@ for (const replacement of replacements) { fixedThemeJson = fixedThemeJson.replace(new RegExp(replacement.source, "g"), replacement.destination) } -const fixScriptPath = dir + "/fix_script_"+path.replace(/\//g,"_")+".sh" writeFileSync(dir + "/generated.license_info.json", JSON.stringify(licenses, null, " ")) -writeFileSync(fixScriptPath, linuxHints.join("\n")) writeFileSync(path+".autofixed.json", fixedThemeJson) console.log(`IMPORTANT: - 1) run ${fixScriptPath} - 2) Copy generated.license_info.json over into license_info.json and add the missing attributions and authors - 3) Verify ${path}.autofixed.json as theme, and rename it to ${path} - 4) Delete the fix script and other unneeded files`) \ No newline at end of file + 1) Copy generated.license_info.json over into license_info.json and add the missing attributions and authors + 2) Verify ${path}.autofixed.json as theme, and rename it to ${path}`) \ No newline at end of file diff --git a/scripts/generateCache.ts b/scripts/generateCache.ts index 8a91d709a..77dfa8653 100644 --- a/scripts/generateCache.ts +++ b/scripts/generateCache.ts @@ -16,9 +16,7 @@ import * as OsmToGeoJson from "osmtogeojson"; import MetaTagging from "../Logic/MetaTagging"; import LayerConfig from "../Customizations/JSON/LayerConfig"; import {GeoOperations} from "../Logic/GeoOperations"; -import {fail} from "assert"; import {UIEventSource} from "../Logic/UIEventSource"; -import DummyFeatureSource from "../Logic/FeatureSource/DummyFeatureSource"; function createOverpassObject(theme: LayoutConfig) { @@ -169,7 +167,7 @@ async function postProcess(targetdir: string, r: TileRange, theme: LayoutConfig, // Extract the relationship information const relations = ExtractRelations.BuildMembershipTable(ExtractRelations.GetRelationElements(rawOsm)) - MetaTagging.addMetatags(featuresFreshness, new DummyFeatureSource(new UIEventSource<{feature: any; freshness: Date}[]>(featuresFreshness)) , relations, theme.layers, false); + MetaTagging.addMetatags(featuresFreshness, new UIEventSource<{feature: any; freshness: Date}[]>(featuresFreshness) , relations, theme.layers, false); for (const feature of geojson.features) { diff --git a/test.ts b/test.ts index 1736e2aa9..cdc00c93f 100644 --- a/test.ts +++ b/test.ts @@ -9,7 +9,7 @@ import {SlideShow} from "./UI/Image/SlideShow"; import {FixedUiElement} from "./UI/Base/FixedUiElement"; import Img from "./UI/Base/Img"; import {AttributedImage} from "./UI/Image/AttributedImage"; -import {Imgur} from "./Logic/Web/Imgur"; +import {Imgur} from "./Logic/ImageProviders/Imgur"; import ReviewForm from "./UI/Reviews/ReviewForm"; import {OsmConnection} from "./Logic/Osm/OsmConnection";