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:
parent
16bef43945
commit
42b19a4ba5
7 changed files with 156 additions and 57 deletions
15
lib/lists.js
15
lib/lists.js
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue