EpicGames Additional Links

Adds additional links to EpicGames store for free download.

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

// ==UserScript==
// @name         EpicGames Additional Links
// @namespace    EpicGames
// @version      1.0.1
// @author       Wizzergod
// @description  Adds additional links to EpicGames store for free download.
// @grant        GM.getValue
// @grant        GM.setValue
// @grant        GM_addStyle
// @match        *://store.epicgames.com/*/p/*
// @run-at       document-idle
// @icon         https://www.google.com/s2/favicons?sz=64&domain=www.downloadha.com
// @resource     Icon https://www.google.com/s2/favicons?sz=64&domain=www.downloadha.com
// @license      MIT
// ==/UserScript==

(function() {
    'use strict';

    const NewLinks = [
        { 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" },
        { url: "https://fitgirl-repacks.site/?s=", title: "Fitgirl" },
        { url: "https://gload.to/?s=", title: "Gload" },
        { url: "https://gog-games.com/search/", title: "GOG Games" },
        { url: "https://gogunlocked.com/?s=", title: "GOG Unlocked" },
        { url: "https://steamrip.com/?s=", title: "SteamRIP" },
        { url: "https://steamunlocked.net/?s=", title: "Steam Unlocked" },
        { url: "https://www.downloadha.com/?s=", title: "DownloadHa" },
        { url: "https://www.ovagames.com/?s=", title: "OVA Games" }
    ];

    const titleElement = document.querySelector("title");
    const metaElement = document.querySelector('meta[name="og:title"]');
    const appName = extractAppName(metaElement ? metaElement.getAttribute("content") : titleElement?.textContent);

    function extractAppName(title) {
        const match = title.match(/^(.*?)\s\|/);
        return match ? match[1].trim() : title;
    }

    function createButton(href, text, className) {
        let element = document.createElement("a");
        element.href = href;
        element.target = "_blank";
        element.innerHTML = text;
        element.className = className;
        return element;
    }

    const checkExistEpic = setInterval(() => {
        const epicButtons = document.querySelectorAll('.css-8en90x');
        if (epicButtons.length && epicButtons[0].innerText == "BUY NOW") {
            console.log("Exists!");
            const buttonClass = epicButtons[0].parentElement.className;
            const className = `newbuttons ${buttonClass}`;
            NewLinks.forEach(link => {
                const button = createButton(link.url + appName + (link.urlSpecial || ""), link.title, className);
                epicButtons[0].parentElement.parentElement.parentElement.append(button);
            });
            clearInterval(checkExistEpic);
        }
    }, 100);
})();

GM_addStyle(`
.newbuttons {
  font-size: 12px;
  letter-spacing: 0.5px;
  font-weight: 500;
  position: relative;
  border-radius: 4px;
  text-transform: uppercase;
  text-align: center;
  align-items: center;
  justify-content: center;
  line-height: 30px;
  padding: 5px 10px;
  height: 30px;
  display: flex;
  width: 100%;
  min-width: auto;
  background-color: rgba(0, 153, 228, 0.36);
  color: rgb(255, 255, 255);
  margin-top: 5px;
}
`);