Redirect Buttons to Piracy Sites

Redirect Buttons to Piracy Sites for SteamDB.info

As of 2025-04-10. See the latest version.

// ==UserScript==
// @name         Redirect Buttons to Piracy Sites
// @namespace    https://steamdb.info/
// @author       nightsman
// @license      GNU GPLv3
// @version      1.1.0
// @description  Redirect Buttons to Piracy Sites for SteamDB.info
// @match        https://steamdb.info/app/*/
// @grant        none
// ==/UserScript==
(function () {
    'use strict';

    const buttons = [
        {
            label: 'SteamRIP',
            urlPrefix: 'https://steamrip.com/?s=',
        },
        {
            label: 'GOG Games',
            urlPrefix: 'https://gog-games.to/?search=',
        },
        {
            label: 'AnkerGames',
            urlPrefix: 'https://ankergames.net/search/',
        },
        {
            label: 'Fitgirl Repacks',
            urlPrefix: 'https://fitgirl-repacks.site/?s=',
        },
        {
            label: 'Dodi Repacks',
            urlPrefix: 'https://dodi-repacks.site/?s=',
        },
    ];
    // =======================================================

    window.addEventListener('load', () => {
        const titleElement = document.querySelector('h1');
        const navLinks = document.querySelector('nav.app-links');
        if (!titleElement || !navLinks) return;

        let gameTitle = titleElement.textContent.trim();

        gameTitle = gameTitle.replace(/[^\x00-\x7F]/g, '');

        const style = document.createElement('style');
        style.textContent = `
            .app-links > a.dynamic-button {
                display: inline-block;
                cursor: pointer;
                color: #67c1f5;
                background: #273b4b;
                border: 1px solid rgb(255 255 255 / 10%);
                padding: 0 10px;
                font-size: 15px;
                line-height: 30px;
                border-radius: 6px;
                margin-right: 0px;
                text-decoration: none;
            }
            .app-links > a.dynamic-button:hover {
                color: var(--link-color-hover, #0095ff);
            }
            .app-links > a:last-child {
                margin-right: 0;
            }
        `;
        document.head.appendChild(style);

        buttons.forEach(({ label, urlPrefix, urlSuffix = '' }) => {
            const btn = document.createElement('a');
            btn.href = urlPrefix + encodeURIComponent(gameTitle) + urlSuffix;
            btn.textContent = label;
            btn.target = '_blank';
            btn.className = 'dynamic-button';
            navLinks.appendChild(btn);
        });
    });
})();