clock Facebook figuccio data-time

data ora calendario

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

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

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name          clock Facebook figuccio data-time
// @namespace     https://greatest.deepsurf.us/users/237458
// @version       1.2
// @author        figuccio
// @description   data ora calendario
// @match         https://*.facebook.com/*
// @grant         GM_addStyle
// @grant         GM_setValue
// @grant         GM_getValue
// @grant         GM_registerMenuCommand
// @require       https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @run-at        document-start
// @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==
// @require       https://greatest.deepsurf.us/scripts/12228/code/setMutationHandler.js
// @noframes
// @license       MIT
// ==/UserScript==
(function() {
    'use strict';

    const $ = window.jQuery.noConflict(); // Evita triangolo giallo

    // Aggiungi la funzione per il trascinamento limitato allo schermo
    function makeDraggableLimited(element) {
        element.draggable({
            containment: "window",
            stop: function(event, ui) {
                // Memorizza la posizione dopo il trascinamento
                GM_setValue('boxPosition', JSON.stringify(ui.position));
            }
        });
    }

    // Creazione del contenitore
    const body = document.body;
    const style = "position:fixed; top:0; left:760px; z-index:99999;";
    const box = document.createElement("div");
    box.id = "mydata";
    box.style = style;
    body.append(box);

    // Ripristina la posizione salvata, se presente
    const savedPosition = GM_getValue('boxPosition');
    if (savedPosition) {
        const parsedPosition = JSON.parse(savedPosition);
        $(box).css({ top: parsedPosition.top, left: parsedPosition.left });
    }

    // Rendi l'elemento trascinabile con limitazioni di schermo
    makeDraggableLimited($(box));

    // Funzione per mostrare/nascondere il box
    function toggleBoxVisibility() {
        box.style.display = (box.style.display !== 'none') ? 'none' : 'block';
    }

    GM_registerMenuCommand("Nascondi/Mostra Time", toggleBoxVisibility);

    // Timer per aggiornare l'ora e la data
    setInterval(myTimer, 70);
    function myTimer() {
        var d = new Date();
        var t = d.toLocaleTimeString();
        var mm = d.getMilliseconds(); // Millisecondi
        var date = new Date().toLocaleString('it', {'weekday': 'short', 'month': '2-digit', 'day': '2-digit','year':'numeric'
    });
    document.getElementById("datePicker1").innerHTML = date + " " + t + mm;
}
    // Inserimento del layout
    box.innerHTML = `
        <fieldset style="background:#3b3b3b;border:2px solid red;color:lime;border-radius:7px;text-align:center;height:35px;width:200px;">
            <legend>DATA-TIME</legend>
           <div id=setuiclock style="width:auto;height:25px;margin:-12px;border-width:1px;">
                <div id="datePicker1" style="background:#3b3b3b;color:lime;border:1px solid yellow;font-size:16px;border-radius:5px;margin:9px;text-align:center;width:max-content;">
                </div>

        </fieldset>
    `;
})();