Vault ROM Restore

Restores the download and play online button to Vimm's Vault games.

当前为 2024-10-07 提交的版本,查看 最新版本

您需要先安装一个扩展,例如 篡改猴Greasemonkey暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴暴力猴,之后才能安装此脚本。

您需要先安装一个扩展,例如 篡改猴Userscripts ,之后才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。

您需要先安装用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==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, &#39;tooltip4&#39;)"><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(&#39;download_form&#39;); 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=&#39;/vault/?p=play&amp;mediaId=&#39; + document.forms[&#39;download_form&#39;].elements[&#39;mediaId&#39;].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);
}