-
-
Save Jakesta13/9adf367ab15b29920b815f039bd62a5d to your computer and use it in GitHub Desktop.
UserScript - Remove Reddit Promoted Post
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 Reddit Hide Promoted Links (New Design) | |
// @namespace http://github.com/rohenaz | |
// @version 0.1 | |
// @description remove promoted posts and advertisements | |
// @author Satchmo | |
// @match https://www.reddit.com/* | |
// @grant none | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
let els = document.getElementsByClassName('promotedlink') | |
clean(els) | |
setInterval(() => { | |
let adEls = document.querySelectorAll('[data-google-query-id]') | |
clean(adEls) | |
}, 2000) | |
})(); | |
function clean(els) { | |
if(els) { | |
let x = els.length | |
while(x--) { | |
if (els[x].getAttribute('data-slot')) { | |
els[x] = els[x].parentElement.parentElement.parentElement | |
} | |
els[x].style.display = 'none' | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment