Greasy Fork

Greasy Fork is available in English.

Am_I_Replied

判断是否已经回过贴

当前为 2022-10-21 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name:zh-CN      我回过贴了吗
// @name            Am_I_Replied
// @namespace       https://blog.chrxw.com
// @supportURL      https://blog.chrxw.com/scripts.html
// @contributionURL https://afdian.net/@chr233
// @version         1.3
// @description     判断是否已经回过贴
// @description:zh-CN  判断是否已经回过贴
// @author          Chr_
// @include         https://keylol.com/forum.php?*
// @include         https://keylol.com/t*
// @include         https://bbs.nga.cn/read.php?*
// @include         https://ngabbs.com/read.php?*
// @include         https://nga.178.com/read.php?*
// @license         AGPL-3.0
// @icon            https://blog.chrxw.com/favicon.ico
// ==/UserScript==

(async () => {
    "use strict";

    if ((location.pathname === "/forum.php" && !location.search.includes("tid")) || location.search.includes("authorid")) {
        return;
    }

    const userId = typeof discuz_uid != 'undefined' ? discuz_uid : __CURRENT_UID;

    let testUrl = location.href;

    if (location.search) {
        testUrl += `&authorid=${userId}`;
    } else {
        testUrl += `?authorid=${userId}`;
    }

    fetch(testUrl)
        .then((res) => res.text())
        .then((html) => {
            const replied = !(html.includes("未定义操作") || html.includes("ERROR:"));
            const btnArea = document.querySelector("#pgt, #m_nav>.nav");
            const text = replied ? "✅已经回过贴了" : "❌还没回过贴子";
            const tips = document.createElement("a");
            tips.textContent = text;
            if (replied) {
                tips.href = testUrl;
            }
            else {
                tips.addEventListener("click", () => {
                    showError("❌还没回过贴子");
                });
            }
            btnArea.appendChild(tips);
        });
})();