Replay Details Script

shows additional information in replays

ของเมื่อวันที่ 16-12-2019 ดู เวอร์ชันล่าสุด

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey, Greasemonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

คุณจะต้องติดตั้งส่วนขยาย เช่น Tampermonkey หรือ Violentmonkey เพื่อติดตั้งสคริปต์นี้

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         Replay Details Script
// @namespace    http://tampermonkey.net/
// @version      0.21
// @description  shows additional information in replays
// @author       Oki
// @match        https://*.jstris.jezevec10.com/*
// @grant        none
// ==/UserScript==

/**************************
   Replay Details Script
**************************/

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

var repDhold=document.createElement("div");
repDhold.id="repDHolder";
repDhold.style.position="absolute"
repDhold.style.left = (myCanvas.getBoundingClientRect().left - 500) + "px";
repDhold.style.top = (myCanvas.getBoundingClientRect().top + 100) + "px";
document.body.appendChild(repDhold);

var fRepD = '<style>#repDT {border-collapse:collapse;text-align:left}.repD {border:1px solid white;padding:5px}</style><table id="repDT">'

var website = "jstris.jezevec10.com"
var url = window.location.href
var parts = url.split("/")

if(parts[3]=="replay" && parts[2].endsWith(website)){



	fetch("https://"+parts[2]+"/replay/data?id="+ (parts.length==6?(parts[5]+"&live=1"):(parts[4])))
		.then(function(response) {
		    return response.json();
		})
		.then(function(jsonResponse) {
			try {
				var keys = Object.keys(jsonResponse.c)
			}
			catch (e) {
				console.log("very old replay, cant execute replay details script")
				keys = []
				break;
			}

			for (var i = 0; i < keys.length; i++) {
				var key=keys[i]
				var add=[key,jsonResponse.c[key]]

				if(key=="softDropId"){
					add[1]="Slow9Medium9Fast9Ultra9Instant".split(9)[add[1]]
				}
				if(key=="gameEnd" || key=="gameStart"){
					add[1]=(""+new Date(add[1])).split(" ").splice(0,5)
				}
				if(key=="v"){add[0]="version"}
				if(key=="bs"){add[0]="blockskin id"}
				if(key=="se"){add[0]="sound effects id"}
				if(key=="map"){add[1]="<a href='https://jstris.jezevec10.com/map/"+add[1]+"'>"+add[1]+"</a>"}

				fRepD+=`<tr><td class="repD">${add[0]}</td><td class="repD">${add[1]}</td></tr>`
			}

			repDHolder.innerHTML = fRepD+"</table>"
		});

}

    });
})();