Restores the download and play online button to Vimm's Vault games.
当前为
// ==UserScript==
// @name Vault ROM Restore
// @namespace http://tampermonkey.net/
// @version 1.0.1
// @description Restores the download and play online button to Vimm's Vault games.
// @author InariOkami
// @icon https://vimm.net/images/vimmbutton-100.png
// @match https://vimm.net/vault/*
// @grant GM_log
// ==/UserScript==
const linesToDetect = [
"Download, box art, and screen shots unavailable at the request of Nintendo of America",
"Download unavailable at the request of the Entertainment Software Association",
"Download unavailable at the request of Sega Corporation",
"Download unavailable at the request of LEGO Juris A/S"
];
let lineDetected = linesToDetect.find(line => document.body.innerHTML.indexOf(line) !== -1);
if (lineDetected) {
var system;
var links = document.getElementsByTagName('a');
for (let i = 0; i < links.length; i++) {
if (links[i].href.endsWith("/A")) {
system = links[i].href.replace("https://vimm.net/vault/", "");
system = system.replace("/A", "");
break;
}
}
var media = allMedia[allMedia.length - 1];
var buttonHTML = '<table style="width:100%"><tbody><tr id="download-row" style="display: table-row;"><td style="width:33%"></td><td style="width:34%"><form action="https://download' + (system === "Wii" ? 2 : 3) + '.vimm.net/download/" method="POST" id="download_form" onsubmit="return submitDownload(this, 'tooltip4')"><input type="hidden" name="mediaId" value="' + media.ID + '"><input type="hidden" name="alt" value="0" disabled=""><button type="submit" style="width:100%">Download</button></form></td><td style="width:33%; text-align:center" id="download_size">' + media.ZippedText + '</td></tr><tr id="upload-row" style="display:none"><td colspan="3" style="text-align:center"><span class="redBorder">⚠</span> Download unavailable <span class="redBorder">⚠</span><div style="margin-top:10px">Do you have this game?<br><a href=' + document.location.href + '"/?p=upload" onclick="upload('download_form'); return false">Upload it to The Vault</a></div></td></tr></tbody></table><div style="margin-top:2px">';
if (system !== "Wii") buttonHTML += '<button type="button" title="Play Online" onclick="location.href='/vault/?p=play&mediaId=' + document.forms['download_form'].elements['mediaId'].value" style="width:33%">Play Online</button>';
buttonHTML += '</div>';
// Apply to HTML
document.body.innerHTML = document.body.innerHTML.replaceAll(allMedia[0].GoodTitle, media.GoodTitle);
document.body.innerHTML = document.body.innerHTML.replaceAll(allMedia[0].GoodHash.toLowerCase(), media.GoodHash.toLowerCase());
document.body.innerHTML = document.body.innerHTML.replaceAll(lineDetected, buttonHTML);
}