Play multiple replays

plays a sequence of replays back to back

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension to install this script.

(I already have a user script manager, let me install it!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==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);
		}
    });
})();