Merge branch 'master' into develop

This commit is contained in:
pietervdvn 2021-06-22 15:25:18 +02:00
commit 26ff765e5f
37 changed files with 286 additions and 104 deletions

View file

@ -1,4 +1,4 @@
import {ImagesInCategory, Wikidata, Wikimedia} from "../Web/Wikimedia";
import {ImagesInCategory, Wikidata, Wikimedia} from "../ImageProviders/Wikimedia";
import {UIEventSource} from "../UIEventSource";
/**

View file

@ -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;
}
}

View file

@ -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]
}

View file

@ -5,7 +5,6 @@ import BaseUIElement from "../../UI/BaseUIElement";
export default abstract class ImageAttributionSource {
private _cache = new Map<string, UIEventSource<LicenseInfo>>()
GetAttributionFor(url: string): UIEventSource<LicenseInfo> {
@ -22,6 +21,7 @@ export default abstract class ImageAttributionSource {
public abstract SourceIcon(backlinkSource?: string) : BaseUIElement;
protected abstract DownloadAttribution(url: string): UIEventSource<LicenseInfo>;
/*Converts a value to a URL. Can return null if not applicable*/
public PrepareUrl(value: string): string{
return value;
}

View file

@ -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;
}

View file

@ -97,7 +97,7 @@ export class OsmPreferences {
public GetPreference(key: string, prefix: string = "mapcomplete-"): UIEventSource<string> {
key = prefix + key;
key = key.replace(/[:\\\/"' {}.%_]/g, '')
key = key.replace(/[:\\\/"' {}.%]/g, '')
if (key.length >= 255) {
throw "Preferences: key length to big";
}

View file

@ -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 = {

View file

@ -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/)

View file

@ -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 {

View file

@ -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 {

View file

@ -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 {

View file

@ -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";

View file

@ -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;
}

View file

@ -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<any>;
public static downloadJson(url: string): Promise<any>{
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

View file

@ -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}]}
{"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}]}

View file

@ -378,7 +378,8 @@
"it": "Su quale sito web è possibile trovare altre informazioni riguardanti questopera?",
"ru": "Есть ли сайт с более подробной информацией об этой работе?",
"ja": "この作品についての詳しい情報はどのウェブサイトにありますか?",
"zh_Hant": "在那個網站能夠找到更多藝術品的資訊?"
"zh_Hant": "在那個網站能夠找到更多藝術品的資訊?",
"nb_NO": "Finnes det en nettside med mer info om dette kunstverket?"
},
"render": {
"en": "More information on <a href='{website}' target='_blank'>this website</a>",
@ -389,7 +390,8 @@
"it": "Ulteriori informazioni su <a href='{website}' target='_blank'>questo sito web</a>",
"ru": "Больше информации на <a href='{website}' target='_blank'>этом сайте</a>",
"ja": "<a href='{website}' target='_blank'>Webサイト</a>に詳細情報がある",
"zh_Hant": "<a href='{website}' target='_blank'>這個網站</a>有更多資訊"
"zh_Hant": "<a href='{website}' target='_blank'>這個網站</a>有更多資訊",
"nb_NO": "Mer info er å finne på <a href='{website}' target='_blank'>denne nettsiden</a>"
},
"freeform": {
"key": "website",
@ -398,14 +400,15 @@
},
{
"question": {
"en": "Which wikidata-entry corresponds with <b>this artwork</b>?",
"nl": "Welk wikidata-item beschrijft dit kunstwerk?",
"fr": "Quelle entrée wikidata correspond à <b>cette œuvre d'art</b> ?",
"en": "Which Wikidata-entry corresponds with <b>this artwork</b>?",
"nl": "Welk Wikidata-item beschrijft dit kunstwerk?",
"fr": "Quelle entrée Wikidata correspond à <b>cette œuvre d'art</b> ?",
"de": "Welcher Wikidata-Eintrag entspricht <b>diesem Kunstwerk</b>?",
"it": "Quale elemento Wikidata corrisponde a <b>questopera darte</b>?",
"ru": "Какая запись в wikidata соответсвует <b>этой работе</b>?",
"ja": "<b>このアートワーク</b>に関するwikidataのエントリーはどれですか?",
"zh_Hant": "<b>這個藝術品</b>有那個對應的 wikidata 項目?"
"ru": "Какая запись в Wikidata соответсвует <b>этой работе</b>?",
"ja": "<b>このアートワーク</b>に関するWikidataのエントリーはどれですか?",
"zh_Hant": "<b>這個藝術品</b>有那個對應的 Wikidata 項目?",
"nb_NO": "Hvilken Wikipedia-oppføring samsvarer med <b>dette kunstverket</b>?"
},
"render": {
"en": "Corresponds with <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>",
@ -415,7 +418,8 @@
"it": "Corrisponde a <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>",
"ru": "Запись об этой работе в wikidata: <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>",
"ja": "<a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>に関連する",
"zh_Hant": "與 <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>對應"
"zh_Hant": "與 <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>對應",
"nb_NO": "Samsvarer med <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>"
},
"freeform": {
"key": "wikidata",

View file

@ -437,14 +437,14 @@
"key": "description"
}
},
{"#": "Rock type",
{
"#": "Rock type",
"render": {
"en": "The rock type is {_embedding_features_with_rock:rock} as stated <a href='#{_embedding_features_with_rock:id}'>on the surrounding crag</a>"
},
"freeform": {
"key": "_embedding_features_with_rock:rock"
}
},
"reviews"
],
@ -562,7 +562,7 @@
{
"#": "Contained routes hist",
"render": {
"en": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist, , , 3.*:#56bd56, 4.*:#ffff59, 5.*:#ffad48, 6.*:#63a9ff, 7.*:#ff5858, 8.*:#000000, .*:#aaa )}"
"en": "<h3>Difficulties overview</h3>{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": "登坂教室?",

View file

@ -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"
]
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 839 KiB

View file

@ -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": "<h3>Welkom bij de Groendoener!</h3>De Zuidrand dat is spelen, ravotten, chillen, wandelen,… in het groen. Meer dan <b>200 grote en kleine speelplekken</b> 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!<br/><br/>Het project groendoener kadert binnen het strategisch project <a href='https://www.provincieantwerpen.be/aanbod/dlm/samenwerkingsverbanden/zuidrand/projecten/strategisch-project-beleefbare-open-ruimte.html' target='_blank'>Beleefbare Open Ruimte in de Antwerpse Zuidrand</a> 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.<br/><img class='w-full md:w-1/2' src='./assets/themes/speelplekken/provincie_antwerpen.jpg'/><img class='w-full md:w-1/2' src='./assets/themes/speelplekken/Departement_Omgeving_Vlaanderen.png'/>"
},
"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": "<iframe style='width: 100%; height: 300px' src=\"https://www.youtube-nocookie.com/embed/{_video:id}\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen></iframe>"
}
],
"+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": [

View file

@ -149,7 +149,7 @@
"codeContributionsBy": "MapComplete wurde von {contributors} und <a href=\"https://github.com/pietervdvn/MapComplete/graphs/contributors\" target=\"_blank\">{hiddenCount} weiteren Beitragenden</a> erstellt",
"themeBy": "Thema betreut von {author}",
"attributionContent": "<p>Alle Daten wurden bereitgestellt von <a href=\"https://osm.org\" target=\"_blank\">OpenStreetMap</a>, frei verwendbar unter der <a href=\"https://osm.org/copyright\" target=\"_blank\">Open Database License</a>.</p>"
}
}
},
"favourite": {
"panelIntro": "<h3>Ihr persönliches Thema</h3>Aktivieren Sie Ihre Lieblingsebenen aus allen offiziellen Themen",

View file

@ -31,6 +31,7 @@
"loginWithOpenStreetMap": "Login with OpenStreetMap",
"welcomeBack": "You are logged in, welcome back!",
"loginToStart": "Login to answer this question",
"openStreetMapIntro": "<h3>An Open Map</h3><p>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.</p><p><b><a href='https://OpenStreetMap.org' target='_blank'>OpenStreetMap</a></b> is this map. The map data can be used for free (with <a href='https://osm.org/copyright' target='_blank'>attribution and publication of changes to that data</a>). 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.</p><p>A ton of people and application already use OpenStreetMap: <a href='https://maps.me/' target='_blank'>Maps.me</a>, <a href='https://osmAnd.net' target='_blank'>OsmAnd</a>, 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!</p>",
"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 <a href='mailto:{email}' target='_blank'>{email}</a>"
},
"morescreen": {
"intro": "<h3>More thematic maps?</h3>Do you enjoy collecting geodata? <br/>There are more themes available.",
"requestATheme": "If you want a custom-built quest, request it in the issue tracker",
"streetcomplete": "Another, similar application is <a href='https://play.google.com/store/apps/details?id=de.westnordost.streetcomplete' class='underline hover:text-blue-800' class='underline hover:text-blue-800' target='_blank'>StreetComplete</a>.",
"createYourOwnTheme": "Create your own MapComplete theme from scratch"
},
"sharescreen": {
"intro": "<h3>Share this map</h3> Share this map by copying the link below and sending it to friends and family:",
"addToHomeScreen": "<h3>Add to your home screen</h3>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": "<h3>More thematic maps?</h3>Do you enjoy collecting geodata? <br/>There are more themes available.",
"requestATheme": "If you want a custom-built quest, request it in the issue tracker",
"streetcomplete": "Another, similar application is <a href='https://play.google.com/store/apps/details?id=de.westnordost.streetcomplete' class='underline hover:text-blue-800' class='underline hover:text-blue-800' target='_blank'>StreetComplete</a>.",
"createYourOwnTheme": "Create your own MapComplete theme from scratch"
"attribution": {
"attributionTitle": "Attribution notice",
"attributionContent": "<p>All data is provided by <a href='https://osm.org' target='_blank'>OpenStreetMap</a>, freely reusable under <a href='https://osm.org/copyright' target='_blank'>the Open DataBase License</a>.</p>",
"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 <a href='https://github.com/pietervdvn/MapComplete/graphs/contributors' target='_blank'>{hiddenCount} more contributors</a>"
},
"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.",

View file

@ -75,7 +75,7 @@
"render": "More information on <a href='{website}' target='_blank'>this website</a>"
},
"4": {
"question": "Which wikidata-entry corresponds with <b>this artwork</b>?",
"question": "Which Wikidata-entry corresponds with <b>this artwork</b>?",
"render": "Corresponds with <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>"
}
}
@ -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 <a href='#{_embedding_features_with_rock:id}'>on the surrounding crag</a>"
}
},
"presets": {
@ -475,6 +490,9 @@
"3": {
"render": "<h3>Difficulties overview</h3>{histogram(_difficulty_hist)}"
},
"4": {
"render": "<h3>Contains {_contained_climbing_routes_count} routes</h3> <ul>{_contained_climbing_routes}</ul>"
},
"5": {
"render": "<strong>{name}</strong>",
"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": {

View file

@ -75,7 +75,7 @@
"render": "Plus d'info <a href='{website}' target='_blank'>sûr ce site web</a>"
},
"4": {
"question": "Quelle entrée wikidata correspond à <b>cette œuvre d'art</b> ?",
"question": "Quelle entrée Wikidata correspond à <b>cette œuvre d'art</b> ?",
"render": "Correspond à <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>"
}
}

View file

@ -75,7 +75,7 @@
"render": "<a href='{website}' target='_blank'>Webサイト</a>に詳細情報がある"
},
"4": {
"question": "<b>このアートワーク</b>に関するwikidataのエントリーはどれですか?",
"question": "<b>このアートワーク</b>に関するWikidataのエントリーはどれですか?",
"render": "<a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>に関連する"
}
}

View file

@ -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å <a href='{website}' target='_blank'>denne nettsiden</a>"
},
"4": {
"question": "Hvilken Wikipedia-oppføring samsvarer med <b>dette kunstverket</b>?",
"render": "Samsvarer med <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>"
}
}
}

View file

@ -79,7 +79,7 @@
"render": "Meer informatie op <a href='{website}' target='_blank'>deze website</a>"
},
"4": {
"question": "Welk wikidata-item beschrijft dit kunstwerk?",
"question": "Welk Wikidata-item beschrijft dit kunstwerk?",
"render": "Komt overeen met <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>"
}
}
@ -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": "<span class='subtle'>Een <a href='#{_embedding_feature:id}'>omvattend element</a> geeft aan dat</span> een toelating nodig is om hier te klimmen<br/>{_embedding_feature:access:description}"
},
"0": {
"then": "<span class='subtle'>Een <a href='#{_embedding_feature:id}'>omvattend element</a> geeft aan dat dit <span>publiek toegangkelijk is</span><br/>{_embedding_feature:access:description}"
}
}
},
"0": {
"question": "Is er een (onofficiële) website met meer informatie (b.v. met topos)?"
}
}
},
@ -939,4 +975,4 @@
}
}
}
}
}

View file

@ -75,7 +75,7 @@
"render": "Больше информации на <a href='{website}' target='_blank'>этом сайте</a>"
},
"4": {
"question": "Какая запись в wikidata соответсвует <b>этой работе</b>?",
"question": "Какая запись в Wikidata соответсвует <b>этой работе</b>?",
"render": "Запись об этой работе в wikidata: <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>"
}
}

View file

@ -75,7 +75,7 @@
"render": "<a href='{website}' target='_blank'>這個網站</a>有更多資訊"
},
"4": {
"question": "<b>這個藝術品</b>有那個對應的 wikidata 項目?",
"question": "<b>這個藝術品</b>有那個對應的 Wikidata 項目?",
"render": "與 <a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'>{wikidata}</a>對應"
}
}

View file

@ -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";

View file

@ -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<any> {
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)

View file

@ -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 <path to theme>")
@ -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`)
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}`)

View file

@ -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) {

View file

@ -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";