make dashboard accesible from everywhere to Plugin Click, ctrl + enter just in domainspace

This commit is contained in:
viehlieb 2022-03-11 14:06:32 +01:00
parent 0c8ce940a8
commit 07f663abb0
5 changed files with 54 additions and 20 deletions

View file

@ -1,3 +1,22 @@
browser.browserAction.onClicked.addListener((tab) => {
console.log(tab.url);
});
"use strict";
function onError(error) {
console.error(`Error: ${error}`);
}
function sendMessageToTabs(tabs) {
for (let tab of tabs) {
browser.tabs.sendMessage(
tab.id,
{overlay: "display"}
).then(response => {
}).catch(onError);
}
}
browser.browserAction.onClicked.addListener(() => {
browser.tabs.query({
currentWindow: true,
active: true
}).then(sendMessageToTabs).catch(onError);
});