SteamDB Floating Search Buttons

Добавляет плавающие кнопки для поиска игры на online-fix.me, rustorka.com, rutracker.org.

Bu betiği kurabilmeniz için Tampermonkey, Greasemonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu betiği kurabilmeniz için Tampermonkey ya da Violentmonkey gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

Bu betiği kurabilmeniz için Tampermonkey ya da Userscripts gibi bir kullanıcı betiği eklentisini kurmanız gerekmektedir.

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

Bu komut dosyasını yüklemek için bir kullanıcı komut dosyası yöneticisi uzantısı yüklemeniz gerekecek.

(Zaten bir kullanıcı komut dosyası yöneticim var, kurmama izin verin!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Zateb bir user-style yöneticim var, yükleyeyim!)

// ==UserScript==
// @name         SteamDB Floating Search Buttons
// @namespace    http://tampermonkey.net/
// @version      1.9
// @description  Добавляет плавающие кнопки для поиска игры на online-fix.me, rustorka.com, rutracker.org.
// @author       GodinRaider
// @license      MIT
// @match        https://steamdb.info/app/*
// @grant        none
// ==/UserScript==

(function () {
    'use strict';

    // Функция для создания кнопки
    function createButton(label, url, tooltip) {
        let button = document.createElement('a');
        button.href = url;
        button.target = '_blank'; // Открывать в новой вкладке
        button.textContent = label;
        button.title = tooltip;
        button.style.cssText = `
            display: inline-block;
            background-color: #4C6EF5;
            color: white;
            text-align: center;
            text-decoration: none;
            font-size: 14px;
            font-weight: bold;
            padding: 10px 20px;
            border-radius: 5px;
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
            transition: transform 0.3s ease, box-shadow 0.3s ease;
        `;
        button.onmouseover = () => {
            button.style.transform = 'scale(1.1)';
            button.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.3)';
        };
        button.onmouseout = () => {
            button.style.transform = 'scale(1)';
            button.style.boxShadow = '0 2px 4px rgba(0, 0, 0, 0.2)';
        };
        return button;
    }

    // Получаем название игры из элемента <h1 itemprop="name">
    let gameNameElement = document.querySelector('h1[itemprop="name"]');
    if (!gameNameElement) return; // Если элемент не найден, прекращаем выполнение
    let gameName = encodeURIComponent(gameNameElement.textContent.trim());

    // Проверяем наличие тега NSFW
    let tagsContainer = document.querySelector('.store-tags');
    let isNSFW = tagsContainer && tagsContainer.textContent.includes('NSFW');

    // Создаем кнопки
    let buttons = [
        createButton('Online-Fix', `https://online-fix.me/?do=search&subaction=search&story=${gameName}`, 'Поиск на online-fix.me'),
        createButton('Rustorka', `http://rustorka.com/forum/tracker.php?nm=${gameName}&o=10&s=2`, 'Поиск на rustorka.com'),
        createButton('RuTracker', `https://rutracker.org/forum/tracker.php?nm=${gameName}&o=10&s=2`, 'Поиск на rutracker.org')
    ];

    // Если игра NSFW, добавляем кнопку для Pornolab
    if (isNSFW) {
        buttons.push(createButton('Pornolab', `https://pornolab.net/forum/tracker.php?nm=${gameName}`, 'Поиск на pornolab.net'));
    }

    // Создаем контейнер для кнопок
    let container = document.createElement('div');
    container.style.cssText = `
        position: fixed;
        top: 100px;
        left: 10px;
        display: flex;
        flex-direction: column;
        gap: 10px;
        z-index: 1000;
    `;

    // Добавляем кнопки в контейнер
    buttons.forEach(button => container.appendChild(button));

    // Добавляем контейнер на страницу
    document.body.appendChild(container);
})();