投稿论坛bug/机制


点击就会变回原文

4 Likes

显示的是那一楼的完整内容
但是直接召唤另一人还是可行

2 Likes

自用。不为bug负责。

// ==UserScript==
// @name         FakeQuoteFucker
// @version      0.1.0
// @description  引用文本能改, 那引用目的在哪儿请问?
// @author       Niarb
// @match        https://forum.rdfzer.com/*
// @grant        none
// @run-at       document-idle
// @license      WTFPL
// ==/UserScript==

/*
Copyright © 2025 Niarb

This work is free. You can redistribute it and/or modify it
under the terms of the Do What The Fuck You Want To Public License,
Version 2, as published by Sam Hocevar. See http://www.wtfpl.net/ for more details.
*/

(function() {
    'use strict';
    function expandAllQuoteBtns() {
        const btns = document.querySelectorAll('button.btn.no-text.btn-flat.quote-toggle');
        btns.forEach(btn => {
            try {
                if (btn.getAttribute('aria-expanded') === 'false') {
                    btn.setAttribute('aria-expanded', 'true');
                    btn.setAttribute('title', '收起');
                    btn.setAttribute('aria-label', '收起');

                    btn.dispatchEvent(new MouseEvent('click', {
                        bubbles: true,
                        cancelable: true,
                        view: window
                    }));
                }
            } catch (e) {
                console.error('fqf bug:', e);
            }
        });
    }

    if (document.readyState === 'complete' || document.readyState === 'interactive')
        setTimeout(expandAllQuoteBtns, 500);
    else window.addEventListener('load', function() {
        setTimeout(expandAllQuoteBtns, 500);
    });

    let scrollTimeout;
    window.addEventListener('scroll', function() {
        clearTimeout(scrollTimeout);
        scrollTimeout = setTimeout(function() {
            expandAllQuoteBtns();
        }, 300);
    });

    const observer = new MutationObserver(function(muts) {
        muts.forEach(function(mut) {
            if (mut.addedNodes && mut.addedNodes.length > 0) {
                let newBtn = false;
                mut.addedNodes.forEach(node => {
                    if (node.nodeType === 1) {
                        if (node.querySelector('button.btn.no-text.btn-flat.quote-toggle') ||
                            (node.matches && node.matches('button.btn.no-text.btn-flat.quote-toggle'))) {
                            newBtn = true;
                        }
                    }
                });
                if (newBtn) setTimeout(expandAllQuoteBtns, 100);
            }
        });
    });

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

})();
1 Like

思路可以:抓到折疊quote-toggle 就點開,但有坑:)

1 Like
1 Like