version 0.3
This commit is contained in:
parent
3fb2db279f
commit
8eed835aa2
@ -1,5 +1,4 @@
|
||||
# SAC Route Portal GPX Downloader
|
||||
|
||||
The [Swiss Alpine Club](https://www.sac-cas.ch/en/) has a great
|
||||
[route portal](https://www.sac-cas.ch/en/huts-and-tours/sac-route-portal/)
|
||||
for finding interesting hiking routes.
|
||||
|
@ -129,11 +129,14 @@ function listener(details) {
|
||||
let buffer = await blob.arrayBuffer();
|
||||
let str = decoder.decode(buffer);
|
||||
|
||||
gpxTrack = JSON.parse(str);
|
||||
updateActiveTab(browser.tabs);
|
||||
|
||||
filter.write(encoder.encode(str));
|
||||
filter.close();
|
||||
|
||||
let geoJson = JSON.parse(str);
|
||||
const routeTitle = trackTitle(geoJson);
|
||||
gpxTrack = {title: routeTitle, data: toGpx(geoJson)};
|
||||
};
|
||||
|
||||
return {};
|
||||
@ -162,14 +165,12 @@ function handleClick(tab) {
|
||||
return;
|
||||
}
|
||||
|
||||
let blob = new Blob([toGpx(gpxTrack)], {type: "application/gpx+xml"});
|
||||
let blob = new Blob([gpxTrack.data], {type: "application/gpx+xml"});
|
||||
let objectURL = URL.createObjectURL(blob);
|
||||
|
||||
const routeTitle = trackTitle(gpxTrack);
|
||||
|
||||
let downloading = browser.downloads.download({
|
||||
url : objectURL,
|
||||
filename : `track-${routeTitle}.gpx`,
|
||||
filename : `track-${gpxTrack.title}.gpx`,
|
||||
saveAs: true,
|
||||
conflictAction : 'uniquify'
|
||||
});
|
||||
@ -209,7 +210,7 @@ function updateIcon(tab) {
|
||||
tabId: tab.id
|
||||
});
|
||||
browser.browserAction.setTitle({
|
||||
title: hasTrack ? `Download track ${trackTitle(gpxTrack)}` : 'No track selected',
|
||||
title: hasTrack ? `Download track ${gpxTrack.title}` : 'No track selected',
|
||||
tabId: tab.id
|
||||
});
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
"manifest_version": 2,
|
||||
"name": "SAC Route Portal GPX Downloader",
|
||||
"version": "0.2",
|
||||
"version": "0.3",
|
||||
"developer": {
|
||||
"name": "Sebastian Hugentobler",
|
||||
"url": "https://code.vanwa.ch/sebastian/sac-route-portal-gpx-fx"
|
||||
|
Loading…
Reference in New Issue
Block a user