1
0
Fork 0
mirror of https://github.com/kkapsner/CanvasBlocker synced 2025-07-04 20:46:39 +02:00

Added session white list

Fixes #197
This commit is contained in:
kkapsner 2018-07-17 13:07:50 +02:00
parent 6c2dbbebf0
commit 5077c86859
11 changed files with 306 additions and 1 deletions

View file

@ -12,6 +12,7 @@
const domainNotification = require("./domainNotification");
const Notification = require("./Notification");
const {createActionButtons, modalPrompt} = require("./gui");
const lists = require("./lists");
Promise.all([
browser.tabs.query({active: true, currentWindow: true}),
@ -98,6 +99,25 @@
}
});
}
},
{
name: "whitelistDomainTemporarily",
isIcon: true,
callback: function(domain){
modalPrompt(
browser.i18n.getMessage("inputSessionWhitelistURL"),
domain
).then(function(domain){
if (domain){
lists.appendTo("sessionWhite", domain).then(function(){
window.close();
});
}
else {
window.close();
}
});
}
}
].forEach(function(domainAction){
domainNotification.addAction(domainAction);
@ -137,6 +157,25 @@
}
});
}
},
{
name: "whitelistURLTemporarily",
isIcon: true,
callback: function({url}){
modalPrompt(
browser.i18n.getMessage("inputSessionWhitelistDomain"),
"^" + url.href.replace(/([\\+*?[^\]$(){}=!|.])/g, "\\$1") + "$"
).then(function(url){
if (url){
lists.appendTo("sessionWhite", url).then(function(){
window.close();
});
}
else {
window.close();
}
});
}
}
].forEach(function(action){
Notification.addAction(action);