Click Message Input on Right Arrow Key

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

目前为 2024-09-13 提交的版本。查看 最新版本

  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 2.1
  7. // @license MIT
  8. // @author Trilla_G
  9. // @description This script focuses and 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
  17. if (event.key === 'ArrowRight') {
  18. clickMessageInput();
  19. }
  20. });
  21.  
  22. function clickMessageInput() {
  23. // Target the message input element
  24. let messageInputButton = document.querySelector('.editor-input');
  25.  
  26. if (messageInputButton) {
  27. // Ensure the element is focused before clicking
  28. messageInputButton.focus(); // Focus the input field
  29. messageInputButton.click(); // Click the input field
  30. }
  31. }
  32. })();
  33.