SteamDB Floating Search Buttons

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

  1. // ==UserScript==
  2. // @name SteamDB Floating Search Buttons
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.9
  5. // @description Добавляет плавающие кнопки для поиска игры на online-fix.me, rustorka.com, rutracker.org.
  6. // @author GodinRaider
  7. // @license MIT
  8. // @match https://steamdb.info/app/*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. // Функция для создания кнопки
  16. function createButton(label, url, tooltip) {
  17. let button = document.createElement('a');
  18. button.href = url;
  19. button.target = '_blank'; // Открывать в новой вкладке
  20. button.textContent = label;
  21. button.title = tooltip;
  22. button.style.cssText = `
  23. display: inline-block;
  24. background-color: #4C6EF5;
  25. color: white;
  26. text-align: center;
  27. text-decoration: none;
  28. font-size: 14px;
  29. font-weight: bold;
  30. padding: 10px 20px;
  31. border-radius: 5px;
  32. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  33. transition: transform 0.3s ease, box-shadow 0.3s ease;
  34. `;
  35. button.onmouseover = () => {
  36. button.style.transform = 'scale(1.1)';
  37. button.style.boxShadow = '0 4px 8px rgba(0, 0, 0, 0.3)';
  38. };
  39. button.onmouseout = () => {
  40. button.style.transform = 'scale(1)';
  41. button.style.boxShadow = '0 2px 4px rgba(0, 0, 0, 0.2)';
  42. };
  43. return button;
  44. }
  45.  
  46. // Получаем название игры из элемента <h1 itemprop="name">
  47. let gameNameElement = document.querySelector('h1[itemprop="name"]');
  48. if (!gameNameElement) return; // Если элемент не найден, прекращаем выполнение
  49. let gameName = encodeURIComponent(gameNameElement.textContent.trim());
  50.  
  51. // Проверяем наличие тега NSFW
  52. let tagsContainer = document.querySelector('.store-tags');
  53. let isNSFW = tagsContainer && tagsContainer.textContent.includes('NSFW');
  54.  
  55. // Создаем кнопки
  56. let buttons = [
  57. createButton('Online-Fix', `https://online-fix.me/?do=search&subaction=search&story=${gameName}`, 'Поиск на online-fix.me'),
  58. createButton('Rustorka', `http://rustorka.com/forum/tracker.php?nm=${gameName}&o=10&s=2`, 'Поиск на rustorka.com'),
  59. createButton('RuTracker', `https://rutracker.org/forum/tracker.php?nm=${gameName}&o=10&s=2`, 'Поиск на rutracker.org')
  60. ];
  61.  
  62. // Если игра NSFW, добавляем кнопку для Pornolab
  63. if (isNSFW) {
  64. buttons.push(createButton('Pornolab', `https://pornolab.net/forum/tracker.php?nm=${gameName}`, 'Поиск на pornolab.net'));
  65. }
  66.  
  67. // Создаем контейнер для кнопок
  68. let container = document.createElement('div');
  69. container.style.cssText = `
  70. position: fixed;
  71. top: 100px;
  72. left: 10px;
  73. display: flex;
  74. flex-direction: column;
  75. gap: 10px;
  76. z-index: 1000;
  77. `;
  78.  
  79. // Добавляем кнопки в контейнер
  80. buttons.forEach(button => container.appendChild(button));
  81.  
  82. // Добавляем контейнер на страницу
  83. document.body.appendChild(container);
  84. })();