summaryrefslogtreecommitdiff
path: root/src/bg
diff options
context:
space:
mode:
authorhackademix2019-07-21 10:55:59 +0200
committerhackademix2019-07-23 18:11:14 +0200
commit8f71c8f4d35f3af21b59439e7afb6ebf3b6ea8e8 (patch)
tree6d23974553bb14144df13217dce76e92915f3d6f /src/bg
parentdc2cf89b3f50880ede81dd874238917e8445d7e4 (diff)
downloadnoscript-8f71c8f4d35f3af21b59439e7afb6ebf3b6ea8e8.tar.gz
noscript-8f71c8f4d35f3af21b59439e7afb6ebf3b6ea8e8.tar.xz
noscript-8f71c8f4d35f3af21b59439e7afb6ebf3b6ea8e8.zip
Add "Collapse blocked objects" option to the Blocked Objects prompt.
Diffstat (limited to 'src/bg')
-rw-r--r--src/bg/RequestGuard.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/bg/RequestGuard.js b/src/bg/RequestGuard.js
index bdf2ea2..a3631c8 100644
--- a/src/bg/RequestGuard.js
+++ b/src/bg/RequestGuard.js
@@ -173,7 +173,7 @@ var RequestGuard = (() => {
TabStatus.recordAll(sender.tab.id, message.seen);
return true;
},
- async enable(message, sender) {
+ async blockedObjects(message, sender) {
let {url, documentUrl, policyType} = message;
let TAG = `<${policyType.toUpperCase()}>`;
let origin = Sites.origin(url);
@@ -184,7 +184,8 @@ var RequestGuard = (() => {
}
options = [
{label: _("allowLocal", siteKey), checked: true},
- {label: _("allowLocal", origin)}
+ {label: _("allowLocal", origin)},
+ {label: _("CollapseBlockedObjects")},
];
let t = u => `${TAG}@${u}`;
let ret = await Prompts.prompt({
@@ -193,6 +194,9 @@ var RequestGuard = (() => {
options});
debug(`Prompt returned %o`);
if (ret.button !== 0) return;
+ if (ret.option === 2) {
+ return {collapse: "all"};
+ }
let key = [siteKey, origin][ret.option || 0];
if (!key) return;
let {siteMatch, contextMatch, perms} = ns.policy.get(key, documentUrl);
@@ -210,7 +214,7 @@ var RequestGuard = (() => {
ns.policy.set(key, perms);
await ns.savePolicy();
}
- return true;
+ return {enable: key};
},
}
const Content = {