Show Web App Version

show app version and building timestamp!

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==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);
})();