Fixed new container

This commit is contained in:
2026-07-05 23:32:30 -04:00
parent 3e0ba9a9dd
commit 6c6a630853
+7 -3
View File
@@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Torn - Arrival Time Predictor // @name Torn - Arrival Time Predictor
// @namespace http://tampermonkey.net/ // @namespace http://tampermonkey.net/
// @version 1.01 // @version 1.02
// @description Calculates and displays the exact local time you will land while traveling // @description Calculates and displays the exact local time you will land while traveling
// @author You // @author You
// @match https://www.torn.com/page.php?sid=travel // @match https://www.torn.com/page.php?sid=travel
@@ -46,13 +46,17 @@
// Remove flight scene // Remove flight scene
travelRoot.querySelector('[class^="airspaceScene"]').remove(); travelRoot.querySelector('[class^="airspaceScene"]').remove();
const ogTimer = document.querySelector("#travel-root > div.viewport___cdEK9 > div.flightProgressSection___OEJoR > div.progressText___BEQ0k > div > span"); const ogTimer = document.querySelector("#travel-root > div.viewport___cdEK9 > div.flightProgressSection___OEJoR > div.progressText___BEQ0k > div > span");
var timerContainer = null;
if (ogTimer) { if (ogTimer) {
ogTimer.style.cssText = 'font-weight: bold; font-size: 1.5rem;'; ogTimer.style.cssText = 'font-weight: bold; font-size: 1.5rem;';
ogTimer.innerText = 'Calculating landing time...'; ogTimer.innerText = 'Calculating landing time...';
timerContainer = ogTimer;
} else { } else {
const timeDisplay = document.createElement('div'); const timeDisplay = document.createElement('div');
timeDisplay.style.cssText = 'padding: 10px; margin-top: 10px; color: #fff; text-align: center; border-radius: 5px; font-weight: bold; border: 1px solid #444; transition: color 0.5s ease;'; timeDisplay.style.cssText = 'padding: 10px; margin-top: 10px; color: #fff; text-align: center; border-radius: 5px; font-weight: bold; border: 1px solid #444; transition: color 0.5s ease;';
timerElement.parentNode.insertBefore(timeDisplay, timerElement.nextSibling); timerElement.parentNode.insertBefore(timeDisplay, timerElement.nextSibling);
timeDisplay.innerText = 'Calculating landing time...';
timerContainer = ogTimer;
} }
//const info = document.querySelector("#travel-root > div.viewport___cdEK9.stage0 > div.factWrapper___LvERA > div"); //const info = document.querySelector("#travel-root > div.viewport___cdEK9.stage0 > div.factWrapper___LvERA > div");
//info.remove(); //info.remove();
@@ -77,7 +81,7 @@
if (msRemaining <= 120000) { if (msRemaining <= 120000) {
//ogTimer.style.cssText += ' color: #aa0000;' //ogTimer.style.cssText += ' color: #aa0000;'
// Add the blinking class to the text. // Add the blinking class to the text.
ogTimer.classList.add('pulse-text'); timerContainer.classList.add('pulse-text');
} }
@@ -89,7 +93,7 @@
//ogTimer.remove(); //ogTimer.remove();
// Format the output neatly (e.g., "16:24:05") // Format the output neatly (e.g., "16:24:05")
ogTimer.innerText = `Estimated Landing: ${landingTime.toLocaleTimeString()}`; timerContainer.innerText = `Estimated Landing: ${landingTime.toLocaleTimeString()}`;
} }
}, 1000); }, 1000);
} }