yt-shorts-remover.js hinzugefügt
This commit is contained in:
commit
fe8d02a21f
35
yt-shorts-remover.js
Normal file
35
yt-shorts-remover.js
Normal file
@ -0,0 +1,35 @@
|
||||
// ==UserScript==
|
||||
// @name YouTube Shorts Blocker & Redirector
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.3
|
||||
// @description Entfernt Shorts von YouTube + Weiterleitung von /shorts/* zur Startseite
|
||||
// @author Du
|
||||
// @match https://www.youtube.com/*
|
||||
// @grant none
|
||||
// ==/UserScript==
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// 1. Weiterleitung, falls URL mit /shorts/ beginnt
|
||||
if (location.pathname.startsWith('/shorts/')) {
|
||||
window.location.replace('https://www.youtube.com/');
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. Funktion zum Entfernen von Shorts-Elementen
|
||||
function removeShorts() {
|
||||
// Entferne alle <a title="Shorts">
|
||||
document.querySelectorAll('a[title="Shorts"]').forEach(el => el.remove());
|
||||
|
||||
// Entferne alle Elemente mit dem Attribut is-shorts
|
||||
document.querySelectorAll('[is-shorts]').forEach(el => el.remove());
|
||||
}
|
||||
|
||||
// 3. Beim Laden ausführen
|
||||
window.addEventListener('load', removeShorts);
|
||||
|
||||
// 4. Auch auf dynamischen Content achten
|
||||
const observer = new MutationObserver(removeShorts);
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
})();
|
Loading…
Reference in New Issue
Block a user