make themes work better

This commit is contained in:
Malte Jürgens
2023-02-18 15:23:14 +01:00
parent 30c0526ff7
commit b39e23d462
6 changed files with 70 additions and 30 deletions

View File

@@ -161,13 +161,14 @@ function main() {
userscript.log("Loading userstyles...");
userscript.loadingMessage = "Loading userstyles...";
let stylesheet = document.getElementById("discordScreenaudioUserstyles");
if (!stylesheet) {
stylesheet = document.createElement("style");
stylesheet.id = "discordScreenaudioUserstyles";
stylesheet.type = "text/css";
document.head.appendChild(stylesheet);
if (stylesheet) {
userscript.log("Removing old userstyles...");
stylesheet.remove();
}
stylesheet = document.createElement("style");
stylesheet.id = "discordScreenaudioUserstyles";
stylesheet.innerText = userscript.userstyles;
document.head.appendChild(stylesheet);
userscript.log("Finished loading userstyles");
userscript.loadingMessage = "";
}
@@ -329,6 +330,18 @@ function main() {
})
);
section.appendChild(
createButton("Install Theme", () => {
userscript.showThemeDialog();
})
);
section.appendChild(
createButton("Uninstall Theme", () => {
userscript.installUserStyles("");
})
);
section.appendChild(
createSwitch(
"Move discord-screenaudio to the system tray instead of closing",