Anti Spacebar Scroll [Sploop.io, Moomoo.io]

Removes scrolling when pressing spacebar

当前为 2022-07-13 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Anti Spacebar Scroll [Sploop.io, Moomoo.io]
  3. // @author Murka
  4. // @description Removes scrolling when pressing spacebar
  5. // @icon https://i.imgur.com/RigUeNF.png
  6. // @version 0.1
  7. // @match *://sploop.io/*
  8. // @match *://moomoo.io/*
  9. // @match *://*.moomoo.io/*
  10. // @run-at document-start
  11. // @grant none
  12. // @license MIT
  13. // @namespace https://greasyfork.org/users/919633
  14. // ==/UserScript==
  15. /* jshint esversion:6 */
  16.  
  17. /*
  18. Author: Murka
  19. Github: https://github.com/Murka007
  20. Discord: https://discord.gg/sG9cyfGPj5
  21. Greasyfork: https://greasyfork.org/en/users/919633
  22. */
  23.  
  24. (function() {
  25. "use strict";
  26.  
  27. const log = console.log;
  28. function isInput() {
  29. const element = document.activeElement;
  30. return ["TEXTAREA", "INPUT"].includes(element.tagName);
  31. }
  32.  
  33. window.addEventListener("keydown", function(event) {
  34. if (event.code === "Space" && !isInput()) {
  35. event.preventDefault();
  36. }
  37. })
  38.  
  39. })();