Greasy Fork

来自缓存

Greasy Fork is available in English.

Claude No Auto-Scroll

Disable auto-scroll on Claude.ai

当前为 2025-03-16 提交的版本,查看 最新版本

// ==UserScript==
// @name        Claude No Auto-Scroll
// @match       https://claude.ai/*
// @description Disable auto-scroll on Claude.ai
// @version 0.0.1.20250316172120
// @namespace http://greasyfork.icu/users/1435046
// ==/UserScript==

// Target Claude's message container elements
const TARGET_SELECTOR = '[class*="Message__Content-sc"]';

function disableAutoScroll(element) {
    element.scrollIntoView = () => {}; // Disable auto-scroll
}

// Apply to existing messages
document.querySelectorAll(TARGET_SELECTOR).forEach(disableAutoScroll);

// Observer for new messages
const observer = new MutationObserver((mutations) => {
    mutations.forEach((mutation) => {
        mutation.addedNodes.forEach((node) => {
            if(node.nodeType === 1 && node.matches(TARGET_SELECTOR)) {
                disableAutoScroll(node);
            }
        });
    });
});

observer.observe(document.body, { childList: true, subtree: true });