diff --git a/car_maxspeed.json b/car_maxspeed.json index b5d8102..c3da28d 100644 --- a/car_maxspeed.json +++ b/car_maxspeed.json @@ -32,6 +32,8 @@ " {% set maxspeedKmh = m[1] * 1.60934 %}", " {% set maxspeed = m[1] %}", " {% set unit = \"mph\" %}", + " {% else %}", + " {% set maxspeed = 'other' %}", " {% endif %}", "{% endif %}", "", @@ -48,6 +50,8 @@ " {% set maxspeedFKmh = m[1] * 1.60934 %}", " {% set maxspeedF = m[1] %}", " {% set unit = \"mph\" %}", + " {% else %}", + " {% set maxspeedF = 'other' %}", " {% endif %}", "{% endif %}", "", @@ -64,6 +68,8 @@ " {% set maxspeedBKmh = m[1] * 1.60934 %}", " {% set maxspeedB = m[1] %}", " {% set unit = \"mph\" %}", + " {% else %}", + " {% set maxspeedB = 'other' %}", " {% endif %}", "{% endif %}", "", @@ -75,23 +81,23 @@ "{% set color = colorInterpolate(const.colorMap, (maxspeedKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}", "{% endif %}", "", - "{% if maxspeedF == 'none' %}", - "{% set colorF = \"#0000ff\" %}", + "{% if const.colorOther[maxspeedF] %}", + "{% set colorF = const.colorOther[maxspeedF] %}", "{% elseif maxspeedFKmh %}", "{% set colorF = colorInterpolate(const.colorMap, (maxspeedFKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}", "{% endif %}", "", - "{% if maxspeedB == 'none' %}", - "{% set colorB = \"#0000ff\" %}", + "{% if const.colorOther[maxspeedB] %}", + "{% set colorB = const.colorOther[maxspeedB] %}", "{% elseif maxspeedBKmh %}", "{% set colorB = colorInterpolate(const.colorMap, (maxspeedBKmh - const.offsetColorSpeed) / const.highestColorSpeed) %}", "{% endif %}" ], "description": [ "{% if maxspeedF or maxspeedB %}", - "{{ const.colorOther[maxspeedB] ? tagTrans('maxspeed', maxspeedB) : maxspeedB|default(trans('unknown')) }} / {{ const.colorOther[maxspeedF] ? tagTrans('maxspeed', maxspeedF) : maxspeedF|default(trans('unknown')) }} {{ unit }}", - "{% elseif maxspeed %}", - "{{ const.colorOther[maxspeed] ? tagTrans('maxspeed', maxspeed) : maxspeed }} {{ unit }}", + "{{ maxspeedB == 'other' ? attribute(tags, 'maxspeed:backward') : const.colorOther[maxspeedB] ? tagTrans('maxspeed', maxspeedB) : maxspeedB|default(trans('unknown')) }} / {{ maxspeedF == 'other' ? attribute(tags, 'maxspeed:forward') : const.colorOther[maxspeedF] ? tagTrans('maxspeed', maxspeedF) : maxspeedF|default(trans('unknown')) }} {{ unit }}", + "{% elseif maxspeed == 'other' %}", + "{{ maxspeed == 'other' ? tags.maxspeed : const.colorOther[maxspeed] ? tagTrans('maxspeed', maxspeed) : maxspeed }} {{ unit }}", "{% elseif tags.maxspeed %}", "{{ tags.maxspeed }}", "{% else %}", @@ -106,9 +112,9 @@ "color": "{{ color }}", "text": [ "{% if maxspeedB or maxspeedF %}", - " {% if maxspeedB %}🡸 {{ maxspeedB }} {% endif %}|{% if maxspeedF %} {{ maxspeedF }} 🡺{% endif %} ", + " {% if maxspeedB %}🡸 {{ maxspeedB == 'other' ? attribute(tags, 'maxspeed:backward') : maxspeedB }} {% endif %}|{% if maxspeedF %} {{ maxspeedF == 'other' ? attribute(tags, 'maxspeed:forward') : maxspeedF }} 🡺{% endif %} ", "{% else %}", - " {{ maxspeed }} ", + " {{ maxspeed == 'other' ? tags.maxspeed : maxspeed }} ", "{% endif %}" ], "textRepeat": "1", @@ -134,8 +140,9 @@ "#af00af" ], "colorOther": { - "none": "#0000ff", - "walk": "#00afff" + "none": "#ff00ff", + "walk": "#00afff", + "other": "#0000ff" }, "highestColorSpeed": 150, "offsetColorSpeed": 10 @@ -154,6 +161,10 @@ " {{ markerLine(evaluate({ \"maxspeed\": \"none\" }))|raw }}", " {{ tagTrans('maxspeed', 'none') }}", " ", + " ", + " {{ markerLine(evaluate({ \"maxspeed\": \"other\" }))|raw }}", + " {{ trans('other') }}", + " ", "", "
", "",