Auto Click Chatbox

This script automatically clicks the "Message Input" button on the sidebar, on kick.com.

Stan na 29-12-2023. 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  3.0
// @license     MIT
// @author      Trilla_G
// @description This script automatically clicks the "Message Input" button on the sidebar, on kick.com.
// ==/UserScript==

(function () {
    'use strict';

    function getPlayer() {
        var possibleVideo = document.querySelector('.vjs-tech');
        if (!possibleVideo || possibleVideo.nodeName !== "VIDEO") {
            return null;
        }
        return possibleVideo;
    }

    function clickMessageInput() {
        var videoPlayer = getPlayer();
        if (videoPlayer) {
            console.log('Video found. Clicking "Message Input" button.');
            var messageInputButton = document.querySelector('#message-input');
            if (messageInputButton) {
                var clickEvent = document.createEvent('MouseEvents');
                clickEvent.initEvent('click', true, true);
                messageInputButton.dispatchEvent(clickEvent);
            }
        } else {
            console.log('No video found on the page.');
        }
    }

    // Initial click and observe hashchange
    setTimeout(function () {
        clickMessageInput();
    }, 1337);

    // Create a MutationObserver to retrigger on hashchange
    const observer = new MutationObserver(() => {
        console.log('Hashchange event detected. Retriggering script.');
        clickMessageInput();
    });

    // Configure and start observing changes to the URL hash
    const config = { childList: true, subtree: true };
    observer.observe(document.body, config);
})();