Play multiple replays

plays a sequence of replays back to back

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Play multiple replays
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  plays a sequence of replays back to back
// @author       Oki
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

/**************************
  Jstris B2B replays script      
**************************/

var delayBeforeClickingLoad = 2000;
var delayAfterReplayFinishes = 2000;

(function() {

    window.addEventListener('load', function(){

    	setTimeout(startReplay,delayBeforeClickingLoad)

    	function startReplay() {
    		var replayList = localStorage.playReplays.split(",");
			if(replayList[replayList.length-1] != "check"){
				localStorage.playReplays += ",check"
			}


    		if(typeof load != "undefined"){
				localStorage.playReplays = localStorage.playReplays.split(",").slice(1)

				var init = Replayer['prototype']['initSetOnce'].toString()
				init = `try {` + trim(init) + `} catch(e){var nextRep=localStorage.playReplays.split(",")[0];if(nextRep!='check'){location.replace(nextRep)}};`
				Replayer['prototype']['initSetOnce'] = new Function(init);

				load.click()
				setTimeout(overwrite,2000)
			} else {
				location.replace(localStorage.playReplays.split(",")[0])
			}
    	}
		
		var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
		var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}


		function overwrite() {
			var paint = View['prototype']['paintMatrixWithColor'].toString()
			var paintParams = getParams(paint);
			paint = `setTimeout(x=>{var nextRep=localStorage.playReplays.split(",")[0];if(nextRep!='check'){location.replace(nextRep)}},${delayAfterReplayFinishes});` + trim(paint)
			View['prototype']['paintMatrixWithColor'] = new Function(...paintParams, paint);
		}
    });
})();