From 2107d19cb1db00c12e32dd76dec63b5c7f482e6b Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Fri, 30 Jul 2021 19:35:05 +0000 Subject: [PATCH] [map] Add information on air conditioning in the vehicle --- common.js | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/common.js b/common.js index af26776..3f7be8a 100644 --- a/common.js +++ b/common.js @@ -285,22 +285,44 @@ var span = document.createElement('span'); span.className = 'vehicleInfo'; + var text = ''; + var floor_type = ''; if(vehicleInfo.low === 0) { - setText(span, lang.high_floor_sign); + text += lang.high_floor_sign; floor_type = lang.high_floor; } else if(vehicleInfo.low === 1) { - setText(span, lang.partially_low_floor_sign); + text += lang.partially_low_floor_sign; floor_type = lang.partially_low_floor; } else if(vehicleInfo.low === 2) { - setText(span, lang.low_floor_sign); + text += lang.low_floor_sign; floor_type = lang.low_floor; } - span.title = lang.tram_type_pattern + var air_conditioning = ''; + if(vehicleInfo.ac) { + text += lang.air_conditioning_sign; + air_conditioning = lang.air_conditioning; + } + + setText(span, text); + + span.dataset.typeFull = lang.tram_type_pattern .replace('$num', vehicleInfo.num) .replace('$type', vehicleInfo.type) - .replace('$floor', floor_type); + .replace('$floor', floor_type) + .replace('$ac', air_conditioning); + span.dataset.typeShort = lang.tram_type_pattern_short + .replace('$num', vehicleInfo.num) + .replace('$type', vehicleInfo.type) + .replace('$floor', floor_type) + .replace('$ac', air_conditioning); + span.dataset.typeAdditional = lang.tram_type_pattern_additional + .replace('$num', vehicleInfo.num) + .replace('$type', vehicleInfo.type) + .replace('$floor', floor_type) + .replace('$ac', air_conditioning); + span.title = span.dataset.typeFull; return span; } -- Gitblit v1.9.1