Auto Click Create Ticket Button with Ticket Limit

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

2025-04-14 या दिनांकाला. सर्वात नवीन आवृत्ती पाहा.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey, Greasemonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey किंवा Violentmonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

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

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला Tampermonkey यासारखे एक्स्टेंशन इंस्टॉल करावे लागेल..

ही स्क्रिप्ट इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्क्रिप्ट व्यवस्थापक एक्स्टेंशन इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्क्रिप्ट व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला Stylus सारखे एक्स्टेंशन इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

ही स्टाईल इंस्टॉल करण्यासाठी तुम्हाला एक युझर स्टाईल व्यवस्थापक इंस्टॉल करावे लागेल.

(माझ्याकडे आधीच युझर स्टाईल व्यवस्थापक आहे, मला इंस्टॉल करू द्या!)

// ==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);
})();