Number of planes and messages in title

Simple addition to display the current number of planes and messages in
the title.
This commit is contained in:
m30164 2015-02-20 11:42:29 +01:00
parent ab8c4db85b
commit 297d3b0125
2 changed files with 26 additions and 3 deletions

View file

@ -5,6 +5,11 @@
//
// --------------------------------------------------------
// -- Title Settings --------------------------------------
// Show number of aircraft and/or messages per second in the page title
NumPlanesInTitle = true;
NumMessagesInTitle = true;
// -- Output Settings -------------------------------------
// Show metric values
// This controls the units used in the plane table,

View file

@ -34,6 +34,7 @@ var StaleReceiverCount = 0;
var FetchPending = null;
var MessageCountHistory = [];
var MessagesPerSecond = 0;
var NBSP='\u00a0';
var DEGREES='\u00b0'
@ -142,7 +143,7 @@ function fetchData() {
var PositionHistorySize = 0;
function initialize() {
// Set page basics
$("head title").text(PageName);
$("head title").text(PageName); // page title
$("#infoblock_name").text(PageName);
PlaneRowTemplate = document.getElementById("plane_row_template");
@ -600,8 +601,23 @@ function format_latlng(p) {
return p.lat().toFixed(3) + DEGREES + "," + NBSP + p.lng().toFixed(3) + DEGREES;
}
// Page Title update function
function refreshPageTitle() {
if(NumPlanesInTitle && !NumMessagesInTitle){
$("head title").text("DUMP1090 - " + TrackedAircraftPositions);
}
else if(!NumPlanesInTitle && NumMessagesInTitle){
$("head title").text("DUMP1090 - " + MessagesPerSecond.toFixed(1));
}
else if(NumPlanesInTitle && NumMessagesInTitle){
$("head title").text("DUMP1090 - " + TrackedAircraftPositions + " | " + MessagesPerSecond.toFixed(1));
}
}
// Refresh the detail window about the plane
function refreshSelected() {
refreshPageTitle();
var selected = false;
if (typeof SelectedPlane !== 'undefined' && SelectedPlane != "ICAO" && SelectedPlane != null) {
selected = Planes[SelectedPlane];
@ -623,8 +639,10 @@ function refreshSelected() {
message_rate = message_count_delta / message_time_delta;
}
if (message_rate !== null)
if (message_rate !== null){
MessagesPerSecond = message_rate;
$('#dump1090_message_rate').text(message_rate.toFixed(1));
}
else
$('#dump1090_message_rate').text("n/a");