Sltrooms Enable Uploads

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

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

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

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

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

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

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

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.

(I already have a user style manager, let me install it!)

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