SeedHub - 显示扫码转存二维码

显示SeedHub网盘扫码转存二维码

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         SeedHub - 显示扫码转存二维码
// @namespace    http://tampermonkey.net/
// @version      1.1
// @description  显示SeedHub网盘扫码转存二维码
// @author      visionzk
// @license     MIT
// @match        https://www.seedhub.cc/link_start*
// @grant        GM_addStyle
// ==/UserScript==

(function() {
    'use strict';

    // 1. 强制显示 .mobile-pan 及其子元素
    GM_addStyle(`
        .mobile-pan,
        .mobile-pan * {
            display: block !important;
            visibility: visible !important;
            opacity: 1 !important;
            height: auto !important;
            width: auto !important;
            max-height: none !important;
            max-width: none !important;
            position: static !important;
            clip: auto !important;
        }
    `);

    // 2. 隐藏 #qrcode 下的第一个 canvas
    GM_addStyle(`
        #qrcode canvas:first-of-type {
            display: none !important;
            visibility: hidden !important;
        }
    `);

    // 3. 动态检查(防止元素延迟加载)
    function applyStyles() {
        // 确保 .mobile-pan 显示
        const mobilePan = document.querySelector('.mobile-pan');
        if (mobilePan) {
            const setDisplayVisible = (element) => {
                element.style.display = 'block';
                element.style.visibility = 'visible';
                element.style.opacity = '1';
                Array.from(element.children).forEach(child => setDisplayVisible(child));
            };
            setDisplayVisible(mobilePan);
        }

        // 隐藏 #qrcode 下的第一个 canvas
        const qrcodeCanvas = document.querySelector('#qrcode canvas:first-of-type');
        if (qrcodeCanvas) {
            qrcodeCanvas.style.display = 'none';
            qrcodeCanvas.style.visibility = 'hidden';
        }
    }

    // 初始执行
    applyStyles();

    // 监听 DOM 变化(适用于动态加载内容)
    const observer = new MutationObserver(applyStyles);
    observer.observe(document.body, {
        childList: true,
        subtree: true
    });

    // 确保在页面完全加载后再次检查
    window.addEventListener('load', applyStyles);
})();