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

Decoupled block mode from protected part

Fixes #287
This commit is contained in:
kkapsner 2018-10-23 08:26:23 +02:00
parent 5932ac2292
commit 8b9197a68a
17 changed files with 356 additions and 211 deletions

View file

@ -21,21 +21,19 @@
scope.check = function check({url, errorStack}){
url = new URL(url || "about:blank");
var match = checkBoth(errorStack, url, settings.get("blockMode", url)).match(
/^(block|allow|fake|ask)(|Readout|Everything|Context|Input|Internal)$/
/^(block|allow|fake|ask)(|Everything|Internal)$/
);
if (match){
return {
url: url,
type: (match[2] === "Everything" || match[2] === "")?
["context", "readout", "input"]:
[match[2].toLowerCase()],
internal: match[2] === "Internal",
mode: match[1]
};
}
else {
return {
url: url,
type: ["context", "readout", "input"],
internal: false,
mode: "block"
};
}
@ -72,21 +70,9 @@
mode = "block";
break;
case "block":
case "blockContext":
case "blockReadout":
case "blockInput":
case "ask":
case "askContext":
case "askReadout":
case "askInput":
case "fake":
case "fakeContext":
case "fakeReadout":
case "fakeInput":
case "allow":
case "allowContext":
case "allowReadout":
case "allowInput":
if (url && lists.get("white").match(url)){
mode = "allow";
}