// ==UserScript== // @name CSDN博客百度广告移除 // @namespace http://tampermonkey.net/ // @version 0.2 // @note 0.1 基础代码完成 // @note 0.2 修复iframe异常导致无法移除的报错原因,更改为定时器5秒检测一次 // @description fuck off baidu! // @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(); }; } } removeIframe(); setInterval(removeIframe,5000); })();