// ==UserScript== // @name Focusing Reading // @namespace http://tampermonkey.net/ // @version 0.1.3 // @description Reading CSDN,stackoverflow free without any advertisements and other you not want to see. // @author 乐邻互联 // @match https://blog.csdn.net/* // @match https://stackoverflow.com/questions/* // @match https://www.cnblogs.com/* // @grant none // 2018-04-16 add Statckoverflow site // 2018-04-17 add switch button you can hide or show the hidden elements // @downloadURL none // ==/UserScript== (function() { 'use strict'; function css(id,styles){ try{ $('#'+id).css(styles);}catch(e){} try{ $(id).css(styles);}catch(e){}} function css_(id,styles){ try{ $('#'+id).removeAttr('style');}catch(e){} try{ $(id).removeAttr('style');}catch(e){}} 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); } }; window.toggle(); var html = ""; html+="
"; $('body').append(html); // Your code here...background: ; })();