Click Message Input on Right Arrow Key

This script clicks the "Message Input" button on the sidebar when the right arrow key is pressed.

目前为 2023-12-30 提交的版本。查看 最新版本

  1. // ==UserScript==
  2. // @name Click Message Input on Right Arrow Key
  3. // @namespace https://greasyfork.org/en/users/1200587-trilla-g
  4. // @match *://*.kick.com/*
  5. // @grant none
  6. // @version 4.0
  7. // @license MIT
  8. // @author Trilla_G
  9. // @description This script clicks the "Message Input" button on the sidebar when the right arrow key is pressed.
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. document.addEventListener('keydown', function(event) {
  16. // Check if the right arrow key is pressed (key code 39)
  17. if (event.key === 'ArrowRight') {
  18. clickMessageInput();
  19. }
  20. });
  21.  
  22. function clickMessageInput() {
  23. let messageInputButton = document.querySelector('#message-input');
  24. if (messageInputButton) {
  25. messageInputButton.click();
  26. }
  27. }
  28. })();
  29.