BetterDiscordApp-rauenzi/src/builtins/minimalmode.js

35 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-06-06 21:57:25 +02:00
import Builtin from "../structs/builtin";
2019-05-30 23:18:52 +02:00
export default new class MinimalMode extends Builtin {
get name() {return "MinimalMode";}
2019-06-06 06:28:43 +02:00
get category() {return "appearance";}
get id() {return "minimalMode";}
get hideChannelsID() {return "hideChannels";}
2019-06-06 21:57:25 +02:00
get hideChannels() {return this.get(this.hideChannelsID);}
2019-05-30 23:18:52 +02:00
constructor() {
super();
this.enableHideChannels = this.enableHideChannels.bind(this);
this.disableHideChannels = this.disableHideChannels.bind(this);
}
enabled() {
2019-06-20 04:19:34 +02:00
document.body.classList.add("bd-minimal");
2019-05-30 23:18:52 +02:00
if (this.hideChannels) this.enableHideChannels();
2019-06-06 21:57:25 +02:00
this.hideChannelCancel = this.registerSetting(this.hideChannelsID, this.enableHideChannels, this.disableHideChannels);
2019-05-30 23:18:52 +02:00
}
disabled() {
2019-06-20 04:19:34 +02:00
document.body.classList.remove("bd-minimal");
2019-05-30 23:18:52 +02:00
if (this.hideChannels) this.disableHideChannels();
if (this.hideChannelCancel) this.hideChannelCancel();
}
enableHideChannels() {
2019-06-20 04:19:34 +02:00
document.body.classList.add("bd-minimal-chan");
2019-05-30 23:18:52 +02:00
}
disableHideChannels() {
2019-06-20 04:19:34 +02:00
document.body.classList.remove("bd-minimal-chan");
2019-05-30 23:18:52 +02:00
}
};