Skins in 1v1 Replay

allows skins in 1v1 replays

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

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

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

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

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

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

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

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

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

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

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

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

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

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

// ==UserScript==
// @name         Skins in 1v1 Replay
// @namespace    http://tampermonkey.net/
// @version      0.2
// @description  allows skins in 1v1 replays
// @author       Oki
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

/**************************
    Skins in 1v1 Replay
**************************/
(function() {
    window.addEventListener('load', function(){


if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
redrawFunc = Replayer['prototype']['redraw'].toString()

//Comment out the line for skin1=... or skin2=... if you want to keep the skin for that side
skin1=["https://i.imgur.com/6I8Aqh7.png",32]
skin2=["https://i.imgur.com/l6P1G9W.png",32]
injected = [false,false]

function inject() {
	side = this.v.canvas.id.slice(-1)
	if(!injected[side-1]){
		if(eval("typeof skin"+side+'!= "undefined"')){
			this.skins.map(x=>{
				x.data = eval("skin"+side+"[0]"), x.w = eval("skin"+side+"[1]"), this.v.changeSkin(1)
			})
		}
		injected[side-1]=true
	};
}

Replayer['prototype']['redraw'] = new Function(trim(inject.toString()) + trim(redrawFunc))


});
})();