// ==UserScript== // @name Clean Reading // @name:zh_CN 清爽阅读 // @namespace http://www.lelins.com/ // @version 0.1.4 // @description remove CSDN,stackoverflow,cnblogs,jb51.net elements you not like, such as advertisements. // @description:zh_CN 轻松去除CSDN,statckoverflow,cnblog,jb51等网站上很乱的东西,让你更专注于阅读内容。支持把内容直接打印为PDF // @author lelins.com // @match https://blog.csdn.net/* // @match https://stackoverflow.com/questions/* // @match https://www.cnblogs.com/* // @match http://www.jb51.net/article/* // @grant none // 2018-04-16 add Statckoverflow site // 2018-04-17 add switch button you can hide or show the hidden elements // 2018-04-18 add jb51.net site // @downloadURL https://update.greasyfork.icu/scripts/40705/Clean%20Reading.user.js // @updateURL https://update.greasyfork.icu/scripts/40705/Clean%20Reading.meta.js // ==/UserScript== (function() { 'use strict'; function css(id,styles){ try{ $('#'+id).css(styles);}catch(e){} try{ $(id).css(styles);}catch(e){}} function css_(id){ try{ $('#'+id).removeAttr('style');}catch(e){} try{ $(id).removeAttr('style');}catch(e){}} window.killJB51 = function(hideThem){ if(hideThem){ $('.main.mb10.clearfix,.topTools,.header,.wrap>.subnav,.fr.w300,#right-share,.xgcomm.clearfix,#footer,#comments,.jb51ewm,.art_xg,.w350.fr').hide(); $('iframe').remove(); setTimeout(function(){ $('#BAIDU_DUP_fp_wrapper').hide(); $('.w750.fl').css({width:'1080px'}); $('#content,.jb51code').css({width:'1000px'}); },300); }else{ $('.main.mb10.clearfix,.topTools,.header,.wrap>.subnav,.fr.w300,#right-share,.xgcomm.clearfix,#footer,#comments,.jb51ewm,.art_xg,.w350.fr').show(); css_('.w750.fl,#content,.jb51code'); } }; window.killCSDN = function(hideThem){ if(hideThem){ css('main',{ paddingLeft : 0, width: '97%',float : 'left'}); css('article_content',{height:'auto'}); $('#side,#navigator,#article_ad,.readall_box,.article_next_prev,aside').hide(); setTimeout(function(){ $('#share_box,.meau-gotop-box,.csdn-toolbar,.recommend_list,.comment_look_more,.pulllog-box,.comments').hide(); css('comment_list',{height:'auto'}); $('#layerd').remove(); $('iframe').remove(); },500); }else{ css_('main'); css_('article_content'); $('#side,#navigator,#article_ad,.readall_box,.article_next_prev,aside').show(); $('#share_box,.meau-gotop-box,.csdn-toolbar,.recommend_list,.comment_look_more,.pulllog-box,.comments').show(); css_('comment_list'); } }; /* StatckOverflow 站点 */ window.killStackoverflow = function (hideThem){ if( hideThem ){ $('#sidebar').hide(); setTimeout(function(){ $('#mainbar, .mainbar,.answer,.answers-header,#questions, #answers').css({'width':'97%'}); $('.question-page #answers .answer').css({'border-top':'5px solid #ccc'}); $('.everyonelovesstackoverflow').hide(); $('footer,#dfp-mlb,.new-post-login,#post-form').hide(); $('.bottom-notice,.hero-container,.post-text ~ div').hide(); $('.answer .vote-count-post:contains("-")').each(function(){ $(this).parents('.answer').hide(); }); },800); }else{ $('#sidebar').show(); css_('#mainbar, .mainbar,.answer,.answers-header,#questions, #answers'); css_('.question-page #answers .answer'); $('.everyonelovesstackoverflow').show(); $('footer,#dfp-mlb,.new-post-login,#post-form').show(); $('.bottom-notice,.hero-container,.post-text ~ div').show(); $('.answer .vote-count-post:contains("-")').each(function(){ $(this).parents('.answer').show(); }); } }; window.killCNBlog = function(hideThem){ if(hideThem){ $('#leftcontent,#header,#comment_form,.footer,#blog_post_info_block,#mytopmenu').hide(); $('#centercontent').css({width : '80%','padding-left':'10%'}); }else{ $('#leftcontent,#header,#comment_form,.footer,#blog_post_info_block,#mytopmenu').show(); $('#centercontent').removeAttr('style'); } }; window.siteCfg = {}; window.toggle = function(){ var host = window.location.host; window.siteCfg[host] = !!!window.siteCfg[host]; var hideThem = window.siteCfg[host]; if( 'blog.csdn.net' == host){ window.killCSDN(hideThem); }else if('stackoverflow.com' == host){ window.killStackoverflow(hideThem); }else if('www.cnblogs.com' == host){ window.killCNBlog(hideThem); }else if('www.jb51.net' == host){ window.killJB51(hideThem); } }; window.toggle(); var html = ""; html+="
"; $('body').append(html); // Your code here...background: ; })();