Update ThemeSettings.plugin.js

This commit is contained in:
Mirco Wittrien 2018-12-11 22:15:42 +01:00
parent 3743383fd2
commit 3c3579c808
1 changed files with 10 additions and 10 deletions

View File

@ -7,7 +7,7 @@ class ThemeSettings {
getDescription () {return "Allows you to change Theme Variables within BetterDiscord.";} getDescription () {return "Allows you to change Theme Variables within BetterDiscord.";}
getVersion () {return "1.0.1";} getVersion () {return "1.0.2";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -126,7 +126,7 @@ class ThemeSettings {
button.className = "bda-settings-button themes-settings-button"; button.className = "bda-settings-button themes-settings-button";
button.innerText = "Settings"; button.innerText = "Settings";
footer.appendChild(button); footer.appendChild(button);
$(button).on("click." + this.getName(), () => { button.addEventListener("click", () => {
li.classList.remove("settings-closed"); li.classList.remove("settings-closed");
li.classList.add("settings-open"); li.classList.add("settings-open");
let children = []; let children = [];
@ -134,14 +134,14 @@ class ThemeSettings {
children.push(li.firstChild); children.push(li.firstChild);
li.firstChild.remove(); li.firstChild.remove();
} }
$(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg></div>`) let closebutton = $(`<div style="float: right; cursor: pointer;"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 12 12" style="width: 18px; height: 18px;"><g class="background" fill="none" fill-rule="evenodd"><path d="M0 0h12v12H0"></path><path class="fill" fill="#dcddde" d="M9.5 3.205L8.795 2.5 6 5.295 3.205 2.5l-.705.705L5.295 6 2.5 8.795l.705.705L6 6.705 8.795 9.5l.705-.705L6.705 6"></path></g></svg></div>`)[0];
.on("click." + this.getName(), () => { li.appendChild(closebutton);
li.classList.remove("settings-open"); closebutton.addEventListener("click", () => {
li.classList.add("settings-closed"); li.classList.remove("settings-open");
while (li.childElementCount) li.firstChild.remove(); li.classList.add("settings-closed");
while (children.length) li.appendChild(children.shift()); while (li.childElementCount) li.firstChild.remove();
}) while (children.length) li.appendChild(children.shift());
.appendTo(li); })
li.appendChild(this.createThemeSettings(name, vars)); li.appendChild(this.createThemeSettings(name, vars));
}); });
} }