Steam🎮-100%

Steam -100% mit halbautomatischem Download für IGG

// ==UserScript==
// @name              Steam🎮-100%
// @name:ar           ستيم 🎮-100%
// @name:bg           Steam🎮-100%
// @name:cs           Steam🎮-100%
// @name:da           Steam🎮-100%
// @name:de           Steam🎮-100%
// @name:el           Steam🎮-100%
// @name:en           Steam🎮-100%
// @name:es           Steam🎮-100%
// @name:fi           Steam🎮-100%
// @name:fr           Steam🎮-100%
// @name:fr-CA        Steam🎮-100%
// @name:he           סטים 🎮-100%
// @name:hu           Steam🎮-100%
// @name:id           Steam🎮-100%
// @name:it           Steam🎮-100%
// @name:ja           スチーム🎮-100%
// @name:ko           스팀🎮-100%
// @name:nl           Steam🎮-100%
// @name:no           Steam🎮-100%
// @name:pl           Steam🎮-100%
// @name:pt           Steam🎮-100%
// @name:ro           Steam🎮-100%
// @name:ru           Steam🎮-100%
// @name:sk           Steam🎮-100%
// @name:sv           Steam🎮-100%
// @name:th           สตีม🎮-100%
// @name:tr           Steam🎮-100%
// @name:uk           Steam🎮-100%
// @name:vi           Steam🎮-100%
// @name:zh           Steam🎮-100%
// @description       Steam -100% with semi-auto-download for IGG
// @description:ar    ستيم -100٪ مع تحميل شبه تلقائي لـ IGG
// @description:bg    Steam -100% със полуавтоматично изтегляне за IGG
// @description:cs    Steam -100% s poloautomatickým stahováním pro IGG
// @description:da    Steam -100% med semi-automatisk download til IGG
// @description:de    Steam -100% mit halbautomatischem Download für IGG
// @description:el    Steam -100% με ημι-αυτόματη λήψη για IGG
// @description:en    Steam -100% with semi-auto-download for IGG
// @description:es    Steam -100% con descarga semi-automática para IGG
// @description:fi    Steam -100% puoliautomaattisella latauksella IGG:lle
// @description:fr    Steam -100% avec semi-téléchargement automatique pour IGG
// @description:fr-CA    Steam -100% avec semi-téléchargement automatique pour IGG
// @description:he    Steam -100% עם הורדה חצי-אוטומטית עבור IGG
// @description:hu    Steam -100% félautomatikus letöltéssel IGG-hez
// @description:id    Steam -100% dengan unduhan semi-otomatis untuk IGG
// @description:it    Steam -100% con download semi-automatico per IGG
// @description:ja    Steam -100%:IGG用の半自動ダウンロード対応
// @description:ko    Steam -100% IGG용 반자동 다운로드 지원
// @description:nl    Steam -100% met semi-automatische download voor IGG
// @description:no    Steam -100% med semi-automatisk nedlasting for IGG
// @description:pl    Steam -100% z półautomatycznym pobieraniem dla IGG
// @description:pt    Steam -100% com semi-download automático para IGG
// @description:ro    Steam -100% cu descărcare semi-automată pentru IGG
// @description:ru    Steam -100% с полуавтоматической загрузкой для IGG
// @description:sk    Steam -100% s poloautomatickým sťahovaním pre IGG
// @description:sv    Steam -100% med semi-automatisk nedladdning för IGG
// @description:th    Steam -100% พร้อมการดาวน์โหลดกึ่งอัตโนมัติสำหรับ IGG
// @description:tr    Steam -100% IGG için yarı otomatik indirme ile
// @description:uk    Steam -100% з напівавтоматичним завантаженням для IGG
// @description:vi    Steam -100% với tải xuống bán tự động cho IGG
// @description:zh    Steam -100%,支持 IGG 半自动下载
// @version      1.0.3
// @match        *store.steampowered.com/app/*
// @include      *igg-games.com/*-free-download.html?cdl*
// @include      *igg-games.com/*-free-download.html
// @include      https://igg-games.com/*
// @include      *skidrowreloaded.com/*&z123*
// @match        https://online-fix.me/index.php?do=search*
// @run-at       document-end
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_addValueChangeListener
// @grant        GM_xmlhttpRequest
// @connect      online-fix.me
// @license      MIT
// @namespace    DEV314R
// ==/UserScript==

(function() {
  "use strict";

  // ---------- i18n labels ----------
  const LABEL_DL = {
    en:"Download", ar:"تحميل", bg:"Изтегли",
    "zh-CN":"下载", "zh-TW":"下載",
    cs:"Stáhnout", da:"Download", nl:"Downloaden",
    fi:"Lataa", fr:"Télécharger", de:"Herunterladen",
    el:"Λήψη", hu:"Letöltés", id:"Unduh",
    it:"Scarica", ja:"ダウンロード", ko:"다운로드",
    no:"Last ned", pl:"Pobierz",
    "pt-PT":"Transferir", "pt-BR":"Baixar",
    ro:"Descărcare", ru:"Скачать",
    "es-ES":"Descargar", "es-LA":"Bajar",
    sv:"Ladda ner", th:"ดาวน์โหลด", tr:"İndir",
    uk:"Завантажити", vi:"Tải xuống"
  };
  const LABEL_MULTI = {
    en:"Multiplayer", ar:"متعدد اللاعبين", bg:"Мултиплейър",
    "zh-CN":"多人游戏", "zh-TW":"多人遊戲",
    cs:"Multiplayer", da:"Flerspiller", nl:"Multiplayer",
    fi:"Moninpeli", fr:"Multijoueur", de:"Mehrspieler",
    el:"Πολλαπλών παικτών", hu:"Többjátékos", id:"Multipemain",
    it:"Multigiocatore", ja:"マルチプレイヤー", ko:"멀티플레이어",
    no:"Flerspiller", pl:"Wieloosобowy",
    "pt-PT":"Multijogador", "pt-BR":"Multijogador",
    ro:"Multiplayer", ru:"Многопользовательская игра",
    "es-ES":"Multijugador", "es-LA":"Multijugador",
    sv:"Flerspelarläge", th:"ผู้เล่นหลายคน", tr:"Çok Oyunculu",
    uk:"Багатокористувацька", vi:"Nhiều người chơi"
  };

  // ---- détecte la langue du navigateur ----
  const rawLang = (navigator.language || "en").toLowerCase();
  let langKey;
  if (rawLang.startsWith("pt-br")) langKey = "pt-BR";
  else if (rawLang.startsWith("pt-pt")) langKey = "pt-PT";
  else if (rawLang.startsWith("zh-tw") || rawLang.startsWith("zh-hk")) langKey = "zh-TW";
  else if (rawLang.startsWith("zh")) langKey = "zh-CN";
  else if (rawLang.startsWith("es-")) {
    const latam = ["es-mx","es-ar","es-co","es-cl","es-pe","es-ve","es-uy","es-bo","es-py","es-cr","es-pa","es-do","es-ec","es-gt","es-hn","es-ni","es-sv","es-pr","es-419"];
    langKey = latam.includes(rawLang) ? "es-LA" : "es-ES";
  } else langKey = rawLang.split("-")[0];

  const dlLabel = LABEL_DL[langKey] || LABEL_DL.en;
  const multiLabel = LABEL_MULTI[langKey] || LABEL_MULTI.en;

  const temp = 6000;
  let platform = GM_getValue("platform", "IGG");
  let sdl = GM_getValue("source", "MegaUp.net");

  // --- Styles ---
  const style = document.createElement("style");
  style.textContent = `
    .menu { font-family: Arial,sans-serif; font-size: 1em; position: relative; user-select: none; padding: 0.1em; display:inline-flex; }
    .menu-btn { background: #67c1f533; color: #67c1f5; padding: 0.4em 0.6em; border-radius: .3em; cursor: pointer; }
    .menu-btn:hover { background: #67c1f5bb; color: #fff; }
    .flyout { border: none; border-radius: 0.3em; background: #23262E;
              position: absolute; top: 100%; left: 0; display: none; z-index: 10000; }
    .menu:hover .flyout { display: block; }
    .flyout a { display:block; padding: 0.4em 0.6em; background: #23262E; color:#ddd; text-decoration: none; }
    .flyout a:hover { background: #85949d59; color: #fff;}
    .menu-container { right: 0.75em; top: 0.75em; z-index: 9999;  }
  `;
  document.head.appendChild(style);

  // --- Flyout Creator ---
  const createFlyout = (label, key, items, stars=[]) => {
    const container = document.querySelector("#category_block");
    if(!container) return;
    const val = GM_getValue(key, items[0]);
    const html = `
      <div class="menu">
        <div class="menu-btn">${label}: ${val}</div>
        <div class="flyout">
          ${items.map(i => `<a href="#" data-value="${i}">${stars.includes(i)?'⭐'+i:i}</a>`).join("")}
        </div>
      </div>
    `;
    container.insertAdjacentHTML("beforebegin", html);
    const menu = container.previousElementSibling ;
    const btn = menu.querySelector(".menu-btn");

    menu.querySelectorAll("a").forEach(a => {
      a.addEventListener("click", e => {
        e.preventDefault();
        const v = a.dataset.value;
        GM_setValue(key, v);
        if (key === "platform") platform = v; else sdl = v;
        btn.textContent = `${label}: ${v}`;
        updateDownloadLink(true);
      });
    });
  };

  // --- Download Link Updater ---
let gameName = null; // cache global

const updateDownloadLink = (force = false) => {
  const dl = document.querySelector('#add314');
  if (!dl || (!force && !document.hasFocus())) return;

  // si déjà défini, on évite tout GM_xmlhttpRequest
  if (gameName) {
    applyLink(dl);
    return;
  }

  const href = location.href.split("?")[0] + "?l=english";
  GM_xmlhttpRequest({
    method: "GET",
    url: href,
    onload: res => {
      if (res.status !== 200) return;
      const doc = new DOMParser().parseFromString(res.responseText, "text/html");
      const nameEl = doc.querySelector('span[itemprop="name"]');
      if (!nameEl) return;
      gameName = nameEl.textContent
        .normalize("NFD")
        .replace(/[\u0300-\u036f]|[©®™℠]/g, "")
        .replace(/[:'–—]/g, "")
        .trim()
        .toLowerCase();
      applyLink(dl);
    }
  });
};

function applyLink(dl) {
  const enc = encodeURIComponent(sdl);
  let url = "#";
  switch (platform) {
    case "IGG":
      url = `https://igg-games.com/${gameName.replace(/\s+/g, "-")}-free-download.html?cdl&src=${enc}`;
      break;
    case "Skidrow":
      url = `https://www.skidrowreloaded.com/?s=${gameName.replace(/\s+/g, "+").replace(/\./g,"")}&z123&src=${enc}`;
      break;
    case "FitGirl":
      url = `https://fitgirl-repacks.site/?s=${gameName.replace(/\s+/g, "+")}&src=${enc}`;
      break;
  }
  dl.href = url;
}


  // --- Steam UI integration ---
  const steamPurchaseEl = document.querySelector('.game_area_purchase_game_wrapper:not(#demoGameBtn) > * > .game_purchase_action');
  if(steamPurchaseEl && !document.querySelector('.game_area_comingsoon,.game_area_bubble')){
    const container = document.createElement("div");
    container.className = "menu-container";
    document.body.appendChild(container);
    createFlyout("🌐","platform",["IGG","Skidrow","FitGirl"],["IGG","Skidrow"]);
    createFlyout("🎯","source",["1Fichier","MegaUp.net","Mega.nz","Google Drive","AnonFiles","GoFile","Rapidgator","Uploaded"],["1Fichier","MegaUp.net"]);

    const priceEl = document.querySelector("[class^='discount_original_price']") ||
                document.querySelector("[data-price-final]");
    const price = (priceEl && priceEl.innerText ? priceEl.innerText.trim() : "") || "";
    const finalPrice = price ? `0,--${price.slice(-1)}` : "0,00";

    steamPurchaseEl.innerHTML = `
      <div class="game_purchase_action_bg">
        <div class="discount_block game_purchase_discount" data-discount="100">
          <div class="discount_pct">-100%</div>
          <div class="discount_prices">
            <div class="discount_original_price">${price}</div>
            <div class="discount_final_price">${finalPrice}</div>
          </div>
        </div>
        <div class="btn_addtocart">
          <a id="add314" class="btn_green_steamui btn_medium" href="#" target="_blank"><span>${dlLabel}</span></a>
        </div>
      </div>
    `;
    updateDownloadLink(true);

    // --- Multijoueur check ---
    if(document.querySelector(".game_area_details_specs_ctn[href*='category2=38'],.game_area_details_specs_ctn[href*='category2=36']")){
      const g = document.querySelector('#add314');
      const n = document.querySelector('#appHubAppName').innerText
        .normalize("NFD")
        .replace(/[\u0300-\u036f]|[\u00A9\u00AE\u2122\u2120]/g,"")
        .replace(/:| :|'| -/g,"")
						  .replace(/\./g,"");
      const url = `https://online-fix.me/index.php?do=search&subaction=search&story=${n.replace(/\s|\\|\//g,"+")}`;
      g.insertAdjacentHTML("afterend", `<a id="add314r" class="btn_green_steamui btn_medium" href="${url}" target="_blank"><span>⏳${multiLabel}</span></a>`);
      const butn = document.querySelector('#add314r');
      GM_xmlhttpRequest({
        method: "GET",
        url,
        onload: res => {
          if(res.status===200){
            const doc = new DOMParser().parseFromString(res.responseText,"text/html");
            doc.querySelectorAll("h2.title").forEach(el=>el.innerText=el.innerText.replace(/ по сети/g,""));
            const found = Array.from(doc.querySelectorAll("h2.title")).some(el=>el.innerText.toLowerCase().includes(n.toLowerCase()));
            butn.querySelector("span").textContent = found ? "✅"+multiLabel : "⛔"+multiLabel;
          } else butn.querySelector("span").textContent = "🙅"+multiLabel;
        },
        onerror:() => butn.querySelector("span").textContent = "❌"+multiLabel
      });
    }
  }

 // --- IGG auto-download ---
if(/igg-games.+download\.html\?cdl/i.test(location.href)){
    document.title = "⏳"+document.title;
    const tryDownload = () => {
      document.querySelectorAll("b.uk-heading-bullet").forEach(el=>{
        if(el.innerText.replace(/Link\s*:?/i,"").includes(sdl)){
          const links = el.parentElement.querySelectorAll("a[href]");
          let i=0;
          const open = () => { if(i<links.length){ links[i++].click(); setTimeout(open,temp); } else setTimeout(()=>window.close(),2000); };
          open();
        }
      });
    };
    tryDownload();
}
 // --- Skidrow auto ---
if(location.href.search(/skidrowreloaded.+&z123.+/gi)>-1){
const postExcerpt = document.querySelector('[class^="post-excerpt"] [href]');
if(postExcerpt) postExcerpt.click();}
	// --- online-fix ---
if(location.href.search(/online-fix.me\/index.php\?do=search/gi)>-1){
const titles=document.querySelectorAll('h2.title');
if(titles.length===1)titles[0].click();}

})();