From a830993fed93fd4d700c26f3bf8158fa4c0db68e Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Thu, 31 Jan 2019 10:38:41 +0000
Subject: [PATCH] Add feature type (bus/tram stop) to the headers and listings
---
map.js | 32 +++++++++++++++++++++++++-------
lang_en.js | 6 ++++++
map.html | 4 ++--
lang_pl.js | 12 ++++++++++--
4 files changed, 43 insertions(+), 11 deletions(-)
diff --git a/lang_en.js b/lang_en.js
index c49a63f..0449c2e 100644
--- a/lang_en.js
+++ b/lang_en.js
@@ -40,8 +40,14 @@
time_minutes_ago_suffix: ' min ago',
type_vehicle: 'Vehicle',
+ type_bus: 'Bus',
+ type_tram: 'Tram',
type_stop: 'Stop',
+ type_stop_bus: 'Bus stop',
+ type_stop_tram: 'Tram stop',
type_stoppoint: 'Stop point',
+ type_stoppoint_bus: 'Bus stop point',
+ type_stoppoint_tram: 'Tram stop point',
select_feature: 'There is more than one feature here. Select the proper one:',
departures_for_stop: 'Click for stop departures (and not only this stop point).',
diff --git a/lang_pl.js b/lang_pl.js
index 5159b44..dfc4857 100644
--- a/lang_pl.js
+++ b/lang_pl.js
@@ -19,6 +19,8 @@
header_line: 'Linia',
header_direction: 'Kierunek',
header_vehicle: 'Pojazd',
+ header_bus: 'Autobus',
+ header_tram: 'Tramwaj',
header_time: 'Odjazd',
header_delay: 'Opóźn.',
header_lines: 'Linie',
@@ -40,11 +42,17 @@
time_minutes_ago_suffix: ' min temu',
type_vehicle: 'Pojazd',
+ type_bus: 'Autobus',
+ type_tram: 'Tramwaj',
type_stop: 'Przystanek',
- type_stoppoint: 'Punkt przystankowy',
+ type_stop_bus: 'Przystanek autobusowy',
+ type_stop_tram: 'Przystanek tramwajowy',
+ type_stoppoint: 'Peron',
+ type_stoppoint_bus: 'Peron autobusowy',
+ type_stoppoint_tram: 'Peron tramwajowy',
select_feature: 'W tym miejscu znajduje się więcej niż jeden element. Wybierz właściwy z listy:',
- departures_for_stop: 'Kliknij, by zobaczyć odjazdy dla całego przystanku (a nie tylko punktu przystankowego).',
+ departures_for_stop: 'Kliknij, by zobaczyć odjazdy dla całego przystanku (a nie tylko peronu).',
tram_type_pattern: '$num $type ($floor)',
high_floor: 'wysokopodłogowy',
diff --git a/map.html b/map.html
index 9ab6a6d..5bfd891 100644
--- a/map.html
+++ b/map.html
@@ -16,8 +16,8 @@
<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script>
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList"></script>
<script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js" integrity="sha384-iQkGyyH4ioz3m+maM3s9MX1Oq67mACa4B9Z3ovUv3Sv37LJ96fx3WnZfLoiC3Wfl" crossorigin="anonymous"></script>
-<script tyle="text/javascript" src="lang_pl.js" id="lang_script"></script>
+<script tyle="text/javascript" src="lang_pl.js?v2" id="lang_script"></script>
<script tyle="text/javascript" src="common.js?v2"></script>
-<script tyle="text/javascript" src="map.js?v3"></script>
+<script tyle="text/javascript" src="map.js?v4"></script>
</body>
</html>
diff --git a/map.js b/map.js
index b31d688..737a1f8 100644
--- a/map.js
+++ b/map.js
@@ -506,7 +506,10 @@
switch(feature.getId().substr(0, 1)) {
case 't':
case 'b':
- type = lang.type_vehicle;
+ type = lang.type_tram;
+ if(feature.getId().startsWith('b')) {
+ type = lang.type_bus;
+ }
var span = displayVehicle(feature.get('vehicle_type'));
@@ -524,7 +527,10 @@
vehicleTable(feature.get('tripId'), tbody, feature.getId());
break;
case 's':
- type = lang.type_stop;
+ type = lang.type_stop_tram;
+ if(feature.getId().startsWith('sb')) {
+ type = lang.type_stop_bus;
+ }
addElementWithText(thead, 'th', lang.header_line);
addElementWithText(thead, 'th', lang.header_direction);
@@ -534,7 +540,10 @@
stopTable('stop', feature.get('shortName'), tbody, feature.getId());
break;
case 'p':
- type = lang.type_stoppoint;
+ type = lang.type_stoppoint_tram;
+ if(feature.getId().startsWith('pb')) {
+ type = lang.type_stoppoint_bus;
+ }
additional = document.createElement('p');
additional.className = 'small';
@@ -542,7 +551,7 @@
'click',
function() {
featureClicked(stops_source.forEachFeature(function(stop_feature) {
- if(stop_feature.get('shortName') == feature.get('shortName')) {
+ if(stop_feature.get('shortName') == feature.get('shortName') && stop_feature.getId().substr(1,1) == feature.getId().substr(1,1)) {
return stop_feature;
}
}));
@@ -773,16 +782,25 @@
switch(feature.getId().substr(0, 1)) {
case 't':
case 'b':
- type = lang.type_vehicle;
+ type = lang.type_tram;
+ if(feature.getId().startsWith('b')) {
+ type = lang.type_bus;
+ }
if(feature.get('vehicle_type').num) {
type += ' ' + feature.get('vehicle_type').num;
}
break;
case 's':
- type = lang.type_stop;
+ type = lang.type_stop_tram;
+ if(feature.getId().startsWith('sb')) {
+ type = lang.type_stop_bus;
+ }
break;
case 'p':
- type = lang.type_stoppoint;
+ type = lang.type_stoppoint_tram;
+ if(feature.getId().startsWith('pb')) {
+ type = lang.type_stoppoint_bus;
+ }
break;
}
--
Gitblit v1.9.1