helloworld202110163.com / GP7 "1ST" Cheat

// ==UserScript==
// @name         GP7 "1ST" Cheat
// @namespace    http://tampermonkey.net/
// @version      1.0
// @description  Make u always the 1st to type 1st after recording
// @author       GP7 Ghst
// @match        https://www.pottersschool.org/gp7/*
// @grant        none
// @license MIT
// ==/UserScript==

(function() {
    'use strict';

    // --- Configuration ---
    const TARGET_TEXT = "Meeting is being recorded";
    const TEXT_TO_ENTER = "1st";
    const EVENT_SPAN_SELECTOR = "span.chat-event";
    const TEXT_AREA_SELECTOR = "textarea.ant-input";
    // For better performance, target a specific chat container if possible, otherwise use document.body
    const OBSERVE_TARGET_NODE = document.body;

    // Create an observer instance linked to a callback function
    const observer = new MutationObserver((mutationsList, obs) => {
        // Look through all mutations that just occurred
        for (const mutation of mutationsList) {
            // We are only interested in nodes being added
            if (mutation.type === 'childList') {
                // Look through all added nodes
                for (const node of mutation.addedNodes) {
                    // Ensure the node is an element, not just text
                    if (node.nodeType === 1) {
                        // Check if the added node itself is the span we're looking for
                        // Or if it contains the span we're looking for
                        const eventSpan = node.matches(EVENT_SPAN_SELECTOR) ? node : node.querySelector(EVENT_SPAN_SELECTOR);

                        if (eventSpan && eventSpan.textContent.trim() === TARGET_TEXT) {
                            console.log("Detected recording message. Performing action.");

                            // Find the text area on the page
                            const textArea = document.querySelector(TEXT_AREA_SELECTOR);
                            if (textArea) {
                                // Set the value of the text area
                                textArea.value = TEXT_TO_ENTER;

                                // Create and dispatch an "Enter" keydown event
                                document.getElementsByClassName("ant-btn ant-btn-primary ant-btn-sm")[3].click()

                                // --- THIS IS THE CRITICAL STEP TO NEVER CHECK AGAIN ---
                                console.log("Action complete. Disconnecting observer.");
                                obs.disconnect(); // Stop observing for any future changes
                                return; // Exit the function
                            } else {
                                console.error("Could not find the text area.");
                            }
                        }
                    }
                }
            }
        }
    });

    // Configuration of the observer:
    const config = { childList: true, subtree: true };

    // Start observing the target node for configured mutations
    observer.observe(OBSERVE_TARGET_NODE, config);

    console.log("Observer is now watching for the recording message.");

})();