Clean code
This commit is contained in:
parent
677cb71c58
commit
415d448ae4
|
@ -118,157 +118,133 @@ export default new class V2_SettingsPanel {
|
||||||
updateSettings(id, enabled, sidebar) {
|
updateSettings(id, enabled, sidebar) {
|
||||||
if(!["lightcord-8", "no_window_bound", "enable_glasstron", "lightcord-10", "lightcord-11"].includes(id))settingsCookie[id] = enabled;
|
if(!["lightcord-8", "no_window_bound", "enable_glasstron", "lightcord-10", "lightcord-11"].includes(id))settingsCookie[id] = enabled;
|
||||||
|
|
||||||
if (id == "bda-gs-2") {
|
switch(id) {
|
||||||
if (enabled) DOM.addClass(document.body, "bd-minimal");
|
case "bda-gs-1":
|
||||||
else DOM.removeClass(document.body, "bd-minimal");
|
if (enabled) publicServersModule.addButton();
|
||||||
}
|
else publicServersModule.removeButton();
|
||||||
|
break;
|
||||||
if (id == "bda-gs-3") {
|
case "bda-gs-2":
|
||||||
if (enabled) DOM.addClass(document.body, "bd-minimal-chan");
|
if (enabled) DOM.addClass(document.body, "bd-minimal");
|
||||||
else DOM.removeClass(document.body, "bd-minimal-chan");
|
else DOM.removeClass(document.body, "bd-minimal");
|
||||||
}
|
break;
|
||||||
|
case "bda-gs-3":
|
||||||
if (id == "bda-gs-1") {
|
if (enabled) DOM.addClass(document.body, "bd-minimal-chan");
|
||||||
if (enabled) publicServersModule.addButton();
|
else DOM.removeClass(document.body, "bd-minimal-chan");
|
||||||
else publicServersModule.removeButton();
|
break;
|
||||||
}
|
case "bda-gs-4":
|
||||||
|
if (enabled) voiceMode.start();
|
||||||
if (id == "bda-gs-4") {
|
else voiceMode.stop();
|
||||||
if (enabled) voiceMode.start();
|
break;
|
||||||
else voiceMode.stop();
|
case "bda-gs-5":
|
||||||
}
|
if (enabled) DOM.addClass(DOM.query("#app-mount"), "bda-dark");
|
||||||
|
else DOM.removeClass(DOM.query("#app-mount"), "bda-dark");
|
||||||
if (id == "bda-gs-5") {
|
break;
|
||||||
if (enabled) DOM.addClass(DOM.query("#app-mount"), "bda-dark");
|
case "bda-gs-6":
|
||||||
else DOM.removeClass(DOM.query("#app-mount"), "bda-dark");
|
if (enabled) tfHour.inject24Hour();
|
||||||
}
|
break;
|
||||||
|
case "bda-gs-7":
|
||||||
if (enabled && id == "bda-gs-6") tfHour.inject24Hour();
|
if (enabled) coloredText.injectColoredText();
|
||||||
|
else coloredText.removeColoredText();
|
||||||
if (id == "bda-gs-7") {
|
break;
|
||||||
if (enabled) coloredText.injectColoredText();
|
case "bda-gs-8":
|
||||||
else coloredText.removeColoredText();
|
if (enabled) dMode.startDebugListener();
|
||||||
}
|
else dMode.stopDebugListener();
|
||||||
|
break;
|
||||||
if (id == "fork-ps-4") {
|
case "fork-ps-4":
|
||||||
if (enabled) ClassNormalizer.start();
|
if (enabled) ClassNormalizer.start();
|
||||||
else ClassNormalizer.stop();
|
else ClassNormalizer.stop();
|
||||||
}
|
break;
|
||||||
|
case "fork-ps-5":
|
||||||
if (id == "fork-ps-5") {
|
if (enabled) {
|
||||||
if (enabled) {
|
ContentManager.watchContent("plugin");
|
||||||
ContentManager.watchContent("plugin");
|
ContentManager.watchContent("theme");
|
||||||
ContentManager.watchContent("theme");
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
ContentManager.unwatchContent("plugin");
|
|
||||||
ContentManager.unwatchContent("theme");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id == "fork-wp-1") {
|
|
||||||
Utils.setWindowPreference("transparent", enabled);
|
|
||||||
if (enabled) Utils.setWindowPreference("backgroundColor", null);
|
|
||||||
else Utils.setWindowPreference("backgroundColor", "#2f3136");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (id == "bda-gs-8") {
|
|
||||||
if (enabled) dMode.startDebugListener();
|
|
||||||
else dMode.stopDebugListener();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id == "fork-dm-1") {
|
|
||||||
if (enabled) dMode.startCopySelector();
|
|
||||||
else dMode.stopCopySelector();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (id === "lightcord-1") {
|
|
||||||
if (enabled) window.Lightcord.Settings.devMode = true
|
|
||||||
else window.Lightcord.Settings.devMode = false
|
|
||||||
sidebar.forceUpdate()
|
|
||||||
}
|
|
||||||
if (id === "lightcord-2") {
|
|
||||||
if (enabled) window.Lightcord.Settings.callRingingBeat = true
|
|
||||||
else window.Lightcord.Settings.callRingingBeat = false
|
|
||||||
}
|
|
||||||
if (id === "lightcord-presence-1") {
|
|
||||||
if (enabled) {
|
|
||||||
CustomRichPresence.enable()
|
|
||||||
const settingsStore = BDModules.get(e => e.default && typeof e.default === "object" && "showCurrentGame" in e.default)[0]
|
|
||||||
if(settingsStore && !settingsStore.default.showCurrentGame){
|
|
||||||
BDModules.get(e => e.default && e.default.updateRemoteSettings)[0].default.updateRemoteSettings({
|
|
||||||
showCurrentGame: true
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
}
|
else {
|
||||||
else CustomRichPresence.disable()
|
ContentManager.unwatchContent("plugin");
|
||||||
}
|
ContentManager.unwatchContent("theme");
|
||||||
if (id === "lightcord-3") {
|
}
|
||||||
ipcRenderer.sendSync("LIGHTCORD_SET_ALWAYS_ON_TOP", enabled)
|
break;
|
||||||
}
|
case "fork-wp-1":
|
||||||
if (id === "lightcord-4") {
|
Utils.setWindowPreference("transparent", enabled);
|
||||||
if(enabled){
|
if (enabled) Utils.setWindowPreference("backgroundColor", null);
|
||||||
AntiAdDM.enable()
|
else Utils.setWindowPreference("backgroundColor", "#2f3136");
|
||||||
}else{
|
break;
|
||||||
AntiAdDM.disable()
|
case "fork-dm-1":
|
||||||
}
|
if (enabled) dMode.startCopySelector();
|
||||||
}
|
else dMode.stopCopySelector();
|
||||||
if (id === "lightcord-6") {
|
break;
|
||||||
if(enabled){
|
case "lightcord-1":
|
||||||
blurPrivate.enable()
|
if (enabled) window.Lightcord.Settings.devMode = true
|
||||||
}else{
|
else window.Lightcord.Settings.devMode = false
|
||||||
blurPrivate.disable()
|
sidebar.forceUpdate()
|
||||||
}
|
break;
|
||||||
}
|
case "lightcord-2":
|
||||||
if (id === "lightcord-7") {
|
if (enabled) window.Lightcord.Settings.callRingingBeat = true
|
||||||
if(enabled){
|
else window.Lightcord.Settings.callRingingBeat = false
|
||||||
disableTyping.enable()
|
break;
|
||||||
}else{
|
case "lightcord-3":
|
||||||
disableTyping.disable()
|
ipcRenderer.sendSync("LIGHTCORD_SET_ALWAYS_ON_TOP", enabled)
|
||||||
}
|
break;
|
||||||
}
|
case "lightcord-4":
|
||||||
if (id === "lightcord-8"){
|
enabled ? AntiAdDM.enable() : AntiAdDM.disable()
|
||||||
let appSettings = window.Lightcord.Api.settings
|
break;
|
||||||
appSettings.set("isTabs", enabled)
|
case "lightcord-6":
|
||||||
appSettings.save()
|
enabled ? blurPrivate.enable() : blurPrivate.disable()
|
||||||
DiscordNative.app.relaunch()
|
break;
|
||||||
}
|
case "lightcord-7":
|
||||||
if (id === "lightcord-9") {
|
enabled ? disableTyping.enable() : disableTyping.disable()
|
||||||
popoutWindow[enabled ? "enable" : "disable"]()
|
break;
|
||||||
}
|
case "lightcord-8":
|
||||||
if (id === "lightcord-10"){
|
let appSettings = window.Lightcord.Api.settings
|
||||||
core.methods.NotificationsUseShim(enabled)
|
appSettings.set("isTabs", enabled)
|
||||||
return
|
appSettings.save()
|
||||||
}
|
DiscordNative.app.relaunch()
|
||||||
if (id === "no_window_bound"){
|
break;
|
||||||
let appSettings = window.Lightcord.Api.settings
|
case "lightcord-9":
|
||||||
appSettings.set("NO_WINDOWS_BOUND", enabled)
|
enabled ? popoutWindow.enable() : popoutWindow.disable()
|
||||||
|
break;
|
||||||
appSettings.delete("IS_MAXIMIZED")
|
case "lightcord-10":
|
||||||
appSettings.delete("IS_MINIMIZED")
|
core.methods.NotificationsUseShim(enabled)
|
||||||
appSettings.delete("WINDOW_BOUNDS")
|
return;
|
||||||
|
case "lightcord-11":
|
||||||
appSettings.save()
|
let appSettings = window.Lightcord.Api.settings
|
||||||
DiscordNative.app.relaunch()
|
if(!enabled){
|
||||||
}
|
appSettings.delete("BD_"+id)
|
||||||
if (id === "enable_glasstron"){
|
appSettings.save()
|
||||||
let appSettings = window.Lightcord.Api.settings
|
return
|
||||||
appSettings.set("GLASSTRON", enabled)
|
}
|
||||||
appSettings.save()
|
appSettings.set("BD_"+id, enabled)
|
||||||
DiscordNative.app.relaunch()
|
|
||||||
}
|
|
||||||
|
|
||||||
if(id === "lightcord-11"){
|
|
||||||
let appSettings = window.Lightcord.Api.settings
|
|
||||||
if(!enabled){
|
|
||||||
appSettings.delete("BD_"+id)
|
|
||||||
appSettings.save()
|
appSettings.save()
|
||||||
return
|
return
|
||||||
}
|
case "lightcord-presence-1":
|
||||||
appSettings.set("BD_"+id, enabled)
|
if (enabled) {
|
||||||
appSettings.save()
|
CustomRichPresence.enable()
|
||||||
return
|
const settingsStore = BDModules.get(e => e.default && typeof e.default === "object" && "showCurrentGame" in e.default)[0]
|
||||||
|
if(settingsStore && !settingsStore.default.showCurrentGame){
|
||||||
|
BDModules.get(e => e.default && e.default.updateRemoteSettings)[0].default.updateRemoteSettings({
|
||||||
|
showCurrentGame: true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else CustomRichPresence.disable()
|
||||||
|
break;
|
||||||
|
case "no_window_bound":
|
||||||
|
let appSettings = window.Lightcord.Api.settings
|
||||||
|
appSettings.set("NO_WINDOWS_BOUND", enabled)
|
||||||
|
|
||||||
|
appSettings.delete("IS_MAXIMIZED")
|
||||||
|
appSettings.delete("IS_MINIMIZED")
|
||||||
|
appSettings.delete("WINDOW_BOUNDS")
|
||||||
|
|
||||||
|
appSettings.save()
|
||||||
|
DiscordNative.app.relaunch()
|
||||||
|
break;
|
||||||
|
case "enable_glasstron":
|
||||||
|
let appSettings = window.Lightcord.Api.settings
|
||||||
|
appSettings.set("GLASSTRON", enabled)
|
||||||
|
appSettings.save()
|
||||||
|
DiscordNative.app.relaunch()
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.saveSettings();
|
this.saveSettings();
|
||||||
|
|
|
@ -236,15 +236,15 @@
|
||||||
|
|
||||||
@keyframes emote-pulse {
|
@keyframes emote-pulse {
|
||||||
0% {
|
0% {
|
||||||
-webkit-transform: scale(1, 1);
|
transform: scale(1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
50% {
|
50% {
|
||||||
-webkit-transform: scale(1.2, 1.2);
|
transform: scale(1.2, 1.2);
|
||||||
}
|
}
|
||||||
|
|
||||||
100% {
|
100% {
|
||||||
-webkit-transform: scale(1, 1);
|
transform: scale(1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -550,12 +550,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.bd-layer {
|
.bd-layer {
|
||||||
-ms-flex-direction: column;
|
|
||||||
-webkit-box-direction: normal;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
display: -webkit-box;
|
|
||||||
display: -ms-flexbox;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
left: 0;
|
left: 0;
|
||||||
|
@ -1095,9 +1090,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ui-switch-item .ui-switch-wrapper {
|
.ui-switch-item .ui-switch-wrapper {
|
||||||
-webkit-user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
position: relative;
|
position: relative;
|
||||||
width: 44px;
|
width: 44px;
|
||||||
|
|
Loading…
Reference in New Issue