SteamDB Floating Search Buttons

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

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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);
})();