Never Let Chat Pause

Automatically clicks elements on Kick.com to keep the chat or other elements active, with a pause feature using the Delete key.

  1. // ==UserScript==
  2. // @name Never Let Chat Pause
  3. // @namespace https://greasyfork.org/en/users/1200587-trilla-g
  4. // @version 5.0
  5. // @description Automatically clicks elements on Kick.com to keep the chat or other elements active, with a pause feature using the Delete key.
  6. // @author Trilla_G
  7. // @match *://*.kick.com/*
  8. // @grant none
  9. // @license MIT
  10. // ==/UserScript==
  11.  
  12. (function () {
  13. 'use strict';
  14.  
  15. // Define the selector for the target element
  16. const targetSelector = '.betterhover\\:hover\\:bg-surface-higher';
  17.  
  18. // State to track whether the script is paused
  19. let scriptPaused = false;
  20.  
  21. // Set up an observer to watch for the target entering the viewport
  22. const observer = new IntersectionObserver(entries => {
  23. if (!scriptPaused) {
  24. entries.forEach(entry => {
  25. if (entry.isIntersecting) {
  26. entry.target.click();
  27. }
  28. });
  29. }
  30. });
  31.  
  32. // Function to monitor and observe the target
  33. function observeTarget() {
  34. if (scriptPaused) return; // Skip functionality when paused
  35.  
  36. const target = document.querySelector(targetSelector);
  37. if (target) {
  38. observer.observe(target);
  39. }
  40. }
  41.  
  42. // Set up a MutationObserver to detect changes in the page and find the target
  43. const mutationObserver = new MutationObserver(() => {
  44. if (!scriptPaused) observeTarget();
  45. });
  46. mutationObserver.observe(document.body, { childList: true, subtree: true });
  47.  
  48. // Automatic clicking every 15 seconds
  49. const autoClickInterval = setInterval(() => {
  50. if (!scriptPaused) {
  51. const target = document.querySelector(targetSelector);
  52. if (target) {
  53. target.click();
  54. }
  55. }
  56. }, 15000); // 15 seconds
  57.  
  58. // Pause the script for 15 seconds when the Delete key is pressed
  59. document.addEventListener('keydown', (event) => {
  60. if (event.key === 'Delete' && !scriptPaused) {
  61. console.log('Script paused for 15 seconds.');
  62. scriptPaused = true;
  63.  
  64. // Disconnect observers and pause automatic actions
  65. observer.disconnect();
  66. mutationObserver.disconnect();
  67.  
  68. // Resume script after 15 seconds
  69. setTimeout(() => {
  70. console.log('Script resumed.');
  71. scriptPaused = false;
  72.  
  73. // Reconnect observers
  74. observeTarget();
  75. mutationObserver.observe(document.body, { childList: true, subtree: true });
  76. }, 15000);
  77. }
  78. });
  79.  
  80. // Initial observation
  81. observeTarget();
  82. })();