Index: devtools-panel.js |
=================================================================== |
--- 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; |
kzar
2016/02/03 10:27:17
Nit: `domainSpecific = domainSpecific || request.u
Sebastian Noack
2016/02/03 10:35:27
No, that's only if it's a popup.
kzar
2016/02/03 10:40:27
Acknowledged. Though the first suggestion still st
|
} |
+ if (domainSpecific) |
+ options.push("domain=" + request.docDomain); |
+ |
+ if (options.length > 0) |
+ filter += "$" + options.join(","); |
+ |
return filter; |
} |
@@ -96,13 +103,19 @@ |
} |
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; |
} |