您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Change background ,remove useless div
当前为
// ==UserScript== // @name Allen's web // @namespace null // @description Change background ,remove useless div // @author @amormaid // @version 0.3.1 // @run-at document-end // @include http://* // @include https://* // @exclude https://www.youtube.com/* // @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/* // @exclude http://127.0.0.1/* // @exclude https://kiwivm.64clouds.com/* // @exclude http://192.168.254.133/* // @exclude http://104.224.166.80/* // @exclude https://www.instagram.com/* /* // @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js */ // @license MIT License // @grant none // ==/UserScript== function recursion_change_style (node,style_obj){ //style_obj.backgroundColor || if(!node.style.backgroundColor){ node.style.backgroundColor = "rgb("+parseInt(239*(1-0.1*Math.random()))+","+parseInt(239*(1-0.1*Math.random()))+","+parseInt(187*(1-0.1*Math.random()))+")" ; } if(style_obj && style_obj instanceof Object){ for(var attr in style_obj){ node.style[attr] = style_obj[attr]; } } if(node && node.children.length > 0){ Array.prototype.forEach.call(node.children,function(e){ recursion_change_style(e,style_obj); }); } } function $$(selector,operation,nodes_model){ var model = nodes_model || 'one'; switch(operation){ case "hide": case 'hide': if( model =='one' ){ var page_ele = document.querySelector(selector) ; if(!page_ele){ return; } page_ele.style.display = "none" ; }else{ var arr = document.querySelectorAll(selector); if(!arr){ return; } Array.prototype.forEach.call(arr,function(e){e.style.display = "none";}); } break; case "remove": case 'remove': if( model =='one' ){ var page_elem = document.querySelector(selector) ; if(!page_elem){ return; } page_elem.parentNode.removeChild(page_elem); }else{ var arr_remove = document.querySelectorAll(selector); if(!arr_remove){ return; } Array.prototype.forEach.call(arr_remove,function(e){e.parentNode.removeChild(e);}); } break; default: if(model ==='one'){ return document.querySelector(selector) ; }else{ return document.querySelectorAll(selector); } } } function remove_div_padding_margin(ele){ if( ele ){ ele.setAttribute('style','overflow:visible;position:relative;padding:0px;margin:0px;left:0px;'); } if(ele && ele.children.length > 0){ Array.prototype.forEach.call(ele.children,(function(e){ remove_div_padding_margin(e); })); } } function content_get() { var ajax = new XMLHttpRequest(); ajax.open('get', '/'); ajax.send(); ajax.onreadystatechange = function() { if (ajax.readyState == 4 && ajax.status == 200) { content_new = ajax.responseText; //console.log(content_new); content_old = content_old || content_new; if(content_new !== content_old){ location.reload() ; } } }; setTimeout(content_get,1000); } function change_wallstreet_style(){ var remove_div = document.getElementsByClassName("left-bar")[0]; if(remove_div) remove_div.style.display = "none"; var arr = document.getElementsByClassName("news-item__cover"); Array.prototype.forEach.call(arr,function(e){e.style.display = "none";}); recursion_change_style(root); setTimeout(change_wallstreet_style,500); } function show_juejin_hidden_content(){ var a = document.getElementsByClassName("show-full")[0]; var b = document.getElementsByClassName("show-full-block")[0]; var c = document.getElementsByClassName(" show-full-btn")[0]; if(a)a.style.height = "auto"; if(b)b.style.height = "auto"; if(c)c.style.display = "none"; recursion_change_style(root); setTimeout(show_juejin_hidden_content,300); } var root = document.body; var links = window.location.hostname; var remove_div,elem,elem_2, arr,ad_ele,remove_ele; var content_old,content_new; try{ switch(links){ case "www.baidu.com": setTimeout(function(){ $$("#content_right",'hide','one'); document.getElementById("container").style.width = "700px"; },50); var head = document.getElementById("head"); var pad = document.getElementById("s_tab"); var u = document.getElementById("u"); head.style.position = 'relative'; head.style.width = window.innerWidth-100+'px'; head.style['min-width'] = 0; pad.style.padding = '0 0 0 121px'; u.style.display = 'none'; //$$("#u",'hide','one'); //u.style.position = 'relative'; //u.style.padding = '0 0 0 121px'; //u.style.margin = '5px 9px 5px 5px'; document.body.style['min-width'] = '10px'; var baidu_style_obj = { // 'max-width':'600px', // 'min-width':'2px', // margin:'5px', // padding:'auto', // backgroundColor:'rgb(255,255,255)', }; recursion_change_style(root); break; case "blog.csdn.net": /* remove_ele = document.getElementsByClassName("pre-numbering"); Array.prototype.forEach.call(remove_ele,function(e){ e.style.display = 'none'; }); */ $$(".csdn-tracking-statistics",'hide','all'); $$("#side",'hide','one'); body_div = document.getElementById("body"); remove_div_padding_margin(body_div); elem = $$("#article_details",'none','one'); if(elem) elem.setAttribute('style','width:700px;left:-260px;margin-left:20px;'); //recursion_change_style(root); var CSDN_style_obj = { 'max-width':document.body.clientWidth-16+'px', 'min-width':'2px', // margin:'5px', // padding:'auto', // backgroundColor:'rgb(255,255,255)', }; recursion_change_style(root,CSDN_style_obj); break; case "www.w3school.com.cn": $$("#navsecond",'hide','one'); recursion_change_style(root); break; case "www.jquery123.com": $$("#sidebar",'hide','one'); var a = $$("#content",'hide','one'); if(a) a.style.width = "100%"; recursion_change_style(root); break; case "wallstreetcn.com": change_wallstreet_style(); break; case "zhidao.baidu.com": var a =document.getElementById("body"); if(a) a.style.left = "50px"; recursion_change_style(root); break; case "www.merriam-webster.com": $$(".right-rail",'hide','one'); $$("#recirc-bar-footer",'hide','one'); if(a) a.elem.style.width = "100%"; $$(".wgt-related-to.jc-card-box.clearfix",'hide','one'); recursion_change_style(root); break; case "blog.sina.com.cn": $$("#column_1",'hide','one'); recursion_change_style(root); break; case "blog.jobbole.com": case "web.jobbole.com": $$("#sidebar",'hide','one'); //$$(".grid-8",'hide','one'); var a = $$(".grid-8",'none','one'); // if (a) a.style.width = "700px"; if (a) a.style.width = "100%"; recursion_change_style(root); break; case "juejin.im": setTimeout(show_juejin_hidden_content,1000); break; case "www.cnblogs.com": $$("#vid",'hide','one'); $$("#left",'hide','one'); $$("#right_content",'hide','one'); $$("#leftcontent",'hide','one'); var a = $$("#centercontent",'none','one'); if(a)a.style['padding-left'] = 0; recursion_change_style(root); break; case "github.com": document.body.style.minWidth = '100px'; var github_pad = document.querySelector('.column.three-fourths.codesearch-results.pr-6') ; if(github_pad ){ github_pad.style.padding = '10px 0 10px 30px'; } recursion_change_style(root,{'max-width':document.body.clientWidth+'px'}); break; case "wiki.jikexueyuan.com": $$(".detail-left",'hide','one'); var a = $$(".detail-main",'none','one'); a.style['margin-left'] = '0px'; a.style.width = document.body.clientWidth+'px'; recursion_change_style(root); break; default: recursion_change_style(root); } console.clear(); }catch(err){ //console.log(err.name,' ',err.message); console.log(err.stack); }