NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript==
// @name Hide Shorts
// @version 0.1.1
// @description Hide youtube shorts
// @author Chrono
// @license MIT
// @match https://www.youtube.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=youtube.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
var observerRunning = false;
var mainObserver = null;
var observerConfig = {attributes: true, subtree: true, childList: true};
function startObserver() {
observerRunning = true;
//console.log("start observer");
mainObserver = new MutationObserver(hideShorts);
mainObserver.observe(document, observerConfig);
}
function hideShorts() {
var shorts = document.querySelectorAll('[overlay-style="SHORTS"]');
//console.log("found shorts: " + shorts.length);
shorts.forEach((el) => {
el.parentElement.parentElement.parentElement.parentElement.style.display="none";
})
}
startObserver();
})();