Skip to content

Commit 10beb0d

Browse files
authored
Merge pull request #26 from LukePrior/testing
PWA Improvements
2 parents 8b3b6f1 + dddbf5a commit 10beb0d

File tree

11 files changed

+89
-2
lines changed

11 files changed

+89
-2
lines changed

css/main.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,7 @@ header .search form input[type='submit'] {
415415
#main .row .data .vbutton {
416416
position: absolute;
417417
background-color: #fff;
418+
width: 25px !important;
418419
right: 5px;
419420
top: 150px;
420421
padding-left: 3px;
@@ -424,6 +425,22 @@ header .search form input[type='submit'] {
424425
border: 1px solid #ccc;
425426
cursor: pointer;
426427
z-index: 5;
428+
text-align: center;
429+
}
430+
431+
#main .row .data .sbutton {
432+
position: absolute;
433+
background-color: #fff;
434+
width: 25px !important;
435+
right: 5px;
436+
top: 170px;
437+
padding-left: 3px;
438+
padding-right: 3px;
439+
font-size: 10px;
440+
border-radius: 5px;
441+
border: 1px solid #ccc;
442+
cursor: pointer;
443+
z-index: 5;
427444
}
428445

429446
#main .row .data .vbutton.active {
@@ -440,6 +457,10 @@ header .search form input[type='submit'] {
440457
top: 50px !important;
441458
}
442459

460+
#main .portrait .row .data .sbutton {
461+
top: 80px !important;
462+
}
463+
443464
#main .row .data img {
444465
position: absolute;
445466
z-index: 2;

img/icons/icon_x192.png

23.9 KB
Loading

img/icons/icon_x512.png

35.6 KB
Loading

img/icons/nyan_icon_x192.png

14.2 KB
Loading

img/icons/nyan_icon_x512.png

19.4 KB
Loading

img/screenshots/screenshot1.png

724 KB
Loading

img/screenshots/screenshot2.png

2.15 MB
Loading

img/screenshots/screenshot3.png

1.18 MB
Loading

js/tracker.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,9 @@ var plot_options = {
116116
]
117117
};
118118

119+
//hide PWA taskbar count
120+
navigator.clearAppBadge();
121+
119122
// aprs overlay (not used)
120123
var overlayARPS = new L.tileLayer('http://{s}.tiles.tracker.habhub.org/aprs/tile_{z}_{x}_{y}.png', {
121124
subdomains: 'abc',
@@ -598,6 +601,20 @@ function showLaunchSites() {
598601
}
599602
}
600603

604+
function shareVehicle(callsign) {
605+
const shareData = {
606+
title: 'SondeHub: ' + vehicles[callsign].marker.options.title + ' Flight Information',
607+
text: 'You can view the flight path and sensor data for ' + vehicles[callsign].marker.options.title + ' on the SondeHub tracker!',
608+
url: window.location.origin + '/' + callsign,
609+
}
610+
try {
611+
navigator.share(shareData);
612+
} catch (e) {
613+
console.log("Error sharing: " + e);
614+
}
615+
616+
}
617+
601618
function panTo(vcallsign) {
602619
if(!vcallsign || vehicles[vcallsign] === undefined) return;
603620

@@ -1211,6 +1228,7 @@ function updateVehicleInfo(vcallsign, newPosition) {
12111228
'<img class="'+((vehicle.vehicle_type=="car")?'car':'')+'" src="'+image+'" />' +
12121229
'<span class="vbutton path '+((vehicle.polyline_visible) ? 'active' : '')+'" data-vcallsign="'+vcallsign+'"' +
12131230
' style="top:'+(vehicle.image_src_size[1]+55)+'px">Path</span>' +
1231+
'<span class="sbutton" onclick="shareVehicle(\'' + vcallsign + '\')">Share</span>' +
12141232
((vcallsign in hysplit) ? '<span class="vbutton hysplit '+((hysplit[vcallsign].getMap()) ? 'active' : '')+'"' +
12151233
' data-vcallsign="'+vcallsign+'" style="top:'+(vehicle.image_src_size[1]+55+21+10)+'px">HYSPLIT</span>' : '') +
12161234
((vcallsign.substr(0, 6) in ssdv) ? '<a class="vbutton active" href="//ssdv.habhub.org/' + vcallsign.substr(0, 6) + '"' +
@@ -2619,6 +2637,11 @@ function refresh() {
26192637
complete: function(request, textStatus) {
26202638
document.getElementById("timeperiod").disabled = false;
26212639
clearTimeout(periodical);
2640+
if (Object.keys(vehicles).length > 1) {
2641+
navigator.setAppBadge(Object.keys(vehicles).length); //show number of vehicles on PWA taskbar
2642+
} else {
2643+
navigator.clearAppBadge(); //hide
2644+
}
26222645
periodical = setTimeout(refresh, timer_seconds * 1000);
26232646
}
26242647
});
@@ -2991,6 +3014,11 @@ function updateReceiverMarker(receiver) {
29913014

29923015
// init a marker if the receiver doesn't already have one
29933016
if(!receiver.marker) {
3017+
3018+
if (!receiver.description.includes("radiosonde_auto_rx")) {
3019+
//future option to show different icon per software
3020+
}
3021+
29943022
receiverIcon = new L.icon({
29953023
iconUrl: host_url + markers_url + "antenna-green.png",
29963024
iconSize: [26, 34],

manifest.json

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,51 @@
1414
"src": "/img/icons/maskable_icon_x192.png",
1515
"type": "image/png",
1616
"sizes": "192x192",
17-
"purpose": "any maskable"
17+
"purpose": "maskable"
1818
},
1919
{
2020
"src": "/img/icons/maskable_icon_x512.png",
2121
"type": "image/png",
2222
"sizes": "512x512",
23-
"purpose": "any maskable"
23+
"purpose": "maskable"
24+
},
25+
{
26+
"src": "/img/icons/icon_x192.png",
27+
"type": "image/png",
28+
"sizes": "192x192",
29+
"purpose": "any"
30+
},
31+
{
32+
"src": "/img/icons/icon_x512.png",
33+
"type": "image/png",
34+
"sizes": "512x512",
35+
"purpose": "any"
36+
}
37+
],
38+
"shortcuts": [
39+
{
40+
"name": "Nyan Mode",
41+
"short_name": "Nyan",
42+
"description": "Start the tracker with Nyan Cat mode enabled",
43+
"url": "/#!nyan=1",
44+
"icons": [{ "src": "/img/icons/nyan_icon_x192.png", "sizes": "192x192" }]
45+
}
46+
],
47+
"screenshots": [
48+
{
49+
"src": "/img/screenshots/screenshot1.png",
50+
"type": "image/png",
51+
"sizes": "1242x2208"
52+
},
53+
{
54+
"src": "/img/screenshots/screenshot2.png",
55+
"type": "image/png",
56+
"sizes": "1242x2208"
57+
},
58+
{
59+
"src": "/img/screenshots/screenshot3.png",
60+
"type": "image/png",
61+
"sizes": "1242x2208"
2462
}
2563
]
2664
}

0 commit comments

Comments
 (0)