Browsing Designer color picker figuccio

color picker background con memoria

目前為 2022-09-06 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

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

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name          Browsing Designer color picker figuccio
// @namespace     https://greasyfork.org/users/237458
// @version       0.3
// @description   color picker background con memoria
// @author        figuccio
// @match         *://*/*
// @icon          https://www.flaticon.com/svg/1426/1426846.svg
// @require       http://code.jquery.com/jquery-latest.js
// @require       https://code.jquery.com/ui/1.12.1/jquery-ui.js
// @grant         GM_addStyle
// @grant         GM_setValue
// @grant         GM_getValue
// @grant         GM_registerMenuCommand
// @license                  MIT
// @noframes
// ==/UserScript==
let $ = window.jQuery;
var j = $.noConflict();
const body=document.body;
let btn_style=`position:fixed;right:10px;bottom:10px;transition:.2s;font-size:15px;box-sizing:border-box;padding:5px;color:black;background:white;border:1px solid lightgrey;border-radius:5px;cursor:pointer;height:fit-content;width:fit-content;z-index:20000000000;font-family: “Helvetica Neue”,Helvetica,Arial,sans-serif;`;

let box_style=`text-align:right;position:fixed;right:10px;top:10px;width:230px;height:25px;transition:.6s;border-box;padding:5px;color:black;background:red;border:1px solid lightgrey;border-radius:5px;cursor:default;z-index:200000000000;font-family: “Helvetica Neue”,Helvetica,Arial,sans-serif;`;
let box=document.createElement("div");

box.innerText="Personalizza";
box.style=btn_style;
let box_state="btn";
j(box).draggable();
body.append(box);

//////////////////////////////////////popup pulsante cambia colori al click visibile dal menu mostra nasconde
function myFunctionbox() {
 box.style.display = ((box.style.display!='none') ? 'none' : 'block');}
GM_registerMenuCommand("display",myFunctionbox);
                      //scomparsa automatica pulsante cambia colori dopo 30sec
setTimeout(() => myFunctionbox(), 30000);//30sec
////////////////////////////////////////////////////////////////////////////
 //la finestra si apre da sola dopo sec
 setTimeout(function(){document.querySelector("body > div.ui-draggable.ui-draggable-handle").click();}, 3000);
//////////////////////////////////////////////////
box.addEventListener("click",function(){
    if(box_state=="btn"){
        this.style=box_style;
        this.innerText="";
        box_state="box";
        this.innerHTML=`
        color picker
<button id="colorSelected">get value</button>

<input id="random" title="Background-Color" name="bgColor" class="inp-customizer picker"  value="#FF0000"   type="color" oninput="document.getElementById('colorSelected').innerHTML = this.value;">


        </div>

        </div>
        </center>
`;

        let colorPickers=document.getElementsByClassName("picker");
        let randomBtn=document.getElementById("random");

        for(let i=0;i<colorPickers.length;i++){
            colorPickers[i].addEventListener("input", function(){
                if(this.name=="bgColor"){
                   body.style.background=this.value;
                    GM_setValue('bg',body.style.background );
                }
            })
        }
    }
})


if (GM_getValue('bg') !==null){
  document.body.style.backgroundColor=GM_getValue('bg');
}