Quick Chat

Quick chat script

  1. // ==UserScript==
  2. // @name Quick Chat
  3. // @namespace http://tampermonkey.net/
  4. // @version 1.0.1
  5. // @description Quick chat script
  6. // @author Realwdpcker
  7. // @match pixelplace.io/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. const map = {
  16. 49: "/here",
  17. 50: "/darkmode",
  18. 51: "/nextwar",
  19. 52: "",
  20. 53: "",
  21. 54: "",
  22. 55: "",
  23. 56: "",
  24. 57: ""
  25. };
  26.  
  27. document.addEventListener("keydown", function (e) {
  28. if (e.altKey && map.hasOwnProperty(e.keyCode)) {
  29. const chatInput = document.querySelector("#chat form input");
  30. let form = chatInput.closest('form');
  31.  
  32. if (chatInput) {
  33. e.preventDefault();
  34. chatInput.focus();
  35. chatInput.value = map[e.keyCode];
  36.  
  37. chatInput.dispatchEvent(new Event('input', { bubbles: true }));
  38.  
  39. form.requestSubmit();
  40. }
  41. }
  42. });
  43. })();