Moving touch buttons in tetr.js

title

目前為 2020-02-06 提交的版本,檢視 最新版本

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