gleam.io days in title

Shows the runtime of the contest in the title

Versione datata 27/11/2021. Vedi la nuova versione l'ultima versione.

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         gleam.io days in title
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Shows the runtime of the contest in the title
// @author       woebbi
// @license     GNU GPLv3 https://choosealicense.com/licenses/gpl-3.0/
// @match        *gleam.io/*
// @icon         https://www.google.com/s2/favicons?domain=gleam.io
// @grant        none
// ==/UserScript==

$(document).ready(function() {
    if (document.getElementsByClassName("status ng-binding")[1] !== null) {
        var status = document.getElementsByClassName("status ng-binding");
        var duration = status[status.length - 1].innerHTML.trim();


        var descr = document.getElementsByClassName("description ng-binding")
        descr = descr[descr.length - 1].innerHTML;
        var timething = descr.trim().charAt(0).toLowerCase();
        if (duration == "Ended"){
            duration = "e";
            timething = ""
        }
        console.log(duration + " " + timething);
        var textfortitle = "(" + duration + timething + ")";
        document.title = textfortitle + document.title;
    }
});