Forked from rohenaz/UserScript-RedditNoPromoted.js
Last active
January 29, 2023 02:15
-
-
Save neoOpus/2aa8f33b417a55d980191efc9b20582b to your computer and use it in GitHub Desktop.
UserScript - Remove Reddit Promoted Post
This file contains hidden or 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