Greasy Fork is available in English.

YouTube Thumbnail Hider & Shorts Remover

Hide video thumbnails on YouTube and remove Shorts sections. Persistent hiding.

Installera detta skript?
Författaren's rekommenderade skript

Du kanske också gillar X Timeline Sync.

Installera detta skript
// ==UserScript==
// @name         YouTube Thumbnail Hider & Shorts Remover
// @namespace    http://tampermonkey.net/
// @version      2025-01-03
// @description  Hide video thumbnails on YouTube and remove Shorts sections. Persistent hiding.
// @description:de  Blende Video-Thumbnails auf YouTube aus und entferne Shorts-Bereiche. Dauerhafte Ausblendung.
// @description:es  Oculta miniaturas de video en YouTube y elimina secciones de Shorts. Ocultación persistente.
// @description:fr  Masquer les miniatures de vidéos sur YouTube et supprimer les sections Shorts. Masquage persistant.
// @author       Copiis
// @match        https://www.youtube.com/feed/subscriptions
// @grant        none
// @locale       en, de, es, fr
// @license      MIT
// @icon         https://www.youtube.com/favicon.ico
// ==/UserScript==
//
// If you find this script useful and would like to support my work, consider making a small donation!
// Your generosity helps me maintain and improve projects like this one. 😊
// Bitcoin (BTC): bc1quc5mkudlwwkktzhvzw5u2nruxyepef957p68r7
// PayPal: https://www.paypal.com/paypalme/Coopiis?country.x=DE&locale.x=de_DE
//
// Thank you for your support! ❤️

(function() {
    'use strict';

    const LANGUAGES = {
        en: 'Click to hide this video permanently.',
        de: 'Klicken, um dieses Video dauerhaft auszublenden.',
        es: 'Haga clic para ocultar este video permanentemente.',
        fr: 'Cliquez pour masquer cette vidéo de façon permanente.'
    };

    const userLang = navigator.language.startsWith('de') ? 'de' :
                     navigator.language.startsWith('es') ? 'es' :
                     navigator.language.startsWith('fr') ? 'fr' : 'en';

    const observer = new MutationObserver(addEyeToThumbnails);
    observer.observe(document.body, { childList: true, subtree: true });

    const hiddenVideos = JSON.parse(localStorage.getItem('hiddenVideos') || '{}');

    function addEyeToThumbnails() {
        document.querySelectorAll('ytd-grid-video-renderer, ytd-rich-item-renderer').forEach(video => {
            const videoId = video.querySelector('a#thumbnail')?.href?.split('v=')[1];
            if (!videoId) return;

            if (hiddenVideos[videoId]) {
                video.style.display = 'none';
                return;
            }

            const thumbnailContainer = video.querySelector('#thumbnail');
            if (!thumbnailContainer || thumbnailContainer.querySelector('.eye-icon')) return;

            const eye = document.createElement('div');
            eye.textContent = '👁️';
            eye.classList.add('eye-icon');
            eye.style.position = 'absolute';
            eye.style.left = '8px';
            eye.style.top = '8px';
            eye.style.fontSize = '24px';  // Größeres Symbol
            eye.style.cursor = 'pointer';
            eye.style.zIndex = '10';  // Stellt sicher, dass das Auge über dem Thumbnail bleibt
            eye.dataset.persistent = 'true';

            eye.addEventListener('click', (e) => {
                e.stopPropagation();
                video.style.display = 'none';
                hiddenVideos[videoId] = true;
                localStorage.setItem('hiddenVideos', JSON.stringify(hiddenVideos));
                rearrangeVideos();
            });

            thumbnailContainer.style.position = 'relative';  // Erforderlich für die Platzierung
            thumbnailContainer.prepend(eye);
        });

        // Sicherstellen, dass das Auge nach dem vollständigen Laden nicht verschwindet
        document.querySelectorAll('.eye-icon').forEach(eye => {
            if (!eye.dataset.persistent) {
                eye.remove();
            }
        });

        document.querySelectorAll('ytd-rich-section-renderer').forEach(section => {
            if (section.querySelector('#title')?.textContent.includes('Shorts')) {
                section.remove();
            }
        });
    }

    function rearrangeVideos() {
        const videoGrid = document.querySelector('ytd-rich-grid-renderer #contents');
        if (videoGrid) {
            videoGrid.childNodes.forEach(video => {
                if (!hiddenVideos[video.querySelector('a#thumbnail')?.href?.split('v=')[1]]) {
                    video.style.display = 'block';
                }
            });
        }
    }

    rearrangeVideos();
})();