Digital Clock & Date figuccio

digital clock data al passaggio del mouse

// ==UserScript==
// @name           Digital Clock & Date figuccio
// @namespace      https://greasyfork.org/users/237458
// @description    digital clock data al passaggio del mouse
// @match          *://*/*
// @version        2.1
// @grant          GM_addStyle
// @grant          GM_setValue
// @grant          GM_getValue
// @grant          GM_registerMenuCommand
// @icon           data:image/gif;base64,R0lGODlhEAAQAKECABEREe7u7v///////yH5BAEKAAIALAAAAAAQABAAAAIplI+py30Bo5wB2IvzrXDvaoFcCIBeeXaeSY4tibqxSWt2RuWRw/e+UQAAOw==
// @noframes
// @require        http://code.jquery.com/jquery-latest.js
// @require        https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @license        MIT
// ==/UserScript==
(function() {
    'use strict';
var $ = window.jQuery;
var j = $.noConflict();

const body = document.body;
var use_date = false; // "true" si date , "false" no data
var time_box = document.createElement("div");
time_box.id = "digital_clock";
time_box.title = 'date';
time_box.setAttribute("style", "text-decoration:none;margin-left:770px;position:fixed;font-size:20px;line-height:12px;width:auto;padding:3px 6px;color:green!important;background-color:white!important;border:4px solid #c471ed!important;font-family:sans-serif;top:6px;text-align:center;border-radius:10px;z-index:99999999;cursor:pointer;");
document.body.appendChild(time_box);
j(time_box).draggable();

function setTime() {
    var period = "",
    fulldate = "",
    date = new Date();
    var time = new Date().toLocaleTimeString();
    var ms = date.getMilliseconds();
    ////////////////////////////
    // Gestire la disposizione della data
    if (use_date === true) {
        var datario = new Date().toLocaleString('it', { 'weekday': 'long', 'month': 'long', 'day': '2-digit', 'year': 'numeric' });
        if (fulldate === "") fulldate = datario;
    }

    time_box.textContent = time + period + ":" + ms +
        (use_date ? ("  " + fulldate) : ""); // Aggiungi data se abilitato
    window.setTimeout(setTime, 70);
}

window.setTimeout(setTime, 0);

//mostra/nascondi orologio al click
time_box.addEventListener('click', function() {
    time_box.style.display = (time_box.style.display != 'none') ? 'none' : 'block';
});

//mostra/nascondi data true/false al passaggio del mouse
time_box.addEventListener('mouseover', function() {
    use_date = !use_date;
});

time_box.addEventListener('mouseout', function() {
    use_date = !use_date;
});

// Funzione per nascondere/mostrare l'orologio tramite menu
function toggleDisplay() {
    time_box.style.display = (time_box.style.display != 'none') ? 'none' : 'block';
}
GM_registerMenuCommand("Nascondi/Mostra Orologio", toggleDisplay);
/*
// Funzione per attivare/disattivare la data tramite menu
function toggleDate() {
    use_date = !use_date;
}
GM_registerMenuCommand("Attiva/Disattiva Data", toggleDate);
*/
})();