Greasy Fork

Greasy Fork is available in English.

Beyond-HD BHD汉化\一键下载助手

下载 Beyond-HD 当前页面的所有种子,并进行更精确的汉化

当前为 2024-12-20 提交的版本,查看 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Beyond-HD BHD汉化\一键下载助手
// @namespace    http://greasyfork.icu/zh-CN/users/1413398-babalala
// @version      1.2
// @description  下载 Beyond-HD 当前页面的所有种子,并进行更精确的汉化
// @author       babalala
// @match        https://beyond-hd.me/*
// @grant        none
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    // -------------------- 下载种子部分 --------------------
    let downloadInterval = null;
    let dlButtons = [];
    let currentIndex = 0;

    // 创建“下载当前页面所有种子”按钮
    const startButton = document.createElement('button');
    startButton.textContent = '下载当前页面所有种子';
    startButton.style.position = 'fixed';
    startButton.style.top = '10px';
    startButton.style.right = '10px';
    startButton.style.zIndex = '9999';
    document.body.appendChild(startButton);

    // 创建“立即停止”按钮
    const stopButton = document.createElement('button');
    stopButton.textContent = '立即停止';
    stopButton.style.position = 'fixed';
    stopButton.style.top = '40px'; // 放在开始按钮下方
    stopButton.style.right = '10px';
    stopButton.style.zIndex = '9999';
    stopButton.disabled = true; // 初始禁用停止按钮
    document.body.appendChild(stopButton);

    // 查找符合条件的 DL 按钮
    function findDLButtons() {
        const allLinks = document.querySelectorAll('a');
        dlButtons = [];
        currentIndex = 0;

        allLinks.forEach(link => {
            // 使用 title 属性和 href 属性的开头部分进行判断
            if (link.title === "Download Torrent" && link.href.startsWith("https://beyond-hd.me/download/")) {
                dlButtons.push(link);
            }
        });

        console.log("找到符合条件的 DL 按钮数量:", dlButtons.length);
    }

    // 下载种子的函数
    function downloadTorrents() {
        if (currentIndex < dlButtons.length) {
            const dlButton = dlButtons[currentIndex];
            console.log("正在下载第", currentIndex + 1, "个种子,链接:", dlButton.href);
            dlButton.click();
            currentIndex++;
        } else {
            clearInterval(downloadInterval);
            downloadInterval = null;
            startButton.disabled = false;
            stopButton.disabled = true;
            alert('当前页面所有种子下载完成!');
        }
    }

    // 开始按钮的点击事件
    startButton.addEventListener('click', () => {
        findDLButtons();
        if (dlButtons.length > 0) {
            startButton.disabled = true;
            stopButton.disabled = false;
            downloadInterval = setInterval(downloadTorrents, 3000);
        } else {
            alert('没有找到符合条件的 DL 按钮!');
        }
    });

    // 停止按钮的点击事件
    stopButton.addEventListener('click', () => {
        clearInterval(downloadInterval);
        downloadInterval = null;
        startButton.disabled = false;
        stopButton.disabled = true;
        console.log("下载已停止");
        alert('下载已停止!');
    });
    // -------------------- 下载种子部分结束 --------------------

    // -------------------- 汉化部分 --------------------
    const translations = {
        // 原有翻译
        "Download": "下载",
        "Upload": "上传",
        "Ratio": "分享率",
        "Freeleech": "免费下载",
        "Snatched": "已完成",
        "Seeders": "做种者",
        "Leechers": "下载者",
        "Title":"标题",
        "Peers":"同伴",
        "Info":"信息",
        "BM":"收藏",
        "Golden":"金色",
        "Silver":"银色",
        "Home":"首页",
        "Library":"图书馆",
        "Trending":"流行趋势",
        "Torrents":"种子",
        "Requests":"求种",
        "Rewards":"奖励",
        "By":"发布",
        "In":"发布于",

        // 新添加的翻译
        "Filtered": "已筛选",
        "Mediahub": "媒体中心",
        "Bookmarks": "收藏",
        "RSS": "订阅",
        "Drafts": "草稿",
        "Movies": "电影",
        "TV": "剧集",
        "TV Shows": "剧集",
        "TV Packs": "剧包",
        "Lists": "片单",
        "People": "影人",
        "Watchlist": "想看",
        "Ratings": "评分",
        "Missing": "待补",
        "Requested": "已求种",
        "Voted": "已投票",
        "Claimed": "已认领",
        "Archive": "归档",
        "Reseed": "补种",
        "Seed Help": "请求协助",
        "New Request": "发布新求种",
        "Support": "技术支持",
        "Helpdesk": "帮助中心",
        "Rules": "规则",
        "FAQ": "常见问题",
        "Tracker Codes": "追踪器代码",
        "Client Blocklist": "客户端黑名单",
        "Donate": "捐赠",
        "Stats": "统计信息",
        "Classes": "等级",
        "Badges": "徽章",
        "Log": "日志",
        "Staff": "管理组",
        "Internals": "内部信息",
        "My Profile": "我的资料",
        "My Settings": "账号设置",
        "My Theme": "我的主题",
        "My Privacy": "隐私设置",
        "My Security": "安全设置",
        "My Notifications": "我的通知",
        "My Bookmarks": "我的书签",
        "My Watchlist": "我的想看",
        "My Ratings": "我的评分",
        "My Viewed": "我的已阅",
        "My Uploads": "我的上传",
        "My Harvests": "我的收获",
        "My Collectibles": "我的收藏品",
        "My Badges": "我的勋章",
        "Logout": "退出登录",
        "All": "全部",
        "SD": "标清",
        "Internal": "内部",
        "Search": "搜索",
        "Uploader": "上传者",
        "ID": "编号",
        "Category": "分类",
        "Type": "类型",
        "Source": "来源",
        "Discount": "折扣",
        "Special": "特别版块",
        "Codec": "编码",
        "Health": "健康度",
        "Activity": "活跃度",
        "Features": "特性",
        "Genres": "类型",
        "Release Date": "发布日期",
        "Countries": "国家",
        "Languages": "语言",
        "Audios": "音轨",
        "Subtitles": "字幕",
        "None": "无",
        "Restrictions": "限制",
        "Sort": "排序",
        "Bumped At": "置顶于",
        "Descending": "降序",
        "Quantity": "数量",
        "Name": "名称",
        "Uploaded": "已上传",
        "Completed": "已完成",
        "IMDB": "IMDB评分",
        "RT": "烂番茄评分",
        "Enable Filters": "启用过滤",
        "Rewinds": "回顾",
        "Refunds": "退款",
        "Rescues": "拯救",
        "Capped FL": "限制的免费下载",
        "Rain Drops": "雨滴",
        "Promos": "促销",
        "Poster": "海报",
        "Age": "上传时长",
        "Size": "大小",
        "Year": "年份",
        "ACCOUNT": "账号",
        "LABS": "实验室",
        "COMMUNITY": "社区",
        "SUPPORT": "支持",
        "信息": "信息",
        "Blockbusters": "大片",
        "Superbads": "超级坏蛋",
        "Forums": "论坛",
        "Chat History": "聊天历史",
        "Games": "游戏",
        "Collectibles": "收藏品",
        "Battles": "战斗",
        "Workhouse": "工作坊",
        "Vault": "金库",
        "Bets": "打赌",
        "Invite": "邀请",
        "Overview": "概览",
        "Latest Topics": "最新话题",
        "Latest Posts": "最新帖子",
        "Upcoming Releases": "即将发布",
        "My Topics": "我的话题",
        "My Posts": "我的帖子",
        "Encoding": "编码",
        "Remuxing": "重封装",
        "Comparisons": "对比",
        "BitTorrent": "比特流",
        "Networking": "网络",
        "Help": "帮助",
        "Polls": "投票",
        "Blackmarket": "黑市",
        "Introductions": "介绍",
        "Film Club": "电影俱乐部",
        "The Art Gallery": "艺术馆",
        "The Laugh Factory": "笑料工厂",
        "Site Contests": "网站竞赛",
        "Site Games": "网站游戏",
        "Forum Contests": "论坛竞赛",
        "Forum Games": "论坛游戏",
        "Anything Goes": "随意",
        "Television": "电视剧",
        "Theatre": "剧院",
        "Bonus Points": "奖励积分",
        "Store": "商店",
        "Swaps": "交换",
        "Returns": "返回",
        "Rescue Points": "救援积分",
        "FL Tokens": "免费下载代币",
        "Covers": "封面",
        "Tasks": "任务",
        "Heists": "抢劫",
        "Community": "社区",
        "Min. BHD rating": "最低BHD评分",
        "Min. votes": "最小投票数",
        "Min. TMDB rating": "最小TMDB评分",
        "Min. IMDB rating": "最小IMDB评分",
        "IMDB Top 250": "IMDB Top 250榜单",
        "TMDB Top 250": "TMDB Top 250榜单",
        "Birthdays": "生日",
        "IMPORTANT NOTICE": "重要通知",
        "Search & Hide": "搜索和隐藏",
        "Search & Save": "搜索和保存",
        "Reset": "重置",
        "Topic name quick search (all topics)": "话题快速搜索(所有话题)",
        "Active Topics": "活跃话题",
        "Site Features": "网站功能",
        "User Submitted Tutorials": "用户提交的教程",
        "Sandbox": "沙盒",
        "Announcements": "公告",
        "Site & Tracker Discussions": "网站和追踪器讨论",
        "Upcoming Internal Releases": "即将发布的内部版本",
        "News & Current Events": "新闻和时事",
        "Site Bugs/Issues": "网站错误/问题",
        "Site Suggestions": "网站建议",
        "Staff Approved Tutorials": "管理员批准的教程",
        "User Submitted Tutorials": "用户提交的教程",
        "Sandbox": "沙盒",
        "Announcements": "公告",
        "Site & Tracker Discussions": "网站和追踪器讨论",
        "Upcoming Internal Releases": "即将发布的内部版本",
        "News & Current Events": "新闻和时事",
        "Anything Goes": "随意",
        "Movies": "电影",
        "Television": "电视剧",
        "Theatre": "剧院",
        "Staff Approved Tutorials": "管理员批准的教程"
    };

    function translatePage() {
        const elements = document.querySelectorAll('body *:not(script):not(style)');

        elements.forEach(element => {
            if (element.children.length === 0) { // 只处理没有子元素的元素,避免重复翻译
                for (const key in translations) {
                    // 使用正则表达式和 \b 单词边界进行匹配和替换
                    const regex = new RegExp("\\b" + key + "\\b", 'g');
                    if (regex.test(element.textContent)) {
                        element.textContent = element.textContent.replace(regex, translations[key]);
                    }
                }
            }
        });
    }
    // -------------------- 汉化部分结束 --------------------

    // 页面加载完成后执行汉化
    window.addEventListener('load', translatePage);
})();