Improved www.ttss.krakow.pl
Jacek Kowalski
2021-07-30 2107d19cb1db00c12e32dd76dec63b5c7f482e6b
[map] Add information on air conditioning in the vehicle
6 files modified
62 ■■■■ changed files
common.js 32 ●●●● patch | view | raw | blame | history
index.html 4 ●●●● patch | view | raw | blame | history
lang_en.js 7 ●●●● patch | view | raw | blame | history
lang_pl.js 7 ●●●● patch | view | raw | blame | history
map.html 6 ●●●● patch | view | raw | blame | history
map.js 6 ●●●●● patch | view | raw | blame | history
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;
}
index.html
@@ -135,8 +135,8 @@
            </div>
        </div>
        <script src="https://polyfill.io/v3/polyfill.min.js?features=Promise,XMLHttpRequest"></script>
        <script type="text/javascript" src="lang_pl.js?v10" id="lang_script"></script>
        <script type="text/javascript" src="common.js?v11"></script>
        <script type="text/javascript" src="lang_pl.js?v11" id="lang_script"></script>
        <script type="text/javascript" src="common.js?v12"></script>
        <script type="text/javascript" src="index.js?v8"></script>
    </body>
</html>
lang_en.js
@@ -71,7 +71,9 @@
    trip_current: 'current',
    trip_next: 'next \u00BB',
    
    tram_type_pattern: '$num $type ($floor)',
    tram_type_pattern: '$num $type ($floor$ac)',
    tram_type_pattern_short: '$num $type',
    tram_type_pattern_additional: '$floor$ac',
    high_floor: 'high floor',
    high_floor_sign: '\u2010\u00A0',
    high_floor_description: 'high-floor vehicle',
@@ -81,6 +83,9 @@
    low_floor: 'low floor',
    low_floor_sign: '\u267F',
    low_floor_description: 'low-floor vehicle',
    air_conditioning: ', air conditioning',
    air_conditioning_sign: '\u2744',
    air_conditioning_description: 'has air conditioning unit',
    
    status_departed: 'Departed',
    status_stopped: 'At stop',
lang_pl.js
@@ -71,7 +71,9 @@
    trip_current: 'aktualny',
    trip_next: 'następny \u00BB',
    
    tram_type_pattern: '$num $type ($floor)',
    tram_type_pattern: '$num $type ($floor$ac)',
    tram_type_pattern_short: '$num $type',
    tram_type_pattern_additional: '$floor$ac',
    high_floor: 'wysokopodłogowy',
    high_floor_sign: '\u2010\u00A0',
    high_floor_description: 'pojazd wysokopodłogowy',
@@ -81,6 +83,9 @@
    low_floor: 'niskopodłogowy',
    low_floor_sign: '\u267F',
    low_floor_description: 'pojazd niskopodłogowy',
    air_conditioning: ', klimatyzacja',
    air_conditioning_sign: '\u2744',
    air_conditioning_description: 'posiada klimatyzację',
    
    status_departed: 'Odjechał',
    status_stopped: 'Na przystanku',
map.html
@@ -20,8 +20,8 @@
<div id="panel"></div>
<script src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.forEach,Array.prototype.includes,Array.prototype.map,Element.prototype.classList,Promise,String.prototype.startsWith,XMLHttpRequest,requestAnimationFrame"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.6.1/build/ol.js" integrity="sha384-2t8P2Mt0pPrLNwMqTljtykP6hpy7mzd34amfOqUYKK74XwsZgukowi3L4lW4bd3K" crossorigin="anonymous"></script>
<script tyle="text/javascript" src="lang_pl.js?v10" id="lang_script"></script>
<script tyle="text/javascript" src="common.js?v11"></script>
<script tyle="text/javascript" src="map.js?v27"></script>
<script tyle="text/javascript" src="lang_pl.js?v11" id="lang_script"></script>
<script tyle="text/javascript" src="common.js?v12"></script>
<script tyle="text/javascript" src="map.js?v28"></script>
</body>
</html>
map.js
@@ -720,8 +720,10 @@
        var span = displayVehicle(feature.get('type'));
        
        additional = document.createElement('p');
        if(span.title) {
            setText(additional, span.title);
        if(span.dataset.typeShort) {
            setText(additional, span.dataset.typeShort);
            additional.title = span.dataset.typeAdditional;
            span.removeAttribute('title');
        } else {
            setText(additional, feature.getId());
        }