Auto Click Chatbox

This script automatically clicks the "Message Input" button on the sidebar, on kick.com when the stream is live.

目前為 2023-11-20 提交的版本,檢視 最新版本

  1. // ==UserScript==
  2. // @name Auto Click Chatbox
  3. // @namespace https://greasyfork.org/en/users/1200587-trilla-g
  4. // @match *://*.kick.com/*
  5. // @grant none
  6. // @version 1.1
  7. // @license MIT
  8. // @author Trilla_G
  9. // @description This script automatically clicks the "Message Input" button on the sidebar, on kick.com when the stream is live.
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14.  
  15. function isLive() {
  16. let liveDisplay = document.querySelector(".vjs-live-control");
  17. return liveDisplay && !liveDisplay.classList.contains('vjs-hidden');
  18. }
  19.  
  20. function clickMessageInput() {
  21. let messageInputButton = document.querySelector('#message-input');
  22. if (isLive() && messageInputButton) {
  23. messageInputButton.click();
  24. }
  25. }
  26.  
  27. // Create a MutationObserver to retrigger on hashchange
  28. const observer = new MutationObserver(() => {
  29. console.log('Hashchange event detected. Retriggering script.');
  30. clickMessageInput();
  31. });
  32.  
  33. // Configure and start observing changes to the URL hash
  34. const config = { childList: true, subtree: true };
  35. observer.observe(document.body, config);
  36.  
  37. // Initial click and observe hashchange
  38. setTimeout(function() {
  39. clickMessageInput();
  40. }, 1000);
  41. })();
  42.  
  43.  
  44.