ExCoGi 4K Filter

Toggle 4K filter and hide non‑4K video columns for a cleaner layout, with a yellow filter button.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         ExCoGi 4K Filter
// @license MIT
// @namespace    http://tampermonkey.net/
// @version      1.2
// @description  Toggle 4K filter and hide non‑4K video columns for a cleaner layout, with a yellow filter button.
// @match        https://exploitedcollegegirls.com/members/categories/*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    const STORAGE_KEY = 'excoGi_4K_filter';

    // Hide (or show) the entire grid column if the video doesn't have a 4K badge.
    function filter4KVideos(enableFilter) {
        // Select each column container (adjust selectors if necessary)
        document.querySelectorAll('.col-md-4.col-sm-6.col-12').forEach(col => {
            // Look for a video element inside the column
            const videoItem = col.querySelector('.item-update.item-video');
            if (videoItem) {
                // Check for the presence of a 4K badge
                const has4KBadge = videoItem.querySelector('.fourk-badge') !== null;
                if (enableFilter && !has4KBadge) {
                    col.style.display = 'none';
                } else {
                    col.style.display = '';
                }
            }
        });
    }

    // Create and insert the fixed 4K filter button.
    function addFixed4KButton() {
        if (document.getElementById('fixed4KButton')) return; // Already added

        const btn = document.createElement('button');
        btn.id = 'fixed4KButton';
        // Remove Bootstrap color classes to prevent conflicts.
        btn.className = '';
        // Positioning adjustments: moved down to 50px from the top.
        btn.style.position = 'fixed';
        btn.style.top = '50px'; // Adjusted downwards
        btn.style.right = '10px';
        btn.style.zIndex = '10000';
        btn.style.padding = '6px 12px';
        // Set background to yellow, border to yellow, and text color to black for readability.
        btn.style.backgroundColor = 'yellow';
        btn.style.border = '1px solid yellow';
        btn.style.color = 'black';
        btn.style.cursor = 'pointer';

        let filterEnabled = localStorage.getItem(STORAGE_KEY) === 'true';
        btn.innerText = filterEnabled ? '4K Filter ON' : '4K Filter OFF';

        btn.addEventListener('click', function() {
            filterEnabled = !filterEnabled;
            localStorage.setItem(STORAGE_KEY, filterEnabled);
            btn.innerText = filterEnabled ? '4K Filter ON' : '4K Filter OFF';
            filter4KVideos(filterEnabled);
            // Dispatch a resize event to help force a layout reflow.
            window.dispatchEvent(new Event('resize'));
        });

        document.body.appendChild(btn);
    }

    // Observe changes in the grid to reapply the filter when new content loads.
    function observeGridChanges() {
        // Adjust the container selector to target the element wrapping the grid columns.
        const gridRow = document.querySelector('.row-col-padding-10 .row');
        if (!gridRow) return;
        const observer = new MutationObserver(() => {
            if (localStorage.getItem(STORAGE_KEY) === 'true') {
                filter4KVideos(true);
            }
        });
        observer.observe(gridRow, { childList: true, subtree: true });
    }

    function init() {
        addFixed4KButton();
        const filterEnabled = localStorage.getItem(STORAGE_KEY) === 'true';
        filter4KVideos(filterEnabled);
        observeGridChanges();
    }

    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }
})();