Facebook cambia colore barra new facebook

color picker barra facebook

// ==UserScript==
// @name         Facebook cambia colore barra new facebook
// @author       figuccio
// @namespace    https://gf.qytechs.cn/users/237458
// @description  color picker barra facebook
// @match        https://*.facebook.com/*
// @version      13.5
// @grant        GM_addStyle
// @grant        GM_setValue
// @grant        GM_getValue
// @run-at       document-start
// @grant        GM_registerMenuCommand
// @noframes
// @icon         https://facebook.com/favicon.ico
// @require      https://code.jquery.com/jquery-3.6.0.min.js
// @require      https://code.jquery.com/ui/1.13.2/jquery-ui.min.js
// @license      MIT
// ==/UserScript==
(function() {
    'use strict';
    const $ = window.jQuery;
    const userdata = {color:'figuccio'};

    // Funzione per rendere l'elemento trascinabile con limiti di schermo
    function makeDraggableLimited(element) {
        element.draggable({
            containment: "window",
            stop: function(event, ui) {
                GM_setValue('boxPosition', JSON.stringify(ui.position));
            }
        });
    }

    // Funzione per salvare le impostazioni del colore e applicarlo immediatamente
    function saveColorSetting(color) {
        GM_setValue(userdata.color, color);
        $('div[aria-label="Facebook"][role="navigation"]').css("background-color", color);
    }

    $(document).ready(function() {
        const body = document.body;
        var mycolor = GM_getValue(userdata.color, "#980000"); // Valore predefinito (marzo 2025)
        let currentColor = mycolor;

        const box = $('<div id="my100">').css({
            position: 'fixed',
            top: '60px',
            left: '1101px',
            zIndex: 99999
        }).appendTo(body);

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

        makeDraggableLimited(box);

        // Mostra/Nascondi dal menu
        function toggleBox() {
            box.toggle();
        }
        GM_registerMenuCommand("Nascondi/Mostra box", toggleBox);

        // Stili CSS
        GM_addStyle(`
            #colorspan { margin-left: 1px; margin-bottom: -19px; color: lime; background-color: brown; border: 1px solid blue; border-radius: 5px; }
            #setui { width: auto; height: 25px; margin-top: -1px; margin-left: 0px; margin-right: 0px; margin-bottom: 0px; border-width: 1px; color: lime; }
            #colorinput { margin-left: 4px; margin-top: 4px; background-color: #3b3b3b; color: red; border: 2px solid green; border-radius: 5px; }
           #datePicker{border:1px solid yellow;border-radius:5px;cursor:pointer;text-align:center;margin-top:-6px;margin-left:86px;font-size:14px;width:max-content;}
            .button { padding: 2px 2px; margin-top: -19px; display: inline-block; border: 1px solid green; border-radius: 3px; cursor: pointer; background: red; }
        `);

        // Aggiorna l'orario
     setInterval(myTimer,90);
    function myTimer() {
    var d = new Date();
    var t = d.toLocaleTimeString();
    var mm = d.getMilliseconds();
    var date = new Date().toLocaleString('it', {'weekday': 'short', 'month': '2-digit', 'day': '2-digit','year':'numeric'
    });
    document.getElementById("datePicker").innerHTML = date + " " + t + ":" + mm;
}

        // Contenuto del box
        box.html(`
            <fieldset style="background:blue; border: 2px solid red; color: lime; border-radius: 7px; text-align: center; width:290px;">
                <div id="datePicker"  title="Data-ora" ></div>
                       <legend>Time</legend>
                <div id="setui">
                   <button id="colorspan"title="Hex value">${currentColor}</button><input type="color" list="colors" id="colorinput" value="${currentColor}" title="color picker">
                </div>
            </fieldset>
        `);

        const colorInput = $('#colorinput');
        const colorSpan = $('#colorspan');

        // Evento cambio colore
        colorInput.on('input', function(event) {
            currentColor = event.target.value;
            colorSpan.text(currentColor);
            saveColorSetting(currentColor); // Applica immediatamente il colore
        });

        // Inizializza i valori
        colorSpan.text(currentColor);
        colorInput.val(currentColor);

        // Applica il colore iniziale
        saveColorSetting(currentColor);
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址