gleam.io days in title

Shows the runtime of the contest in the title

Verze ze dne 27. 11. 2021. Zobrazit nejnovější verzi.

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

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

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

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