F95Zone Hide Low Rated Games

Hide low-rated games on F95Zone.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

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.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==UserScript==
// @name         F95Zone Hide Low Rated Games
// @namespace    http://tampermonkey.net/
// @version      3.0
// @description  Hide low-rated games on F95Zone.
// @author       mty
// @match        https://f95zone.to/*
// @grant        none
// @run-at       document-idle
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    let ratingThreshold = 3.5;

    function updateGameVisibility() {
        document.querySelectorAll('.resource-tile').forEach(tile => {
            const ratingElem = tile.querySelector('.resource-tile_info-meta_rating');
            if (ratingElem) {
                const rating = parseFloat(ratingElem.textContent.trim());
                tile.style.display = (!isNaN(rating) && rating < ratingThreshold) ? 'none' : '';
            }
        });
    }

    const observer = new MutationObserver(updateGameVisibility);
    observer.observe(document.body, { childList: true, subtree: true });

    function insertRatingThresholdBlock() {
        if (document.getElementById('filter-block_rating-threshold')) return;
        const dateSlider = document.getElementById('filter-block_date-filter');
        if (!dateSlider) return;

        const block = document.createElement('div');
        block.id = 'filter-block_rating-threshold';
        block.className = 'range-slider_wrap filter-block';
        block.innerHTML = `
            <h4 class="filter-block_title">Rating Threshold</h4>
            <div id="filter-rating_value" class="range-slider_value">${ratingThreshold.toFixed(1)}</div>
            <div id="filter-rating" class="range-slider_bar noUi-target noUi-horizontal"></div>
        `;
        dateSlider.insertAdjacentElement('afterend', block);

        initRatingSlider();
    }

    function initRatingSlider() {
        const sliderElem = document.getElementById('filter-rating');
        if (!sliderElem || sliderElem.noUiSlider || typeof window.noUiSlider === 'undefined') return;

        window.noUiSlider.create(sliderElem, {
            start: [ratingThreshold],
            connect: [true, false],
            range: { min: 0, max: 5 },
            step: 0.1,
            format: {
                to: value => parseFloat(value).toFixed(1),
                from: value => parseFloat(value)
            }
        });

        sliderElem.noUiSlider.on('update', values => {
            ratingThreshold = parseFloat(values[0]);
            document.getElementById('filter-rating_value').textContent = ratingThreshold.toFixed(1);
            updateGameVisibility();
        });
    }

    function initScript() {
        insertRatingThresholdBlock();
        updateGameVisibility();
    }

    setInterval(initScript, 100);

})();