# in Replays Script

shows number of placed blocks in replays

  1. // ==UserScript==
  2. // @name # in Replays Script
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description shows number of placed blocks in replays
  6. // @author Oki
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /**************************
  12. # in Replays Script
  13. **************************/
  14.  
  15. (function() {
  16. window.addEventListener('load', function(){
  17.  
  18. if(typeof Game == "undefined" && typeof Replayer != "undefined") {
  19.  
  20. var website = "jstris.jezevec10.com"
  21. var url = window.location.href
  22. var parts = url.split("/")
  23. Replayer["addStat2"] = function(id,into) {
  24. var apmStat = document.createElement("tr");
  25. apmStat.innerHTML = '<td class="ter">#</td><td class="sval"><span id="'+id+'">0</span></td>'
  26. into.appendChild(apmStat);
  27. }
  28.  
  29. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  30. var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
  31. if(parts[3]=="replay" && parts[2].endsWith(website) && parts.length>4){
  32. if(parts[4]=="1v1"){
  33. Replayer["addStat2"]("countElement1",document.getElementsByTagName("tbody")[0])
  34. Replayer["addStat2"]("countElement2",document.getElementsByTagName("tbody")[2])
  35. } else {
  36. Replayer["addStat2"]("countElementP",document.getElementsByClassName("moreStats")[0])
  37. }
  38. var oldTextBar = View.prototype.updateTextBar.toString();
  39. oldTextBar = trim(oldTextBar) + ';var cat2 = this.kppElement.id.slice(-1);console.log(this);eval("countElement"+cat2+"&&(countElement"+cat2+".innerHTML = this.g.placedBlocks)");'
  40. View.prototype.updateTextBar = new Function(oldTextBar);
  41.  
  42. }
  43. }
  44.  
  45. });
  46. })();