Hide Private Videos on ThisVid

Hides only private videos by targeting the specific link element

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         Hide Private Videos on ThisVid
// @namespace    http://tampermonkey.net/
// @version      5.0
// @description  Hides only private videos by targeting the specific link element
// @author       BlueAnivia
// @match        https://thisvid.com/*
// @grant        none
// @license      MIT
// @run-at       document-idle
// ==/UserScript==

(function() {
    'use strict';

    const PROCESSED_ATTRIBUTE = 'data-private-hidden';

    const hidePrivateVideos = () => {
        // Find all video links that contain private icons
        const privateVideoLinks = document.querySelectorAll('a.tumbpu');

        privateVideoLinks.forEach(link => {
            // Check if this link contains a private icon and hasn't been processed
            const privateIcon = link.querySelector('.icon-private');

            if (privateIcon && !link.hasAttribute(PROCESSED_ATTRIBUTE)) {
                // Hide the entire link element (the video thumbnail)
                link.style.display = 'none';
                link.setAttribute(PROCESSED_ATTRIBUTE, 'true');
                console.log('Hidden private video:', link.querySelector('.title')?.textContent || 'Unknown title');
            }
        });
    };

    // Debug function to see what's being found
    const debugVideos = () => {
        const allLinks = document.querySelectorAll('a.tumbpu');
        const privateLinks = document.querySelectorAll('a.tumbpu .icon-private');

        console.log(`Total video links found: ${allLinks.length}`);
        console.log(`Private video icons found: ${privateLinks.length}`);

        // Log details about each video
        allLinks.forEach((link, index) => {
            const isPrivate = link.querySelector('.icon-private') !== null;
            const title = link.querySelector('.title')?.textContent || 'No title';
            console.log(`Video ${index + 1}: "${title}" - Private: ${isPrivate}`);
        });
    };

    const observer = new MutationObserver((mutations) => {
        for (const mutation of mutations) {
            if (mutation.type === 'childList' && mutation.addedNodes.length > 0) {
                hidePrivateVideos();
                return;
            }
        }
    });

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

    // Run when page loads
    hidePrivateVideos();

    // Uncomment the next line to debug what videos are being found
    // debugVideos();
})();