diff --git a/index.php b/index.php
index b94c2a2..f9480dc 100644
--- a/index.php
+++ b/index.php
@@ -264,8 +264,7 @@ try {
- Agent:
- Credits:
+ Agent:
@@ -448,11 +447,16 @@ try {
| Role |
Type |
Status |
+ Nav Timer |
Flight Mode |
Route |
+
|
| |
|
- |
-
+ |
+
+
+ |
+
|
|
@@ -536,6 +547,47 @@ try {
(function() {
const tabs = document.querySelectorAll('.system-tab');
const panels = document.querySelectorAll('.system-tab-panel');
+ const navTimerNodes = document.querySelectorAll('.ship-nav-timer');
+
+ function formatNavTimer(seconds) {
+ if (seconds <= 0) {
+ return 'Arriving';
+ }
+
+ const total = Math.max(0, Math.floor(seconds));
+ const hours = Math.floor(total / 3600);
+ const minutes = Math.floor((total % 3600) / 60);
+ const secs = total % 60;
+
+ if (hours > 0) {
+ return `${hours}:${String(minutes).padStart(2, '0')}:${String(secs).padStart(2, '0')}`;
+ }
+
+ return `${minutes}:${String(secs).padStart(2, '0')}`;
+ }
+
+ function renderNavTimers() {
+ const nowMs = Date.now();
+
+ navTimerNodes.forEach((node) => {
+ const status = node.dataset.status || '';
+ const arrival = node.dataset.arrival || '';
+
+ if (status !== 'IN_TRANSIT') {
+ node.textContent = 'Ready';
+ return;
+ }
+
+ const arrivalMs = Date.parse(arrival);
+ if (!Number.isFinite(arrivalMs)) {
+ node.textContent = 'In transit';
+ return;
+ }
+
+ const remainingSeconds = Math.max(0, Math.floor((arrivalMs - nowMs) / 1000));
+ node.textContent = formatNavTimer(remainingSeconds);
+ });
+ }
function activateTab(targetId) {
panels.forEach((panel) => {
@@ -561,6 +613,11 @@ try {
if (tabs.length > 0) {
activateTab('tab-waypoints');
}
+
+ renderNavTimers();
+ if (navTimerNodes.length > 0) {
+ window.setInterval(renderNavTimers, 1000);
+ }
})();