From 5122edadac373ddd49323377155cff39434602bf Mon Sep 17 00:00:00 2001 From: mic Date: Mon, 13 May 2024 21:53:32 +0200 Subject: [PATCH] excluding disabled prompts. related to #12 --- js/mzta-menus.js | 2 +- js/mzta-prompts.js | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/js/mzta-menus.js b/js/mzta-menus.js index f9c8128f..5e27865a 100644 --- a/js/mzta-menus.js +++ b/js/mzta-menus.js @@ -42,7 +42,7 @@ export class mzta_Menus { async initialize() { - this.allPrompts = await getPrompts(); + this.allPrompts = await getPrompts(true); this.allPrompts.forEach((prompt) => { this.addAction(prompt) }); diff --git a/js/mzta-prompts.js b/js/mzta-prompts.js index 83cd5a93..f16aa0ec 100644 --- a/js/mzta-prompts.js +++ b/js/mzta-prompts.js @@ -138,10 +138,13 @@ const defaultPrompts = [ ]; -export async function getPrompts(){ +export async function getPrompts(filterDisabled = false){ const defaultPrompts = await getDefaultPrompts_withProps(); const customPrompts = await getCustomPrompts(); let output = defaultPrompts.concat(customPrompts); + if(filterDisabled){ + output = output.filter(obj => obj.enabled != 0); + } output.sort((a, b) => a.id.localeCompare(b.id)); for(let i=1; i<=output.length; i++){ output[i-1].idnum = i;