Skip to content

Instantly share code, notes, and snippets.

@Eptun
Last active May 24, 2024 21:25
Show Gist options
  • Save Eptun/3fdcc84552e75e452731cd4621c535e9 to your computer and use it in GitHub Desktop.
Save Eptun/3fdcc84552e75e452731cd4621c535e9 to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name EmuParadise Download Workaround - 1.1.1
// @version 1.1.2
// @description Replaces the download button link with a working one
// @author Eptun
// @match https://www.emuparadise.me/*/*/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==
(function() {
'use strict';
var id = ((document.URL).split("/"))[5];
$(".download-link").prepend(`<a target="_blank" href="/roms/get-download.php?gid=`+id+`&test=true" title="Download using the workaround script">Download using the workaround script</a><br><br>`);
})();
@wolfinston85
Copy link

Works great!

If it just opens a new tab what you should do is right click on the "Download using the workaround script" and then click on "Save link as..." option, this will open a file explorer window asking you where you want to donwload your game; that's it!!!

@Lplumb
Copy link

Lplumb commented Apr 21, 2022

If I click the workaround link it gets stuck on a blank page, if I select save content as... then the download gets stuck on 100% but never really finishes. Could be an issue due to me using opera GX but I haven't had an issue with it before so something could've changed will try with chrome.

@Nona9614
Copy link

Nona9614 commented Dec 18, 2023

Eptun

@Eptun I loved your workaround! As a recomendation from a Web Developer.

  • Use the "location" object from the global window object. This will allow you to build the full URL path. location.origin should give to you the "https://www.emuparadaise.com" text.
  • Then append the id variable at the end of this new generated text and save it to a new variable to use it in the anchor a HTML element.
  • Finally add the anchor the attribute of download to force the Save as behaviour as @ReclusiveEagle mentioned.

Note: The 3rd step must be manually applied if the user is using Google Chrome. Firefox works with this method automatically.

If anything that I said was difficult I will attach the code for you!

// ==UserScript==
// @name EmuParadise Download Workaround - 1.1.1
// @version 1.1.2
// @description Replaces the download button link with a working one
// @author Eptun
// @match https://www.emuparadise.me/*/*/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js
// @grant none
// ==/UserScript==

(function () {
  "use strict";

  /** The style class from the download button */
  const DOWNLOAD_BUTTON_CLASS = "download-link";

  /** The game id from the `emuparadise` servers */
  const id = document.URL.substring(document.URL.lastIndexOf("/") + 1);
  /** The link to follow when the generated button is clicked */
  const href = `${location.origin}/roms/get-download.php?gid=${id}&test=true`;

  /** The original download link container */
  const DownloadLinkContainer = document.body.querySelector(
    `.${DOWNLOAD_BUTTON_CLASS}`
  );
  /** The original link */
  const DownloadLink = DownloadLinkContainer.querySelector("a");

  /** The original text in the link */
  const text = DownloadLink.innerText;
  /** The original link extra text */
  const extra = DownloadLinkContainer.innerText.substring(
    text.length,
    DownloadLinkContainer.innerText.length
  );

  // Modifies the text in the original link
  DownloadLink.innerText = `${text} [Ignore]`;
  /** The generated download link */
  const WorkaroundLink = document.createElement("a");
  WorkaroundLink.target = "_blank";
  WorkaroundLink.href = href;
  WorkaroundLink.download = text;
  WorkaroundLink.title = "The link using the workaround script";
  WorkaroundLink.innerText = `${text} [Repaired]`;

  /** The new link container */
  const WorkaroundLinkContainer = document.createElement("div");
  WorkaroundLinkContainer.classList.add(DOWNLOAD_BUTTON_CLASS);
  WorkaroundLinkContainer.appendChild(WorkaroundLink);
  WorkaroundLinkContainer.append(extra);

  // Appends the new generated link before the original link
  DownloadLinkContainer.insertAdjacentElement(
    "beforebegin",
    WorkaroundLinkContainer
  );

  // Removes the original link
  DownloadLinkContainer.remove();
})();

User

You don't need to install any add-on!

  • Open the Developers Tools from the browser (ussually clicking F12)
  • Then find a tab called console and click it.
  • This tab will open a text field below it, there you should paste only the code then hit enter.
  • If done properly the link should be replaced with a version with an extra text [Repaired]. That link is the one that should be clicked.
  • If the link is not working is because the browser is blocking it. Try Firefox or if you want to use the one that blocked the link, follow the steps from @ReclusiveEagle.

Note This method should be applied just once, if at any step you feel something failed to you, reload the page and start over. Plus this method will only look for the first download link in the page. Those games that contains multple "links", those are just dead ends. Just try this method ignoring those extra "zombie links".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment