Auto Click Chatbox

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

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

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

    // ==UserScript==
    // @name        Auto Click Chatbox
    // @namespace   https://greasyfork.org/en/users/1200587-trilla-g
    // @match       *://*.kick.com/*
    // @grant       none
    // @version     1.0
    // @license     MIT
    // @author      Trilla_G
    // @description This script automatically clicks the "Chat" button and "Message Input" on the sidebar, on kick.com.
    // ==/UserScript==
     
    (function() {
        'use strict';
     
        function isLive() {
            let liveDisplay = document.querySelector(".vjs-live-control");
            return liveDisplay && !liveDisplay.classList.contains('vjs-hidden');
        }
     
        function clickChatAndMessageInput() {
            let chatButton = document.querySelector('#chat-button');
            let messageInputButton = document.querySelector('#message-input');
     
            if (isLive()) {
                if (messageInputButton) {
                    messageInputButton.click();
                }
            } else {
                if (chatButton) {
                    chatButton.click();
                }
                if (messageInputButton) {
                    messageInputButton.click();
                }
            }
        }
     
        // Create a MutationObserver to retrigger on hashchange
        const observer = new MutationObserver(() => {
            console.log('Hashchange event detected. Retriggering script.');
            clickChatAndMessageInput();
        });
     
        // Configure and start observing changes to the URL hash
        const config = { childList: true, subtree: true };
        observer.observe(document.body, config);
     
        // Initial click and observe hashchange
        setTimeout(function() {
            clickChatAndMessageInput();
        }, 1000);
    })();