Clock figuccio migliore

clock compare data se passi il mouse sopra

スクリプトをインストールするには、Tampermonkey, GreasemonkeyViolentmonkey のような拡張機能のインストールが必要です。

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

スクリプトをインストールするには、TampermonkeyViolentmonkey のような拡張機能のインストールが必要です。

スクリプトをインストールするには、TampermonkeyUserscripts のような拡張機能のインストールが必要です。

このスクリプトをインストールするには、Tampermonkeyなどの拡張機能をインストールする必要があります。

このスクリプトをインストールするには、ユーザースクリプト管理ツールの拡張機能をインストールする必要があります。

(ユーザースクリプト管理ツールは設定済みなのでインストール!)

このスタイルをインストールするには、Stylusなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus などの拡張機能をインストールする必要があります。

このスタイルをインストールするには、Stylus tなどの拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

このスタイルをインストールするには、ユーザースタイル管理用の拡張機能をインストールする必要があります。

(ユーザースタイル管理ツールは設定済みなのでインストール!)

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name           Clock figuccio migliore
// @description    clock compare data se passi il mouse sopra
// @version        1.5
// @match          *://*/*
// @run-at         document-start
// @author         figuccio
// @grant          GM_addStyle
// @grant          GM_setValue
// @grant          GM_getValue
// @grant          GM_registerMenuCommand
// @require        http://code.jquery.com/jquery-latest.js
// @require        https://code.jquery.com/ui/1.13.2/jquery-ui.js
// @icon           data:image/gif;base64,R0lGODlhEAAQAKECABEREe7u7v///////yH5BAEKAAIALAAAAAAQABAAAAIplI+py30Bo5wB2IvzrXDvaoFcCIBeeXaeSY4tibqxSWt2RuWRw/e+UQAAOw==
// @namespace      https://greasyfork.org/users/237458
// @noframes
// @license        MIT
// ==/UserScript==
(function() {
    'use strict';
     var $ = window.jQuery;
     var clockVisible = true; // Variabile per monitorare la visibilità dell'orologio
 // Comando del menu Registra per attivare/disattivare la visibilità dell'orologio
        GM_registerMenuCommand(clockVisible ? "Nascondi orologio" : "Mostra orologio", function() {
            if (clockVisible) {
                $("#b").hide();
                clockVisible = false;
            } else {
                $("#b").show();
                clockVisible = true;
            }
        });

    // Funzione per aggiornare l'orologio
    function Clock() {
        var date = new Date();
        var mm = date.getMilliseconds(); //millisecondi
        var ore = date.toLocaleString('it', {
        hour: '2-digit',
        minute: 'numeric',
        second: 'numeric',
        });
        node.innerHTML = ore + ":" + mm;
    }

    // Creare l'elemento di visualizzazione dell'ora
    var node = document.createElement('div');
    node.id = "b";
    node.title = 'time';
    node.setAttribute("style", "cursor:pointer;padding:4px;background:black;color:lime;top:0px;left:800px;font-family:sans-serif;font-size:14px;position:fixed;text-align:center;z-index:999999;border-radius:10px;border:2px solid yellow;");
    document.body.appendChild(node);

    // Funzione per aggiornare la data premendo il mouse
    function updateDateOnMouseEnter() {
        let currentDate = new Date();
        node.setAttribute('title', currentDate.toLocaleDateString('it', {day:'2-digit', month:'long', weekday:'long', year:'numeric'}));
    }

    // Aggiungi l'evento mouseenter alla data di aggiornamento
    $(node).mouseenter(updateDateOnMouseEnter);

    // Rendi trascinabili gli elementi dell'orologio
   $(document).ready(function() {
    $("#b").draggable({
        containment: "window", // Limita il trascinamento
        stop: function(event, ui) {
            GM_setValue('clockPosition', JSON.stringify({ top: ui.position.top, left: ui.position.left }));
        }
    });

        // Carica la posizione dalla memoria GM
        var savedPosition = GM_getValue('clockPosition');
        if (savedPosition) {
            var position = JSON.parse(savedPosition);
            $("#b").css({
            top: position.top,
            left: position.left
            });
        }
  window.addEventListener('beforeunload', function() {
        var currentPosition = $("#b").position();
        GM_setValue('clockPosition', JSON.stringify({ top: currentPosition.top, left: currentPosition.left }));
    });
});

    //Aggiorna l'orologio ogni 70
    setInterval(Clock, 70);

})();