{
    "order": [
        "2",
        "1",
        "3",
        "4",
        "5",
        "6"
    ],
    "items": {
        "1": {
            "content": "\/\/ ==UserScript==\n\/\/ @name         知乎一键展开阅读全文（自动展开+固定间隔滚动）\n\/\/ @namespace    https:\/\/github.com\/yourname\/zhihu-scripts\n\/\/ @version      2.3\n\/\/ @description  基于\"阅读全文\"文本匹配，一键展开+实时计数+5秒固定间隔滚动（400px\/次，每10次滑到底部并自动展开，60次失败自动停止）\n\/\/ @author       自定义名称\n\/\/ @match        *:\/\/*.zhihu.com\/*\n\/\/ @icon         https:\/\/static.zhihu.com\/heifetz\/favicon.ico\n\/\/ @grant        none\n\/\/ @run-at       document-end\n\/\/ @noframes\n\/\/ @license      MIT\n\/\/ ==\/UserScript==\n\n(function() {\n    'use strict';\n\n    \/\/ ===================== 全局状态与配置 =====================\n    const EXPAND_TEXT_KEYWORDS = ['阅读全文', '展开全文', '展开', '查看更多', '显示全部'];\n    \/\/ 展开相关状态\n    let isAutoMode = false;\n    let autoCheckTimer = null;\n    const clickedButtonCache = new Set();\n    let totalExpandCount = 0;\n    \/\/ 滚动相关状态（核心调整）\n    let isAutoScroll = false;     \/\/ 自动滚动开关\n    let autoScrollTimer = null;   \/\/ 自动滚动定时器\n    const SCROLL_DELAY = 5;       \/\/ 固定滚动间隔（秒）\n    const SCROLL_STEP = 400;      \/\/ 单次滚动像素（400px\/次）\n    const MAX_FAILED_ATTEMPTS = 60;\/\/ 最大连续失败次数\n    let failedAttempts = 0;       \/\/ 连续失败计数\n    let scrollAttempts = 0;       \/\/ 累计单次滚动次数（每10次滑到底部）\n    const SCROLL_TO_BOTTOM_AFTER = 10; \/\/ 每N次单次滚动后滑到底部\n\n    \/\/ ===================== 工具函数 =====================\n    \/\/ 检查元素是否可见\n    function isElementVisible(el) {\n        if (!el || el.nodeType !== 1) return false;\n        const style = window.getComputedStyle(el);\n        return (\n            style.display !== 'none' &&\n            style.visibility !== 'hidden' &&\n            style.opacity !== '0' &&\n            el.offsetParent !== null &&\n            el.clientWidth > 0 &&\n            el.clientHeight > 0\n        );\n    }\n\n    \/\/ 模拟真人点击\n    function simulateRealClick(el) {\n        if (!el || !isElementVisible(el)) return false;\n        el.scrollIntoView({ behavior: 'instant', block: 'nearest' });\n\n        const mouseEvents = [\n            new MouseEvent('mousedown', { bubbles: true, cancelable: true, view: window, button: 0, buttons: 1 }),\n            new MouseEvent('mouseup', { bubbles: true, cancelable: true, view: window, button: 0, buttons: 0 }),\n            new MouseEvent('click', { bubbles: true, cancelable: true, view: window, button: 0 })\n        ];\n\n        try {\n            mouseEvents.forEach(event => el.dispatchEvent(event));\n            return true;\n        } catch (e) {\n            return false;\n        }\n    }\n\n    \/\/ 根据文本查找所有未点击的展开按钮\n    function findNewExpandButtons() {\n        const newButtons = [];\n        const xpathBase = \"\/\/*[self::button or self::div or self::span][@role='button' or @class][not(@disabled)]\";\n\n        EXPAND_TEXT_KEYWORDS.forEach(keyword => {\n            const xpath = `${xpathBase}[contains(text(), '${keyword}') or contains(@aria-label, '${keyword}')]`;\n            const nodes = document.evaluate(xpath, document, null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null);\n\n            for (let i = 0; i < nodes.snapshotLength; i++) {\n                const el = nodes.snapshotItem(i);\n                if (isElementVisible(el) && !clickedButtonCache.has(el)) {\n                    newButtons.push(el);\n                }\n            }\n        });\n        return newButtons;\n    }\n\n    \/\/ 滑到页面底部并自动展开全文（核心新增）\n    function scrollToBottomAndExpand() {\n        \/\/ 1. 滑到页面底部（instant=立即，smooth=平滑）\n        window.scrollTo({\n            top: document.body.scrollHeight,\n            behavior: 'instant'\n        });\n        console.log(`✅ 累计${SCROLL_TO_BOTTOM_AFTER}次单次滚动，已自动滑到页面底部`);\n\n        \/\/ 2. 延迟500ms执行展开（等待新内容加载）\n        setTimeout(() => {\n            const expandCount = batchExpand();\n            if (expandCount > 0) {\n                console.log(`✅ 滑到底部后自动展开：本次展开${expandCount}个内容，累计展开${totalExpandCount}个`);\n                \/\/ 可选：桌面通知（需授权）\n                if (Notification.permission === 'granted') {\n                    new Notification('知乎自动展开', {\n                        body: `滑到底部后自动展开${expandCount}个新内容，累计展开${totalExpandCount}个`\n                    });\n                }\n            } else {\n                console.log(`ℹ️ 滑到底部后自动展开：暂无新的「阅读全文」按钮`);\n            }\n        }, 500);\n    }\n\n    \/\/ ===================== 展开计数显示 =====================\n    function updateExpandCountDisplay() {\n        const countBadge = document.getElementById('zhihu-expand-count-badge');\n        const expandBtn = document.getElementById('zhihu-expand-all-btn');\n        if (!countBadge || !expandBtn) return;\n\n        if (totalExpandCount > 0) {\n            countBadge.textContent = totalExpandCount;\n            countBadge.style.display = 'flex';\n            expandBtn.title = isAutoMode\n                ? `当前：自动展开模式（累计展开${totalExpandCount}个），再次点击关闭`\n                : `点击展开所有含「阅读全文」的内容（累计展开${totalExpandCount}个），点击后开启自动模式`;\n        } else {\n            countBadge.textContent = '';\n            countBadge.style.display = 'none';\n            expandBtn.title = isAutoMode\n                ? '当前：自动展开模式（暂无展开），再次点击关闭'\n                : '点击展开所有含「阅读全文」的内容，点击后开启自动模式';\n        }\n    }\n\n    function resetExpandCount() {\n        totalExpandCount = 0;\n        clickedButtonCache.clear();\n        updateExpandCountDisplay();\n    }\n\n    \/\/ ===================== 核心展开逻辑 =====================\n    function batchExpand() {\n        let expandCount = 0;\n        const newButtons = findNewExpandButtons();\n\n        newButtons.forEach(btn => {\n            const success = simulateRealClick(btn);\n            if (success) {\n                expandCount++;\n                clickedButtonCache.add(btn);\n            }\n        });\n\n        if (expandCount > 0) {\n            totalExpandCount += expandCount;\n            updateExpandCountDisplay();\n            console.log(`✅ 本次展开${expandCount}个，累计展开${totalExpandCount}个`);\n        }\n        return expandCount;\n    }\n\n    function autoCheckAndExpand() {\n        const newCount = batchExpand();\n        if (newCount > 0 && Notification.permission === 'granted') {\n            new Notification('知乎自动展开', {\n                body: `自动展开${newCount}个新内容，累计展开${totalExpandCount}个`\n            });\n        }\n    }\n\n    function toggleAutoMode() {\n        const expandBtn = document.getElementById('zhihu-expand-all-btn');\n        if (!expandBtn) return;\n\n        if (!isAutoMode) {\n            isAutoMode = true;\n            expandBtn.textContent = '自动';\n            expandBtn.style.background = '#00cc88 !important';\n\n            const firstCount = batchExpand();\n            const firstTip = firstCount === 0\n                ? `✅ 已开启自动展开模式\\n当前无新的「阅读全文」按钮（累计展开${totalExpandCount}个）`\n                : `✅ 已开启自动展开模式\\n首次展开${firstCount}个，累计${totalExpandCount}个，后续会自动监测新内容`;\n            alert(firstTip);\n\n            autoCheckTimer = setInterval(autoCheckAndExpand, 2000);\n        } else {\n            isAutoMode = false;\n            expandBtn.textContent = '展开';\n            expandBtn.style.background = '#0084ff !important';\n\n            clearInterval(autoCheckTimer);\n            autoCheckTimer = null;\n            alert(`✅ 已关闭自动展开模式\\n本次会话累计展开${totalExpandCount}个内容`);\n            updateExpandCountDisplay();\n        }\n    }\n\n    \/\/ ===================== 核心调整：固定间隔自动滚动（滑底后自动展开） =====================\n    \/\/ 检测滚动是否成功（核心判断）\n    function isScrollSuccess() {\n        \/\/ 滚动前位置\n        const prevScrollY = window.scrollY;\n        \/\/ 执行单次向下滚动（400px）\n        window.scrollBy(0, SCROLL_STEP);\n        \/\/ 立即检测滚动后位置（scrollBy是同步操作）\n        const currScrollY = window.scrollY;\n        \/\/ 滚动成功：位置发生变化（说明能向下滚动）\n        return currScrollY > prevScrollY;\n    }\n\n    \/\/ 自动滚动核心执行函数（递归设置定时器）\n    function autoScrollExecute() {\n        if (!isAutoScroll) return; \/\/ 已关闭则终止\n\n        \/\/ 执行单次滚动并判断结果\n        const scrollSuccess = isScrollSuccess();\n\n        if (scrollSuccess) {\n            \/\/ 滚动成功：重置连续失败计数\n            failedAttempts = 0;\n            console.log(`✅ 滚动成功（400px），下次间隔${SCROLL_DELAY}秒`);\n        } else {\n            \/\/ 滚动失败：累计失败次数\n            failedAttempts++;\n            console.log(`❌ 滚动失败，连续失败${failedAttempts}\/${MAX_FAILED_ATTEMPTS}次，下次间隔${SCROLL_DELAY}秒重试`);\n\n            \/\/ 检查是否达到最大失败次数\n            if (failedAttempts >= MAX_FAILED_ATTEMPTS) {\n                \/\/ 60次失败，彻底停止\n                toggleAutoScroll(); \/\/ 关闭自动滚动\n                alert(`❌ 连续${MAX_FAILED_ATTEMPTS}次滚动失败，已达到最大重试次数，自动停止滚动`);\n                return;\n            }\n        }\n\n        \/\/ 累计单次滚动次数，每10次滑到底部并展开\n        scrollAttempts++;\n        if (scrollAttempts >= SCROLL_TO_BOTTOM_AFTER) {\n            scrollToBottomAndExpand(); \/\/ 替换为滑底+展开函数\n            scrollAttempts = 0; \/\/ 重置计数\n        }\n\n        \/\/ 更新滚动按钮提示（显示失败次数+累计滚动次数）\n        updateScrollBtnTip();\n\n        \/\/ 设置下一次滚动定时器（固定5秒间隔）\n        autoScrollTimer = setTimeout(autoScrollExecute, SCROLL_DELAY * 1000);\n    }\n\n    \/\/ 更新滚动按钮提示文字\n    function updateScrollBtnTip() {\n        const scrollBtn = document.getElementById('zhihu-scroll-btn');\n        if (!scrollBtn) return;\n\n        if (isAutoScroll) {\n            scrollBtn.title = `当前：自动滚动中（5秒\/次，400px\/次），连续失败${failedAttempts}\/${MAX_FAILED_ATTEMPTS}次，已滚动${scrollAttempts}\/${SCROLL_TO_BOTTOM_AFTER}次（满10次滑到底部并自动展开）（点击停止）`;\n        } else {\n            scrollBtn.title = '点击开启自动向下滚动（5秒\/次，400px\/次，每10次滑到底部并自动展开，60次失败自动停止）';\n        }\n    }\n\n    \/\/ 切换自动滚动模式（调整：重置滚动次数计数）\n    function toggleAutoScroll() {\n        const scrollBtn = document.getElementById('zhihu-scroll-btn');\n        if (!scrollBtn) return;\n\n        if (!isAutoScroll) {\n            \/\/ 开启自动滚动：重置所有计数\n            isAutoScroll = true;\n            failedAttempts = 0;\n            scrollAttempts = 0; \/\/ 重置单次滚动计数\n            scrollBtn.textContent = '停止';\n            scrollBtn.style.background = '#ff7a45 !important';\n            updateScrollBtnTip();\n\n            \/\/ 立即执行第一次滚动，然后启动递归定时器\n            autoScrollExecute();\n        } else {\n            \/\/ 停止自动滚动\n            isAutoScroll = false;\n            scrollBtn.textContent = '滚动';\n            scrollBtn.style.background = '#ff9500 !important';\n            updateScrollBtnTip();\n\n            \/\/ 清除定时器\n            clearTimeout(autoScrollTimer);\n            autoScrollTimer = null;\n            alert(`✅ 已手动停止自动滚动（本次连续失败${failedAttempts}次，累计滚动${scrollAttempts}次）`);\n        }\n    }\n\n    \/\/ 强制停止自动滚动（用于URL变化\/页面卸载）\n    function stopAutoScroll() {\n        if (isAutoScroll) {\n            clearTimeout(autoScrollTimer);\n            isAutoScroll = false;\n            failedAttempts = 0; \/\/ 重置失败计数\n            scrollAttempts = 0; \/\/ 重置单次滚动计数\n            const scrollBtn = document.getElementById('zhihu-scroll-btn');\n            if (scrollBtn) {\n                scrollBtn.textContent = '滚动';\n                scrollBtn.style.background = '#ff9500 !important';\n                updateScrollBtnTip();\n            }\n        }\n    }\n\n    \/\/ ===================== 悬浮按钮创建 =====================\n    function createExpandButton() {\n        const existingBtn = document.getElementById('zhihu-expand-all-btn');\n        if (existingBtn) {\n            existingBtn.style.display = 'block';\n            if (isAutoMode) {\n                existingBtn.textContent = '自动';\n                existingBtn.style.background = '#00cc88 !important';\n            } else {\n                existingBtn.textContent = '展开';\n                existingBtn.style.background = '#0084ff !important';\n            }\n            updateExpandCountDisplay();\n            return;\n        }\n\n        \/\/ 1. 创建展开主按钮\n        const expandBtn = document.createElement('button');\n        expandBtn.id = 'zhihu-expand-all-btn';\n        expandBtn.style.cssText = `\n            position: fixed !important;\n            right: 20px !important;\n            bottom: 20px !important;\n            width: 50px !important;\n            height: 50px !important;\n            border-radius: 50% !important;\n            background: #0084ff !important;\n            color: #ffffff !important;\n            border: none !important;\n            outline: none !important;\n            font-size: 14px !important;\n            cursor: pointer !important;\n            z-index: 99999 !important;\n            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;\n            transition: background-color 0.2s ease !important;\n            opacity: 1 !important;\n            visibility: visible !important;\n            display: flex !important;\n            align-items: center !important;\n            justify-content: center !important;\n        `;\n        expandBtn.textContent = '展开';\n        expandBtn.title = '点击展开所有含「阅读全文」的内容，点击后开启自动模式';\n\n        \/\/ 展开计数徽章\n        const countBadge = document.createElement('span');\n        countBadge.id = 'zhihu-expand-count-badge';\n        countBadge.style.cssText = `\n            position: absolute !important;\n            top: -5px !important;\n            right: -5px !important;\n            width: 20px !important;\n            height: 20px !important;\n            border-radius: 50% !important;\n            background: #ff3b30 !important;\n            color: #ffffff !important;\n            font-size: 12px !important;\n            font-weight: bold !important;\n            display: none !important;\n            align-items: center !important;\n            justify-content: center !important;\n            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;\n        `;\n        expandBtn.appendChild(countBadge);\n\n        \/\/ 展开按钮hover效果\n        expandBtn.addEventListener('mouseover', () => {\n            if (isAutoMode) {\n                expandBtn.style.background = '#00aa77 !important';\n            } else {\n                expandBtn.style.background = '#0066cc !important';\n            }\n        });\n        expandBtn.addEventListener('mouseout', () => {\n            if (isAutoMode) {\n                expandBtn.style.background = '#00cc88 !important';\n            } else {\n                expandBtn.style.background = '#0084ff !important';\n            }\n        });\n\n        expandBtn.addEventListener('click', toggleAutoMode);\n        document.body.appendChild(expandBtn);\n        updateExpandCountDisplay();\n    }\n\n    \/\/ 创建自动滚动按钮\n    function createScrollButton() {\n        const existingBtn = document.getElementById('zhihu-scroll-btn');\n        if (existingBtn) {\n            existingBtn.style.display = 'block';\n            if (isAutoScroll) {\n                existingBtn.textContent = '停止';\n                existingBtn.style.background = '#ff7a45 !important';\n            } else {\n                existingBtn.textContent = '滚动';\n                existingBtn.style.background = '#ff9500 !important';\n            }\n            updateScrollBtnTip();\n            return;\n        }\n\n        \/\/ 创建滚动按钮（位于展开按钮上方80px处）\n        const scrollBtn = document.createElement('button');\n        scrollBtn.id = 'zhihu-scroll-btn';\n        scrollBtn.style.cssText = `\n            position: fixed !important;\n            right: 20px !important;\n            bottom: 80px !important; \/* 与展开按钮间距60px *\/\n            width: 50px !important;\n            height: 50px !important;\n            border-radius: 50% !important;\n            background: #ff9500 !important; \/* 橙色主题 *\/\n            color: #ffffff !important;\n            border: none !important;\n            outline: none !important;\n            font-size: 14px !important;\n            cursor: pointer !important;\n            z-index: 99999 !important;\n            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15) !important;\n            transition: background-color 0.2s ease !important;\n            opacity: 1 !important;\n            visibility: visible !important;\n            display: flex !important;\n            align-items: center !important;\n            justify-content: center !important;\n        `;\n        scrollBtn.textContent = '滚动';\n        updateScrollBtnTip();\n\n        \/\/ 滚动按钮hover效果\n        scrollBtn.addEventListener('mouseover', () => {\n            if (isAutoScroll) {\n                scrollBtn.style.background = '#ff6a30 !important';\n            } else {\n                scrollBtn.style.background = '#e68a00 !important';\n            }\n        });\n        scrollBtn.addEventListener('mouseout', () => {\n            if (isAutoScroll) {\n                scrollBtn.style.background = '#ff7a45 !important';\n            } else {\n                scrollBtn.style.background = '#ff9500 !important';\n            }\n        });\n\n        \/\/ 绑定滚动模式切换\n        scrollBtn.addEventListener('click', toggleAutoScroll);\n        document.body.appendChild(scrollBtn);\n    }\n\n    \/\/ ===================== 页面监听与初始化 =====================\n    function monitorPageChanges() {\n        let lastUrl = window.location.href;\n        \/\/ 监听URL变化（知乎单页应用）\n        setInterval(() => {\n            if (window.location.href !== lastUrl) {\n                lastUrl = window.location.href;\n                \/\/ 切换页面：重置所有状态\n                if (isAutoMode) {\n                    clearInterval(autoCheckTimer);\n                    isAutoMode = false;\n                }\n                stopAutoScroll(); \/\/ 停止自动滚动\n                resetExpandCount();\n                createExpandButton();\n                createScrollButton();\n            }\n        }, 800);\n\n        \/\/ 滚动时确保按钮存在\n        let scrollTimer = null;\n        window.addEventListener('scroll', () => {\n            clearTimeout(scrollTimer);\n            scrollTimer = setTimeout(() => {\n                const expandBtn = document.getElementById('zhihu-expand-all-btn');\n                const scrollBtn = document.getElementById('zhihu-scroll-btn');\n                if (!expandBtn) createExpandButton();\n                if (!scrollBtn) createScrollButton();\n            }, 500);\n        });\n    }\n\n    \/\/ 初始化桌面通知权限\n    function initNotificationPermission() {\n        if (Notification.permission !== 'granted' && Notification.permission !== 'denied') {\n            Notification.requestPermission();\n        }\n    }\n\n    function init() {\n        initNotificationPermission();\n\n        \/\/ 初始化两个按钮\n        const initHandler = () => {\n            createExpandButton();\n            createScrollButton();\n            monitorPageChanges();\n        };\n\n        if (document.readyState === 'complete' || document.readyState === 'interactive') {\n            initHandler();\n        } else {\n            document.addEventListener('DOMContentLoaded', initHandler);\n        }\n        window.addEventListener('load', initHandler);\n        setTimeout(initHandler, 1500);\n\n        \/\/ 页面卸载时清理所有定时器\n        window.addEventListener('beforeunload', () => {\n            clearInterval(autoCheckTimer);\n            clearTimeout(autoScrollTimer);\n        });\n    }\n\n    init();\n\n})();",
            "mtime": 1773650187
        },
        "2": {
            "content": "接下来我会发送代码给你，请你记住并分析其功能，并且介绍其前端显示效果和具体操作逻辑。                                                                                                                                                                                                      ",
            "mtime": 1766479464
        },
        "3": {
            "content": "请基于PHP5.6实现以下功能，并且优先在一个PHP文件实现以下功能，",
            "mtime": 1766480247
        },
        "4": {
            "content": "编写一个数字记忆网页程序，可选20，40，60，80，100，数字记忆。点击可分别选取本次记忆数字，选取后显示数字，之后可点击开始按钮开始计时，用户之后点击暂停后记录记忆时间，显示的数字消失，用户通过下方按钮进行回答，页面下方分为两列按钮，上方为1到5，下方为6到0，用户每点击一个数字上方显示一个数字并判断是否正确（正确在数字外显示绿色外框，错误红色）。并实时计算正确率。用户全部完成后将要本次数据保留在data.csv文件中。",
            "mtime": 1766559022
        },
        "5": {
            "content": "生成100个常见名词，如，苹果、西瓜",
            "mtime": 1766560411
        },
        "6": {
            "content": "",
            "mtime": 1777599998
        }
    }
}