diff --git a/car_maxspeed.json b/car_maxspeed.json index 034b6b9..b19606e 100644 --- a/car_maxspeed.json +++ b/car_maxspeed.json @@ -21,8 +21,8 @@ "{% set unit = null %}", "", "{% if tags.maxspeed is defined %}", - " {% if tags.maxspeed == 'none' %}", - " {% set maxspeed = 'none' %}", + " {% if const.colorOther[tags.maxspeed] %}", + " {% set maxspeed = tags.maxspeed %}", " {% elseif tags.maxspeed|matches(\"^[0-9]+$\") %}", " {% set maxspeedKmh = tags.maxspeed %}", " {% set maxspeed = tags.maxspeed %}", @@ -36,8 +36,9 @@ "{% endif %}", "", "{% if attribute(tags, 'maxspeed:forward') is defined %}", - " {% if attribute(tags, 'maxspeed:forward') == 'none' %}", - " {% set maxspeedF = 'none' %}", + " {% set x = attribute(tags, 'maxspeed:forward') %}", + " {% if const.colorOther[x] %}", + " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}", " {% elseif attribute(tags, 'maxspeed:forward')|matches(\"^[0-9]+$\") %}", " {% set maxspeedFKmh = attribute(tags, 'maxspeed:forward') %}", " {% set maxspeedF = attribute(tags, 'maxspeed:forward') %}", @@ -51,8 +52,9 @@ "{% endif %}", "", "{% if attribute(tags, 'maxspeed:backward') is defined %}", - " {% if attribute(tags, 'maxspeed:backward') == 'none' %}", - " {% set maxspeedB = 'none' %}", + " {% set x = attribute(tags, 'maxspeed:backward') %}", + " {% if const.colorOther[x] %}", + " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}", " {% elseif attribute(tags, 'maxspeed:backward')|matches(\"^[0-9]+$\") %}", " {% set maxspeedBKmh = attribute(tags, 'maxspeed:backward') %}", " {% set maxspeedB = attribute(tags, 'maxspeed:backward') %}", @@ -65,8 +67,8 @@ " {% endif %}", "{% endif %}", "", - "{% if maxspeed == 'none' %}", - "{% set color = \"#0000ff\" %}", + "{% if const.colorOther[maxspeed] %}", + "{% set color = const.colorOther[maxspeed] %}", "{% elseif not maxspeedKmh %}", "{% set color = \"#404040\" %}", "{% else %}", @@ -87,9 +89,9 @@ ], "description": [ "{% if maxspeedF or maxspeedB %}", - "{{ maxspeedB == 'none' ? tagTrans('maxspeed', 'none') : maxspeedB|default(trans('unknown')) }} / {{ maxspeedF == 'none' ? tagTrans('maxspeed', 'none') : maxspeedF|default(trans('unknown')) }} {{ unit }}", + "{{ const.colorOther[maxspeedB] ? tagTrans('maxspeed', maxspeedB) : maxspeedB|default(trans('unknown')) }} / {{ const.colorOther[maxspeedF] ? tagTrans('maxspeed', maxspeedF) : maxspeedF|default(trans('unknown')) }} {{ unit }}", "{% elseif maxspeed %}", - "{{ maxspeed == 'none' ? tagTrans('maxspeed', 'none') : maxspeed }} {{ unit }}", + "{{ const.colorOther[maxspeed] ? tagTrans('maxspeed', maxspeed) : maxspeed }} {{ unit }}", "{% elseif tags.maxspeed %}", "{{ tags.maxspeed }}", "{% else %}", @@ -131,6 +133,10 @@ "#ff0000", "#af00af" ], + "colorOther": { + "none": "#0000ff", + "walk": "#00afff" + }, "highestColorSpeed": 150, "offsetColorSpeed": 10 }, @@ -141,6 +147,10 @@ "