Steam Helpful Buttons

Adds a buttons to SteamDB, StopGame and Rutor info near the Community Hub button.

2024-11-18 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==UserScript==
// @name         Steam Helpful Buttons
// @name:ru      Полезные кнопки Steam
// @description  Adds a buttons to SteamDB, StopGame and Rutor info near the Community Hub button.
// @description:ru Добавляет кнопки SteamDB, StopGame и Rutor рядом с кнопкой Центр сообщества.
// @include      https://store.steampowered.com/app/*
// @namespace    https://greasyfork.org/users/1367171
// @version      1.0
// @author       corviciuz
// @match        https://store.steampowered.com/
// @icon         https://www.google.com/s2/favicons?sz=64&domain=steampowered.com
// @license MIT
// ==/UserScript==
var buttonSet = [
    { url: "https://rutor.info/search/0/0/100/0/", title: "Rutor" },
    { url: "https://stopgame.ru/game/", title: "StopGame" },
];

var button = document.querySelector('.btnv6_blue_hoverfade.btn_medium');
var buttwidth = button ? button.offsetWidth + 10 : 0;

var parts = window.location.href.split('/');
if (parts.indexOf('store.steampowered.com') === 2 && parts[3] === 'app') {
  var otherSiteInfo = document.querySelector('.apphub_OtherSiteInfo');

  if (otherSiteInfo) {
    otherSiteInfo.style.position = 'relative';
    var buttonsContainer = document.createElement('div');
    buttonsContainer.style.position = 'absolute';
    buttonsContainer.style.top = '0';
    buttonsContainer.style.right = buttwidth + 'px';
    buttonsContainer.style.display = 'flex';
    buttonsContainer.style.gap = '10px';
    buttonsContainer.style.zIndex = '10';

    var steamDb = document.createElement('a');
    steamDb.href = 'https://steamdb.info/app/' + parts[4];
    steamDb.className = 'btnv6_blue_hoverfade btn_medium';
    steamDb.target = '_blank';
    steamDb.innerHTML = '<span>SteamDB</span>';

    buttonsContainer.appendChild(steamDb);

    var rutor = document.createElement('a');
    var appName = document.getElementsByClassName("apphub_AppName")[0].textContent;
    appName = appName.trim();
    rutor.href = buttonSet[0].url + appName;
    rutor.className = 'btnv6_blue_hoverfade btn_medium';
    rutor.target = '_blank';
    rutor.innerHTML = `<span>${buttonSet[0].title}</span>`;

    buttonsContainer.appendChild(rutor);

    var stopgame = document.createElement('a');
    stopgame.href = buttonSet[1].url + parts[5];
    stopgame.className = 'btnv6_blue_hoverfade btn_medium';
    stopgame.target = '_blank';
    stopgame.innerHTML = `<span>${buttonSet[1].title}</span>`;

    buttonsContainer.insertBefore(stopgame, steamDb.nextSibling);

    var communityCenterButton = document.querySelector('.btn_blue_hoverfade');

    if (communityCenterButton) {
      communityCenterButton.parentNode.insertBefore(buttonsContainer, communityCenterButton);
    } else {
      otherSiteInfo.parentNode.appendChild(buttonsContainer);
    }
  }
}