Trying new things
This commit is contained in:
parent
bd56cbf19a
commit
13751b3ab2
3 changed files with 23 additions and 21 deletions
|
@ -372,7 +372,7 @@ async function clearCacheForMessages(idsInput) {
|
||||||
//for the love of god work please
|
//for the love of god work please
|
||||||
browser.messageDisplayAction.onClicked.addListener(async (tab, info) => {
|
browser.messageDisplayAction.onClicked.addListener(async (tab, info) => {
|
||||||
try {
|
try {
|
||||||
let header = await browser.messageDisplay.getDisplayedMessages();
|
let header = await browser.messageDisplay.getDisplayedMessages(tab.id);
|
||||||
if (!header) {
|
if (!header) {
|
||||||
logger.aiLog("No header, no message loaded?", { debug: true });
|
logger.aiLog("No header, no message loaded?", { debug: true });
|
||||||
return;
|
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) => {
|
browser.menus.onClicked.addListener(async (info, tab) => {
|
||||||
if (info.menuItemId === "apply-ai-rules-list" || info.menuItemId === "apply-ai-rules-display") {
|
if (info.menuItemId === "apply-ai-rules-list" || info.menuItemId === "apply-ai-rules-display") {
|
||||||
const ids = info.selectedMessages?.messages?.map(m => m.id) ||
|
const ids = info.selectedMessages?.messages?.map(m => m.id) ||
|
||||||
|
|
14
details.js
14
details.js
|
@ -8,14 +8,14 @@ document.addEventListener("DOMContentLoaded", async () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
const thisTab = await browser.tabs.getCurrent();
|
const thisTab = await browser.tabs.getCurrent();
|
||||||
const baseTabId = thisTab.openerTabId ?? thisTab.id;
|
//const baseTabId = thisTab.openerTabId ?? thisTab.id;
|
||||||
const [header] = await browser.messageDisplay.getDisplayedMessages(baseTabId);
|
//const [header] = await browser.messageDisplay.getDisplayedMessages(baseTabId);
|
||||||
|
|
||||||
if (header) {
|
//if (header) {
|
||||||
loadMessage(header.id);
|
// loadMessage(header.id);
|
||||||
} else {
|
//} else {
|
||||||
aiLog("Details popup: no displayed message found");
|
// aiLog("Details popup: no displayed message found");
|
||||||
}
|
//}
|
||||||
});
|
});
|
||||||
|
|
||||||
async function loadMessage(id) {
|
async function loadMessage(id) {
|
||||||
|
|
|
@ -40,8 +40,6 @@
|
||||||
"accountsRead",
|
"accountsRead",
|
||||||
"menus",
|
"menus",
|
||||||
"scripting",
|
"scripting",
|
||||||
"tabs",
|
"tabs"
|
||||||
"*://*/*"
|
]
|
||||||
],
|
|
||||||
"content_security_policy": "script-src 'self'; object-src 'none'; connect-src 'self' http: https:"
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue