Skip to content

Instantly share code, notes, and snippets.

@rocknard
Last active June 1, 2020 04:27
Show Gist options
  • Save rocknard/3aff2efadbcb437b315907c453734031 to your computer and use it in GitHub Desktop.
Save rocknard/3aff2efadbcb437b315907c453734031 to your computer and use it in GitHub Desktop.
[Tampermonkey] EP links' fix.
// ==UserScript==
// @name emuparadise.me
// @match https://www.emuparadise.me/*/*/*
// ==/UserScript==
var _el = document.querySelectorAll('.download-link a[href*="-download"]'), _url = document.URL.split('/');
if(_url[3] == 'Sega_Dreamcast_ISOs') {
for(var _i = 0; _i < _el.length; _i++) {
_el[_i].href = 'http://50.7.189.186/happyxhJ1ACmlTrxJQpol71nBc/Dreamcast/' + _el[_i].title.split('Download ').pop().split(' ISO for Sega Dreamcast')[0];
}
}
else {
for(var _j = 0; _j < _el.length; _j++) {
_el[_j].href = 'https://www.emuparadise.me/roms/get-download.php?gid=' + _url.pop() + '&test';
}
}
async function _fetch(url = '', data = {}) {
const body = new FormData();
body.append('url', data.url);
body.append('referrer', data.referrer);
const response = await fetch(url, {
method: 'POST',
body: body,
});
return await response.json();
}
for(var _k = 0; _k < _el.length; _k++) {
_el[_k].addEventListener('click', function(ee) {
_fetch('https://url-expander.000webhostapp.com', {
url: this.href,
referrer: location.href,
}).then((data) => {
location.replace(data.url);
});
ee.preventDefault();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment