Sltrooms Enable Uploads

8/2/2025, 1:53:46 PM

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

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

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

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.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name        Sltrooms Enable Uploads
// @namespace   Violentmonkey Scripts
// @match       *://sltrooms.cc/r/*
// @grant       none
// @version     1.0
// @author      SenorCompost
// @description 8/2/2025, 1:53:46 PM
// @license MIT
// ==/UserScript==


waitForElement("button[class='btn btn-success btn-icon upload_new_files_to_room']").then((element) => {
 enableUploads();
});


function enableUploads(){
  MutationObserver = window.MutationObserver || window.WebKitMutationObserver;
      var myobserver = new MutationObserver(mutations => {
        var element = document.querySelector("button[class='btn btn-success btn-icon upload_new_files_to_room']");
        if(element && element.style.display == 'none'){
          element.removeAttribute('style');
        }
      });

    myobserver.observe(document, {
        childList: true,
        subtree: true,
        attributes: true
  });
}

function waitForElement(selector) {
    return new Promise((resolve) => {
        var observer = new MutationObserver((mutations, observer) => {
            var element = document.querySelector(selector);
            if (element) {
                observer.disconnect();
                resolve(element);
            }
        });

        observer.observe(document, {
            childList: true,
            subtree: true,
            attributes: true
        });
    });
}