Php Sandbox Ctrl + Enter to execute

Execute code faster

当前为 2021-10-21 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Php Sandbox Ctrl + Enter to execute
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Execute code faster
  6. // @author rostuhan
  7. // @match https://sandbox.onlinephpfunctions.com/
  8. // @icon https://www.google.com/s2/favicons?domain=onlinephpfunctions.com
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. function click() {
  13. document.getElementsByClassName("garlic-auto-save")[4].click();
  14. }
  15. var hold = false;
  16. document.addEventListener("keydown", function(e) {
  17. if (e.key == "Control") {
  18. hold = true;
  19. }
  20. else if (e.key == "Enter" && hold) {
  21. click();
  22. }
  23. });
  24. document.addEventListener("keyup", function(e) {
  25. if (e.key == "Control") {
  26. hold = false;
  27. }
  28. })