Skip to content

Instantly share code, notes, and snippets.

@hadongsoo
Last active March 6, 2020 08:30
Show Gist options
  • Save hadongsoo/f557cf98955b779559229632240564ea to your computer and use it in GitHub Desktop.
Save hadongsoo/f557cf98955b779559229632240564ea to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name youtube_menu_fliter
// @namespace Violentmonkey Scripts
// @match https://www.youtube.com/*
// @grant none
// @version 1.0
// @author -
// @run-at document-end
// @description 2020. 3. 6. 오후 4:23:04
// ==/UserScript==
const TIMEOUT = 1;
const blockMenus = ['Trending', 'Your videos'];
setTimeout(() => {
let contentContainer = document.querySelector('#contentContainer');
let guideButton = document.querySelector('yt-icon-button#guide-button');
guideButton.addEventListener('click', () => remover());
let getDoms = () => {
if (contentContainer.attributes.opened) {
let wrap = document.querySelector('#sections ytd-guide-section-renderer #items');
return wrap.querySelectorAll('ytd-guide-entry-renderer');
}
let wrap = document.querySelector('ytd-mini-guide-renderer #items');
return wrap.querySelectorAll('ytd-mini-guide-entry-renderer');
}
let remover = () => {
let domList = getDoms();
let domListSize = domList.length,
blockMenusSize = blockMenus.length;
for (let i=0; i<domListSize; i++){
for(let j=0; j<blockMenusSize; j++){
if (domList[i].textContent.includes(blockMenus[j])){
domList[i].style.display = 'none';
}
}
}
};//remover
remover();
}, TIMEOUT * 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment