improved the dynamic menu prompts loading
This commit is contained in:
parent
8277645c87
commit
58cdd01c19
2 changed files with 15 additions and 13 deletions
|
|
@ -103,22 +103,24 @@ async function handleShortcut(tab) {
|
|||
}
|
||||
}
|
||||
|
||||
async function preparePopupMenu(tab) {
|
||||
await taStore.setSessionData("lastShortcutTabId", tab.id);
|
||||
await taStore.setSessionData("lastShortcutTabType", tab.type);
|
||||
await taStore.setSessionData("lastShortcutPromptsData", menus.shortcutMenu);
|
||||
//console.log(">>>>>>>> menus.shortcutMenu: " + JSON.stringify(menus.shortcutMenu));
|
||||
function preparePopupMenu(tab) {
|
||||
let output = {};
|
||||
output.lastShortcutTabId = tab.id;
|
||||
output.lastShortcutTabType = tab.type;
|
||||
output.lastShortcutPromptsData = menus.shortcutMenu;
|
||||
output.lastShortcutFiltering = 0;
|
||||
switch (tab.type) {
|
||||
case "mail":
|
||||
case "messageDisplay":
|
||||
taStore.setSessionData("lastShortcutFiltering", 1);
|
||||
output.lastShortcutFiltering = 1;
|
||||
break;
|
||||
case "messageCompose":
|
||||
taStore.setSessionData("lastShortcutFiltering", 2);
|
||||
output.lastShortcutFiltering = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return output;
|
||||
}
|
||||
|
||||
messenger.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
|
|
@ -224,8 +226,8 @@ messenger.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|||
if(tabs.length == 0){
|
||||
return false;
|
||||
}
|
||||
await preparePopupMenu(tabs[0]);
|
||||
return true;
|
||||
return preparePopupMenu(tabs[0]);
|
||||
//return true;
|
||||
}
|
||||
return _popup_menu_ready();
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@ document.addEventListener('DOMContentLoaded', async () => {
|
|||
taLog = new taLogger("mzta-popup",prefs.do_debug);
|
||||
let reponse = await browser.runtime.sendMessage({command: "popup_menu_ready"});
|
||||
taLog.log("Preparing data to load the popup menu: " + JSON.stringify(reponse));
|
||||
let tabId = await taStore.getSessionData("lastShortcutTabId");
|
||||
let tabType = await taStore.getSessionData("lastShortcutTabType");
|
||||
let filtering = await taStore.getSessionData("lastShortcutFiltering");
|
||||
let _prompts_data = await taStore.getSessionData("lastShortcutPromptsData");
|
||||
let tabId = reponse.lastShortcutTabId;
|
||||
let tabType = reponse.lastShortcutTabType;
|
||||
let filtering = reponse.lastShortcutFiltering;
|
||||
let _prompts_data = reponse.lastShortcutPromptsData;
|
||||
taLog.log("_prompts_data: " + JSON.stringify(_prompts_data));
|
||||
let active_prompts = filterPromptsForTab(_prompts_data, filtering);
|
||||
taLog.log("active_prompts: " + JSON.stringify(active_prompts));
|
||||
|
|
|
|||
Loading…
Reference in a new issue