Greasy Fork

饭饭百度广告一键纯净

去广告啦

当前为 2022-03-26 提交的版本,查看 最新版本

// ==UserScript==
// @name         饭饭百度广告一键纯净
// @namespace    http://your.homepage/
// @version      0.1
// @description  去广告啦
// @author       小凡宝宝
// @match        https://wenku.baidu.com/view/476ebd705e0e7cd184254b35eefdc8d376ee14b6.html
// @include      *://www.baidu.com/*
// @grant        none
// @license      AGPL License
// ==/UserScript==
var s = document.createElement('div');
s.setAttribute('id','d');
s.style="position:fixed;z-index:-199999;background-color:yellow;cursor:pointer;top:20%;left:0px;width:28px;height:36px'";
s.innerHTML="<div id='ff' style='font-size:13px;font-weight:bold' onclick=clean()>一键纯净<font id='jj' style='color:red'>关闭</font></div>";
document.getElementsByTagName('body')[0].appendChild(s);

function clean() {
  j = !j;
  var jj = document.getElementById('jj');
  if (j) {
    document.querySelectorAll(".EC_result").forEach(a => {
      a.style.display = "none";
    })
    jj.style='color:red';
    jj.innerText='关闭';
    console.log('广告清除开启了')
  } else {
    jj.style='color:green';
    jj.innerText='开启';
    console.log('广告清除关闭了!')
  }
}

var j = false;
clean();

console.log('去广告脚本 执行完毕!')