From 356885667b9aae12d15bf9e74e391d892134fbfa Mon Sep 17 00:00:00 2001 From: mic Date: Tue, 9 Sep 2025 22:27:19 +0200 Subject: [PATCH] context menu loading fixed --- mzta-background.js | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/mzta-background.js b/mzta-background.js index e5f0f42c..c57dc390 100644 --- a/mzta-background.js +++ b/mzta-background.js @@ -870,14 +870,8 @@ function setupStorageChangeListener() { if(newConnectionType === "chatgpt_web"){ removeContextMenu(contextMenuID_AddTags); removeContextMenu(contextMenuID_Spamfilter); - }else{ - if(prefs_init.add_tags && prefs_init.add_tags_context_menu){ - addContextMenu(contextMenuID_AddTags); - } - if(prefs_init.spamfilter && prefs_init.spamfilter_context_menu){ - addContextMenu(contextMenuID_Spamfilter); - } } + addContextMenuItems(); } // context menu changes for add_tags and spamfilter @@ -961,16 +955,19 @@ function removeContextMenu(menu_id) { taLog.log("Context menu removed: " + menu_id); } -// Add Context menu: Add tags -if(prefs_init.add_tags && prefs_init.add_tags_context_menu && ((prefs_init.connection_type !== "chatgpt_web")||checkSpecificIntegration(prefs_init.add_tags_use_specific_integration,prefs_init.add_tags_connection_type))){ - addContextMenu(contextMenuID_AddTags); -} - -// Add Context menu: Spamfilter -if(prefs_init.spamfilter && prefs_init.spamfilter_context_menu && ((prefs_init.connection_type !== "chatgpt_web")||checkSpecificIntegration(prefs_init.spamfilter_use_specific_integration,prefs_init.spamfilter_connection_type))){ - addContextMenu(contextMenuID_Spamfilter); +function addContextMenuItems() { + // Add Context menu: Add tags + if(prefs_init.add_tags && prefs_init.add_tags_context_menu && ((prefs_init.connection_type !== "chatgpt_web")||checkSpecificIntegration(prefs_init.add_tags_use_specific_integration,prefs_init.add_tags_connection_type))){ + addContextMenu(contextMenuID_AddTags); + } + + // Add Context menu: Spamfilter + if(prefs_init.spamfilter && prefs_init.spamfilter_context_menu && ((prefs_init.connection_type !== "chatgpt_web")||checkSpecificIntegration(prefs_init.spamfilter_use_specific_integration,prefs_init.spamfilter_connection_type))){ + addContextMenu(contextMenuID_Spamfilter); + } } +addContextMenuItems(); // Listen for context menu item clicks browser.menus.onClicked.addListener( (info, tab) => {