登录 立即注册

首页 > 绿虎论坛 > 软件开发 > 网站开发 (发帖)

和 Codex 一块儿搓了个新前端 hu60next


『回复列表(102|隐藏机器人聊天)』

100.

由于快速翻页器的缺失,我现在只能通过修改URL来快速回到第一页
image.png(611.61 KB)

(/@Ta/2026-07-29 16:19//)

101.

@老虎会游泳 #99 现在可以了

(/@Ta/2026-07-29 16:19//)

102. 发言已通过机审,仅登录用户可见。
<script>// 检测并转换楼层数字为链接
(function() {
    var containers = document.querySelectorAll('.floor-content.comments-content.user-content, .floor_content.user-content');
    if (!containers.length) return;

    var baseUrl = window.location.href.split('?')[0].split('#')[0];
    var processed = new Set();

    function walk(node) {
        if (node.nodeType === 3) {
            var text = node.nodeValue;
            var regex = /(?:^|\s| )#(\d+)(?=\s| |$)/g;
            var match, lastIndex = 0, parts = [], found = false;

            while ((match = regex.exec(text)) !== null) {
                var num = match[1];
                if (processed.has(num)) continue;
                processed.add(num);
                found = true;
                if (match.index > lastIndex) parts.push(text.substring(lastIndex, match.index));
                var link = document.createElement('a');
                link.href = baseUrl + '?floor=' + num + '#' + num;
                link.textContent = ' #' + num;
                parts.push(link);
                lastIndex = match.index + match[0].length;
            }

            if (found) {
                if (lastIndex < text.length) parts.push(text.substring(lastIndex));
                var fragment = document.createDocumentFragment();
                parts.forEach(function(part) {
                    fragment.appendChild(typeof part === 'string' ? document.createTextNode(part) : part);
                });
                node.parentNode.replaceChild(fragment, node);
            }
        } else if (node.nodeType === 1 && node.tagName !== 'A' && node.tagName !== 'SCRIPT') {
            Array.from(node.childNodes).forEach(walk);
        }
    }

    containers.forEach(function(container) {
        Array.from(container.childNodes).forEach(walk);
    });
})();
</script>
(/@Ta/2026-07-29 17:29//)

上一页 6/6页,共102楼

回复需要登录

7月29日 18:40 星期三

本站由hu60wap6驱动

备案号: 京ICP备18041936号-1