// ==UserScript== // @name CSDN博客百度广告移除 // @namespace http://tampermonkey.net/ // @version 0.3 // @note 0.1 基础代码完成 // @note 0.2 修复iframe异常导致无法移除的报错原因,更改为定时器5秒检测一次 // @note 0.3 移除其他广告位和可恶的彩蛋图标 // @description try to take over the world! // @author ZhangLee // @match https://blog.csdn.net/ // @include *://blog.csdn.net/* // @require http://code.jquery.com/jquery-1.12.4.min.js // @grant none // @downloadURL none // ==/UserScript== (function() { 'use strict'; function removeIframe() { var iframe = $('iframe'); for (var i = 0; i < iframe.length; i++) { var src = $(iframe[i]).attr('src'); if (typeof(src) != "undefined" && src.indexOf('baidu') >-1) { $(iframe[i]).remove(); }; } $('div[class="p4course_target"]').remove(); $('div[class="pulllog-box"]').hide(); $('div[class="csdn-tracking-statistics mb8 box-shadow"]').hide(); $('li[class="bdsharebuttonbox _360_interactive bdshare-button-style0-16"]').remove(); } removeIframe(); setInterval(removeIframe,5000); })();