Last active
March 29, 2021 11:22
-
-
Save estelsmith/4aa0b48d2e898f6c363086161b1a5082 to your computer and use it in GitHub Desktop.
Updates the download button on emulator.games to ROM pages to link directly to the file download
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name emulator.games download | |
// @version 0.0.2 | |
// @description Fixes the download button on emulator.games to actually download ROMs | |
// @author estelsmith | |
// @match https://emulator.games/roms/*/*/ | |
// @grant none | |
// ==/UserScript== | |
(function($, romId) { | |
'use strict'; | |
var infoUrl = '/get.php'; | |
$(function () { | |
var link = document.querySelector('a#rom-link'); | |
var buttonText = link.querySelector('.dl-text'); | |
var deferred = $.ajax({ | |
method: 'POST', | |
url: infoUrl, | |
dataType: 'json', | |
data: { | |
set_type: 'rom', | |
set_id: romId | |
} | |
}); | |
deferred.done(function (responseData) { | |
if (responseData.length >= 4 && responseData[3]) { | |
var downloadUrl = responseData[3]; | |
$(link).attr('href', encodeURI(downloadUrl)); | |
$(buttonText).text('Download Now (for real)'); | |
} | |
}); | |
}); | |
})(jQuery, set_id); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Why
Emulator.Games is a decent resource to find and download ROMs if you know how to get past their broken download system.
When trying to download ROMs from this site, you are brought to a page with the following countdown:
Your Download is Starting in 30 second(s)
. Unfortunately, at the end of the countdown you are simply greeted with an error sayingThis game is unavailable
.This script updates the
Download Now
button to allow you to immediately download your ROM, skipping the broken download process.How to use
Install Tampermonkey, then press the
Raw
button next to theemulator.games.user.js
file in this Gist. Tampermonkey will prompt you to install the script.That's it!!
When you visit a ROM page, the download link will be changed from
Download Now
toDownload Now (for real)
, indicating the link has been updated.