YoutubeClock

Add a simple clock to the youtube bar so that you don't need to close fullscreen to see it.

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey 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 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.

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

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

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         YoutubeClock
// @namespace    https://oxodao.fr/
// @version      1
// @description  Add a simple clock to the youtube bar so that you don't need to close fullscreen to see it.
// @author       Nathan <Oxodao> JANCZEWSKI
// @match        https://www.youtube.com/watch?v=*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    let bar = document.getElementsByClassName("ytp-right-controls")[0];
    let clock = document.createElement("span");
    clock.classList.add("ytp-time-display");
    clock.innerText = "Toto";

    function clockTime() {
        var today = new Date();
        var h = today.getHours();
        var m = today.getMinutes();
        var s = today.getSeconds();
        if (h < 10) h = "0" + h;
        if (m < 10) m = "0" + m;
        if (s < 10) s = "0" + s;
        clock.innerText = h + ":" + m + ":" + s;
        setTimeout(clockTime, 500);
    }

    clockTime();

    bar.insertBefore(clock, bar.childNodes[0]);
})();