Bauws / New Userscript

// ==UserScript==
// @name         New Userscript
// @namespace    http://tampermonkey.net/
// @version      2024-03-17
// @description  try to take over the world!
// @author       You
// @match        https://*.ogame.gameforge.com/game/index.php?page=ingame&component=traderOverview*
// @updateURL    https://openuserjs.org/meta/Bauws/New_Userscript.meta.js
// @downloadURL  https://openuserjs.org/install/Bauws/New_Userscript.user.js
// @copyright    2024, Bauws (https://openuserjs.org/users/Bauws)
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

(async function() {
    'use strict';
    await new Promise(r => setTimeout(r, 3000));

    var approx = document.querySelector("#div_traderAuctioneer > div.content > div.left_box > div.left_content > p > span > span").innerHTML.split(" ")[1];

    while (true) {

        if (approx != document.querySelector("#div_traderAuctioneer > div.content > div.left_box > div.left_content > p > span > span").innerHTML.split(" ")[1]) {
            var time = document.querySelector("#bar > ul > li.OGameClock").innerHTML.split("<span>")[1].split("</span>")[0];

            var label = document.createElement('label');
            label.textContent = time;

            // Add the button to the page, adjust the selector according to your needs
            var targetElement = document.querySelector('#siteHeader');
            targetElement.appendChild(label);
            break;
        }

        await new Promise(r => setTimeout(r, 1000));
    }
})();