Vault ROM Restore

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

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Vault ROM Restore
// @namespace    http://tampermonkey.net/
// @version      0.3
// @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 Nintendo of America",
    "Download unavailable at the request of the Entertainment Software Association",
    "Download, box art, and screen shots unavailable at the request of the Entertainment Software Association",
    "Download unavailable at the request of Sega Corporation",
    "Download, box art, and screen shots unavailable at the request of Sega Corporation",
    "Download unavailable at the request of LEGO Juris A/S",
    "Download, box art, and screen shots unavailable at the request of LEGO Juris A/S"
];

let lineDetected = linesToDetect.find(line => document.body.innerHTML.includes(line));

if (lineDetected) {
    let system = window.location.pathname.split('/')[2];

    let media = typeof allMedia !== "undefined" && allMedia.length > 0 ? allMedia[allMedia.length - 1] : null;

    if (media) {
        let buttonHTML = `<table style="width:100%">
            <tbody>
                <tr id="download-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">
                            <input type="hidden" name="mediaId" value="${media.ID}">
                            <button type="submit" style="width:100%">Download</button>
                        </form>
                    </td>
                    <td style="width:33%; text-align:center" id="download_size">${media.ZippedText}</td>
                </tr>
            </tbody>
        </table>`;

        if (system !== "Wii") {
            buttonHTML += `<button type="button" title="Play Online" onclick="location.href='/vault/?p=play&mediaId=${media.ID}'" style="width:33%">Play Online</button>`;
        }

        document.body.innerHTML = document.body.innerHTML.replace(lineDetected, buttonHTML);
    } else {
        console.error("Media data is undefined or empty.");
    }
}