ExCoGi 4K Filter

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

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

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

คุณจะต้องติดตั้งส่วนขยาย เช่น 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         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();
    }
})();