Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: background.js

Issue 5838948538515456: Issue 370 - Make "Block element" hide elements for added filters (Closed)
Patch Set: Fixed failsafe code Created March 4, 2015, 6:51 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | block.js » ('j') | include.preload.js » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -20,6 +20,7 @@
this.Filter = Filter;
this.BlockingFilter = BlockingFilter;
this.WhitelistFilter = WhitelistFilter;
+ this.ElemHideFilter = ElemHideFilter;
}
with(require("subscriptionClasses"))
{
@@ -534,10 +535,17 @@
break;
}
+ var selectors = [];
for (var i = 0; i < filters.length; i++)
- FilterStorage.addFilter(filters[i]);
+ {
+ var filter = filters[i];
+ FilterStorage.addFilter(filter);
- sendResponse({status: "ok"});
+ if (filter instanceof ElemHideFilter)
+ selectors.push(filter.selector);
+ }
+
+ sendResponse({status: "ok", selectors: selectors});
break;
case "add-subscription":
ext.showOptions(function(page)
« no previous file with comments | « no previous file | block.js » ('j') | include.preload.js » ('J')

Powered by Google App Engine
This is Rietveld