diff --git a/public_html/config.js b/public_html/config.js
index d6fa5e9..c35bf42 100644
--- a/public_html/config.js
+++ b/public_html/config.js
@@ -7,8 +7,8 @@
// -- Title Settings --------------------------------------
// Show number of aircraft and/or messages per second in the page title
-NumPlanesInTitle = true;
-NumMessagesInTitle = true;
+PlaneCountInTitle = true;
+MessageRateInTitle = false;
// -- Output Settings -------------------------------------
// Show metric values
diff --git a/public_html/script.js b/public_html/script.js
index e81a5bb..aff834e 100644
--- a/public_html/script.js
+++ b/public_html/script.js
@@ -1,3 +1,4 @@
+// -*- mode: javascript; indent-tabs-mode: nil; c-basic-offset: 8 -*-
"use strict";
// Define our global variables
@@ -34,7 +35,7 @@ var StaleReceiverCount = 0;
var FetchPending = null;
var MessageCountHistory = [];
-var MessagesPerSecond = 0;
+var MessageRate = 0;
var NBSP='\u00a0';
@@ -140,7 +141,7 @@ function fetchData() {
var PositionHistorySize = 0;
function initialize() {
// Set page basics
- $("head title").text(PageName); // page title
+ document.title = PageName;
$("#infoblock_name").text(PageName);
PlaneRowTemplate = document.getElementById("plane_row_template");
@@ -488,22 +489,37 @@ function reaper() {
// 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));
- }
+ if (!PlaneCountInTitle && !MessageRateInTitle)
+ return;
+
+ var subtitle = "";
+
+ if (PlaneCountInTitle) {
+ subtitle += TrackedAircraftPositions + '/' + TrackedAircraft;
+ }
+
+ if (MessageRateInTitle) {
+ if (subtitle) subtitle += ' | ';
+ subtitle += MessageRate.toFixed(1) + '/s';
+ }
+
+ document.title = PageName + ' - ' + subtitle;
}
// Refresh the detail window about the plane
function refreshSelected() {
+ if (MessageCountHistory.length > 1) {
+ var message_time_delta = MessageCountHistory[MessageCountHistory.length-1].time - MessageCountHistory[0].time;
+ var message_count_delta = MessageCountHistory[MessageCountHistory.length-1].messages - MessageCountHistory[0].messages;
+ if (message_time_delta > 0)
+ MessageRate = message_count_delta / message_time_delta;
+ } else {
+ MessageRate = null;
+ }
+
refreshPageTitle();
- var selected = false;
+ var selected = false;
if (typeof SelectedPlane !== 'undefined' && SelectedPlane != "ICAO" && SelectedPlane != null) {
selected = Planes[SelectedPlane];
}
@@ -516,21 +532,12 @@ function refreshSelected() {
$('#dump1090_total_ac_positions').text(TrackedAircraftPositions);
$('#dump1090_total_history').text(TrackedHistorySize);
- var message_rate = null;
- if (MessageCountHistory.length > 1) {
- var message_time_delta = MessageCountHistory[MessageCountHistory.length-1].time - MessageCountHistory[0].time;
- var message_count_delta = MessageCountHistory[MessageCountHistory.length-1].messages - MessageCountHistory[0].messages;
- if (message_time_delta > 0)
- message_rate = message_count_delta / message_time_delta;
- }
-
- if (message_rate !== null){
- MessagesPerSecond = message_rate;
- $('#dump1090_message_rate').text(message_rate.toFixed(1));
- }
- else
+ if (MessageRate !== null) {
+ $('#dump1090_message_rate').text(MessageRate.toFixed(1));
+ } else {
$('#dump1090_message_rate').text("n/a");
-
+ }
+
return;
}