Play multiple replays

plays a sequence of replays back to back

  1. // ==UserScript==
  2. // @name Play multiple replays
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2
  5. // @description plays a sequence of replays back to back
  6. // @author Oki
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /**************************
  12. Jstris B2B replays script
  13. **************************/
  14.  
  15. var delayBeforeClickingLoad = 2000;
  16. var delayAfterReplayFinishes = 2000;
  17.  
  18. (function() {
  19.  
  20. window.addEventListener('load', function(){
  21.  
  22. setTimeout(startReplay,delayBeforeClickingLoad)
  23.  
  24. function startReplay() {
  25. var replayList = localStorage.playReplays.split(",");
  26. if(replayList[replayList.length-1] != "check"){
  27. localStorage.playReplays += ",check"
  28. }
  29.  
  30.  
  31. if(typeof load != "undefined"){
  32. localStorage.playReplays = localStorage.playReplays.split(",").slice(1)
  33.  
  34. var init = Replayer['prototype']['initSetOnce'].toString()
  35. init = `try {` + trim(init) + `} catch(e){var nextRep=localStorage.playReplays.split(",")[0];if(nextRep!='check'){location.replace(nextRep)}};`
  36. Replayer['prototype']['initSetOnce'] = new Function(init);
  37.  
  38. load.click()
  39. setTimeout(overwrite,2000)
  40. } else {
  41. location.replace(localStorage.playReplays.split(",")[0])
  42. }
  43. }
  44. var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}
  45. var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}
  46.  
  47.  
  48. function overwrite() {
  49. var paint = View['prototype']['paintMatrixWithColor'].toString()
  50. var paintParams = getParams(paint);
  51. paint = `setTimeout(x=>{var nextRep=localStorage.playReplays.split(",")[0];if(nextRep!='check'){location.replace(nextRep)}},${delayAfterReplayFinishes});` + trim(paint)
  52. View['prototype']['paintMatrixWithColor'] = new Function(...paintParams, paint);
  53. }
  54. });
  55. })();