From 85de91c66881ec200e59060d19efdffe113352b3 Mon Sep 17 00:00:00 2001 From: Sebastian Hugentobler Date: Wed, 16 Jun 2021 12:59:13 +0200 Subject: [PATCH] add all waypoints and the endpoint --- background.js | 11 ++++++++++- manifest.json | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/background.js b/background.js index e60dbe0..64d2af0 100644 --- a/background.js +++ b/background.js @@ -74,7 +74,9 @@ function toWGS84(point) { */ function trackTitle(geoJson) { const route = geoJson.segments[0]; - return `${geoJson.book_route_number}-${route.route_id} ${route.title}`; + const book = geoJson.book_route_number ? `${geoJson.book_route_number}-` : ""; + + return `${book}${route.route_id} ${route.title}`; } /** @@ -90,6 +92,11 @@ function toGpx(geoJson) { `; }).join(""); + let endPoint = geoJson.end_point ? toWayPoint(geoJson.end_point) : ""; + let waypoints = geoJson.waypoints ? geoJson.waypoints.map(wp => { + return toWayPoint(wp.reference_poi); + }).join("") : ""; + const routeTitle = trackTitle(geoJson); const xmlString = ` @@ -101,6 +108,8 @@ function toGpx(geoJson) { creator="SAC-Tourenportal GPX Downloader"> ${toWayPoint(geoJson.departure_point)} ${toWayPoint(geoJson.destination_poi)} + ${waypoints} + ${endPoint} Track ${routeTitle} ${trackSegments} diff --git a/manifest.json b/manifest.json index 5dbcacf..e89dbd4 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "manifest_version": 2, "name": "SAC Route Portal GPX Downloader", - "version": "0.4", + "version": "0.5", "developer": { "name": "Sebastian Hugentobler", "url": "https://code.vanwa.ch/sebastian/sac-route-portal-gpx-fx"