Merge branch 'title_numbers' of https://github.com/m30164/dump1090 into m30164-title_numbers

This commit is contained in:
Oliver Jowett 2015-02-22 11:35:59 +00:00
commit 288a8242dd
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
// The Metric setting controls whether metric (m, km, km/h) or

View file

@ -34,6 +34,7 @@ var StaleReceiverCount = 0;
var FetchPending = null;
var MessageCountHistory = [];
var MessagesPerSecond = 0;
var NBSP='\u00a0';
@ -139,7 +140,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");
@ -485,8 +486,23 @@ function reaper() {
refreshSelected();
}
// 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];
@ -508,8 +524,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");