Auto Click Chatbox

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

Stan na 19-03-2024. Zobacz najnowsza wersja.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Greasemonkey lub Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana jest instalacje jednego z następujących rozszerzeń: Tampermonkey, Violentmonkey.

Aby zainstalować ten skrypt, wymagana będzie instalacja rozszerzenia Tampermonkey lub Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

Aby zainstalować ten skrypt, musisz zainstalować rozszerzenie menedżera skryptów użytkownika.

(Mam już menedżera skryptów użytkownika, pozwól mi to zainstalować!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Będziesz musiał zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

Musisz zainstalować rozszerzenie menedżera stylów użytkownika, aby zainstalować ten styl.

(Mam już menedżera stylów użytkownika, pozwól mi to zainstalować!)

// ==UserScript==
// @name        Auto Click Chatbox
// @namespace   https://greasyfork.org/en/users/1200587-trilla-g
// @match       *://*.kick.com/*
// @grant       none
// @version     7.3
// @license     MIT
// @author      Trilla_G
// @description This script automatically clicks the "Message Input" button on the sidebar, on kick.com when the stream is live.
// ==/UserScript==

(function() {
    'use strict';

    let clicked = false;


    function isLive() {
        let liveDisplay = document.querySelector(".vjs-tech");
        return liveDisplay;
    }

    function clickMessageInput() {
        let messageInputButton = document.querySelector('#message-input');
        if (isLive() && messageInputButton && !clicked) {
            messageInputButton.click();
            clicked = true;
        }
    }

    // Function to observe URL changes using MutationObserver
    const observeUrlChanges = () => {
        let currentUrl = window.location.href;

        const observer = new MutationObserver(mutationsList => {
            const newUrl = window.location.href;
            if (newUrl !== currentUrl && newUrl.includes('kick.com')) {
                clicked = false; // Reset the clicked flag on URL change
                currentUrl = newUrl;
                setTimeout(clickMessageInput, 1600); // 1.6-second delay before the click after URL change
            }
        });

        // Start observing changes to the attributes of the document's body
        observer.observe(document.body, { attributes: true, subtree: true });

        // Cleanup observer on page unload
        window.addEventListener('beforeunload', () => observer.disconnect());
    };

    // Initial run of the script
    setTimeout(clickMessageInput, 1600); // 1.6-second delay before the initial click

    // Initial observation of URL changes
    observeUrlChanges();
})();