// ==UserScript== // @name 【去广告 屏蔽广告 广告拦截 百度广告 百度联盟广告 谷歌广告】@LYS-广告拜拜助手(适配手机) // @namespace http://tampermonkey.net/ // @version 1.4 // @description 1、净化百度搜索结果中推广广告;2、净化百度联盟推广广告;3、净化不知名的谷歌广告;…… // @author LYS // @match */* // @icon none // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function () { 'use strict'; if (window.location.href.includes("pos.baidu.com/") || window.location.href.includes("googleads.g.doubleclick.net") || window.location.href.includes("pagead2.googlesyndication.com") || window.location.href.includes("tpc.googlesyndication.com")) { document.getElementsByTagName('head').innerHTML = ""; document.getElementsByTagName('title').innerHTML = ""; document.getElementsByTagName('body')[0].innerHTML = ""; } if (window.location.href.includes("www.baidu.com/")) { setInterval(function () { $('#content_left div:contains("广告")').slideUp() }, 500) } if (window.location.href.includes("m.baidu.com/")) { setInterval(function () { $('.ec_ad_results').hide() }, 500) } if (typeof jQuery != "undefined") { console.log("ok") } else { var script = document.createElement("script"); script.type = "text/javascript"; script.src = "https://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"; document.getElementsByTagName('head')[0].appendChild(script); } var killads = function () { $('*').each(function (index, DOMe) { var src = $(DOMe).attr("src") if (typeof src != "undefined") { if (src.includes("pos.baidu.com/") || src.includes("googleads.g.doubleclick.net") || src.includes("pagead2.googlesyndication.com") || src.includes("tpc.googlesyndication.com")) { $(DOMe).hide() } } }) } window.lys = setInterval(function () { if (typeof jQuery != "undefined") { killads(); clearInterval(lys) return } }, 500) })();