EpicGames Additional Links

Adds additional links to EpicGames store for free download.

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

  1. // ==UserScript==
  2. // @name EpicGames Additional Links
  3. // @namespace EpicGames
  4. // @version 1.0.1
  5. // @author Wizzergod
  6. // @description Adds additional links to EpicGames store for free download.
  7. // @grant GM.getValue
  8. // @grant GM.setValue
  9. // @grant GM_addStyle
  10. // @match *://store.epicgames.com/*/p/*
  11. // @run-at document-idle
  12. // @icon https://www.google.com/s2/favicons?sz=64&domain=www.downloadha.com
  13. // @resource Icon https://www.google.com/s2/favicons?sz=64&domain=www.downloadha.com
  14. // @license MIT
  15. // ==/UserScript==
  16.  
  17. (function() {
  18. 'use strict';
  19.  
  20. const NewLinks = [
  21. { url: "https://cs.rin.ru/forum/search.php?keywords=", urlSpecial: "&terms=any&author=&sc=1&sf=titleonly&sk=t&sd=d&sr=topics&st=0&ch=300&t=0&submit=Search", title: "CS.RIN.RU" },
  22. { url: "https://fitgirl-repacks.site/?s=", title: "Fitgirl" },
  23. { url: "https://gload.to/?s=", title: "Gload" },
  24. { url: "https://gog-games.com/search/", title: "GOG Games" },
  25. { url: "https://gogunlocked.com/?s=", title: "GOG Unlocked" },
  26. { url: "https://steamrip.com/?s=", title: "SteamRIP" },
  27. { url: "https://steamunlocked.net/?s=", title: "Steam Unlocked" },
  28. { url: "https://www.downloadha.com/?s=", title: "DownloadHa" },
  29. { url: "https://www.ovagames.com/?s=", title: "OVA Games" }
  30. ];
  31.  
  32. const titleElement = document.querySelector("title");
  33. const metaElement = document.querySelector('meta[name="og:title"]');
  34. const appName = extractAppName(metaElement ? metaElement.getAttribute("content") : titleElement?.textContent);
  35.  
  36. function extractAppName(title) {
  37. const match = title.match(/^(.*?)\s\|/);
  38. return match ? match[1].trim() : title;
  39. }
  40.  
  41. function createButton(href, text, className) {
  42. let element = document.createElement("a");
  43. element.href = href;
  44. element.target = "_blank";
  45. element.innerHTML = text;
  46. element.className = className;
  47. return element;
  48. }
  49.  
  50. const checkExistEpic = setInterval(() => {
  51. const epicButtons = document.querySelectorAll('.css-8en90x');
  52. if (epicButtons.length && epicButtons[0].innerText == "BUY NOW") {
  53. console.log("Exists!");
  54. const buttonClass = epicButtons[0].parentElement.className;
  55. const className = `newbuttons ${buttonClass}`;
  56. NewLinks.forEach(link => {
  57. const button = createButton(link.url + appName + (link.urlSpecial || ""), link.title, className);
  58. epicButtons[0].parentElement.parentElement.parentElement.append(button);
  59. });
  60. clearInterval(checkExistEpic);
  61. }
  62. }, 100);
  63. })();
  64.  
  65. GM_addStyle(`
  66. .newbuttons {
  67. font-size: 12px;
  68. letter-spacing: 0.5px;
  69. font-weight: 500;
  70. position: relative;
  71. border-radius: 4px;
  72. text-transform: uppercase;
  73. text-align: center;
  74. align-items: center;
  75. justify-content: center;
  76. line-height: 30px;
  77. padding: 5px 10px;
  78. height: 30px;
  79. display: flex;
  80. width: 100%;
  81. min-width: auto;
  82. background-color: rgba(0, 153, 228, 0.36);
  83. color: rgb(255, 255, 255);
  84. margin-top: 5px;
  85. }
  86. `);