Greasy Fork 还支持 简体中文。

Moving touch buttons in tetr.js

title

  1. // ==UserScript==
  2. // @name Moving touch buttons in tetr.js
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.6.6
  5. // @author Oki
  6. // @description title
  7. // @match http://farter.cn/tetr.js/
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. (function() {
  12.  
  13. window.addEventListener('load', function(){
  14.  
  15.  
  16.  
  17. if(typeof trim != "function"){var trim=a=>{a=a.slice(0,-1);a=a.substr(a.indexOf("{")+1);return a}}
  18.  
  19. function onTouchPressed() {
  20. //execute stuff after placing block
  21. setInterval(x=>{touchLeft.style.height = "1.5in";touchLeft.style.backgroundColor="red"},3000)
  22. }
  23.  
  24. var placeBlockFunc = window.touchButtonsLayout.toString()
  25. placeBlockFunc = trim(onTouchPressed.toString()) + trim(placeBlockFunc)
  26. window.touchButtonsLayout = new Function(placeBlockFunc);
  27.  
  28.  
  29. "Hold0RotLeft0Down0Left0Right0RotRight0Drop".split(0).map(x=>{u=document.getElementById("touch"+x);u.style.paddingBottom="100px";u.style.backgroundColor="red";u.style.marginTop="-3in";console.log(u)})
  30.  
  31.  
  32.  
  33. });
  34. })();