unknown81311 / igg on stor pages

// ==UserScript==
// @name         igg on stor pages
// @namespace    my-web-site.cyleja1234.repl.co/
// @version      2.6
// @description  open game on igg-games (other game store platforms coming soon!)[steam epic games oprigin]
// @author       Unknown81311#6616 (discord)
// @license      GPL-3.0-or-later
// @require      https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
// @match        *store.steampowered.com/app/*
// @match        https://www.epicgames.com/store/*
// @match        https://www.origin.com/*
// @icon url     https://store.steampowered.com/favicon.ico
// @icon         https://store.steampowered.com/favicon.ico
// @copyright    2020, unknown81311 (https://openuserjs.org/users/unknown81311)
// ==/UserScript==
var hostname = window.location.origin; //find curent domain
if ("https://store.steampowered.com" === window.location.origin) { //for steam
  var name = $(".apphub_AppName").text(),
    appName = name.replace(/ /g, "-").replace(/[^a-zA-Z0-9 -]/g, ""),
    el1 = document.querySelector("#game_area_purchase > div.game_area_purchase_game_wrapper > div > div.game_purchase_action >   div.game_purchase_action_bg > div.btn_addtocart"); //get game name
  //set clone target elemnt
  $(el1).clone().prependTo(".game_purchase_action").css({float: "right",display: "inline-block","background-color": "#000000",padding: "2px 2px 2px 0px"}); //clone originall button and add style
  var link = "https://igg-games.com/" + appName + "-free-download.html",
    target = "#game_area_purchase > div.game_area_purchase_game_wrapper > div > div.game_purchase_action > div.btn_addtocart > a"; //setlink
  //set targettred elemnt
  $(target).attr("href", link), //change link
    $(target).attr("target", "_blank"), //redirect to new tab
    $(target + " > span").text("Free"), //rename to free
    $("#dlc_purchase_action > div:nth-child(1)").remove(), //remove bug
    $("#game_area_purchase > div:nth-child(2) > div > div.game_purchase_action > div.btn_addtocart").remove()// remove bug
}
if ("https://www.epicgames.com" === window.location.origin) { //for epic games

  var name2 = $("div.css-eizwrh-NavigationBar__contentPrimary > ul > li:nth-child(2) > a > h2 > span").text(); //get game name
  var appName2 = name2.replace(/ /g, "-").replace(/[^a-zA-Z0-9 -]/g, ""); //replace space with "-" and "'"
  var el2 = "div.css-wgi9q7 > div >";
  $("div.css-wgi9q7 > div > button").clone().prependTo("div.css-wgi9q7 > div"), $("div.Description-ctaWrapper_e8d00c38 > div > div > div > div.css-wgi9q7 > div > a > button").removeAttr('disabled'); //enable button
  var link2 = "https://igg-games.com/" + appName2 + "-free-download.html"; //setlink
  $("div.css-wgi9q7 > div > button:nth-child(1)").wrap("<a href=\"#\" target=\"_blank\">"); // add a tag to be changed
  $("div.css-wgi9q7 > div > a").attr("href", link2); // change link
}

if ("https://www.origin.com" === window.location.origin) { // for origin, in proggress...
    var name3 = document.querySelector("#storecontent > section:nth-child(21) > div > origin-store-osp-termsandconditions > div > otkex-legal > div > strong").text();// get game name
alert(name3);
}