Faphouse-HideWatched

Removes watched videos from the feed. The next unwatched video takes it place so there are no obvious side-effects.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Faphouse-HideWatched
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Removes watched videos from the feed. The next unwatched video takes it place so there are no obvious side-effects.
// @author       echo17
// @match        *://*.faphouse.com/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // Function to find and remove the watched elements
    function removeWatchedVideos() {
        // Find all spans with the specific class
        const watchedSpans = document.querySelectorAll('span.t-vw');

        watchedSpans.forEach(span => {
            // Verify the text says "Watched" just to be safe
            if (span.textContent.trim() === 'Watched') {
                // Traverse up the DOM tree to find the main container div
                const parentDiv = span.closest('.thumb');

                // If the parent is found, remove it from the page
                if (parentDiv) {
                    parentDiv.remove();
                }
            }
        });
    }

    // 1. Run once on initial page load
    removeWatchedVideos();

    // 2. Set up a MutationObserver to handle dynamically loaded content (infinite scrolling)
    const observer = new MutationObserver((mutations) => {
        for (const mutation of mutations) {
            if (mutation.addedNodes.length > 0) {
                removeWatchedVideos();
            }
        }
    });

    // Start observing the document body for newly added HTML
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
})();