Change background ,remove useless div
当前为
// ==UserScript==
// @name Allen's web
// @namespace null
// @description Change background ,remove useless div
// @author @amormaid
// @version 0.02
// @include http://*
// @include https://*
// @exclude https://www.youtube.com/*
// @exclude http://127.0.0.1/*
// @exclude http://192.168.254.199/*
// @exclude http://10.200.1.237/*
// @exclude http://10.200.0.116/*
// @exclude http://10.200.1.238/*
// @exclude https://127.0.0.1/*
// @license MIT License
// @grant none
// ==/UserScript==
function recursion_change_style (node){
node.style.backgroundColor = "rgb("+parseInt(193*(1-0.1*Math.random()))+","+parseInt(230*(1-0.1*Math.random()))+","+parseInt(198*(1-0.1*Math.random()))+")" ;
//console.log(typeof node);
//console.log(node.children[0]);
if(node.children.length > 0){
Array.prototype.forEach.call(node.children,(function(e){
recursion_change_style(e);
}));
}
}
var targetColor = '#C1E6C6'; // 90 rgb(193,230,198)
var root = document.getElementsByTagName("body")[0];
var links = window.location.hostname;
var remove_div,elem, arr;
recursion_change_style(root);
switch(links){
case "blog.csdn.net":
remove_div = document.getElementById("side");
remove_div.style.display = "none";
// remove_div.parentNode.removeChild(remove_div);
elem = document.getElementById("article_details");
elem.setAttribute('style','overflow:visible;width:700px;position:relative;left:0;');
elem.parentNode.setAttribute('style','overflow:visible;width:700px;position:relative;left:0;');
elem.parentNode.parentNode.setAttribute('style','overflow:visible;width:700px;position:relative;left:-260px;');
break;
case "www.w3school.com.cn":
remove_div = document.getElementById("navsecond");
remove_div.parentNode.removeChild(remove_div);
break;
case "www.jquery123.com":
remove_div = document.getElementById("sidebar");
remove_div.parentNode.removeChild(remove_div);
document.getElementById("content").style.width = "100%";
break;
case "wallstreetcn.com":
remove_div = document.getElementsByClassName("left-bar")[0];
if(remove_div){ remove_div.style.display = "none";}
arr = document.getElementsByClassName("news-item__cover");
Array.prototype.forEach.call(arr,function(e){e.style.display = "none";});
break;
case "zhidao.baidu.com":
document.getElementById("body").style.left = "50px";
}