diff --git a/src/index-bd.js b/src/index-bd.js index e83a72b1..87a5e437 100644 --- a/src/index-bd.js +++ b/src/index-bd.js @@ -1,12 +1,17 @@ -// const { initUI, destroy } = require('./undiscord'); +import { initUI, destroy, toggleWindow } from './undiscord'; export default class Undiscord { // Required function. Called when the plugin is activated (including after reloads) start() { - // initUI(); + initUI(); } + + getSettingsPanel() { + toggleWindow(true); + } + // Required function. Called when the plugin is deactivated stop() { - // destroy(); + destroy(); } } diff --git a/src/undiscord.js b/src/undiscord.js index a59a5361..014c1d2d 100644 --- a/src/undiscord.js +++ b/src/undiscord.js @@ -69,16 +69,6 @@ export function initUI() { }); _observer.observe(discordElm, { attributes: false, childList: true, subtree: true }); - function toggleWindow() { - if (undiscordWindow.style.display !== 'none') { - undiscordWindow.style.display = 'none'; - undiscordBtn.style.color = 'var(--interactive-normal)'; - } - else { - undiscordWindow.style.display = ''; - undiscordBtn.style.color = 'var(--interactive-active)'; - } - } messagePicker.init(); @@ -128,6 +118,17 @@ export function initUI() { } +export function toggleWindow(bool) { + if (bool || undiscordWindow.style.display === 'none') { + undiscordWindow.style.display = ''; + undiscordBtn.style.color = 'var(--interactive-active)'; + } + else { + undiscordWindow.style.display = 'none'; + undiscordBtn.style.color = 'var(--interactive-normal)'; + } +} + let _stopFlag; const stopHndl = () => !(_stopFlag === true);