Show Web App Version

show app version and building timestamp!

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Show Web App Version
// @namespace    https://crossjs.com/
// @version      0.4
// @description  show app version and building timestamp!
// @author       crossjs
// @match        *://*.arnoo.com/*
// @grant        unsafeWindow
// @grant        GM_registerMenuCommand
// ==/UserScript==

(function() {
    'use strict';

    const chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
    const radix = chars.length;

    function decode(str) {
        const len = str.length;
        let num = 0;
        for (let i = 0; i < len; i++) {
            num += chars.indexOf(str.charAt(len - i - 1)) * Math.pow(radix, i);
        }
        return num;
    }

    const prefix = "VERSION: ";

    const showVersion = () => {
        const element = document.querySelector("[data-role=__VERSION_AND_TIMESTAMP__]");
        if (element) {
            const value = element.textContent;
            if (value.indexOf(prefix) === 0) {
                const [_, v, d] = value.match(/^VERSION: (\d+\.\d+\.\d+(?:-(?:alpha|beta)\.\d+)?)\.(.+)$/)
                alert(`Version: ${v}\nTS: ${new Date(decode(d))}`);
                return;
            }
        }
        setTimeout(showVersion, 1000)
    };

    GM_registerMenuCommand('Show Web App Version', showVersion);
})();