testing

test

  1. // ==UserScript==
  2. // @name testing
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description test
  6. // @author Oki
  7. // @match https://*.jstris.jezevec10.com/*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. /************************************
  12. testing
  13. ************************************/
  14. (function() {
  15. window.addEventListener('load', function(){
  16.  
  17.  
  18.  
  19.  
  20.  
  21.  
  22. customFieldBorder = true //change to false to disable
  23.  
  24. if(customFieldBorder){
  25.  
  26. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  27. if(typeof getParams != "function"){var getParams=a=>{var params=a.slice(a.indexOf("(")+1);params=params.substr(0,params.indexOf(")")).split(",");return params}}
  28.  
  29. function atGameStart() {
  30.  
  31. bgLayer.width = 880
  32. bgLayer.height = 650
  33. bgLayer.style.left = "-"+((880-248)/2)/2+"px"
  34. bgLayer.style.top = "-"+((1080-480)/2)/2+"px"
  35. this.drawBgGrid(1);
  36. var bgctx = bgLayer.getContext("2d");
  37. var img = new Image;
  38. img.onload = function(){
  39. bgctx.clearRect(0, 0, 880, 1080);
  40. bgctx.drawImage(img,58,120,880/2,1080/2); // Or at whatever offset you like
  41. };
  42. img.src = "https://i.imgur.com/yEQorDE.png";
  43. sprintInfo.style.zIndex = "100000";
  44. }
  45.  
  46. var initRandom = GameCore['prototype']['initRandomizer'].toString()
  47. var initRandomParams = getParams(initRandom)
  48. initRandom = trim(atGameStart.toString()) + trim(initRandom)
  49. GameCore['prototype']['initRandomizer'] = new Function(...initRandomParams, initRandom);
  50.  
  51.  
  52.  
  53.  
  54. var queueC = queueCanvas.getBoundingClientRect();
  55.  
  56. for (var i = 0; i < 5; i++) {
  57. var qCC = document.createElement("canvas");
  58. qCC.id = "queueCopy" + i
  59. qCC.className = "queueCopy"
  60. qCC.style.position = "absolute";
  61. qCC.style.left = queueC.left+"px";
  62. qCC.style.top = queueC.top+(72*i)+"px";
  63. qCC.height=72
  64. i&&(qCC.style.transform = "translatey("+(72*i)+") ")
  65. qCC.width=queueCanvas.width
  66. document.body.appendChild(qCC)
  67.  
  68. }
  69.  
  70. var customStyleQueue=document.createElement("style");
  71. customStyleQueue.innerHTML='#queueCanvas {visibility:hidden;} .queueCopy {z-index:1} #holdCanvas {z-index:2}';
  72. document.body.appendChild(customStyleQueue);
  73.  
  74.  
  75. var updateQueueBoxFunc = Game['prototype']['updateQueueBox'].toString()
  76.  
  77. var inject = `;for (var i = 0; i < 5; i++) {
  78. var destCanvas = document.getElementById("queueCopy"+i)
  79. var destCtx = destCanvas.getContext('2d');
  80. destCtx.clearRect(0, 0, destCanvas.width, destCanvas.height);
  81. destCtx.drawImage(queueCanvas, 0, -i*72);}`
  82.  
  83. updateQueueBoxFunc = trim(updateQueueBoxFunc) + inject
  84.  
  85. Game['prototype']["updateQueueBox"] = new Function(updateQueueBoxFunc);
  86.  
  87. queueCopies = [queueCopy0,queueCopy1,queueCopy2,queueCopy3,queueCopy4]
  88.  
  89. i=0
  90. queueCopies.map(x=>{
  91. x.style.transform += "scale(0.5,0.5)"
  92. x.style.transform += "translate(-75px,"+ -i*40 +"px)"
  93. i++
  94. })
  95.  
  96. holdCanvas.style.float = "none"
  97. holdCanvas.style.position = "absolute"
  98. holdCanvas.style.transform = "scale(0.5,0.5)"
  99. holdCanvas.style.top = "2px"
  100. holdCanvas.style.left = "28px"
  101.  
  102.  
  103. rInfoBox.style.position = "absolute"
  104. rInfoBox.style.zIndex = 100
  105. rInfoBox.style.marginLeft = "90px"
  106. rInfoBox.style.transform = "scale(0.8,0.8)"
  107.  
  108. stage.style.left = "112px"
  109.  
  110. }
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117. });
  118. })();