您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Customize background color
当前为
// ==UserScript== // @name Website Customizer picker figuccio // @namespace https://greasyforks.org/users/237458 // @version 0.6 // @description Customize background color // @author figuccio // @match *://*/* // @grant GM_addStyle // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @require https://code.jquery.com/jquery-1.11.0.min.js // @require http://code.jquery.com/jquery-latest.js // @require https://code.jquery.com/ui/1.12.1/jquery-ui.js // @icon https://www.google.com/s2/favicons?sz=64&domain=tampermonkey.net // @noframes // @license MIT // ==/UserScript== //Creazione del colorPicker (function() { 'use strict'; var $ = window.jQuery; var j = $.noConflict(); //avvia la funzione dopo che la pagina e stata caricata $(document).ready(function() { var body=document.body; var style="position:fixed; top:200px; left:1100px;z-index:99999;" var customizer=document.createElement("div"); customizer.id="controll"; customizer.style=style; j(customizer).draggable({ containment: "window" // Limita il trascinamento allo schermo }); // Impostazione iniziale della posizione salvata var savedPosition = GM_getValue('customizerPosition'); if (savedPosition) { var positions = savedPosition.split(","); customizer.style.left = positions[0]; customizer.style.top = positions[1]; } body.append(customizer); // Nascondi/mostra customizer function nascondi() { var customizer = document.getElementById('controll'); customizer.style.display = ((customizer.style.display!='none') ? 'none' : 'block'); } GM_registerMenuCommand("nascondi/mostra customizer",nascondi); // Dati per la conservazione var userdata = {color:'Background',} var mycolor; if(/^#+\w+$/.test(GM_getValue(userdata.color))){mycolor = GM_getValue(userdata.color);} else {mycolor="#00ff00";} // Salvare i dati personalizzati window.setInterval(saveSetting,3000); function saveSetting() { GM_setValue(userdata.color, mycolor); GM_setValue('customizerPosition', customizer.style.left + "," + customizer.style.top); // Memorizza la posizione $('body,div[aria-label="Facebook"][role="navigation"]').css("background-color",mycolor ); } // Imposta lo stile CSS degli elementi nel menu GM_addStyle(` #code { margin-left:1px; margin-bottom:-19px; color:lime;background-color:brown; border: 2px solid blue; border-radius: 5px;cursor:pointer;} #colorinput2{margin-left:4px; margin-top:4px; background-color:#3b3b3b; color:red; border:2px solid green; border-radius: 5px;cursor:pointer;} `); // Define the customization controls width:170px evita che spostandolo hai lati cambi di dimensioni customizer.innerHTML= ` <div style="padding:10px; background-color:white; border-radius:10px; border:4px solid green;width:180px;"> <div style="display: flex; justify-content: space-between;align-items:center;"> <h3 style="margin: 0; color:blue;">Figuccio-Color</h3> <button id="closeButton" style="background-color:red; color:white; border:2px solid blue; border-radius:50%; width:25px; height:25px; cursor:pointer;">X</button> </div> <div id="controls" style="display: block;"> <button id="code">${mycolor}</button> <input type="color" list="colors" id="colorinput2" value="${mycolor}"> </div> </div> `; var colorinput2=document.querySelector('#colorinput2'); var code = document.querySelector('#code'); // Fa vedere la modifica colore prima di salvarla col tasto Salva colorinput2.addEventListener('input', function(event){Change(event)},false); // Evento della tavolozza dei colori function Change (e) { mycolor = e.target.value; code.innerHTML=e.target.value; // Colore immediatamente visibile $('body,div[aria-label="Facebook"][role="navigation"]').css("background-color",mycolor ); GM_setValue(userdata.color, mycolor); } // Add the customizer to the document body document.body.insertAdjacentHTML('beforeend', customizer); var Close=document.querySelector('#closeButton'); // Funzione chiudi con la x prende la funzione mostra nascondi dal menu Close.addEventListener('click',nascondi,false); })(); })();