Auto Click "Show more" on Steam Store

Automatically clicks "Show more" buttons on the Steam Store site when visible.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Auto Click "Show more" on Steam Store
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Automatically clicks "Show more" buttons on the Steam Store site when visible.
// @author       YourName
// @match        https://store.steampowered.com/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Function to check if an element is in the viewport
    function isElementInViewport(el) {
        const rect = el.getBoundingClientRect();
        return (
            rect.top >= 0 &&
            rect.left >= 0 &&
            rect.bottom <= (window.innerHeight + 1500 || document.documentElement.clientHeight + 1500) &&
            rect.right <= (window.innerWidth || document.documentElement.clientWidth)
        );
    }

    // Function to check and click the "Show more" button
    function clickShowMore() {
        const buttons = document.querySelectorAll('button'); // Find all buttons on the page
        buttons.forEach(button => {
            if (button.innerText.trim() === "Show more" && isElementInViewport(button)) {
                console.log("Clicking 'Show more' button...");
                button.click();
            }
        });
    }

    // Run the script periodically
    setInterval(clickShowMore, 100); // Check every 1 second
})();