zoukankan      html  css  js  c++  java
  • 通过 JS 脚本去除csdn广告

    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()}};
    
    
  • 相关阅读:
    ruby 中的respond_to (转)
    outlook最小化到托盘的设置方法
    FCKeditor 在VS2008下的用法
    暴风影音2009开机启动关闭方法
    构建自己的不可替代性
    MySQL安装1045错解决办法(绝对经典)
    如何学好C++,用好类库很重要
    转:什么是重构
    转:C++堆与栈的区别
    SQL Server 中的索引
  • 原文地址:https://www.cnblogs.com/cckui/p/10755415.html
Copyright © 2011-2022 走看看