colori random con pulsante

pulsante per cambio colori

目前為 2022-07-17 提交的版本,檢視 最新版本

// ==UserScript==
// @name           colori random con pulsante
// @author         figuccio
// @namespace      https://gf.qytechs.cn/users/237458
// @description    pulsante per cambio colori
// @version        1.1
// @match          *://*/*
// @grant          GM_registerMenuCommand
// @noframes
// @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
// @license        MIT
// ==/UserScript==
(function() {
    'use strict';
let $ = window.jQuery;
var j3 = $.noConflict();
const body=document.body
var Button = document.createElement('button');
let btn_style = "position:absolute;text-align:center;border:3px solid green;font-size:19px;top:300px;right:;z-index:9999999999999999999999;background-color:aquamarine;color:red;padding:5px;border-radius:5px;";
let box=document.createElement("div");
//box.innerHTML = "cambio colore";
    /////////////////////////////////////
    box.title = '2 click per cambiare colore';
    box.innerHTML=`
        </div>
<button id="random" style="font-size:15px;color:black;background:red;border:1px solid green;">CAMBIA COLORI AL CLICK</button><br>
      </div>
      `;
    ////////////////////////////////////

box.style=btn_style;
j3(box).draggable();
body.append(box);
          //////////////////////////
   if(localStorage.getItem("bg")!==null){
   body.style.background=localStorage.getItem("bg");
}

  function random(){
        return '#'+Math.floor(Math.random()*16777215).toString(16);

    }
       //cambio colore al doppio click
        box.addEventListener("dblclick",function(){
        body.style=`background:${random("color")};color:${random("color")};transition:.6s;`;
        localStorage.setItem("bg",body.style.background)
       })

    //////////////////////////
    function randomColor() {
        var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
        box.innerHTML = "&nbsp;cambio colore <br/>&nbsp;"+ randomColor;
    }
    box.addEventListener("click", randomColor);
})();

QingJ © 2025

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