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

Added status button in browser action to see and set the whitelist status

Fixes #535
This commit is contained in:
kkapsner 2021-05-25 16:44:20 +02:00
parent 16bef43945
commit 42b19a4ba5
7 changed files with 156 additions and 57 deletions

View file

@ -36,6 +36,7 @@
regExp = new RegExp(entry, "i");
}
return {
value: entry,
match: function(url){
if (domain){
return (url.hostname || "").match(regExp);
@ -119,9 +120,23 @@
await settings.set(type + "List", oldValue + (oldValue? ",": "") + entry);
return updateList(type);
};
scope.removeFrom = async function removeFromList(type, entry){
const oldValue = settings[type + "List"];
const filter = entry.forEach? v => entry.indexOf(v) === -1: v => v !== entry;
await settings.set(
type + "List",
oldValue
.split(",")
.map(v => v.replace(/^\s+|\s+$/, ""))
.filter(filter)
.join(",")
);
return updateList(type);
};
scope.update = updateList;
scope.updateAll = function updateAllLists(){
updateList("white");
updateList("sessionWhite");
updateList("ignore");
updateList("black");
updateStackList(settings.stackList);