Skip to content

Instantly share code, notes, and snippets.

@Mte90
Last active February 18, 2022 11:33
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 Mte90/ef375386e531fd41abeef4f3821b48b8 to your computer and use it in GitHub Desktop.
Save Mte90/ef375386e531fd41abeef4f3821b48b8 to your computer and use it in GitHub Desktop.
Hide Youtube video from Reddit
// ==UserScript==
// @name Hide Youtube video from Reddit
// @namespace Mte90
// @match https://reddit.com/*
// @match https://www.reddit.com/*
// @grant none
// @version 1.0
// @author -
// @description As per title
// ==/UserScript==
function remove_youtube() {
document.querySelectorAll('.styled-outbound-link').forEach(function(Item) {
if ( Item.href.includes('youtube.com') || Item.href.includes('youtu.be') ) {
Item.closest('.Post').parentNode.style.display = 'none';
}
});
}
setTimeout(function(){
remove_youtube();
}, 2500);
document.addEventListener('scroll', function(e) {
remove_youtube();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment