DICMusic Unchecked

Open unchecked torrents

目前為 2025-02-05 提交的版本,檢視 最新版本

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         DICMusic Unchecked
// @namespace    http://tampermonkey.net/
// @version      0.1
// @description  Open unchecked torrents
// @match        https://dicmusic.com/torrents.php
// @match        https://dicmusic.com/torrents.php?page=*
// @grant        none
// @license MIT
// ==/UserScript==

// 用户配置 - 设置一次性打开的最大链接数量 (0 表示不限制)
const MAX_LINKS = 20;

(function() {
    'use strict';

    // Wait for DOM to be ready
    function init() {
        // Find the statistics panel container
        const statsPanel = document.querySelector('.alertbar.blend');
        if (!statsPanel) return;

        // Create a button to trigger link opening
        const button = document.createElement('a');
        button.textContent = 'Open Unchecked';
        button.href = 'javascript:void(0);';
        button.style.marginLeft = '10px'; // Add some spacing between links

        // Insert the button after the statistics link
        statsPanel.appendChild(button);

        button.addEventListener('click', function() {
            // Find all groups that match our criteria
            const groups = document.querySelectorAll('tr.group');
            // Store all album links
            const albumLinks = [];

            groups.forEach(group => {
                // Skip if the group has the torrent_all_checked class
                if (group.classList.contains('torrent_all_checked')) {
                    return;
                }
                // Find the album link within each group
                const albumLink = group.querySelector('a[href^="torrents.php?id="]');
                if (albumLink) {
                    const href = albumLink.getAttribute('href');
                    // Create full URL by combining with base URL
                    const fullUrl = 'https://dicmusic.com/' + href;
                    albumLinks.push(fullUrl);
                }
            });

            // Apply limit if MAX_LINKS is greater than 0
            const linksToOpen = MAX_LINKS > 0 ? albumLinks.slice(0, MAX_LINKS) : albumLinks;

            // Show warning if links were limited
            if (MAX_LINKS > 0 && albumLinks.length > MAX_LINKS) {
                alert(`已设置最大打开链接数为 ${MAX_LINKS} \n找到 ${albumLinks.length} 个链接,将只打开前 ${MAX_LINKS} 个 \n处理完成后请刷新本页面`);
            }

            // Open each link
            linksToOpen.forEach(url => {
                window.open(url, '_blank');
            });
        });
    }

    // Run initialization when DOM is ready
    if (document.readyState === 'loading') {
        document.addEventListener('DOMContentLoaded', init);
    } else {
        init();
    }
})();