Cam4 Clean figuccio

cam colorato 2025

// ==UserScript==
// @name		   Cam4 Clean figuccio
// @description    cam colorato 2025
// @version		   16.5
// @author         figuccio
// @match          https://*.cam4.com/*
// @grant          GM_addStyle
// @grant          GM_setValue
// @grant          GM_getValue
// @grant          GM_registerMenuCommand
// @run-at         document-end
// @require        https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @namespace      https://greasyfork.org/users/237458
// @require        http://code.jquery.com/jquery-latest.js
// @require        https://code.jquery.com/ui/1.13.2/jquery-ui.js
// @icon           https://cam4.com/favicon.ico
// @license        MIT
// ==/UserScript==
(function() {
   'use strict';
    function addClock() {
  // Selettore del pulsante esistente clock sulla barra superiore
    const headerElement = document.querySelector("#root > div > div.THmE0 > header > div.rsdM3.AyoJO > div.yLU7N.TcOud > div.f3e13.o_Anz.rbqYB > button");

    if (headerElement) {
        // Creazione dell'elemento orologio
        const clock = document.createElement("div");
        clock.style.display = "inline-block"; // Allinea accanto al pulsante
        clock.style.marginLeft = "10px"; // Distanza tra il pulsante e l'orologio
        clock.style.fontSize = "16px";
        clock.style.color = "lime";
        clock.style.background ="brown";
        clock.style.padding = "1px";
        clock.style.borderRadius = "5px";
        clock.style.zIndex = "9000"; // Valore alto per posizionarlo sopra gli altri elementi
        clock.style.cursor="pointer";
        clock.style.border="1px solid yellow";

        // Aggiunge l'elemento orologio accanto al pulsante
        headerElement.parentNode.insertBefore(clock, headerElement.nextSibling);
         // Aggiungi la data al passaggio del mouse
        clock.addEventListener('mouseenter', function() {
            const currentDate = new Date();
            const formattedDate = currentDate.toLocaleDateString('it', {
                day: '2-digit',
                month: 'long',
                weekday: 'long',
                year: 'numeric'
            });
            clock.setAttribute('title', formattedDate); // Mostra la data come tooltip
        });

        // Applica stile al contenitore del pulsante
        const container = headerElement.parentNode;
        container.style.display = "flex";
        container.style.alignItems = "center"; // Allinea verticalmente al centro

        // Aggiorna l'orologio
        function updateClock() {
            const now = new Date();
            const timeString = `${now.toLocaleTimeString()}:${now.getMilliseconds()}`; // Aggiunge i millisecondi
            clock.textContent = timeString;
        }

        // Aggiorna l'orologio ogni secondo
        updateClock();
        setInterval(updateClock, 90);
    } else {
        console.error("Elemento non trovato. Controlla il selettore.");
    }
        }

   function addColorPicker() {
        const colorPicker = $('<input type="color" title="Color picker" list="colors" id="colorPicker"style="cursor:pointer;">');
        const colorValue = $('<span id="colorValue" title="Hex value" style="margin-left:10px;font-size:16px;color:lime;background-color:brown;border:1px solid yellow;border-radius:5px;cursor:pointer;"></span>');
        const headerElement = document.querySelector("#root > div > div.THmE0 > header > div.rsdM3.AyoJO > div.yLU7N.TcOud > div.f3e13.o_Anz.rbqYB > button");

        if (headerElement) {
            $(headerElement).after(colorPicker);
            $(colorPicker).after(colorValue);

            const userdata = { color: 'camcolor' };
            let mycolor = GM_getValue(userdata.color, "#980000"); // Valore predefinito

            function saveSetting() {
                GM_setValue(userdata.color, mycolor);
                $('.Ia4MR,.OOOkf,.dSgtq,html').css("background", mycolor);
            }
///////////////////////////////////////////////////////////////////////////////
// Funzione per osservare i cambiamenti nel DOM
    function observeDOMChanges() {
    // Creazione di un observer con una funzione di callback
    var observer = new MutationObserver(function(mutationsList, observer) {
        // Per ogni mutazione rilevata, esegui la funzione saveSetting
        for(var mutation of mutationsList) {
            saveSetting();
        }
    });

    // Configurazione dell'observer per osservare cambiamenti nei nodi figlio e nei nodi attributo
    var config = {childList:true, attributes:true, subtree:true};
    // Inizia ad osservare il DOM target
    observer.observe(document.body, config);
}
// Avvia l'osservazione dei cambiamenti nel DOM
observeDOMChanges();
/////////////////////////////////////////////////////////////////////////////////
            $('#colorPicker').val(mycolor); // Imposta il colore del selettore
            $('#colorValue').text(mycolor); // Mostra il valore HEX
            $('.Ia4MR,.OOOkf,.dSgtq,html').css("background", mycolor); // Applica lo sfondo

            $('#colorPicker').on('input', function(event) {
                mycolor = event.target.value;
                $('#colorValue').text(mycolor);
                $('.Ia4MR,.OOOkf,.dSgtq,html').css("background", mycolor);
                saveSetting(); // Salva il valore ogni volta che cambia
            });

            saveSetting(); // Salva il colore iniziale
        } else {
            console.error("Elemento non trovato. Controlla il selettore.");
        }
    }

    setTimeout(function() {
        addClock();
        addColorPicker();
    }, 2000);

//})();
    //////////////////////////////////
        // Serie di selettori di messaggi di chat da tenere d'occhio (se 6 sulle cam corregge scroll)
    const chatMessageSelectors = [
        '.ChatMobileMessages__msgHolder__3-Yju',
        '.ChatMobileMessages__msgHolderEmbed__2LQTu',
        '.ChatMobileMessages__msgHolderForMobile__3tDM4'
    ];

    // Funzione per scorrere la pagina verso l'alto
    function scrollPageUp() {
        window.scrollTo(0, 0);
    }

    // MutationObserver per osservare gli elementi specificati
    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            chatMessageSelectors.forEach((selector) => {
                if (mutation.target.matches(selector) || mutation.target.querySelector(selector)) {
                    scrollPageUp();
                }
            });
        });
    });

    // Inizia a osservare il corpo del documento per eventuali modifiche
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });
 ////////////////////////////////////////////////////////////////////
        GM_addStyle(`
         /* Naked & Uncut: Tulum */
            .SegmentItem__container__NA2zm,

         /* popup sopra */
            .Directory__subHeader__2O2A2,

         /*set 2023 */
            .Footer__footer__202HR,
        /*categorie funziona +parte sotto cam*/
            .ContentCard__title__2CLsx,
            .ContentCard__container__rOtbe,
            .LegalArea__legal__2bQcD,

         .QMBRc,.BYmt2,.jGkoG,.SnYAk,.yId07,


         /*correlate set 2023*/
            .Directory__aboveFooterWrap__sLRuI {
                display: none!important;
            }
        `);

    //continua cookie
// Function to save cookies to local storage
function saveCookiesToLocalStorage() {
    const cookies = document.cookie.split(';');
    cookies.forEach(cookie => {
        const [name, value] = cookie.split('=');
        if (name.trim() === 'disclaimer18' || name.trim() === 'disclaimerMobile18') {
            GM_setValue(name.trim(), value);
        }
    });
}

// Function to set cookies from local storage
function setCookiesFromLocalStorage() {
    const disclaimer18 = GM_getValue('disclaimer18');
    const disclaimerMobile18 = GM_getValue('disclaimerMobile18');
    if (disclaimer18) {
        document.cookie = `disclaimer18=${disclaimer18}; domain=.cam4.com; max-age=315360000`;
    }
    if (disclaimerMobile18) {
        document.cookie = `disclaimerMobile18=${disclaimerMobile18}; domain=.cam4.com; max-age=315360000`;
    }
}

//Salva i cookie nella memoria locale quando viene eseguito lo script
saveCookiesToLocalStorage();

//Imposta i cookie dall'archiviazione locale quando la pagina viene caricata
window.addEventListener('load', setCookiesFromLocalStorage);

if(!localStorage.reload) {
       //correzione errore triangolo giallo
        setTimeout(function(){document.location.reload();}, 2000);
        localStorage.reload = 1;
    }
setCookiesFromLocalStorage();
//popup questo sito utilizza cookie visibile senza estensione blocca publicita rifunziona
GM_addStyle('.index__cookieConsent__2M-8D {display: none!important}');//sett 2023
//foto publicita in alto prova un esperienza piu intima rifunziona
GM_addStyle('.PageHeaders__wrapper__3I9TX .PageHeaders__title__Wms1b {display: none!important}');
//parte sotto paginazione marzo 2024
GM_addStyle('#root > div > footer {display: none!important}');
//scritta scorrevole marzo 2025
GM_addStyle('.jhdSH{display:none!important}');
//parte inutile sotto i numeri rifunziona
GM_addStyle('#app > div.pageContainer > div.pageContent > div.Directory__content__TBdmJ > div.SponsoredAds__premiumAds__ZXHiX.Directory__sponsoredAds__tHvki{display: none!important}');//cam4 premium gennaio 2024

  //x dentro video
GM_addStyle('.index__closeButton__2llsj {display:none!important}');
   //ricordamelo dopo in chat  ottobre
GM_addStyle('.TokenAwarenessDesktop__container__3aA7r {display:none!important}');
//popup badoo allinterno della cam
GM_addStyle('.AdEmbeded__AddWrapperNoButton__28ZlR {display:none!important}');
//current page color red
GM_addStyle('.Pagination__pagination__3if3L li.Pagination__active__xYxuK a {background-color:red!important;color:lime!important;}');
//////////////////////////////////////////////////////////////////////////////////////
    // Click "Accedi" button after 7 seconds
setTimeout(() => {
    const accediButton = document.querySelector("#root > div > div.THmE0 > header > div.LzM4W._GM7Y > button.DicDC.SCZfE.yAILi.s1855.Wg2T7");
    if (accediButton) {
        accediButton.click();
    } else {
        console.error("Accedi button not found");
    }
}, 7000);

// Fare clic sul pulsante "Continua" dopo 5 secondi
var l_foundButton = false;
function clickButton() {
    const continueIntervalId = setInterval(() => {
        const continueButton = document.querySelector("#tUZ2be9k_loginFrom_continueButton");
        if (continueButton) {
            continueButton.click();
            l_foundButton = true;
            clearInterval(continueIntervalId); // Ferma l'intervallo una volta trovato il pulsante
        }
    }, 5000); // Esegui l'intervallo ogni 5 secondi
}

// Aggiunto controllo e log per debug
if (l_foundButton) {
    console.log("Button clicked.");
    l_foundButton = false; // Reset per il prossimo ciclo
} else {
    //console.log("Button  not found.");
}

// Chiama clickButton() ogni 1000 millisecondi (1 secondo) finché il pulsante non viene trovato
var intervalId = setInterval(() => {
    if (!l_foundButton) {
        clickButton();
    } else {
        clearInterval(intervalId); // Interrompe l'intervallo una volta cliccato il pulsante
    }
}, 1000);

// Esegui clickButton() all'avvio per gestire i bottoni già presenti
clickButton();

// Fare clic sul pulsante "Invia" dopo 1 secondo
const submitIntervalId = setInterval(() => {
    const submitButton = document.querySelector("#tUZ2be9k_loginFrom_submitButton");
    if (submitButton) {
        submitButton.click();
        clearInterval(submitIntervalId);
    }
}, 2000);

})();
//////////////////////////////pulsante torna in alto
var $ = window.jQuery;
$(document).ready(function() {
 $('body').append('<img class="toPageTop1" title="Sali in alto" style="position:fixed;z-index:999999999999999999;bottom:320px;right:0px;cursor:pointer;border-radius:100%;width:70px;height:70px" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAABINJREFUeF7tmkFy2koQhv9W7PeWT3CBQFXE9vmdIPYJQk4QvIxYBJ8gzglMFihL804QcgKTE8TZIleZdwFQlrFd6lejWCmFCNQjzWBTwI6anp7ub3p6emZE2PIfbbn/2AHYRcCWE9gtgS0PgF0SXNsScM+uXezfPXee4AAxN5iokY0+Yp7CoWnMGOP73tfopBmtIzqtAnA/XDcQ374goENEBzoOMfMlA0M4+5+i182pTl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c3e52yM28kArIGrzUxCo+6EqClc0Ce8uTmhzC0lRfUPs/MPckpT+K8kSWwBESHQKfSJ+0iY9XpjsGn6UtSkbxOu9EI+C0/BFdtB3GbQW3dozQD3wg8iuGMynz6IoVgFUDWiB+fz+IQxA2+f2RNE6cK7R/hyFMwTWMHY52PHKTO5smtDUAVI2323QGwSXcTdO8iYBNmyaaNuwiwSXcTdO8iYBNmyaaNWx8B/wMj7yxftxxt6gAAAABJRU5ErkJggg==";/>');

        $(".toPageTop1").hide(0);
        $(window).scroll(function(){
            if($(window).scrollTop() >= 100){
                $(".toPageTop1").fadeIn(4000);
            }else{
                $(".toPageTop1").stop(true,true).fadeOut(2000);
            }
        });
        $(".toPageTop1").click(function(){
            $("html,body").animate({
                scrollTop:0
            },3000);
        });

    });
//passa alla pagina successiva senza reflesh febbr 2025
    let isScrolling = false;
    function scrollHandler() {
        if (isScrolling) return;
        if ($(window).scrollTop() + $(window).height() >= $(document).height()) {
            isScrolling = true;
            const currentPage = document.querySelector('a[aria-current="true"]');
            if (currentPage) {
                const nextPage = currentPage.nextElementSibling;
                if (nextPage && nextPage.tagName.toLowerCase() === 'a') {
                    nextPage.click();
                    setTimeout(function() {
                        isScrolling = false;
                    }, 3000); // Timeout per prevenire il doppio click
                }
            }
        }
    }

    $(window).scroll(scrollHandler);
////////////////////////////////////////
//scrollbar
GM_addStyle(`
		/*####----BROWSER SCROLL BAR----####*/
		::-webkit-scrollbar {
        /*colore di spondo pulsanti su e giu */
		background:#303134!important;
		width:17px!important;
		}

        /*cursore che scorre*/
        ::-webkit-scrollbar-thumb {background-color:#676767!important;border-radius:5px!important;border:2px solid green!important;}

        /*parte colorata sotto lo scroll */
        body::-webkit-scrollbar-track {background:#303134;}

        /*pulsanti sotto freccine su e giu*/
        ::-webkit-scrollbar-button {background-color:#777777;}

        /*freccia nera sopra*/
        ::-webkit-scrollbar-button:single-button:vertical:decrement {display:block;
        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QgFDgonQxmpnwAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAc0lEQVQoz+XRMUoCAACF4Q/BSa/gHjl1Alu8QwguXcC7eApPIXQJt2iKjhAk+DcoJDjonP/8vulxJ1Wr6rNa3wpm1bZju2p5DUyqTfXTX2/Vw/lucAZGWOAZQ3zjgEe8VuMLhClesMc7vvBxwnM8/ecffwFSoEVS/hyFWgAAAABJRU5ErkJggg==)!important;
        background-size: cover!important;
		background-repeat: no-repeat!important;
        border:1px solid red;
		}
        /*freccia nera sotto*/
        ::-webkit-scrollbar-button:single-button:vertical:increment {display:block;
        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA0AAAANCAYAAABy6+R8AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH4QgFDTUIslAAowAAAB1pVFh0Q29tbWVudAAAAAAAQ3JlYXRlZCB3aXRoIEdJTVBkLmUHAAAAdUlEQVQoz+XPIQoCUQCE4XnJ4Daz3UuIJ9lsNHoH457CUwhWD+ANBEGzYUG+Da6IsIhZ/zQwDDOT/B7lKTBP0iSZJGl7T5JRkmuSZSnl8JZGhQ0uuOPmwRlrjAdrMcPeixZbTD/uRY1jH9ph8dVRNDhhlT+hA0tUX1KVJjAXAAAAAElFTkSuQmCC)!important;
        background-size: cover!important;
		background-repeat: no-repeat!important;
        border:1px solid red;
		}
`);