Created
September 4, 2018 12:24
-
-
Save grt1st/0d2b4c430c3ceba6a70796c647c7b6a9 to your computer and use it in GitHub Desktop.
tampermonkey scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name csdn ad block | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to block ad of csdn blog! | |
// @author grt1st | |
// @match https://blog.csdn.net/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
var url = window.location.href; | |
if (url.startsWith("https://blog.csdn.net")) { | |
console.log("get it"); | |
var below = document.getElementsByClassName("pulllog-box"); | |
for(var i= 0;i<below.length;i++){ | |
below[i].remove(); | |
} | |
var right = document.getElementById("_360_interactive"); | |
if (right != null) { | |
right.remove(); | |
} | |
var left = document.getElementsByClassName("csdn-tracking-statistics mb8 box-shadow"); | |
for(var j= 0;j<left.length;j++){ | |
left[j].remove(); | |
} | |
var bottom = document.getElementsByClassName("p4course_target"); | |
for(var k= 0;k<bottom.length;k++){ | |
bottom[k].style.display="none"; | |
} | |
var news = document.getElementsByTagName("newsfeed"); | |
for(var l= 0;l<news.length;l++){ | |
news[l].style.display="none"; | |
} | |
var vip = document.getElementById("adContent"); | |
if (vip != null) { | |
vip.remove(); | |
} | |
var ads = document.getElementsByClassName("recommend-ad-box"); | |
for(var m = 0;m<ads.length;m++){ | |
ads[m].style.display="none"; | |
} | |
// | |
var a = document.getElementById("btn-readmore"); | |
if (a != null) { | |
a.click(); | |
} | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment