Trying new things

This commit is contained in:
Jordan Wages 2025-07-06 18:05:19 -05:00
commit 13751b3ab2
3 changed files with 23 additions and 21 deletions

View file

@ -372,7 +372,7 @@ async function clearCacheForMessages(idsInput) {
//for the love of god work please
browser.messageDisplayAction.onClicked.addListener(async (tab, info) => {
try {
let header = await browser.messageDisplay.getDisplayedMessages();
let header = await browser.messageDisplay.getDisplayedMessages(tab.id);
if (!header) {
logger.aiLog("No header, no message loaded?", { debug: true });
return;
@ -386,6 +386,10 @@ async function clearCacheForMessages(idsInput) {
}
});
browser.messageDisplay.onMessagesDisplayed.addListener(async (tab, displayedMessages) => {
logger.aiLog("Messages displayed!", { debug: true }, displayedMessages);
});
browser.menus.onClicked.addListener(async (info, tab) => {
if (info.menuItemId === "apply-ai-rules-list" || info.menuItemId === "apply-ai-rules-display") {
const ids = info.selectedMessages?.messages?.map(m => m.id) ||

View file

@ -8,14 +8,14 @@ document.addEventListener("DOMContentLoaded", async () => {
}
const thisTab = await browser.tabs.getCurrent();
const baseTabId = thisTab.openerTabId ?? thisTab.id;
const [header] = await browser.messageDisplay.getDisplayedMessages(baseTabId);
//const baseTabId = thisTab.openerTabId ?? thisTab.id;
//const [header] = await browser.messageDisplay.getDisplayedMessages(baseTabId);
if (header) {
loadMessage(header.id);
} else {
aiLog("Details popup: no displayed message found");
}
//if (header) {
// loadMessage(header.id);
//} else {
// aiLog("Details popup: no displayed message found");
//}
});
async function loadMessage(id) {

View file

@ -40,8 +40,6 @@
"accountsRead",
"menus",
"scripting",
"tabs",
"*://*/*"
],
"content_security_policy": "script-src 'self'; object-src 'none'; connect-src 'self' http: https:"
"tabs"
]
}