Never Let Chat Pause (Memory Leak Fix)

Keeps chat active to most recent messages, will not allow it to scroll up and see previous messages

当前为 2024-05-15 提交的版本,查看 最新版本

// ==UserScript==
// @name         Never Let Chat Pause (Memory Leak Fix)
// @namespace    https://gf.qytechs.cn/en/users/1200587-trilla-g
// @version      0.1
// @description  Keeps chat active to most recent messages, will not allow it to scroll up and see previous messages
// @author       Trilla_G
// @match        *://*.kick.com/*
// @grant        none
// @license     MIT
// ==/UserScript==

(function() {
    'use strict';

    // Define the selector for the button with the exact class name
    const buttonSelector = 'div.flex.cursor-pointer.items-center.gap-1.rounded.bg-secondary-lighter\\/80.py-1\\.5.pl-2.pr-3.font-semibold.hover\\:bg-secondary-lightest\\/80';

    // Function to check for the button and click it
    function checkForButtonAndClick() {
        const button = document.querySelector(buttonSelector);
        if (button) {
            button.click();
            console.log('Button clicked!');
        }
    }

    // Use a MutationObserver to detect when the button is added to the DOM
    const observer = new MutationObserver((mutations) => {
        mutations.forEach((mutation) => {
            if (mutation.addedNodes.length > 0) {
                checkForButtonAndClick();
            }
        });
    });

    // Start observing the body for added nodes
    observer.observe(document.body, { childList: true, subtree: true });

    // Initial check in case the button is already present when the script runs
    checkForButtonAndClick();
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址