Steam Helpful Buttons

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

目前为 2024-11-18 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Steam Helpful Buttons
  3. // @name:ru Полезные кнопки Steam
  4. // @description Adds a buttons to SteamDB, StopGame and Rutor info near the Community Hub button.
  5. // @description:ru Добавляет кнопки SteamDB, StopGame и Rutor рядом с кнопкой Центр сообщества.
  6. // @include https://store.steampowered.com/app/*
  7. // @namespace https://greasyfork.org/users/1367171
  8. // @version 1.0
  9. // @author corviciuz
  10. // @match https://store.steampowered.com/
  11. // @icon https://www.google.com/s2/favicons?sz=64&domain=steampowered.com
  12. // @license MIT
  13. // ==/UserScript==
  14. var buttonSet = [
  15. { url: "https://rutor.info/search/0/0/100/0/", title: "Rutor" },
  16. { url: "https://stopgame.ru/game/", title: "StopGame" },
  17. ];
  18.  
  19. var button = document.querySelector('.btnv6_blue_hoverfade.btn_medium');
  20. var buttwidth = button ? button.offsetWidth + 10 : 0;
  21.  
  22. var parts = window.location.href.split('/');
  23. if (parts.indexOf('store.steampowered.com') === 2 && parts[3] === 'app') {
  24. var otherSiteInfo = document.querySelector('.apphub_OtherSiteInfo');
  25.  
  26. if (otherSiteInfo) {
  27. otherSiteInfo.style.position = 'relative';
  28. var buttonsContainer = document.createElement('div');
  29. buttonsContainer.style.position = 'absolute';
  30. buttonsContainer.style.top = '0';
  31. buttonsContainer.style.right = buttwidth + 'px';
  32. buttonsContainer.style.display = 'flex';
  33. buttonsContainer.style.gap = '10px';
  34. buttonsContainer.style.zIndex = '10';
  35.  
  36. var steamDb = document.createElement('a');
  37. steamDb.href = 'https://steamdb.info/app/' + parts[4];
  38. steamDb.className = 'btnv6_blue_hoverfade btn_medium';
  39. steamDb.target = '_blank';
  40. steamDb.innerHTML = '<span>SteamDB</span>';
  41.  
  42. buttonsContainer.appendChild(steamDb);
  43.  
  44. var rutor = document.createElement('a');
  45. var appName = document.getElementsByClassName("apphub_AppName")[0].textContent;
  46. appName = appName.trim();
  47. rutor.href = buttonSet[0].url + appName;
  48. rutor.className = 'btnv6_blue_hoverfade btn_medium';
  49. rutor.target = '_blank';
  50. rutor.innerHTML = `<span>${buttonSet[0].title}</span>`;
  51.  
  52. buttonsContainer.appendChild(rutor);
  53.  
  54. var stopgame = document.createElement('a');
  55. stopgame.href = buttonSet[1].url + parts[5];
  56. stopgame.className = 'btnv6_blue_hoverfade btn_medium';
  57. stopgame.target = '_blank';
  58. stopgame.innerHTML = `<span>${buttonSet[1].title}</span>`;
  59.  
  60. buttonsContainer.insertBefore(stopgame, steamDb.nextSibling);
  61.  
  62. var communityCenterButton = document.querySelector('.btn_blue_hoverfade');
  63.  
  64. if (communityCenterButton) {
  65. communityCenterButton.parentNode.insertBefore(buttonsContainer, communityCenterButton);
  66. } else {
  67. otherSiteInfo.parentNode.appendChild(buttonsContainer);
  68. }
  69. }
  70. }