Sleazy Fork is available in English.

Amateur.tv Mostrar solo modelos de España

Filtra y muestra solo modelos de España en Amateur.tv de dos maneras: ocultando o cambiando opacidad.

// ==UserScript==
// @name         Amateur.tv Mostrar solo modelos de España
// @namespace    Violentmonkey Scripts
// @version      1.6
// @description  Filtra y muestra solo modelos de España en Amateur.tv de dos maneras: ocultando o cambiando opacidad.
// @match        https://es.amateur.tv/*
// @grant        none
// @icon         https://es.amateur.tv/favicon.ico
// @language     es
// @license      MIT
// @homepageURL  https://greasyfork.org/es/scripts/498257-amateur-tv-mostrar-solo-modelos-de-espa%C3%B1a
// @supportURL   https://greasyfork.org/es/scripts/498257/amateur-tv-mostrar-solo-modelos-de-espa%C3%B1a/feedback
// ==/UserScript==
(function() {
    'use strict';

    const modoTratamiento = 2; // Forma de ocultar modelos 1= opacidad 2= ocultar

    // Verificar que el script se esté ejecutando en la ventana principal y no dentro de un iframe
    if (window.self !== window.top) {
        return;
    }

    const infoDiv = document.createElement('div');
    infoDiv.style.position = 'fixed';
    infoDiv.style.bottom = '0';
    infoDiv.style.width = '100%';
    infoDiv.style.backgroundColor = '#DE001A';
    infoDiv.style.color = 'white';
    infoDiv.style.fontWeight = 'bold';
    infoDiv.style.textAlign = 'center';
    infoDiv.style.padding = '10px';
    infoDiv.style.zIndex = '9999';
    infoDiv.style.transform = 'translateY(100%)'; // Inicialmente oculto desplazado hacia abajo
    infoDiv.style.transition = 'transform 1.5s'; // Transición de desplazamiento de 1.5 segundos
    document.body.appendChild(infoDiv);

    let previousMessage = '';

    function isExcludedUrl() {
        const excludedUrls = ['https://es.amateur.tv/privados', 'https://es.amateur.tv/siguiendo'];
        const currentUrl = window.location.href;
        return excludedUrls.includes(currentUrl);
    }

    function updateInfoDiv() {
        let message;
        if (isExcludedUrl()) {
            message = 'Mostrando modelos de todos los países'.replace('todos', `<span style="color: #FDDB00;">todos</span>`);
        } else {
            message = 'Mostrando modelos de España'.replace('España', `<span style="color: #FDDB00;">España</span>`);
        }

        if (message !== previousMessage) {
            // Iniciar transición de desaparición
            infoDiv.style.transform = 'translateY(100%)';

            setTimeout(() => {
                // Actualizar mensaje y mostrar con transición de aparición
                infoDiv.innerHTML = message;
                infoDiv.style.transform = 'translateY(0)';
                previousMessage = message;
            }, 1500); // Esperar 1.5 segundos (duración de la transición)
        } else {
            // Mostrar el div si no ha cambiado el mensaje
            infoDiv.style.transform = 'translateY(0)';
        }
    }

    function showOnlySpanishModels() {
        if (!isExcludedUrl()) {
            const modelCards = document.querySelectorAll('.cardAmateurContent');

            // Si no hay elementos .cardAmateurContent, ocultar el infoDiv y salir de la función
            if (modelCards.length === 0) {
                infoDiv.style.transform = 'translateY(100%)';
                return;
            }

            modelCards.forEach(card => {
                const childrenWithBackground = card.querySelectorAll('a > div > div > div > div');

                let isSpanish = false;

                childrenWithBackground.forEach(child => {
                    const backgroundImage = window.getComputedStyle(child).getPropertyValue('background-image');
                    if (backgroundImage !== 'none') {
                        isSpanish = true;
                    }
                });

                if (isSpanish) {
                    card.style.opacity = '1';
                } else {
                    if (modoTratamiento === 1) {
                        card.style.opacity = '0.5';
                    } else if (modoTratamiento === 2) {
                        card.style.display = 'none';
                    }
                }
            });
        }

        updateInfoDiv();
    }

    window.addEventListener('load', showOnlySpanishModels);

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

    let currentUrl = window.location.href;
    setInterval(() => {
        if (window.location.href !== currentUrl) {
            currentUrl = window.location.href;
            showOnlySpanishModels();
        }
    }, 1000);
})();