Cam4 pagination figuccio

cam cambio pagine senza reflesh 2025

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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		   Cam4 pagination figuccio
// @description    cam cambio pagine senza reflesh 2025
// @version		   0.1
// @author         figuccio
// @match          https://*.cam4.com/*
// @grant          GM_addStyle
// @run-at         document-start
// @require        https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js
// @icon           https://cam4.com/favicon.ico
// @license        MIT
// @namespace https://greasyfork.org/users/237458
// ==/UserScript==
(function() {
    'use strict';
//passa alla pagina successiva senza reflesh febbr 2025
    var $ = window.jQuery;
    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;
                    }, 2000); // Timeout per prevenire il doppio click
                }
            }
        }
    }

    $(window).scroll(scrollHandler);

})();