flash.moe/public/userscripts/remove-trending-tab.user.js

29 lines
795 B
JavaScript
Raw Normal View History

2020-08-20 00:02:37 +00:00
// ==UserScript==
// @name Removed Trending tab
// @version 1
// @grant none
// @include https://www.youtube.com/*
// ==/UserScript==
window.addEventListener('load', () => {
const guideButton = document.getElementById('guide-button'),
appDrawer = document.querySelector('app-drawer');
if (appDrawer.getAttribute('opened') !== null)
removeTrendingButton();
else
guideButton.addEventListener('click', () => removeTrendingButton());
});
function removeTrendingButton() {
const checkInterval = setInterval(() => {
const trendingButton = document.querySelector('[href="/feed/trending"]');
if (trendingButton) {
trendingButton.parentElement.remove();
clearInterval(checkInterval);
}
}, 100);
}