Skip to content

Instantly share code, notes, and snippets.

@frankyxhl
Created October 11, 2016 17:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankyxhl/83708250dca1dc81affbdc9eacc0bc46 to your computer and use it in GitHub Desktop.
Save frankyxhl/83708250dca1dc81affbdc9eacc0bc46 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name RemoveAdsOnSalangane-books
// @namespace salangane_books
// @author Frank_Xu
// @include http://salangane-books.com/*
// @version 1
// @grant none
// ==/UserScript==
// 本脚本去掉海燕烦人的广告
function removeDivByClassName(className) {
// 找到对应的元素
var elmComent = document.getElementsByClassName(className);
// 循环删除掉
while (elmComent.length>0){
elmComent[0].parentNode.removeChild(elmComent[0]);
}
}
window.addEventListener ("DOMContentLoaded", function() {
// 去掉顶部广告
removeDivByClassName("wp a_t");
// 去掉用户评论处的广告
removeDivByClassName("plc plm");
// 去掉侧边栏的广告
removeDivByClassName("a_pr");
// 去掉干扰码
removeDivByClassName("jammer");
}, false);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment