Display travel time on tab title.
当前为
// ==UserScript==
// @name Time on Tab Title
// @namespace
// @version 0.1
// @description Display travel time on tab title.
// @author HesperCroft [2924630]
// @match https://www.torn.com/index.php
// @icon
// @grant none
// ==/UserScript==
(function() {
'use strict';
const title = "[Time on Tab Title]: ";
var span = document.getElementById('countrTravel');
if (span) {
var observer = new MutationObserver(function(mutations) {
if (document.contains(span)) {
document.title = span.textContent + " Traveling | TORN";
// document.title = span.textContent + " Keep Calm and Code On.";
} else {
observer.disconnect();
console.log(title + 'Element with id "countrTravel" not found. Observer disconnected.');
}
});
observer.observe(span, { characterData: true, childList: true, subtree: true });
}
})();