// ==UserScript== // @name 简单搜索自动展开 // @description 自动展开简单搜索的结果,避免需要多次点击“加载更多”按钮。 // @author ChatGPT // @version 3.0 // @match https://m.baidu.com/* // @match https://www.baidu.com/* // @run-at document-end // @grant none // @namespace https://greasyfork.org/users/452911 // @downloadURL none // ==/UserScript== (function() { 'use strict'; if (navigator.userAgent.includes('SearchCraft')) { const infScroll = document.querySelector('span.se-infiniteload-more'); if (infScroll) { window.addEventListener('scroll', function() { var element = document.querySelector('span.se-infiniteload-more'); if (element) { var position = element.getBoundingClientRect(); if (position.top >= 0 && position.bottom <= window.innerHeight) { element.click(); } } }); } } })();