Google Infinite

Ativa a rolagem infinita nos resultados de pesquisa do Google

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         Google Infinite
// @namespace    https://seu-nome-de-usuario.greasyfork.org/
// @version      1.0
// @description  Ativa a rolagem infinita nos resultados de pesquisa do Google
// @author       Seu nome
// @match        https://www.google.com/search*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    // Definindo o tempo de intervalo entre carregamentos (em milissegundos)
    let scrollWaitTime = 2000;

    // Função para rolar e carregar mais resultados
    function loadMoreResults() {
        // Encontra o botão "Próxima" na página de resultados
        let nextButton = document.querySelector("#pnnext");

        // Se o botão existir, clique nele
        if (nextButton) {
            nextButton.click();
        } else {
            console.log("Fim dos resultados ou não há botão 'Próxima'.");
        }
    }

    // Função para monitorar a rolagem da página
    function handleScroll() {
        // Verifica se o usuário chegou ao final da página
        if ((window.innerHeight + window.scrollY) >= document.body.offsetHeight) {
            setTimeout(loadMoreResults, scrollWaitTime); // Espera um pouco antes de carregar mais
        }
    }

    // Adiciona o listener para monitorar o scroll do usuário
    window.addEventListener("scroll", handleScroll);
})();