Greasy Fork is available in English.

Replay Details Script

shows additional information in replays

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください。
  1. // ==UserScript==
  2. // @name Replay Details Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.22
  5. // @description shows additional information in replays
  6. // @author Oki
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. /**************************
  13. Replay Details Script
  14. **************************/
  15.  
  16. (function() {
  17. window.addEventListener('load', function(){
  18.  
  19. var repDhold=document.createElement("div");
  20. repDhold.id="repDHolder";
  21. repDhold.style.position="absolute"
  22. repDhold.style.left = (myCanvas.getBoundingClientRect().left - 500) + "px";
  23. repDhold.style.top = (myCanvas.getBoundingClientRect().top + 100) + "px";
  24. document.body.appendChild(repDhold);
  25.  
  26. var fRepD = '<style>#repDT {border-collapse:collapse;text-align:left}.repD {border:1px solid white;padding:5px}</style><table id="repDT">'
  27.  
  28. var website = "jstris.jezevec10.com"
  29. var url = window.location.href
  30. var parts = url.split("/")
  31.  
  32. if(parts[3]=="replay" && parts[2].endsWith(website) && parts[4] != "1v1"){
  33.  
  34. var fetchURL = "https://"+parts[2]+"/replay/data?id="+parts[+(L=parts[4]=="live")+4]+"&type="+ +L;
  35. console.log(fetchURL)
  36. /*
  37. if(parts[4] == "live"){
  38. fetchURL = "https://"+parts[2]+"/replay/data?id=" + parts[5] + "&type=1"
  39. } else {
  40. fetchURL = "https://"+parts[2]+"/replay/data?id=" + parts[4] + "&type=0"
  41. }
  42. */
  43.  
  44. fetch(fetchURL)
  45. .then(function(response) {
  46. return response.json();
  47. })
  48. .then(function(jsonResponse) {
  49. try {
  50. var keys = Object.keys(jsonResponse.c)
  51. }
  52. catch (e) {
  53. console.log("very old replay, cant execute replay details script")
  54. keys = []
  55. }
  56.  
  57. for (var i = 0; i < keys.length; i++) {
  58. var key=keys[i]
  59. var add=[key,jsonResponse.c[key]]
  60.  
  61. if(key=="softDropId"){
  62. add[1]="Slow9Medium9Fast9Ultra9Instant".split(9)[add[1]]
  63. }
  64. if(key=="gameEnd" || key=="gameStart"){
  65. add[1]=(""+new Date(add[1])).split(" ").splice(0,5)
  66. }
  67. if(key=="v"){add[0]="version"}
  68. if(key=="bs"){add[0]="blockskin id"}
  69. if(key=="se"){add[0]="sound effects id"}
  70. if(key=="map"){add[1]="<a href='https://jstris.jezevec10.com/map/"+add[1]+"'>"+add[1]+"</a>"}
  71.  
  72. fRepD+=`<tr><td class="repD">${add[0]}</td><td class="repD">${add[1]}</td></tr>`
  73. }
  74.  
  75. repDHolder.innerHTML = fRepD+"</table>"
  76. });
  77.  
  78. }
  79.  
  80. });
  81. })();