Untitled

mail@pastecode.io avatar
unknown
javascript
2 months ago
1.1 kB
2
Indexable
Never
// ==UserScript==
// @name         KG_MainChatReload
// @namespace    http://tampermonkey.net/
// @version      2024-01-02
// @description  Fix the issue with the chat lost connection by reloading the page
// @author       Patcher
// @match        *://klavogonki.ru/g*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=klavogonki.ru
// @grant        none
// ==/UserScript==

(function() {

    // Select the input element
    var inputElement = document.querySelector('.text');

    // Use MutationObserver to observe changes to the attributes of the input element
    var observer = new MutationObserver(function (mutations) {
        mutations.forEach(function (mutation) {
            // Check if 'disabled' attribute is present
            if (inputElement.disabled) {
                // Reload the current page
                location.reload();
            }
        });
    });

    // Configure and start the MutationObserver
    var observerConfig = { attributes: true };
    observer.observe(inputElement, observerConfig);

})();
Leave a Comment