mirror of
https://github.com/kkapsner/CanvasBlocker
synced 2025-07-04 20:46:39 +02:00
Added pageAction to display the notifications.
This commit is contained in:
parent
cba5680406
commit
5cec9781c2
10 changed files with 84 additions and 3 deletions
26
pageAction/pageAction.js
Normal file
26
pageAction/pageAction.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
// console.log(window, browser, browser.runtime);
|
||||
browser.tabs.query({active: true, currentWindow: true}).then(function(tabs){
|
||||
if (!tabs.length){
|
||||
throw new Error("noTabsFound");
|
||||
}
|
||||
var tab = tabs[0];
|
||||
browser.runtime.onMessage.addListener(function(data){
|
||||
if (Array.isArray(data["canvasBlocker-notifications"])){
|
||||
var ul = document.getElementById("prints");
|
||||
data["canvasBlocker-notifications"].forEach(function(notification){
|
||||
var li = document.createElement("li");
|
||||
li.className = "print";
|
||||
li.textContent = notification.url + ": " + notification.messageId + " (" + notification.timestamp + ")" + "\n" + notification.errorStack;
|
||||
ul.appendChild(li);
|
||||
});
|
||||
}
|
||||
});
|
||||
browser.tabs.sendMessage(
|
||||
tab.id,
|
||||
{
|
||||
"canvasBlocker-sendNotifications": tab.id
|
||||
}
|
||||
);
|
||||
}).catch(function(e){
|
||||
console.error(e);
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue