Skip to content

Instantly share code, notes, and snippets.

@tcoppex
Last active April 4, 2018 13:53
Show Gist options
  • Save tcoppex/b3ae05eed8ebd67284e39ef1d48bc027 to your computer and use it in GitHub Desktop.
Save tcoppex/b3ae05eed8ebd67284e39ef1d48bc027 to your computer and use it in GitHub Desktop.
GreaseMonkey script to remove unused links from Youtube main page.
// ==UserScript==
// @name YouTube Spam Filters
// @namespace Youtube Scripts
// @description Remove unused links from Youtube's front page.
// @match *://www.youtube.com/*
// @grant GM_addStyle
// @run-at document-idle
// @icon http://www.youtube.com/favicon.ico
// ==/UserScript==
const links = [ "/feed/trending", "/feed/history", "/feed/purchases" ];
links.forEach((link) => {
const href = `*[href="${link}"]`;
Array.prototype.forEach.call(document.querySelectorAll(href), (node) => {
node.parentNode.style.display = "none";
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment