From f7f4ce5a4f2ae6b5f0cbbe549651b3c5ba5fcbbc Mon Sep 17 00:00:00 2001 From: Jacek Kowalski <Jacek@jacekk.info> Date: Sun, 03 Feb 2019 12:45:03 +0000 Subject: [PATCH] Fix searching for parent stop of a stop point --- common.js | 18 ++++++++++++++---- 1 files changed, 14 insertions(+), 4 deletions(-) diff --git a/common.js b/common.js index fe88f82..f238013 100644 --- a/common.js +++ b/common.js @@ -1,3 +1,5 @@ +"use strict"; + //var ttss_trams_base = 'http://www.ttss.krakow.pl/internetservice'; var ttss_trams_base = 'proxy_tram.php'; //var ttss_buses_base = 'http://91.223.13.70/internetservice'; @@ -112,10 +114,18 @@ }); } -function tramIdToVehicleId(tramId) { - for(var prop in vehicles_info) { - if(vehicles_info[prop]['num'].substr(2) == tramId) { - return prop; +function depotIdToVehicleId(depotId, typeHelper) { + if(typeHelper) { + for(var prop in vehicles_info) { + if(prop.substr(0,1) == type && vehicles_info[prop]['num'].substr(2) == depotId) { + return prop; + } + } + } else { + for(var prop in vehicles_info) { + if(vehicles_info[prop]['num'] == depotId) { + return prop; + } } } } -- Gitblit v1.9.1