Filtering "Incomplete" for PterClub

支持主副标题剧集匹配

当前为 2025-05-31 提交的版本,查看 最新版本

// ==UserScript==
// @name         Filtering "Incomplete" for PterClub
// @namespace    http://tampermonkey.net/
// @version      1.36
// @description  支持主副标题剧集匹配
// @author       @Zuoans 
// @match        https://pterclub.com/torrents.php*
// @license      MIT
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // 1. 扩展CSS选择器(监控副标题)
    GM_addStyle(`
    /* 主标题匹配 */
    tr:has(.torrentname b:matches-format(S\\d+E\\d+)),
    tr:has(.torrentname b:matches-format(S\\d+\\sE\\d+)),
    tr:has(.torrentname b:matches-format(S\\d+E\\d+-E\\d+)),
    tr:has(.torrentname b:matches-format(S\\d+\\sE\\d+-E\\d+)),

    /* 新增:副标题匹配(需根据实际DOM结构调整) */
    tr:has(.torrentname div:matches-format(第\\d+-\\d+集)),
    tr:has(.torrentname span:matches-format(第\\d+-\\d+集)),
    tr:has(.torrentname small:matches-format(第\\d+-\\d+集)) {
        background: #999999CC !important;
        outline: 1px solid #000000 !important;
    }
    `);

    // 2. 增强版JS匹配(主副标题同时检测)
    function highlightEpisodes() {
        const regex = /(S\d+\s?E\d+(-\d+)?|第\d+-\d+集)/i;

        // 检测主标题
        document.querySelectorAll('.torrentname b').forEach(el => {
            if (regex.test(el.textContent)) {
                el.closest('tr').style.cssText += `
                    background: #999999CC !important;
                    outline: 1px solid #000000 !important;
                `;
            }
        });

        // 检测副标题(关键修改)
        document.querySelectorAll('.torrentname div, .torrentname span, .torrentname small').forEach(el => {
            if (regex.test(el.textContent)) {
                el.closest('tr').style.cssText += `
                    background: #999999CC !important;
                    outline: 1px solid #000000 !important;
                `;
            }
        });
    }

    // 3. 执行与监听
    highlightEpisodes();
    new MutationObserver(highlightEpisodes).observe(document.body, {
        childList: true,
        subtree: true
    });
})();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址