Steam/GOG Game Torrent Search Modal

Shows a modal window with buttons for searching games on torrent sites with links to sources of information about games: Steam, GOG, trackers, wikis, etc.

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

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

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

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Steam/GOG Game Torrent Search Modal
// @namespace    GPT
// @version      1.0.5
// @author       Wizzergod
// @description  Shows a modal window with buttons for searching games on torrent sites with links to sources of information about games: Steam, GOG, trackers, wikis, etc.
// @description:ru  Показывает модальное окно с кнопками для поиска игр на торрент-сайтах со ссылками на источники информации об играх: Steam, GOG, трекеры, вики и прочее
// @match        *://store.steampowered.*/app/*
// @exclude      *://steamcommunity.*/*
// @match        *://www.gog.com/*/game/*
// @match        *://store.steampowered.*/*
// @match        *://*.steampowered.*/*
// @exclude      *://*.steampowered.com/bundle/*
// @match        *://steamcommunity.com/app/*
// @icon         https://bit.ly/3Jj2YMu
// @grant        GM_xmlhttpRequest
// @grant        unsafeWindow
// @grant        GM_addStyle
// @grant        GM_openInTab
// @run-at       document-body
// @license      MIT

// ==/UserScript==

(function () {
    'use strict';

    // --- Styles ---
    GM_addStyle(`
        #gameLinksModal {
            position: fixed;
            top: 0; left: 0;
            width: 100%; height: 100%;
            background-color: rgba(0,0,0,0.75);
            z-index: 9999;
            display: none;
            justify-content: center;
            align-items: center;
        }
        #gameLinksModalContent {
            background: #1b1d23;
            color: white;
            padding: 20px;
            border-radius: 12px;
            max-height: 90vh;
            overflow-y: auto;
            width: 700px;
            box-shadow: 0 0 20px #000;
            position: relative;
        }
        #gameLinksModalContent h2 {
            margin-top: 0;
            font-size: 1.5em;
        }
        .gameLinkSection {
            margin-top: 20px;
        }
        .gameLinkSection h3 {
            margin: 0 0 10px;
            border-bottom: 1px solid #444;
            padding-bottom: 5px;
            font-size: 1.2em;
        }
        .gameLinkBtn {
            display: inline-block;
            padding: 8px 14px;
            margin: 4px;
            border-radius: 6px;
            text-decoration: none;
            font-size: 13px;
            font-weight: bold;
            transition: background 0.3s;
        }
        .steamBtn { background: #5c7e10; color: white; }
        .steamBtn:hover { background: #4b670d; }

        .gogBtn { background: #0058a3; color: white; }
        .gogBtn:hover { background: #004080; }

        .torrentBtn { background: #6e35a3; color: white; }
        .torrentBtn:hover { background: #582980; }

        .otherBtn { background: #444; color: white; }
        .otherBtn:hover { background: #333; }

        #closeGameLinksModal {
            float: right;
            background: #ffffff12;
            border: none;
            color: white;
            font-size: 40px;
            cursor: pointer;
            margin-top: -25px;
            margin-right: -5px;
            border-radius: 0 0 6px 6px;
            padding: 1px 15px;
            transition: background 0.3s;
            box-shadow: 0 0 10px rgba(0,0,0,0.5);
        }
        #closeGameLinksModal:hover { background: #4b670d; }
        #openGameLinksBtn {
            position: fixed;
            bottom: 20px;
            right: 20px;
            background: #008669;
            color: white;
            padding: 12px 16px;
            border-radius: 10px;
            font-size: 20px;
            border: none;
            cursor: pointer;
            z-index: 9999;
            box-shadow: 0 0 10px rgba(0,0,0,0.5);
        }
    `);

    // --- Modal ---
    const modal = document.createElement("div");
    modal.id = "gameLinksModal";
    modal.innerHTML = `
        <div id="gameLinksModalContent">
            <button id="closeGameLinksModal">&times;</button>
            <h2>🎮 Steam/GOG Game Torrent Search, and more</h2>
            <div id="gameLinksContainer"></div>
        </div>
    `;
    document.body.appendChild(modal);

    const openBtn = document.createElement("button");
    openBtn.id = "openGameLinksBtn";
    openBtn.textContent = "☰";
    document.body.appendChild(openBtn);

    const modalContent = modal.querySelector("#gameLinksModalContent");

    document.getElementById("closeGameLinksModal").onclick = () => {
        modal.style.display = "none";
    };

    // Close unwindow
    modal.addEventListener("click", (e) => {
        if (!modalContent.contains(e.target)) {
            modal.style.display = "none";
        }
    });

    openBtn.onclick = () => {
        const title = document.querySelector('.apphub_AppName')?.innerText ||
                      document.querySelector('.apphub_sectionTab.active')?.innerText ||
                      document.title.split('on Steam')[0].trim();
        const html = buildLinks(title);
        document.getElementById("gameLinksContainer").innerHTML = html;
        modal.style.display = "flex";
    };

    function getColorClass(groupName) {
        if (groupName.includes('Steam')) return 'steamBtn';
        if (groupName.includes('GOG')) return 'gogBtn';
        if (groupName.includes('Torrent')) return 'torrentBtn';
        return 'otherBtn';
    }

    function buildLinks(title) {
        const encTitle = encodeURIComponent(title);
        const gameappid = document.querySelector('[data-appid]')?.getAttribute('data-appid') ||
                          document.querySelector('[data-miniprofile-appid]')?.getAttribute('data-miniprofile-appid') || '';

        const sections = {
            '🔰 Steam': [
                { label: 'STEAMDB', url: `https://steamdb.info/app/${gameappid}` },
                { label: 'Card Exchange', url: `https://www.steamcardexchange.net/index.php?gamepage-appid-${gameappid}` },
            ],
            '💫 GOG': [
                { label: 'Gogdb', url: `https://www.gogdb.org/products?search=${encTitle}` },
                { label: 'Freegogpcgames', url: `https://freegogpcgames.com/?s=${encTitle}` },
                { label: 'Gog-games', url: `https://gog-games.to/?q=${encTitle}` },
                { label: 'Gogunlocked', url: `https://gogunlocked.com/?s=${encTitle}` }
            ],
            '✨ Torrents': [
                { label: '⭐Rutracker', url: `https://rutracker.org/forum/tracker.php?nm=${encTitle}` },
                { label: '⭐Nnmclub', url: `https://nnmclub.to/forum/tracker.php?nm=${encTitle}` },
                { label: '⭐Catorrent', url: `https://catorrent.org/index.php?do=search&subaction=search&story=${encTitle}` },
                { label: '⭐Gamestracker', url: `https://gamestracker.org/search/?q=${encTitle}` },
                { label: '⭐repack-games', url: `https://repack-games.ru/index.php?do=search&subaction=search&story=${encTitle}` },
                { label: '⭐Byrut', url: `https://thebyrut.org/?do=search&subaction=search&story=${encTitle}` },
                { label: '⭐Hisgames', url: `https://hisgames.org/search?searchphrase=all&searchword=${encTitle}` },
                { label: '⭐Igrovaya', url: `https://igrovaya.org/?do=search&subaction=search&story=${encTitle}&todo=igrovuha.org` },
                { label: '⭐Thelastgame.ru', url: `https://thelastgame.ru/?s=${encTitle}` },
                { label: '⭐Thelastgame.org', url: `https://thelastgame.org/?do=search&subaction=search&story=${encTitle}` },
                { label: 'Torrentdownloads.pro', url: `https://www.torrentdownloads.pro/search/?search=${encTitle}` },
                { label: 'Torrentdownload.info', url: `https://www.torrentdownload.info/search?q=${encTitle}` },
                { label: '1337x', url: `https://1337x.to/search/${encTitle}/1/` },
                { label: 'Thepiratebay', url: `https://thepiratebay.org/search.php?cat=401&q=${encTitle}` }
            ],
            '🧩 Another': [
                { label: 'PCGamingWiki (AppID)', url: `https://www.pcgamingwiki.com/api/appid.php?appid=${gameappid}` },
                { label: 'PCGamingWiki (Title)', url: `https://www.pcgamingwiki.com/w/index.php?search=${encTitle}` },
                { label: 'Small-games.info', url: `https://small-games.info/?go=search&search_text=${encTitle}` },
                { label: 'Old-games', url: `https://www.old-games.ru/catalog/?gamename=${encTitle}` },
                { label: 'Cs.rin', url: `https://cs.rin.ru/forum//search.php?st=0&sk=t&sd=d&sr=topics&terms=any&sf=titleonly&keywords=${encTitle}` },
                { label: 'F95zone - Adult 18+', url: `https://f95zone.to/search/search?keywords=${encTitle}` }
            ]
        };

        return Object.entries(sections).map(([group, links]) => {
            const colorClass = getColorClass(group);
            return `
                <div class="gameLinkSection">
                    <h3>${group}</h3>
                    ${links.map(src => `<a class="gameLinkBtn ${colorClass}" target="_blank" rel="noopener noreferrer" href="${src.url}">${src.label}</a>`).join('')}
                </div>
            `;
        }).join('');
    }
})();