XNXX - Hide Videos Button

Dodaje przycisk ukrywania filmów na miniaturkach

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği yüklemek için Tampermonkey gibi bir uzantı yüklemeniz gerekir.

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği indirebilmeniz için ayrıca Tampermonkey gibi bir eklenti kurmanız gerekmektedir.

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

Bu stili yüklemek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için Stylus gibi bir uzantı kurmanız gerekir.

Bu stili yükleyebilmek için Stylus gibi bir uzantı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

Bu stili yüklemek için bir kullanıcı stili yöneticisi uzantısı kurmanız gerekir.

Bu stili yükleyebilmek için bir kullanıcı stili yöneticisi uzantısı yüklemeniz gerekir.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         XNXX - Hide Videos Button
// @namespace    https://xnxx.com/
// @version      1.0
// @description  Dodaje przycisk ukrywania filmów na miniaturkach
// @match        https://www.xnxx.com/*
// @grant        GM_addStyle
// ==/UserScript==

(function () {
    'use strict';

    const STORAGE_KEY = 'xh-hidden-videos';

    // Wczytaj ukryte filmy
    const hiddenVideos = new Set(
        JSON.parse(localStorage.getItem(STORAGE_KEY) || '[]')
    );

    // Style
    GM_addStyle(`
        .thumb-block {
            position: relative;
        }

        .xh-hide-btn {
            position: absolute;
            top: 6px;
            right: 6px;
            z-index: 9999;
            background: rgba(0,0,0,0.75);
            color: white;
            border: none;
            border-radius: 4px;
            padding: 4px 7px;
            cursor: pointer;
            font-size: 12px;
            line-height: 1;
            transition: 0.2s;
        }

        .xh-hide-btn:hover {
            background: rgba(255,0,0,0.9);
        }

        .xh-hidden {
            display: none !important;
        }
    `);

    function saveHiddenVideos() {
        localStorage.setItem(
            STORAGE_KEY,
            JSON.stringify([...hiddenVideos])
        );
    }

    function getVideoId(link) {
        try {
            return new URL(link.href).pathname;
        } catch {
            return link.href;
        }
    }

    function processThumbs() {
        document.querySelectorAll('.thumb-block').forEach(block => {

            if (block.querySelector('.xh-hide-btn')) return;

            const link = block.querySelector('.thumb a');
            if (!link) return;

            const videoId = getVideoId(link);

            // Ukryj jeśli już zapisany
            if (hiddenVideos.has(videoId)) {
                block.classList.add('xh-hidden');
            }

            const btn = document.createElement('button');
            btn.className = 'xh-hide-btn';
            btn.textContent = '✕';

            btn.addEventListener('click', (e) => {
                e.preventDefault();
                e.stopPropagation();

                hiddenVideos.add(videoId);
                saveHiddenVideos();

                block.classList.add('xh-hidden');
            });

            block.appendChild(btn);
        });
    }

    // Start
    processThumbs();

    // Obsługa dynamicznego ładowania
    const observer = new MutationObserver(() => {
        processThumbs();
    });

    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

})();