Greasy Fork 还支持 简体中文。

Direct Download Card

Creates a card top right Corner to Include all Files without timer

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Direct Download Card
// @namespace    SWScripts
// @match        https://www.cgtrader.com/items/*/download-page
// @grant        GM_addStyle
// @version      v1.0
// @license      MIT
// @description  Creates a card top right Corner to Include all Files without timer
// @author       BN_LOS
// ==/UserScript==

(function() {
    'use strict';

    GM_addStyle(`
        @import url("https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css");
    `);
    const tailwindScript = document.createElement('script');
    tailwindScript.src = 'https://cdn.tailwindcss.com';
    document.head.appendChild(tailwindScript);

    const observer = new MutationObserver(() => {
        createDownloadCard();
    });

    observer.observe(document.body, { childList: true, subtree: true });

    function createDownloadCard() {
        const cardTitleElement = document.querySelector('.details-box__title');
        if (!cardTitleElement) return;
        const cardTitle = cardTitleElement.textContent.trim();

        const downloadList = document.querySelector('.details-box__list');
        if (!downloadList) return;

        if (document.getElementById('SWDirectDownloadCard')) return;

        const card = document.createElement('div');
        card.id = 'SWDirectDownloadCard';
        card.className = "card bg-base-200 shadow-xl fixed top-10 right-10 w-fit max-w-[300px]";

        const cardBody = document.createElement('div');
        cardBody.className = "card-body";
        card.appendChild(cardBody);

        const titleElement = document.createElement('h3');
        titleElement.className = "card-title text-white";
        titleElement.textContent = `SWCards - ${cardTitle}`;
        cardBody.appendChild(titleElement);

        const listItems = downloadList.querySelectorAll('li');
        listItems.forEach(item => {
            const buttonTitle = item.textContent.trim().replace(/Download$/, "");
            const downloadLink = item.querySelector('a[href*="/free-downloads/"]');

            if (downloadLink) {
                const button = document.createElement('button');
                button.className = "btn btn-outline w-full";
                button.textContent = buttonTitle;
                button.onclick = () => {
                    if (downloadLink.classList.contains('js-auth-control')) {
                        downloadLink.click();
                        return;
                    }
                    window.location.href = downloadLink.href;
                };
                cardBody.appendChild(button);
            }
        });

        document.body.appendChild(card);
    }
})();// ==UserScript==
// @name         Direct Download Card
// @namespace    SWScripts
// @match        https://www.cgtrader.com/items/*
// @grant        GM_addStyle
// @version      0.9
// @description  Create a daisyUI styled card with download buttons and white title
// @author       BN_LOS, Refined by Stack Overflow user
// ==/UserScript==

(function() {
    'use strict';

    GM_addStyle(`
        @import url("https://cdn.jsdelivr.net/npm/[email protected]/dist/full.min.css");
        #SWDirectDownloadCard .card-title { @apply text-white; }
    `);

    const tailwindScript = document.createElement('script');
    tailwindScript.src = 'https://cdn.tailwindcss.com';
    document.head.appendChild(tailwindScript);

    const observer = new MutationObserver(createDownloadCard);
    observer.observe(document.body, { childList: true, subtree: true });

    function createDownloadCard() {
        const cardTitleElement = document.querySelector('.details-box__title');
        if (!cardTitleElement || document.getElementById('SWDirectDownloadCard')) return;
        const cardTitle = cardTitleElement.textContent.trim();
        const downloadList = document.querySelector('.details-box__list');
        if (!downloadList) return;

        const card = document.createElement('div');
        card.id = 'SWDirectDownloadCard';
        card.className = "card bg-base-200 shadow-xl fixed top-10 right-10 w-fit max-w-[300px]";

        const cardBody = document.createElement('div');
        cardBody.className = "card-body";
        card.appendChild(cardBody);

        const titleElement = document.createElement('h3');
        titleElement.className = "card-title";
        titleElement.textContent = `SWCards - ${cardTitle}`;
        cardBody.appendChild(titleElement);

        downloadList.querySelectorAll('li').forEach(item => {
            const buttonTitle = item.textContent.trim().replace(/Download$/, "");
            const downloadLink = item.querySelector('a[href*="/free-downloads/"]');

            if (downloadLink) {
                const button = document.createElement('button');
                button.className = "btn btn-outline w-full";
                button.textContent = buttonTitle;
                button.onclick = () => {
                    if (downloadLink.classList.contains('js-auth-control')) downloadLink.click();
                    else window.location.href = downloadLink.href;
                };
                cardBody.appendChild(button);
            }
        });

        document.body.appendChild(card);
    }
})();