archive.org - Streamable-only games repositories

Detects and redirects to the source repositories of streamable-only games from archive.org collection

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name         archive.org - Streamable-only games repositories
// @namespace    https://archive.org/details/stream_only?and[]=mediatype%3A%22software%22
// @description  Detects and redirects to the source repositories of streamable-only games from archive.org collection
// @icon         http://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/Internet_Archive_logo_and_wordmark.png/240px-Internet_Archive_logo_and_wordmark.png
// @author       ner0
// @copyright    2021, ner0 (https://openuserjs.org/users/ner0)
// @license      MIT
// @version      0.1
// @supportURL   https://openuserjs.org/scripts/ner0/archive.org_-_Streamable-only_games_repositories/issues
// @grant        none
// @require      https://code.jquery.com/jquery-1.10.2.min.js
//
// @include      *://archive.org/details/*
// ==/UserScript==

if (window.location.href.indexOf(document.domain + "/details/") > -1) {
    var links = document.getElementsByTagName("a");
    for (var i=0; i<links.length; i++) {
        var link = "" + links[i];
        if (link.indexOf("stream") != -1) {
            var scripts = document.querySelectorAll("script");
            for (var i = 0; i < scripts.length; i++) {
                var emuLoader = "" + scripts[i].text;
                if (emuLoader.indexOf("AJS.emulate_setup") != -1) {
                    emuLoader = emuLoader.substring(emuLoader.indexOf("\/"));
                    emuLoader = emuLoader.replace("\\", "");
                    emuLoader = emuLoader.substring(0, emuLoader.indexOf("?"));

                    var response = "";
                    $.ajax({
                        type: "GET",
                        url: "https://" + document.domain + emuLoader,
                        async: false,
                        success: function (text) {
                            response = text;
                            response = response.substring(response.indexOf("https"));
                            response = response.substring(0, response.indexOf(")"));
                            /*
                            console.log("Download repository: " + response);
                            window.open(response, "_blank");
                            */
                            if (confirm("Browse this game's repository?")) {
                                window.location.href = response;
                            }
                        }
                    });
                    break;
                }
            }
            break;
        }
    }
}