最近 CSDN 搞了一些小动作,导致在安装了 adblock 的插件的情况下,其顶部会出现这样的广告:

去除 CSDN “官方免费去广告 + 万能工具”

我们可以直接用油猴脚本进行去除:

// ==UserScript==
// @name         RemoveCSDNAds
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  try to take over the world!
// @author       You
// @match        *://blog.csdn.net/*
// @grant        none
// @require      https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.slim.min.js
// ==/UserScript==

(function() {
    'use strict';

    // Your code here...
    // 顶部官方去广告元素
    $(function() {
        var removedAd2 = $(".toolbar-advert").remove();
        console.log(removedAd2);
        console.log('删除成功');
    });
})();

原理是利用了 jQuery 的选择器。

关于油猴脚本,如果读者君没有了解过的话,可以直接搜索引擎搜索,网上的资料很多。

相关文章:

  • 2022-01-02
  • 2021-11-29
  • 2021-05-28
  • 2021-08-27
  • 2021-09-13
  • 2021-11-19
  • 2021-07-14
  • 2021-12-19
猜你喜欢
  • 2022-12-23
  • 2021-11-17
  • 2022-02-09
  • 2021-12-27
  • 2022-01-01
  • 2021-11-10
  • 2021-07-22
相关资源
相似解决方案