QuicklyReply-PTer (Touch Screen Ver.修改逻辑版)

faster!

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

// ==UserScript==
// @name         QuicklyReply-PTer (Touch Screen Ver.修改逻辑版)
// @namespace    http://tampermonkey.net/
// @version      1.0.6
// @description  faster!
// @author       PTerClub-Helpers
// @connect      greasyfork.org
// @match        http*://pterclub.com/details.php*
// @match        https://pterclub.com/torrents.php?*
// @icon         https://pterclub.com/favicon.ico
// @grant        GM_xmlhttpRequest
// @grant        GM_setValue
// @grant        GM_getValue
// @license      MIT
// @link         https://greasyfork.org/zh-CN/scripts/523607-quicklyreply-pter-touch-screen-ver
// ==/UserScript==
//
//声明:原作者Frostine和gsdwqe,本代码修改了核心逻辑,使脚本变得易于修改   
// ==================== 配置区 (Configuration Area) ====================
// 在这里编辑、添加、删除或重新排序回复模板,无需修改任何逻辑代码。
const replyOptionsConfig = {
    styles: { // 新增的样式配置区
        sectionTitleColor: "#000", // 区块标题颜色(金色)
        labelTextColor: "#000",    // 选项标签默认颜色(白色)
        panelBackgroundColor: "rgba(255, 255, 255, 0.7)" // 整体面板的背景颜色(半透明黑)
    },
    // 对应视频、剧集等分类
    video_tv_etc: [
        {
            sectionTitle: "标题",
            items: [
                { value: "[*] 标题不符合 PTerClub 资源命名规范。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#对帖子标题的要求]点击此处进入 PTerClub 资源命名规范[/url]", label: "0day 标题" },
                { value: "[*] 主标题片名需要修正", label: "修正片名" },
                { value: "[*] 主标题分辨率需要修正", label: "修正分辨率" },
                { value: "[*] 主标题音频编码需要修正", label: "修正音轨", breakLine: true },
                { value: "[*] 标题里的“.”需要用空格替代(5.1、7.1 等中的点除外)。", label: "标题删点" },
                { value: "[*] 标题不能有中文,需要删除。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题删中文" },
                { value: "[*] 标题里的括号“()”需要用空格替代。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题删括号", breakLine: true },
                { value: "[*] 请按照 IMDb 或海报片名将标题里[b][color=red]片名[/color][/b]原有的英文标点符号补回。", label: "片名补点" },
                { value: "[*] 标题 5.1、7.1 等中的“.”需要补回。", label: "通道补点", breakLine: true },
                { value: "[*] 请查看 Info,正确填写标题的视频编码。对于 Blu-ray Discs 及其 REMUX,填写 AVC 或 HEVC;对于 WEB-DL 和 HDTV,如有 x264 或 x265 字样,填写 x264 或 x265,否则填写 H.264 或 H.265;对于 Encode,填写 x264 或 x265。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#.E8.A7.86.E9.A2.91.2F.E9.9F.B3.E9.A2.91_.E7.BC.96.E7.A0.81]上传规则 - 视频/音频 编码[/url]", label: "视频编码写法不正确", breakLine: true },
                { value: "[*] 标题 TrueHD 7.1 -> TrueHD 7.1 Atmos", label: "标题 TrueHD 7.1 -> TrueHD 7.1 Atmos", breakLine: true },
                { value: "[*] 未完结剧集请在主标题季数 Sxx 后添加集数 Exx", label: "未完结剧集" },
                { value: "[*] 完结剧集请删除主标题中的集数", label: "完结剧集", breakLine: true },
                { value: "[*] 副标题需要用中文写上名称和简单介绍。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "中文副标题", breakLine: true }
            ]
        },
        {
            sectionTitle: "标签",
            items: [
                { value: "[*] 国语资源,需要勾选“国语”标签。", label: "勾选国语" },
                { value: "[*] 没有国语音轨,不要勾选“国语”标签。", label: "不勾选国语", breakLine: true },
                { value: "[*] 粤语资源,需要勾选“粤语”标签。", label: "勾选粤语" },
                { value: "[*] 没有粤语音轨,不要勾选“粤语”标签。", label: "不勾选粤语", breakLine: true },
                { value: "[*] 资源含有中文字幕,需要勾选“中字”标签。", label: "勾选中字" },
                { value: "[*] 资料没显示有中文字幕,不要勾选“中字”标签。", label: "不勾选中字", breakLine: true },
                { value: "[*] 发种人上传了外挂中文字幕后,[b][color=red]需要[/color][/b]勾选“中字”标签。", label: "外挂中字" },
                { value: "[*] 截图无法确认是否有中字,请更换带中字字幕的截图。\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url]", label: "更换中字截图", breakLine: true },
                { value: "[*] 资料没显示有英文字幕,不要勾选“英字”标签。", label: "不勾选英字" },
                { value: "[*] 请更换带中字的截图,并勾选“中字”标签。\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url]", label: "截图和中字", breakLine: true },
                { value: "[*] DIY 原盘(Custom Disc),需要勾选“DIY”标签。", label: "勾选 DIY" },
                { value: "[*] DIY 标签仅限 DIY 原盘(Custom Disc)使用,不要勾选“DIY 原盘”标签。", label: "不勾选 DIY", breakLine: true }
            ]
        },
        {
            sectionTitle: "基本信息",
            items: [
                { value: "[*] 所有动画资源(包括动画电影和电视剧等),类型需要选择 Animation。", label: "动画" },
                { value: "[*] 这是电影,类型需要选择 Movie。", label: "电影" },
                { value: "[*] 这是电视剧,类型需要选择 TV Series。", label: "电视剧", breakLine: true },
                { value: "[*] 这是综艺,类型需要选择 TV Show。", label: "综艺" },
                { value: "[*] 这是纪录片,类型需要选择 Documentary。", label: "纪录片" },
                { value: "[*] 只有单独一首的音乐短片才选择 MV,演唱会或话剧等需要选择 Stage Performance。", label: "舞台演出", breakLine: true },
                { value: "", label: "", breakLine: true },
                { value: "[*] 这是 Remux 资源,质量需要选择 Remux。", label: "Remux" },
                { value: "[*] 这是压制资源,质量需要选择 Encode。", label: "压制" },
                { value: "[*] 这是网络资源,质量需要选择 WEB-DL。", label: "WEB-DL" },
                { value: "[*] 这是 TV 录制资源,质量需要选择 HDTV。", label: "HDTV", breakLine: true },
                { value: "[*] 这是 1080p 原盘资源,质量需要选择 BD Discs。", label: "蓝光原盘" },
                { value: "[*] 这是 2160p 原盘资源,质量需要选择 UHD Discs。", label: "4K 蓝光原盘" },
                { value: "[*] 这是 DVD 资源,质量需要选择 DVD Discs。", label: "DVD 原盘", breakLine: true },
                { value: "", label: "", breakLine: true },
                { value: "[*] 地区需要选择欧美(Western)。", label: "欧美" },
                { value: "[*] 地区需要选择大陆(Mainland, CHN)。", label: "大陆" },
                { value: "[*] 地区需要选择香港(HKG, CHN)。", label: "香港" },
                { value: "[*] 地区需要选择台湾(TWN, CHN)。", label: "台湾", breakLine: true },
                { value: "[*] 地区需要选择韩国(KOR)。", label: "韩国" },
                { value: "[*] 地区需要选择日本(JPN)。", label: "日本" },
                { value: "[*] 地区需要选择印度(IND)。", label: "印度", breakLine: true }
            ]
        },
        {
            sectionTitle: "链接",
            items: [
                { value: "[*] 需要补上 IMDb 链接,链接需要填写在编辑页上面的栏目里。\n  请前往 https://movie.douban.com/ 或 https://www.imdb.com/ 查找对应的链接", label: "IMDb 链接" },
                { value: "[*] 需要补上豆瓣链接,链接需要填写在编辑页上面的栏目里。\n  请前往 https://movie.douban.com/ 查找对应的链接", label: "豆瓣链接", breakLine: true }
            ]
        },
        {
            sectionTitle: "作者制作说明",
            items: [
                { value: "[*] 作者制作说明需要用 quote 引用代码括着。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]", label: "作者制作说明" },
                { value: "[*] 删除免责声明。", label: "删除免责声明", breakLine: true }
            ]
        },
        {
            sectionTitle: "内容",
            items: [
                { value: "[*] 海报缺失或显示错误,需要补图。\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url] 和 [url=https://wiki.pterclub.com/wiki/图床]图床[/url]", label: "补海报" },
                { value: "[*] 请使用 PTgen 或其他工具生成规范的种子介绍,具体请参考以下教程:[url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=5197]种子简介生成工具汇总[/url]", label: "补简介", breakLine: true }
            ]
        },
        {
            sectionTitle: "Info",
            items: [
                { value: "[*] 按来源质量,需要补上 BDInfo 或 MediaInfo,并使用 hide=BDInfo 或 hide=MediaInfo 引用。\n  Info 获取请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=4178]关于视频参数(Info)的获取[/url]\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "补 MediaInfo/BDInfo" },
                { value: "[*] 基于 DVD 原盘结构,需要 IFO 和 VOB 文件的 MediaInfo,才能展现出一个 DVD 原盘的质量和概况。\n  [url=https://wiki.pterclub.com/wiki/从零开始:如何发种#DVD原盘获取mediainfo特别说明]从零开始:如何发种 - DVD 原盘获取 MediaInfo 特别说明[/url]", label: "DVD 的 Info", breakLine: true },
                { value: "[*] 需要补上完整的 MediaInfo,并使用 hide=MediaInfo 引用。\n  Info 获取请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=4178]关于视频参数(Info)的获取[/url]", label: "补完整的 MediaInfo" },
                { value: "[*] Info 需要用 BBCode 代码括着。对于 General Infomation,使用 quote 代码。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "quote", breakLine: true },
                { value: "[*] Info 需要用 BBCode 代码括着。对于 MediaInfo,使用 hide=MediaInfo 代码。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "hide=MediaInfo" },
                { value: "[*] Info 需要用 BBCode 代码括着。对于 BDInfo,使用 hide=BDInfo 代码。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "hide=BDInfo", breakLine: true }
            ]
        },
        {
            sectionTitle: "截图",
            items: [
                { value: "[*] 请删除无法显示的图片。", label: "无法显示的图" },
                { value: "[*] 截图显示错误,需要补图;如无法补图,请删除无法显示的图片。\n  截图方法,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=4310]关于视频截图的简要教程[/url]\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url] 和 [url=https://wiki.pterclub.com/wiki/图床]图床[/url]", label: "补截图", breakLine: true }
            ]
        },
        {
            sectionTitle: "修正",
            items: [
                { value: "[*] 种子简介请按照“海报 - 资源简介 - Info 信息 - 截图”的顺序进行。", label: "内容顺序" },
                { value: "[*] 检查 BBCode,修正错误的代码,删除多余的代码。\n  [url=https://pterclub.com/tags.php]点击此处进入 BBCode 代码相关介绍[/url]", label: "修正 BBCode", breakLine: true }
            ]
        },
        {
            sectionTitle: "其他",
            items: [
                { value: "[*] 请参考发种流程进行学习并修改。\n  [url=https://wiki.pterclub.com/wiki/从零开始:如何发种]从零开始:如何发种[/url]\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=22&topicid=3642]How to fill out the Upload Page[/url]", label: "发种不规范" },
                { value: "[*] ", label: "其他", breakLine: true },
                { value: "[*] 种子将大体按发布顺序审核,请勿催审。如果不确定种子是否符合规范,请不要发布后举报种子,可发到候选由 Helper 手动通过候选。[url=https://wiki.pterclub.com/wiki/用户分享率及等级说明]用户分享率及等级说明[/url]", label: "催审要求", breakLine: true },
                { value: "[b]你好,请参考站内类似资源,修正以下问题:[/b]", label: "需要修正", checked: true },
                { value: "[b]以下问题本次已帮忙修正,后续请多留意,谢谢:[/b]", label: "已代修改", breakLine: true },
                { value: `[b]请尽快按照提示/要求完成修改,[color=red]修改完成请及时举报自己的种子[/color],说明已修改完成。[/b]
(若有疑问欢迎引用该评论联系 Helper,请勿无视修改意见,否则会被删种,多次无视可能会被警告或者禁止上传权限)
(欢迎使用本站的 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=13370]种子审核脚本[/url] 自查修正,有助于提高审核通过率,强烈推荐)`, label: "需要修正", checked: true }
            ]
        }
    ],
    music_video: [
        {
            sectionTitle: "标题",
            items: [
                { value: "[*] 标题不符合 PTerClub 资源命名规范。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#对帖子标题的要求]点击此处进入 PTerClub 资源命名规范[/url]", label: "0day 标题" },
                { value: "[*] 标题歌名部分需按“歌手名 - 歌曲名”格式填写,注意“-”两侧各有 1 个空格。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#对帖子标题的要求]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题缺少空格", breakLine: true },
                { value: "[*] 主标题歌名需要修正", label: "修正片名" },
                { value: "[*] 主标题分辨率需要修正", label: "修正分辨率" },
                { value: "[*] 主标题音频编码需要修正", label: "修正音轨", breakLine: true },
                { value: "[*] 标题里的“.”需要用空格替代(5.1、7.1 等中的点除外)。", label: "标题删点" },
                { value: "[*] 标题不能有中文,需要删除。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题删中文" },
                { value: "[*] 标题里的括号“()”需要用空格替代。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题删括号", breakLine: true },
                { value: "[*] 请参照海报将标题里[b][color=red]歌名[/color][/b]原有的英文标点符号补回。", label: "片名补点" },
                { value: "[*] 标题 5.1、7.1 等中的“.”需要补回。", label: "通道补点", breakLine: true },
                { value: "[*] 请正确填写标题的视频编码。对于 MV,填写 AVC 或 HEVC。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#.E8.A7.86.E9.A2.91.2F.E9.9F.B3.E9.A2.91_.E7.BC.96.E7.A0.81]上传规则 - 视频/音频 编码[/url]", label: "视频编码写法不正确", breakLine: true },
                { value: "[*] 副标题需要用中文写上名称和简单介绍。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "中文副标题", breakLine: true }
            ]
        },
        {
            sectionTitle: "标签",
            items: [
                { value: "[*] 国语资源,需要勾选“国语”标签。", label: "勾选国语" },
                { value: "[*] 没有国语音轨,不要勾选“国语”标签。", label: "不勾选国语", breakLine: true },
                { value: "[*] 粤语资源,需要勾选“粤语”标签。", label: "勾选粤语" },
                { value: "[*] 没有粤语音轨,不要勾选“粤语”标签。", label: "不勾选粤语", breakLine: true },
                { value: "[*] 资源含有中文字幕,需要勾选“中字”标签。", label: "勾选中字" },
                { value: "[*] 资料没显示有中文字幕,不要勾选“中字”标签。", label: "不勾选中字", breakLine: true },
                { value: "[*] 资料没显示有英文字幕,不要勾选“英字”标签。", label: "不勾选英字", breakLine: true }
            ]
        },
        {
            sectionTitle: "基本信息",
            items: [
                { value: "[*] 这是 Remux 资源,质量需要选择 Remux。", label: "Remux" },
                { value: "[*] 这是压制资源,质量需要选择 Encode。", label: "压制" },
                { value: "[*] 这是网络资源,质量需要选择 WEB-DL。", label: "WEB-DL" },
                { value: "[*] 这是 TV 录制资源,质量需要选择 HDTV。", label: "HDTV", breakLine: true },
                { value: "[*] 这是 1080p 原盘资源,质量需要选择 BD Discs。", label: "蓝光原盘" },
                { value: "[*] 这是 2160p 原盘资源,质量需要选择 UHD Discs。", label: "4K 蓝光原盘" },
                { value: "[*] 这是 DVD 资源,质量需要选择 DVD Discs。", label: "DVD 原盘", breakLine: true },
                { value: "", label: "", breakLine: true },
                { value: "[*] 地区需要选择欧美(Western)。", label: "欧美" },
                { value: "[*] 地区需要选择大陆(Mainland, CHN)。", label: "大陆" },
                { value: "[*] 地区需要选择香港(HKG, CHN)。", label: "香港" },
                { value: "[*] 地区需要选择台湾(TWN, CHN)。", label: "台湾", breakLine: true },
                { value: "[*] 地区需要选择韩国(KOR)。", label: "韩国" },
                { value: "[*] 地区需要选择日本(JPN)。", label: "日本" },
                { value: "[*] 地区需要选择印度(IND)。", label: "印度", breakLine: true }
            ]
        },
        {
            sectionTitle: "内容",
            items: [
                { value: "[*] 海报缺失或显示错误,需要补图。\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url] 和 [url=https://wiki.pterclub.com/wiki/图床]图床[/url]", label: "补海报", breakLine: true }
            ]
        },
        {
            sectionTitle: "Info",
            items: [
                { value: "[*] 按来源质量,需要补上 BDInfo 或 MediaInfo,并使用 hide=BDInfo 或 hide=MediaInfo 引用。\n  Info 获取请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=4178]关于视频参数(Info)的获取[/url]\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "补 MediaInfo/BDInfo" },
                { value: "[*] 基于 DVD 原盘结构,需要 IFO 和 VOB 文件的 MediaInfo,才能展现出一个 DVD 原盘的质量和概况。\n  [url=https://wiki.pterclub.com/wiki/从零开始:如何发种#DVD原盘获取mediainfo特别说明]从零开始:如何发种 - DVD 原盘获取 MediaInfo 特别说明[/url]", label: "DVD 的 Info", breakLine: true },
                { value: "[*] 需要补上完整的 MediaInfo,并使用 hide=MediaInfo 引用。\n  Info 获取请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=4178]关于视频参数(Info)的获取[/url] ", label: "补完整的 MediaInfo" },
                { value: "[*] Info 需要用 BBCode 代码括着。对于 General Infomation,使用 quote 代码。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "quote", breakLine: true },
                { value: "[*] Info 需要用 BBCode 代码括着。对于 MediaInfo,使用 hide=MediaInfo 代码。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url]\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "hide=MediaInfo" },
                { value: "[*] Info 需要用 BBCode 代码括着。对于 BDInfo,使用 hide=BDInfo 代码。\n  [url=https://pterclub.com/forums.php?action=viewtopic&topicid=4178&page=p32903#pid32903]点击此处进入 quote 代码相关介绍[/url])\n  [url=https://pterclub.com/tags.php#quote_one]点击此处进入专属 hide 代码相关介绍[/url]", label: "hide=BDInfo", breakLine: true }
            ]
        },
        {
            sectionTitle: "截图",
            items: [
                { value: "[*] 请删除无法显示的图片。", label: "无法显示的图" },
                { value: "[*] 截图显示错误,需要补图;如无法补图,请删除无法显示的图片。\n  截图方法,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=4310]关于视频截图的简要教程[/url]\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url] 和 [url=https://wiki.pterclub.com/wiki/图床]图床[/url]", label: "补截图", breakLine: true }
            ]
        },
        {
            sectionTitle: "修正",
            items: [
                { value: "[*] 种子简介请按照“海报 - 资源简介 - Info 信息 - 截图”的顺序进行。", label: "内容顺序" },
                { value: "[*] 检查 BBCode,修正错误的代码,删除多余的代码。\n  [url=https://pterclub.com/tags.php]点击此处进入 BBCode 代码相关介绍[/url]", label: "修正 BBCode", breakLine: true }
            ]
        },
        {
            sectionTitle: "其他",
            items: [
                { value: "[*] 请参考发种流程进行学习并修改。\n  [url=https://wiki.pterclub.com/wiki/从零开始:如何发种]从零开始:如何发种[/url]\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=22&topicid=3642]How to fill out the Upload Page[/url]", label: "发种不规范" },
                { value: "[*] ", label: "其他", breakLine: true },
                { value: "[*] 种子将大体按发布顺序审核,请勿催审。如果不确定种子是否符合规范,请不要发布后举报种子,可发到候选由 Helper 手动通过候选。\n  [url=https://wiki.pterclub.com/wiki/用户分享率及等级说明]用户分享率及等级说明[/url]", label: "催审要求", breakLine: true },
                { value: `[b]请尽快按照提示/要求完成修改,[color=red]修改完成请及时举报自己的种子[/color],说明已修改完成。[/b]
(若有疑问欢迎引用该评论联系 Helper,请勿无视修改意见,否则会被删种,多次无视可能会被警告或者禁止上传权限)`, label: "需要修正", checked: true }
            ]
        }
    ],
    music: [
        {
            sectionTitle: "标题",
            items: [
                { value: "[*] 标题不符合 PTerClub 资源命名规范。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#对帖子标题的要求]点击此处进入 PTerClub 资源命名规范[/url]", label: "0day 标题" },
                { value: "[*] 主副标题需要使用“-”分隔信息,具体为“歌手 - 歌曲名”和“年份 - 格式”,注意“-”两边各需要 1 个空格。\n  [url=https://wiki.pterclub.com/wiki/上传规则(含标题命名及内容编辑指南)#对帖子标题的要求]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题缺少空格", breakLine: true },
                { value: "[*] 主标题采样位深需要修正", label: "修正采样位深" },
                { value: "[*] 主标题采样频率需要修正", label: "修正采样频率", breakLine: true },
                { value: "[*] 标题里的“.”需要用空格替代(44.1kHz 等中的点除外)。", label: "标题删点" },
                { value: "[*] 标题里的括号“()”需要用空格替代。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "标题删括号", breakLine: true },
                { value: "[*] 请参照海报将标题里[b][color=red]歌名[/color][/b]原有的英文标点符号补回。", label: "歌名补点" },
                { value: "[*] 标题 5.1、7.1 等中的“.”需要补回。", label: "通道补点", breakLine: true },
                { value: "[*] 副标题需要用中文写上名称和简单介绍。\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=1&topicid=53]点击此处进入 PTerClub 资源命名规范[/url]", label: "中文副标题", breakLine: true }
            ]
        },
        {
            sectionTitle: "标签",
            items: [
                { value: "[*] 国语资源,需要勾选“国语”标签。", label: "勾选国语" },
                { value: "[*] 非国语资源,不要勾选“国语”标签。", label: "不勾选国语", breakLine: true },
                { value: "[*] 粤语资源,需要勾选“粤语”标签。", label: "勾选粤语" },
                { value: "[*] 非粤语资源,不要勾选“粤语”标签。", label: "不勾选粤语", breakLine: true }
            ]
        },
        {
            sectionTitle: "基本信息",
            items: [
                { value: "[*] 音乐文件格式为 FLAC,质量需要选择 FLAC。", label: "FLAC" },
                { value: "[*] 音乐文件格式为 WAV,质量需要选择 WAV。", label: "WAV" },
                { value: "[*] 音乐文件格式为 ISO,质量需要选择 ISO。", label: "ISO" },
                { value: "[*] 音乐文件格式非 FLAC、WAV、ISO,质量需要选择 Other。", label: "Other", breakLine: true },
                { value: "", label: "", breakLine: true },
                { value: "[*] 地区需要选择欧美(Western)。", label: "欧美" },
                { value: "[*] 地区需要选择大陆(Mainland, CHN)。", label: "大陆" },
                { value: "[*] 地区需要选择香港(HKG, CHN)。", label: "香港" },
                { value: "[*] 地区需要选择台湾(TWN, CHN)。", label: "台湾", breakLine: true },
                { value: "[*] 地区需要选择韩国(KOR)。", label: "韩国" },
                { value: "[*] 地区需要选择日本(JPN)。", label: "日本" },
                { value: "[*] 地区需要选择印度(IND)。", label: "印度", breakLine: true }
            ]
        },
        {
            sectionTitle: "链接",
            items: [
                { value: "[*] 删除 IMDb 链接(需要将简介中的链接一并删除)。", label: "删除 IMDb 链接" },
                { value: "[*] 删除豆瓣链接(需要将简介中的链接一并删除)。", label: "删除豆瓣链接", breakLine: true }
            ]
        },
        {
            sectionTitle: "内容",
            items: [
                { value: "[*] 海报缺失或显示错误,需要补图。\n  图床使用,请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=2&topicid=2865]手把手教你贴图[/url] 和 [url=https://wiki.pterclub.com/wiki/图床]图床[/url]", label: "补海报", breakLine: true }
            ]
        },
        {
            sectionTitle: "Info",
            items: [
                { value: "[*] 需要补上 Log 或频谱图。\n  频谱图获取请参考 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=25&topicid=3537]频谱图制作教程[/url] 和 [url=https://pterclub.com/forums.php?action=viewtopic&forumid=25&topicid=3914]最简频谱图制作教程[/url]", label: "补 Log 或频谱图", breakLine: true }
            ]
        },
        {
            sectionTitle: "截图",
            items: [
                { value: "[*] 请删除无法显示的图片。", label: "无法显示的图", breakLine: true }
            ]
        },
        {
            sectionTitle: "修正",
            items: [
                { value: "[*] 种子简介请按照“海报 - 资源简介 - Info 信息 - 截图”的顺序进行。", label: "内容顺序" },
                { value: "[*] 检查 BBCode,修正错误的代码,删除多余的代码。\n  [url=https://pterclub.com/tags.php]点击此处进入 BBCode 代码相关介绍[/url]", label: "修正 BBCode", breakLine: true }
            ]
        },
        {
            sectionTitle: "其他",
            items: [
                { value: "[*] 请参考发种流程进行学习并修改。\n  [url=https://wiki.pterclub.com/wiki/从零开始:如何发种]从零开始:如何发种[/url]\n  [url=https://pterclub.com/forums.php?action=viewtopic&forumid=22&topicid=3642]How to fill out the Upload Page[/url]", label: "发种不规范" },
                { value: "[*] ", label: "其他", breakLine: true },
                { value: "[*] 种子将大体按发布顺序审核,请勿催审。如果不确定种子是否符合规范,请不要发布后举报种子,可发到候选由 Helper 手动通过候选。\n  [url=https://wiki.pterclub.com/wiki/用户分享率及等级说明]用户分享率及等级说明[/url]", label: "催审要求", breakLine: true },
                { value: `[b]请尽快按照提示/要求完成修改,[color=red]修改完成请及时举报自己的种子[/color],说明已修改完成。[/b]
(若有疑问欢迎引用该评论联系 Helper,请勿无视修改意见,否则会被删种,多次无视可能会被警告或者禁止上传权限)`, label: "需要修正", checked: true }
            ]
        }
    ]
};
/**
 * 根据单条项目配置,创建并返回一个包含 Checkbox 和可点击标签的 DOM 元素片段。
 * @param {object} itemConfig - 单个回复选项的配置对象, e.g., { value, label, checked?, breakLine? }
 * @param {object} styles - 从主配置中传入的样式对象。
 * @returns {DocumentFragment} 包含生成元素的安全文档片段。
 */
function createReplyOptionElement(itemConfig, styles) {
    // 使用 DocumentFragment 来批量创建DOM,可以提高性能,因为它在插入到主文档之前不会触发重绘。
    const fragment = document.createDocumentFragment();

    // 创建 checkbox
    const checkbox = document.createElement('input');
    checkbox.type = 'checkbox';
    checkbox.className = 'commentcheckbox';
    checkbox.style.cursor = 'pointer';
    checkbox.value = itemConfig.value;
    if (itemConfig.checked) {
        checkbox.checked = true;
    }

    // 创建可点击的标签
    const link = document.createElement('a');
    link.className = 'commentcheckbox';
    link.href = 'javascript:void(0)'; // 避免页面跳转
    link.textContent = itemConfig.label;

    // 应用来自 style 配置的颜色
    if (styles && styles.labelTextColor) {
        link.style.color = styles.labelTextColor;
    }

    // 添加点击事件,使其能安全地控制对应的 checkbox
    link.addEventListener('click', () => {
        checkbox.checked = !checkbox.checked;
    });

    fragment.appendChild(checkbox);
    fragment.appendChild(link);

    // 如果配置中注明需要换行,则添加 <br> 标签
    if (itemConfig.breakLine) {
        fragment.appendChild(document.createElement('br'));
    }

    return fragment;
}

/**
 * 根据完整的配置对象,渲染整个回复面板的用户界面。
 * @param {HTMLElement} container - 用于容纳所有选项的父容器元素。
 * @param {Array<object>} configSections - 包含多个区块的配置数组。
 * @param {object} styles - 从主配置中传入的样式对象。
 */
function renderReplyPanel(container, configSections, styles) {
    // 清空容器,为生成新内容做准备
    container.innerHTML = '';

    // 应用面板背景色
    if (styles && styles.panelBackgroundColor) {
        container.style.backgroundColor = styles.panelBackgroundColor;
    }

    // 遍历配置中的每一个区块 (e.g., "标题", "标签")
    configSections.forEach(section => {
        // 添加区块标题
        if (section.sectionTitle) {
            const title = document.createElement('div');
            title.textContent = `-----------${section.sectionTitle}-----------`;
            // 应用标题颜色
            if (styles && styles.sectionTitleColor) {
                title.style.color = styles.sectionTitleColor;
            }
            container.appendChild(title);
        }

        // 遍历区块内的每一个选项
        if (section.items) {
            section.items.forEach(item => {
                // 调用子函数创建单个选项并添加到容器中
                container.appendChild(createReplyOptionElement(item, styles));
            });
        }
    });
}

(function () {
    'use strict';
    if (window.location.href.includes("/details.php")) {

        var checks = document.getElementsByClassName('commentcheckbox');
        var checkValues = '';
        var areaComment = document.querySelectorAll('textarea[name="body"]')[0];
        function addComment() {
            checkValues = ''
            for (var i = 0; i < checks.length; i++) {
                if (checks[i].checked) {
                    console.log(checks[i].value);
                    checkValues += checks[i].value;
                    checkValues += '\n';
                }
            }
            if (areaComment.childNodes[0] != undefined){
                areaComment.childNodes[0].remove();
            }
            areaComment.value = checkValues;
            window.scrollTo(0, document.documentElement.scrollHeight);
        }

        function comment() {
            var button = document.querySelector('input#qr');
            button.click();
        }

        function checkboxReset() {
            for (var i = 0; i < checks.length; i++) {
                var check = checks[i];
                // 需要保留选中的值
                var keepValues = [
                    "[b]你好,请参考站内类似资源,修正以下问题:[/b]",
                    "[b]请尽快按照提示/要求完成修改,[color=red]修改完成请及时举报自己的种子[/color],说明已修改完成。[/b]"
                ];

                // 只有当值 **不在** keepValues 列表中时,才取消勾选
                if (check.checked && !keepValues.some(value => check.value.includes(value))) {
                    check.checked = false;
                }
            }

            if (areaComment.childNodes[0] !== undefined) {
                areaComment.childNodes[0].remove();
            }
            areaComment.value = '';
        }


        // 添加防抖的状态保存(在原有hideAndSeek函数中修改)
        let saveTimer;
        function hideAndSeek() {
            const s = document.querySelector('#ReplyBox');
            s.style.display = s.style.display === 'none' ? 'block' : 'none';

            // 防抖保存(300ms内只保存一次)
            clearTimeout(saveTimer);
            saveTimer = setTimeout(() => {
                GM_setValue('replyBoxState', s.style.display);
            }, 300);
        }

        function needModification() {
            var r = document.getElementById('radio_need_edit');
            r.checked = true;
            r.parentElement.firstChild.click();
        }

        function torrentChecked() {
            var r = document.getElementById('radio_checked');
            r.checked = true;
            r.parentElement.firstChild.click();
        }

        //$('label').remove('aside-menu')
        //$('#faq-btn').remove()
        var x = document.createElement('div');
        x.style = "position: fixed; right: 0; bottom: 0; opacity: 1; z-index: 90";

        var b = document.createElement('div');

        //版本检查
        if (typeof GM_getValue === 'function') {
            // 从 `@downloadURL` 或 `@updateURL` 中提取脚本 ID
            const scriptUrl = GM_info.scriptMetaStr.match(/@downloadURL\s+(.*)/)[1];
            const scriptIdMatch = scriptUrl.match(/\/scripts\/(\d+)/);
            const scriptId = scriptIdMatch ? scriptIdMatch[1] : null;

            if (scriptId) {
                console.log(`自动获取的脚本 ID: ${scriptId}`);

                // 示例:使用脚本 ID 进行版本检查
                const currentVersion = GM_info.script.version;

                // 获取当前时间戳(单位:毫秒)
                const now = Date.now();

                // 获取上次检查的时间戳(默认值为 0)
                const lastCheckTime = GM_getValue('lastCheckTime', 0);

                // 检查是否超过10分钟(600000 毫秒)
                if (now - lastCheckTime > 600000) {
                    console.log('超过十分钟未检查版本,开始检查...');

                    // 调用 Greasy Fork API 获取脚本信息
                    GM_xmlhttpRequest({
                        method: 'GET',
                        url: `https://greasyfork.org/scripts/${scriptId}.json`,
                        onload: function (response) {
                            if (response.status === 200) {
                                const scriptData = JSON.parse(response.responseText);

                                // 获取最新版本号
                                const latestVersion = scriptData.version;
                                console.log(`当前版本: ${currentVersion}`);
                                console.log(`最新版本: ${latestVersion}`);

                                // 比较版本号
                                if (currentVersion !== latestVersion) {
                                    b.insertAdjacentHTML("afterbegin", "<br><b>检测到新版本,请更新。</b><br>");
                                } else {
                                    console.log('脚本已是最新版本。');
                                }

                                // 更新检查时间戳
                                GM_setValue('lastCheckTime', now);
                            } else {
                                console.error('无法获取脚本信息。');
                            }
                        },
                        onerror: function () {
                            console.error('请求 Greasy Fork API 失败。');
                        },
                    });
                } else {
                    console.log(`未超过十分钟,无需检查版本。(${Math.floor((600000 - (now - lastCheckTime)) / 60000)} 分钟后再检查)`);
                }
            } else {
                console.error('无法自动获取脚本 ID,请检查脚本的 @downloadURL 或 @updateURL 是否正确。');
            }
        }


        b.innerHTML += '<input type="button" id="acb6" value="留言"/>';
        b.innerHTML += '<br>---------------------------------------------------------<br>';
        b.innerHTML += '<input type="button" id="acb1" value="添加评论"/>';
        b.innerHTML += '<input type="button" id="acb2" value="重置选项并清除评论"/>';
        b.innerHTML += '<input type="button" id="acb3" value="展开/收起"/>';
        b.innerHTML += '<br>---------------------------------------------------------';

        var a = document.createElement('div');
        a.id = 'ReplyBox';
        a.style.maxHeight = '500px';
        a.style.maxWidth = '300px';
        a.style.overflow = 'auto';

        // 同步状态加载(立即应用存储状态)
        a.style.display = GM_getValue('replyBoxState', 'block'); // ✅ 立即应用存储状态

        // 异步视觉优化(延迟透明渐变动画)
        requestAnimationFrame(() => {
            a.style.opacity = '1';
            a.style.transition = 'opacity 0.3s ease'; // 添加过渡动画
        });

  // --- 修正部分:重新加入 category 变量的定义和获取逻辑 ---
        let category = ''; // 使用 let 代替 var,并初始化为空字符串
        // 寻找包含“基本信息”的表格,这是获取资源类型最可靠的锚点
        const infoTable = document.querySelector('td#outer > table');
        if (infoTable) {
            // 遍历表格的每一行
            for (const row of infoTable.rows) {
                const headerCell = row.cells[0];
                const contentCell = row.cells[1];
                // 定位到“基本信息”行,并确保内容单元格存在
                if (headerCell && contentCell && headerCell.textContent.trim() === '基本信息') {
                    const contentText = contentCell.textContent;
                    // 从“基本信息”中通过正则表达式匹配“类型”
                    if (contentText.includes('质量')) { // 增加一道检查,确保是我们想要的那个“基本信息”块
                        const match = contentText.match(/类型.*/);
                        if (match) {
                            category = match[0].trim();
                            break; // 找到后即可退出循环
                        }
                    }
                }
            }
        }
        // --- 修正部分结束 ---


        // 动态渲染面板的核心逻辑
        // 首先,插入不区分分类的通用按钮
        const commonButtons = `
            <input type="button" id="acb4" value="未通过"/>
            <input type="button" id="acb5" value="通过"/>
            <hr>
        `;
        // 此处的 'a' 变量已在脚本上方被定义,我们直接使用它,不再重新声明
        a.innerHTML = commonButtons;

        // 然后,根据分类选择对应的配置
        let activeConfig;
        if (category && category.match(/电影|电视剧|动画|综艺|演出|纪录片|体育/)) {
            activeConfig = replyOptionsConfig.video_tv_etc;
        } else if (category && category.match(/音乐短片/)) {
            activeConfig = replyOptionsConfig.music_video;
        } else if (category && category.match(/Music/)) {
            activeConfig = replyOptionsConfig.music;
        }

        // 如果找到了匹配的配置,则调用我们的新函数来渲染面板的剩余部分
        if (activeConfig) {
            renderReplyPanel(a, activeConfig, replyOptionsConfig.styles);
        }

        x.appendChild(b);
        x.appendChild(a);
        document.body.appendChild(x);

        document.getElementById('acb1').onclick = addComment;
        document.getElementById('acb2').onclick = checkboxReset;
        document.getElementById('acb3').onclick = hideAndSeek;
        document.getElementById('acb4').onclick = needModification;
        document.getElementById('acb5').onclick = torrentChecked;
        document.getElementById('acb6').onclick = comment;
        var ahref = document.querySelectorAll('a.commentcheckbox');
        for (let i = 0; i < ahref.length; i++) {
            ahref[i].onclick = function () {
                this.previousSibling.checked = !this.previousSibling.checked;
            }
        }

        table = document.getElementById('bookmark0').parentNode.parentNode.parentNode;
        for (let i = 0; i < table.rows.length; i++) {
            if (table.rows[i].cells[0].textContent == '猫粮奖励') {
                table.rows[i].remove();
                i--;
            } else if (table.rows[i].cells[0].textContent == '感谢者') {
                table.rows[i].remove();
            }
        }
    }


    // 种子名过滤
    if (window.location.href.includes("/torrents.php")) {

        // 正则表达式匹配集数
        const regex = /(第\s?[0-9]{1,4}(?!季)\s?(集|话|期)|第\s?[0-9]{1,4}-[0-9]{1,4}(?!季)\s?(集|话|期))/;

        // 正则表达式匹配 [Checked by .*]
        const checkedRegex = /\[Checked by .*?\]/;

        // 遍历所有符合条件的链接
        document.querySelectorAll('a[href^="details.php?id="]').forEach(link => {
            const href = link.getAttribute('href');
            if (!/^details\.php\?id=\d+$/.test(href)) return; // 验证链接格式

            const span = link.closest('div')?.parentElement?.querySelectorAll('div')[1]?.querySelector('span');
            if (!span) return;

            let spanText = span.innerHTML.trim(); // 获取 span HTML 内容

            // 如果匹配集数,则变绿
            if (regex.test(spanText)) {
                link.style.color = 'green';
                console.log(`链接变绿: ${spanText}`);
            }

            // 如果匹配 [Checked by .*],则变深蓝色加粗
            if (checkedRegex.test(spanText)) {
                span.innerHTML = spanText.replace(checkedRegex, match => `<span style="color: darkblue; font-weight: bold;">${match}</span>`);
            }

            // 查找到目标 td 并获取其文本内容(简化为一行)
            const targetTd = link.closest('table')?.closest('td')?.parentElement?.children?.[Array.from(link.closest('table').closest('td').parentElement.children).indexOf(link.closest('table').closest('td')) + 2];
            const targetText = targetTd?.querySelector('span')?.textContent.trim();

            if (targetText) {
                console.log('目标 TD 文本:', targetText); // 打印目标 TD 的文本内容

                // 如果 targetText 不包含 “分”,将对应 td 的底色变成绿色
                if (targetText.includes('分')) {
                    targetTd.style.backgroundColor = 'green'; // 设置底色为绿色
                }
            }
        });

    }
})();