Move 'icons.json' into a regular library-layer

This commit is contained in:
Pieter Vander Vennet 2023-02-03 03:54:59 +01:00
parent 8bfd0d35ba
commit a8a5ce8ded
20 changed files with 167 additions and 139 deletions

View file

@ -320,7 +320,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": "service:bicycle:pump=yes",
@ -345,4 +345,4 @@
}
],
"deletion": true
}
}

View file

@ -781,7 +781,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": "service:bicycle:pump=yes",
@ -815,4 +815,4 @@
}
}
]
}
}

View file

@ -334,7 +334,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"label": {
@ -360,4 +360,4 @@
"da": "Et lag med caféer og pubber, hvor man kan samles omkring en drink. Laget stiller nogle relevante spørgsmål",
"fr": "Une couche montrants les cafés et pubs où lon peut prendre un verre. Cette couche pose des questions y afférentes."
}
}
}

View file

@ -166,7 +166,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"iconSize": {
@ -186,4 +186,4 @@
}
}
]
}
}

View file

@ -213,7 +213,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"iconSize": {
@ -246,4 +246,4 @@
]
}
]
}
}

View file

@ -94,7 +94,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
]
}
@ -102,4 +102,4 @@
"filter": [
"open_now"
]
}
}

View file

@ -402,7 +402,7 @@
"opening_hours~*"
]
},
"then": "isOpen"
"then": "icons.isOpen"
}
]
}
@ -410,4 +410,4 @@
"filter": [
"open_now"
]
}
}

View file

@ -1045,7 +1045,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": {
@ -1091,4 +1091,4 @@
"es": "Una capa que muestra restaurantes y facilidades de comida rápida",
"fr": "Un claque montrant les restaurants et les endroits de nourriture rapide (avec un rendu spécial pour les friteries)"
}
}
}

View file

@ -0,0 +1,131 @@
{
"id": "icons",
"description": {
"en": "A layer acting as library for icon-tagrenderings, especially to show as badge next to a POI"
},
"source": {
"osmTags": "id~*"
},
"title": null,
"tagRenderings": [
{
"id": "wikipedialink",
"labels": [
"defaults"
],
"render": "<a href='https://wikipedia.org/wiki/{wikipedia}' target='_blank'><img src='./assets/svg/wikipedia.svg' textmode='\uD83D\uDCD6' alt='Wikipedia'/></a>",
"condition": {
"or": [
"wikipedia~*",
"wikidata~*"
]
},
"mappings": [
{
"#": "ignore-image-in-then",
"if": "wikipedia=",
"then": "<a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'><img src='./assets/svg/wikidata.svg' alt='WD'/></a>"
}
]
},
{
"id": "isOpen",
"labels": [
"defaults"
],
"#": "Shows a coloured clock if opening hours are parsed. Uses the metatagging, suitable to use as a (badged) overlay",
"mappings": [
{
"if": "_isOpen=yes",
"then": "clock:#0f0;ring:#0f0"
},
{
"if": "_isOpen=no",
"then": "circle:#f00;clock:#fff"
},
{
"#": "Still loading the country",
"if": {
"and": [
"_isOpen=",
"opening_hours~*"
]
},
"then": "clock:#ff0;ring:#ff0"
},
{
"#": "Still loading the country",
"if": {
"and": [
"_isOpen=parse_error",
"opening_hours~*"
]
},
"then": "circle:#f0f;clock:#fff"
}
]
},
{
"id": "phonelink",
"labels": [
"defaults"
],
"render": "<a href='tel:{phone}'><img textmode='\uD83D\uDCDE' alt='phone' src='./assets/tagRenderings/phone.svg'/></a>",
"condition": "phone~*"
},
{
"id": "emaillink",
"labels": [
"defaults"
],
"render": "<a href='mailto:{email}'><img textmode='✉️' alt='email' src='./assets/tagRenderings/send_email.svg'/></a>",
"condition": "email~*"
},
{
"id": "smokingicon",
"labels": [
"defaults"
],
"mappings": [
{
"#": "ignore-image-in-then",
"if": "smoking=no",
"then": "<img textmode='\uD83D\uDEAD' alt='no-smoking' src='./assets/tagRenderings/no_smoking.svg'/>"
},
{
"#": "ignore-image-in-then",
"if": "smoking=yes",
"then": "<img textmode='\uD83D\uDEAC' alt='smoking-allowed' src='./assets/tagRenderings/smoking.svg'/>"
}
]
},
{
"id": "sharelink",
"labels": [
"defaults"
],
"render": "{share_link()}"
},
{
"id": "osmlink",
"labels": [
"defaults"
],
"render": "<a href='https://openstreetmap.org/{id}' target='_blank'><img alt='on osm' textmode='\uD83D\uDDFA' src='./assets/svg/osm-logo-us.svg'/></a>",
"mappings": [
{
"if": "id~.*/-.*",
"then": ""
},
{
"#": "ignore-image-in-then",
"if": "_backend~*",
"then": "<a href='{_backend}/{id}' target='_blank'><img src='./assets/svg/osm-logo-us.svg'/></a>"
}
],
"condition": "id~(node|way|relation)/[0-9]*"
}
],
"mapRendering": null
}

View file

@ -259,7 +259,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"iconSize": "40,40,center",
@ -269,4 +269,4 @@
]
}
]
}
}

View file

@ -119,7 +119,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"label": {
@ -173,4 +173,4 @@
}
}
]
}
}

View file

@ -578,7 +578,7 @@
"opening_hours~*"
]
},
"then": "isOpen"
"then": "icons.isOpen"
}
],
"iconSize": {
@ -616,4 +616,4 @@
}
}
]
}
}

View file

@ -433,7 +433,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": "shop~*",
@ -451,4 +451,4 @@
"width": "1"
}
]
}
}

View file

@ -326,7 +326,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": {
@ -411,4 +411,4 @@
"accepts_cards",
"has_organic"
]
}
}

View file

@ -553,7 +553,7 @@
"opening_hours~*"
]
},
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": {
@ -602,4 +602,4 @@
"filter": [
"open_now"
]
}
}

View file

@ -49,7 +49,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"location": [
@ -68,4 +68,4 @@
"filter": [
"open_now"
]
}
}

View file

@ -700,7 +700,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
],
"location": [
@ -755,4 +755,4 @@
]
}
]
}
}

View file

@ -372,7 +372,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
},
{
"if": "shop~*",
@ -466,4 +466,4 @@
]
}
]
}
}

View file

@ -79,7 +79,7 @@
"iconBadges": [
{
"if": "opening_hours~*",
"then": "isOpen"
"then": "icons.isOpen"
}
]
},
@ -116,4 +116,4 @@
"id": "vetName"
}
]
}
}

View file

@ -1,103 +0,0 @@
{
"id": "shared_icons",
"defaults": {
"builtin": [
"phonelink",
"emaillink",
"wikipedialink",
"smokingicon",
"osmlink",
"sharelink"
],
"override": {}
},
"wikipedialink": {
"render": "<a href='https://wikipedia.org/wiki/{wikipedia}' target='_blank'><img src='./assets/svg/wikipedia.svg' textmode='\uD83D\uDCD6' alt='Wikipedia'/></a>",
"condition": {
"or": [
"wikipedia~*",
"wikidata~*"
]
},
"mappings": [
{
"#": "ignore-image-in-then",
"if": "wikipedia=",
"then": "<a href='https://www.wikidata.org/wiki/{wikidata}' target='_blank'><img src='./assets/svg/wikidata.svg' alt='WD'/></a>"
}
]
},
"isOpen": {
"#": "Shows a coloured clock if opening hours are parsed. Uses the metatagging, suitable to use as a (badged) overlay",
"mappings": [
{
"if": "_isOpen=yes",
"then": "clock:#0f0;ring:#0f0"
},
{
"if": "_isOpen=no",
"then": "circle:#f00;clock:#fff"
},
{
"#": "Still loading the country",
"if": {
"and": [
"_isOpen=",
"opening_hours~*"
]
},
"then": "clock:#ff0;ring:#ff0"
},
{
"#": "Still loading the country",
"if": {
"and": [
"_isOpen=parse_error",
"opening_hours~*"
]
},
"then": "circle:#f0f;clock:#fff"
}
]
},
"phonelink": {
"render": "<a href='tel:{phone}'><img textmode='\uD83D\uDCDE' alt='phone' src='./assets/tagRenderings/phone.svg'/></a>",
"condition": "phone~*"
},
"emaillink": {
"render": "<a href='mailto:{email}'><img textmode='✉️' alt='email' src='./assets/tagRenderings/send_email.svg'/></a>",
"condition": "email~*"
},
"smokingicon": {
"mappings": [
{
"#": "ignore-image-in-then",
"if": "smoking=no",
"then": "<img textmode='\uD83D\uDEAD' alt='no-smoking' src='./assets/tagRenderings/no_smoking.svg'/>"
},
{
"#": "ignore-image-in-then",
"if": "smoking=yes",
"then": "<img textmode='\uD83D\uDEAC' alt='smoking-allowed' src='./assets/tagRenderings/smoking.svg'/>"
}
]
},
"osmlink": {
"render": "<a href='https://openstreetmap.org/{id}' target='_blank'><img alt='on osm' textmode='\uD83D\uDDFA' src='./assets/svg/osm-logo-us.svg'/></a>",
"mappings": [
{
"if": "id~.*/-.*",
"then": ""
},
{
"#": "ignore-image-in-then",
"if": "_backend~*",
"then": "<a href='{_backend}/{id}' target='_blank'><img src='./assets/svg/osm-logo-us.svg'/></a>"
}
],
"condition": "id~(node|way|relation)/[0-9]*"
},
"sharelink": {
"render": "{share_link()}"
}
}