From daf05239a1215607af528627a9422ef3de61f876 Mon Sep 17 00:00:00 2001 From: Yazazuyo <63968466+MiepHD@users.noreply.github.com> Date: Sun, 10 Dec 2023 20:21:17 +0100 Subject: [PATCH] Enable/Disable Navigation without restart (#1507) --- src/plugins/navigation/index.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/plugins/navigation/index.ts b/src/plugins/navigation/index.ts index ed339a8e..3c23092b 100644 --- a/src/plugins/navigation/index.ts +++ b/src/plugins/navigation/index.ts @@ -10,18 +10,21 @@ import backHTML from './templates/back.html?raw'; export default createPlugin({ name: () => t('plugins.navigation.name'), description: () => t('plugins.navigation.description'), - restartNeeded: true, + restartNeeded: false, config: { enabled: true, }, stylesheets: [style], - renderer() { - const forwardButton = ElementFromHtml(forwardHTML); - const backButton = ElementFromHtml(backHTML); - const menu = document.querySelector('#right-content'); - - if (menu) { - menu.prepend(backButton, forwardButton); - } + renderer: { + start() { + const forwardButton = ElementFromHtml(forwardHTML); + const backButton = ElementFromHtml(backHTML); + const menu = document.querySelector('#right-content'); + menu?.prepend(backButton, forwardButton); + }, + stop() { + document.querySelector('[tab-id=FEmusic_back]')?.remove(); + document.querySelector('[tab-id=FEmusic_next]')?.remove(); + }, }, });