29 lines
795 B
JavaScript
29 lines
795 B
JavaScript
|
// ==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);
|
||
|
}
|