您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Change the background color
当前为
// ==UserScript== // @name Background Color figuccio // @namespace https://greasyfork.org/users/237458 // @match *://*/* // @author figuccio // @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.js // @grant GM_setValue // @grant GM_getValue // @grant GM_registerMenuCommand // @version 0.6 // @noframes // @license MIT // @description Change the background color // ==/UserScript== //Set Cookie var date = new Date(); date.setDate(date.getDate() + 10*1000).toLocaleString(); var exp_date = new Date(); exp_date.setDate(exp_date.getDate() - 10).toLocaleString(); var cookie = document.cookie.toString(); var color_str = /bgcolor=[a-z#0-9]*/i; var check = color_str.exec(cookie); if(check){ var current_bgcolor = check.toString().slice(8); } if(current_bgcolor){ document.body.style.background = current_bgcolor; } //Clear cookie function remove(){ var current_bgcolor_str = "bgcolor="+current_bgcolor; document.cookie = current_bgcolor_str+';expires='+exp_date; } //CSS Here var css1 = "a#color_button{text-align:center;padding-left:1px;width:97px;color:green;background:#d8d8d8;display:block;font-size:16px;border:2px red solid;}"; var css2 = "div#main_div{cursor:pointer;}div#colors{color: blue;cursor:pointer;padding-left:2px;padding-top:4px;padding-bottom:4px;background-color: violet;}span.colors{text-align:center;display:block;border:1px solid black};"; var css = css1 + css2; var head = document.getElementsByTagName('head')[0]; var style = document.createElement('style'); style.type = "text/css"; style.innerHTML = css; head.insertBefore(style,head.childNodes[1]); //Choices of Colors var inner_code1 = '<div id="main_div"><a id="color_button">COLORI</a></div><br>'; //Add colors here //'<span class="colors" id="color">COLOR</span><br>'+ // var inner_code2 = ['<div id="colors">'+ '<input type="radio" class="colors" id="red" name=radiobutton; style=background:red;>RED</span><br>'+ '<input type="radio" class="colors" id="lightred" name=radiobutton; style=background:#fa6671;>LIGHT RED</span><br>'+ //#fa6671 '<input type="radio" class="colors" id="purple" name=radiobutton; style=background:purple;>PURPLE</span><br>'+ '<input type="radio" class="colors" id="lightpurple" name=radiobutton; style=background:#cd81d9;>LIGHT PURPLE</span><br>'+ '<input type="radio" class="colors" id="green" name=radiobutton; style=background:green;>GREEN</span><br>'+ '<input type="radio" class="colors" id="lightgreen" name=radiobutton; style=background:#7aff70;>LIGHT GREEN </span><br>'+//#7aff70 '<input type="radio" class="colors" id="orange" name=radiobutton; style=background:orange;>ORANGE</span><br>'+ '<input type="radio" class="colors" id="lightorange" name=radiobutton; style=background:#ff8e42;>LIGHT ORANGE</span><br>'+ //#ff8e42 '<input type="radio" class="colors" id="lightyellow" name=radiobutton; style=background:#fff370;">LIGHT YELLOW </span><br>'+//#fff370 '<input type="radio" class="colors" id="lightblue" name=radiobutton; style=background:#b8feff;>LIGHT BLUE </span><br>'+//#b8feff '<input type="radio" class="colors" id="blue" name=radiobutton; style=background:#3131cd;>BLUE </span><br>'+//#3131cd '<input type="radio" class="colors" id="pinkdeep" name=radiobutton; style=background:#FF1493;>DEEP PINK </span><br>'+// #FF1493 '<input type="radio" class="colors" id="redorange" name=radiobutton;style=background:#FF4500;>RED ORANGE </span><br>'+//#FF4500 '<input type="radio" class="colors" id="grey" name=radiobutton; style=background:#666666;>GREY</span><br>'+//#666666 '<input type="radio" class="colors" id="lightgrey" name=radiobutton; style=background:#dedede;>LIGHT GREY</span><br>'+ //#dedede //End add colors '<input type="radio" class="colors" id="reset" style=background:#526169;>RESET</span><br>'+ //#526169 '</div>'].join(); var inner_code = inner_code1 + inner_code2; var div = function(){ var a = document.getElementsByTagName('body')[0]; var b = document.createElement('div'); b.style.position = 'absolute'; b.style.top = '50px'; b.style.left = '0px'; b.innerHTML = inner_code; a.appendChild(b); } div(); //Hide or Show if(document.cookie.toString().match(/block/)){ $("#colors").show(); } else if(document.cookie.toString().match(/none/)){ $("#colors").hide(); } else{ $(function(){$("#colors").hide();}) } var disp; $("#main_div").click(function() { $("#colors").slideToggle(function get_disp(){ disp = document.getElementById('colors').style.display; document.cookie = disp +';expires='+date; }); }); //Color executing functions //FOR WHITE var reset = document.getElementById('reset'); reset.onclick = function(){ remove(); window.location = "/"; } //FOR RED var red = document.getElementById('red'); red.onclick = function(){ remove(); document.body.style.background = "red"; var color = "bgcolor=red"; document.cookie= color+';expires='+date; } //FOR LIGHT RED var lightred = document.getElementById('lightred'); lightred.onclick = function(){ remove(); document.body.style.background = "#fa6671"; var color = "bgcolor=#fa6671"; document.cookie= color+';expires='+date; } //FOR PURPLE var purple = document.getElementById('purple'); purple.onclick = function(){ remove(); document.body.style.background = "purple"; var color = "bgcolor=purple"; document.cookie= color+';expires='+date; } //FOR LIGHT PURPLE var lightpurple = document.getElementById('lightpurple'); lightpurple.onclick = function(){ remove(); document.body.style.background = "#cd81d9"; var color = "bgcolor=#cd81d9"; document.cookie= color+';expires='+date; } //FOR GREEN var green = document.getElementById('green'); green.onclick = function(){ remove(); document.body.style.background = "green"; var color = "bgcolor=green"; document.cookie= color+';expires='+date; } //FOR LIGHT GREEN var lightgreen = document.getElementById('lightgreen'); lightgreen.onclick = function(){ remove(); document.body.style.background = "#7aff70"; var color = "bgcolor=#7aff70"; document.cookie= color+';expires='+date; } //FOR ORANGE var orange = document.getElementById('orange'); orange.onclick = function(){ remove(); document.body.style.background = "orange"; var color = "bgcolor=orange"; document.cookie= color+';expires='+date; } //FOR LIGHT ORANGE var lightorange = document.getElementById('lightorange'); lightorange.onclick = function(){ remove(); document.body.style.background = "#ff8e42"; var color = "bgcolor=#ff8e42"; document.cookie= color+';expires='+date; } //FOR YELLOW var lightyellow = document.getElementById('lightyellow'); lightyellow.onclick = function(){ remove(); document.body.style.background = "#fff370"; var color = "bgcolor=#fff370"; document.cookie= color+';expires='+date; } //FOR LIGHT BLUE var darkblue = document.getElementById('lightblue'); darkblue.onclick = function(){ remove(); document.body.style.background = "#b8feff"; var color = "bgcolor=#b8feff"; document.cookie= color+';expires='+date; } //FOR BLUE var blue = document.getElementById('blue'); blue.onclick = function(){ remove(); document.body.style.background = "#3131cd"; var color = "bgcolor=#3131cd"; document.cookie= color+';expires='+date; } //FOR DEEP PINK var pinkdeep = document.getElementById('pinkdeep'); pinkdeep.onclick = function(){ remove(); document.body.style.background = "#FF1493"; var color = "bgcolor=#FF1493"; document.cookie= color+';expires='+date; } //FOR RED ORANGE var redorange = document.getElementById('redorange'); redorange.onclick = function(){ remove(); document.body.style.background = "#FF4500"; var color = "bgcolor=#FF4500"; document.cookie= color+';expires='+date; } //FOR GREY var black = document.getElementById('grey'); black.onclick = function(){ remove(); document.body.style.background = "#666666"; var color = "bgcolor=#666666"; document.cookie= color+';expires='+date; } //FOR LIGHT GREY var lightblack = document.getElementById('lightgrey'); lightblack.onclick = function(){ remove(); document.body.style.background = "#dedede"; var color = "bgcolor=#dedede"; document.cookie= color+';expires='+date; }