Auto Click Create Ticket Button with Ticket Limit

Auto-clicks 'Create ticket' unless 3 or more ticket channels exist

Stan na 14-04-2025. 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 Create Ticket Button with Ticket Limit
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Auto-clicks 'Create ticket' unless 3 or more ticket channels exist
// @author       Yui
// @match        *://*/*
// @grant        none
// @license MIT
// ==/UserScript==

(function () {
    'use strict';

    const MAX_TICKET_CHANNELS = 3;
    let stopClicking = false;

    function checkTicketChannelCount() {
        const elements = document.querySelectorAll(".name__2ea32.overflow__82b15");
        let count = 0;

        elements.forEach(el => {
            if (/ticket/i.test(el.textContent)) {
                count++;
            }
        });

        if (count >= MAX_TICKET_CHANNELS) {
            console.log(`[AutoTicket] Found ${count} ticket channels. Stopping click.`);
            stopClicking = true;
        } else {
            stopClicking = false;
        }
    }

    function clickButton() {
        checkTicketChannelCount();
        if (stopClicking) return;

        const button = document.querySelector(".button__201d5.lookFilled__201d5.colorPrimary__201d5.sizeSmall__201d5.grow__201d5");
        if (button) {
            button.click();
            console.log("[AutoTicket] Create Ticket button clicked.");
        } else {
            console.log("[AutoTicket] Button not found.");
        }
    }

    const observer = new MutationObserver(() => clickButton());
    observer.observe(document.body, { childList: true, subtree: true });

    setInterval(clickButton, 2000);
})();