Replay Details Script

shows additional information in replays

Stan na 13-06-2019. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

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

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

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.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name         Replay Details Script
// @namespace    http://tampermonkey.net/
// @version      0.1
// @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) {

			var keys = Object.keys(jsonResponse.c)

			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://de.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>"
		});
}

    });
})();