diff --git a/public_html/config.js b/public_html/config.js index 81909e4..3968491 100644 --- a/public_html/config.js +++ b/public_html/config.js @@ -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, diff --git a/public_html/script.js b/public_html/script.js index 7d6e160..261c819 100644 --- a/public_html/script.js +++ b/public_html/script.js @@ -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,9 +601,24 @@ 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() { - var selected = false; + 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");