[Pkg-mozext-commits] [adblock-plus] 13/87: Issue 154 - Make the devtools panel generate domain specific filters when $genericblock is active
David Prévot
taffit at moszumanska.debian.org
Sat Apr 30 17:59:03 UTC 2016
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit b845b0d186180366bb0c148545ef6cc3b3c16669
Author: Sebastian Noack <sebastian at adblockplus.org>
Date: Wed Feb 3 10:16:06 2016 +0100
Issue 154 - Make the devtools panel generate domain specific filters when $genericblock is active
---
devtools-panel.js | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/devtools-panel.js b/devtools-panel.js
index 8ce7742..85068dd 100644
--- a/devtools-panel.js
+++ b/devtools-panel.js
@@ -17,18 +17,25 @@
"use strict";
-function generateFilter(request)
+function generateFilter(request, domainSpecific)
{
var filter = request.url.replace(/^[\w\-]+:\/+(?:www\.)?/, "||");
+ var options = [];
if (request.type == "POPUP")
{
- filter += "$popup";
+ options.push("popup");
if (request.url == "about:blank")
- filter += ",domain=" + request.docDomain;
+ domainSpecific = true;
}
+ if (domainSpecific)
+ options.push("domain=" + request.docDomain);
+
+ if (options.length > 0)
+ filter += "$" + options.join(",");
+
return filter;
}
@@ -96,13 +103,19 @@ function createRecord(request, filter, template)
}
if (!filter.whitelisted && request.type != "ELEMHIDE")
- actionWrapper.appendChild(createActionButton("add", "Add exception", "@@" + generateFilter(request)));
+ actionWrapper.appendChild(createActionButton(
+ "add", "Add exception", "@@" + generateFilter(request, false)
+ ));
if (filter.userDefined)
- actionWrapper.appendChild(createActionButton("remove", "Remove rule", filter.text));
+ actionWrapper.appendChild(createActionButton(
+ "remove", "Remove rule", filter.text
+ ));
}
else
- actionWrapper.appendChild(createActionButton("add", "Block item", generateFilter(request)));
+ actionWrapper.appendChild(createActionButton(
+ "add", "Block item", generateFilter(request, request.specificOnly)
+ ));
return row;
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list