1. chorme 浏览器
1.1 通过书签方式添加
新建书签:
在网址一栏中输入:
javascript: $(function () { $('aside .csdn-tracking-statistics').hide();$('#asideFooter').hide();$('.pulllog-box').hide();$('#dmp_ad_58').remove();$('.indexSuperise').remove();$('#btn-readmore').click();$('#adContent').hide();$('.recommend-ad-box').hide();$('.type_hot_word').hide();$('.recommend-fixed-box').hide();$('.recommend-right').hide();$('aside').remove();})
每次进入页面后,执行一下脚本即可。
1.2 js 作为插件安装
新建文件 remove_ad.user.js:
window.onload=function(){if(window.location.host=="blog.csdn.net"){var asideFooter=document.querySelector("#asideFooter");if(asideFooter!=null){asideFooter.style.visibility="hidden"}var pulllogBox=document.querySelector(".pulllog-box");if(pulllogBox!=null){pulllogBox.style.visibility="hidden"}var dmp_ad_58=document.querySelector("#dmp_ad_58");if(dmp_ad_58!=null){dmp_ad_58.style.visibility="hidden"}var indexSuperise=document.querySelector(".indexSuperise");if(indexSuperise!=null){indexSuperise.style.visibility="hidden"}var adContent=document.querySelector("#adContent");if(adContent!=null){adContent.style.visibility="hidden"}var recommendadbox=document.querySelectorAll(".recommend-ad-box");if(recommendadbox!=null){for(var i=0;i<recommendadbox.length;i++){recommendadbox[i].style.visibility="hidden"}}var type_hot_word=document.querySelector(".type_hot_word");if(type_hot_word!=null){type_hot_word.style.visibility="hidden"}var recommendRight=document.querySelector(".recommend-right");if(recommendRight!=null){recommendRight.style.visibility="hidden"}var aside=document.querySelector("aside");if(aside!=null){aside.parentNode.removeChild(aside)}document.querySelector("#btn-readmore").click()}};
打开chrome://extensions/,将脚本文件拖入即可。浏览器每次打开新页面,都会执行以上脚本。
2. Firefox 浏览器
下载并安装用户脚本管理插件 greasemonkey (油猴子),新建并编辑脚本:
// ==UserScript==
// @name 去广告
// @version 1
// @grant none
// ==/UserScript==
window.onload=function(){if(window.location.host=="blog.csdn.net"){var asideFooter=document.querySelector("#asideFooter");if(asideFooter!=null){asideFooter.style.visibility="hidden"}var pulllogBox=document.querySelector(".pulllog-box");if(pulllogBox!=null){pulllogBox.style.visibility="hidden"}var dmp_ad_58=document.querySelector("#dmp_ad_58");if(dmp_ad_58!=null){dmp_ad_58.style.visibility="hidden"}var indexSuperise=document.querySelector(".indexSuperise");if(indexSuperise!=null){indexSuperise.style.visibility="hidden"}var adContent=document.querySelector("#adContent");if(adContent!=null){adContent.style.visibility="hidden"}var recommendadbox=document.querySelectorAll(".recommend-ad-box");if(recommendadbox!=null){for(var i=0;i<recommendadbox.length;i++){recommendadbox[i].style.visibility="hidden"}}var type_hot_word=document.querySelector(".type_hot_word");if(type_hot_word!=null){type_hot_word.style.visibility="hidden"}var recommendRight=document.querySelector(".recommend-right");if(recommendRight!=null){recommendRight.style.visibility="hidden"}var aside=document.querySelector("aside");if(aside!=null){aside.parentNode.removeChild(aside)}document.querySelector("#btn-readmore").click()}};