Skip to content

Commit 7741475

Browse files
committed
various fixes
1 parent 6f90c5d commit 7741475

File tree

1 file changed

+57
-10
lines changed

1 file changed

+57
-10
lines changed

js/tracker.js

Lines changed: 57 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -875,23 +875,22 @@ function drawHistorical (data, station) {
875875
html += "<hr style='margin:0px;margin-top:5px'>";
876876

877877
if (recovered) {
878-
html += "<div><b>Recovered:&nbsp;</b>"+recovery_info.recovered+"</div>";
879-
html += "<div><b>Recovered by:&nbsp;</b>"+recovery_info.recovered_by+"</div>";
880-
html += "<div><b>Recovery time:&nbsp;</b>"+recovery_info.datetime+"</div>";
881-
html += "<div><b>Recovery location:&nbsp;</b>"+recovery_info.position[1]+","+recovery_info.position[0] + "</div>";
878+
html += "<div><b>"+(recovery_info.recovered ? "Recovered by " : "Not Recovered by ")+recovery_info.recovered_by+"</u></b></div>";
879+
html += "<div><b>Recovery time:&nbsp;</b>"+formatDate(stringToDateUTC(recovery_info.datetime))+"</div>";
880+
html += "<div><b>Recovery location:&nbsp;</b>"+recovery_info.position[1]+", "+recovery_info.position[0] + "</div>";
882881
html += "<div><b>Recovery notes:&nbsp;</b>"+recovery_info.description+"</div>";
883882

884883
html += "<hr style='margin:0px;margin-top:5px'>";
885884
}
886885

887-
html += "<div><b>Flight Path: <b><a href=\"javascript:showRecoveredMap('" + serial + "')\">" + serial + "</a></div>";
888-
html += "<div><b>Card: <b><a href='https://www.sondehub.org/card/" + serial + "' target='_blank'>" + serial + "</a></div>";
886+
html += "<div><b>Show Full Flight Path: <b><a href=\"javascript:showRecoveredMap('" + serial + "')\">" + serial + "</a></div>";
887+
html += "<div><b>Flight SkewT Plot: <b><a href='https://www.sondehub.org/card/" + serial + "' target='_blank'>" + serial + "</a></div>";
889888

890889
html += "<hr style='margin:0px;margin-top:5px'>";
891890
html += "<div style='font-size:11px;'>"
892891

893892
if (landing.hasOwnProperty("uploader_callsign")) {
894-
html += "<div>" + landing.uploader_callsign + "</div>";
893+
html += "<div>Last received by: " + landing.uploader_callsign.toLowerCase() + "</div>";
895894
};
896895

897896
popup.setContent(html);
@@ -1053,6 +1052,15 @@ function historicalLaunchViewer(station, marker) {
10531052
return;
10541053
}
10551054

1055+
// Find latest year
1056+
var latestYear = "0";
1057+
var latestYears = Object.keys(data);
1058+
for (var i=0; i < latestYears.length; i++) {
1059+
if (parseInt(latestYears[i]) > parseInt(latestYear)) {
1060+
latestYear = latestYears[i];
1061+
}
1062+
}
1063+
10561064
// Generate year drop down
10571065
var yearList = document.createElement("select");
10581066
yearList.name = "year"
@@ -1066,10 +1074,43 @@ function historicalLaunchViewer(station, marker) {
10661074
var option = document.createElement("option");
10671075
option.value = year;
10681076
option.text = year;
1077+
if (year == latestYear) {
1078+
option.setAttribute("selected", "selected");
1079+
}
10691080
yearList.appendChild(option);
10701081
}
10711082
}
10721083

1084+
// Find latest month
1085+
var latestMonth = "0";
1086+
var latestMonths = Object.keys(data[latestYear]);
1087+
for (var i=0; i < latestMonths.length; i++) {
1088+
if (parseInt(latestMonths[i]) > parseInt(latestMonth)) {
1089+
latestMonth = latestMonths[i];
1090+
}
1091+
}
1092+
1093+
// Generate month drop down
1094+
var monthList = document.createElement("select");
1095+
monthList.name = "month"
1096+
monthList.id = "monthList";
1097+
var option = document.createElement("option");
1098+
option.value = "all";
1099+
option.text = "All";
1100+
monthList.appendChild(option);
1101+
var months = ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
1102+
var monthsText = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
1103+
for (var i=0; i < months.length; i++) {
1104+
var option = document.createElement("option");
1105+
option.value = months[i];
1106+
option.text = monthsText[i];
1107+
if (months[i] == latestMonth) {
1108+
option.setAttribute("selected", "selected");
1109+
}
1110+
monthList.appendChild(option);
1111+
}
1112+
1113+
10731114
// Calculate total launches
10741115
var totalLaunches = 0;
10751116
for (let year in data) {
@@ -1085,7 +1126,7 @@ function historicalLaunchViewer(station, marker) {
10851126
// Generate HTML
10861127
var popupContent = "<br><hr style='margin-bottom:0;'><br>Launches Selected: <span id='launchCount'>" + totalLaunches + "</span><br>";
10871128
popupContent += "<form onchange='getSelectedNumber(\"" + station + "\")'><label for='year'>Year:</label>" + yearList.outerHTML;
1088-
popupContent += "<label for='month'>Month:</label><select name='month' id='monthList'><option value='all'>All</option><option value='01'>1</option><option value='02'>2</option><option value='03'>3</option><option value='04'>4</option><option value='05'>5</option><option value='06'>6</option><option value='07'>7</option><option value='08'>8</option><option value='09'>9</option><option value='10'>10</option><option value='11'>11</option><option value='12'>12</option></select></form>";
1129+
popupContent += "<label for='month'>Month:</label>" + monthList.outerHTML + "</form>";
10891130
popupContent += "<br><button id='submit' onclick='return showHistorical(\"" + station + "\", \"" + marker + "\")'>Fetch</button><img id='submitLoading' style='width:60px;height:20px;display:none;' src='img/hab-spinner.gif' /><button id='deleteHistorical' style='display:none;' onclick='return deleteHistorical(\"" + station + "\")'>Delete</button>";
10901131
historical.html(popupContent);
10911132
historical.show();
@@ -1095,6 +1136,7 @@ function historicalLaunchViewer(station, marker) {
10951136
if (!realpopup.isOpen()) {
10961137
realpopup.setContent("<div id='popup" + station + "'>" + popup.html() + "</div>");
10971138
}
1139+
getSelectedNumber(station);
10981140
}
10991141
if (historical.is(":visible")) {
11001142
// Don't regenerate if already in memory
@@ -2976,9 +3018,14 @@ function addPosition(position) {
29763018
iconAnchor: [23,90],
29773019
});
29783020

3021+
var tempTitle = vcallsign;
3022+
if (typeof position.type !== 'undefined') {
3023+
var tempTitle = position.type + ' ' + vcallsign;
3024+
}
3025+
29793026
marker = new L.Marker(point, {
29803027
icon: balloonIcon,
2981-
title: position.type + ' ' + vcallsign,
3028+
title: tempTitle,
29823029
zIndexOffset: Z_PAYLOAD,
29833030
}).addTo(map).on('click', onClick);
29843031

@@ -3149,7 +3196,7 @@ function addPosition(position) {
31493196
if (vehicle_type == "car") {
31503197
title = marker.bindTooltip(vcallsign, {direction: 'center', permanent: 'true', className: 'serialtooltip'});
31513198
} else {
3152-
title = marker.bindTooltip((position.type + ' ' + vcallsign), {direction: 'center', permanent: 'true', className: 'serialtooltip'});
3199+
title = marker.bindTooltip((tempTitle), {direction: 'center', permanent: 'true', className: 'serialtooltip'});
31533200
}
31543201
} else {
31553202
title = null;

0 commit comments

Comments
 (0)