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

Unified Diff: background.js

Issue 29321198: Issue 2376 - Implement custom filters in new options page (Closed)
Patch Set: Small fixes Created July 15, 2015, 12:04 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 | « README.md ('k') | locale/en-US/options.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: background.js
===================================================================
--- a/background.js
+++ b/background.js
@@ -31,6 +31,14 @@
}
}
+ var params = {
+ blockedURLs: "",
+ seenDataCorruption: false,
+ filterlistsReinitialized: false,
+ addSubscription: false,
+ filterError: false
+ };
+ updateFromURL(params);
Sebastian Noack 2015/07/15 14:30:08 Nit: There should be an empty line below.
saroyanm 2015/07/15 14:36:05 Done.
var modules = {};
global.require = function(module)
{
@@ -153,6 +161,24 @@
return new modules.filterClasses.Filter(text);
};
+ modules.filterValidation =
+ {
+ parseFilter: function(text)
+ {
+
+ if (params.filterError)
+ return {error: "filter-parsing-error"};
Sebastian Noack 2015/07/15 14:30:08 Nit: This is human readable text. So no need for d
saroyanm 2015/07/15 14:36:05 Done.
+ return {filter: modules.filterClasses.Filter.fromText(text)};
+ },
+ parseFilters: function(text)
+ {
+ if (params.filterError)
+ return {errors: ["filter-parsing-error"]};
+ return {filters:
+ text.split("\n").map(modules.filterClasses.Filter.fromText)};
+ }
+ };
+
modules.synchronizer = {
Synchronizer: {}
};
@@ -161,8 +187,6 @@
defaultMatcher: {
matchesAny: function(url, requestType, docDomain, thirdParty)
{
- var params = {blockedURLs: ""};
- updateFromURL(params);
var blocked = params.blockedURLs.split(",");
if (blocked.indexOf(url) >= 0)
return new modules.filterClasses.BlockingFilter();
@@ -221,7 +245,23 @@
"@@||alternate.de^$document",
"@@||der.postillion.com^$document",
"@@||taz.de^$document",
- "@@||amazon.de^$document"
+ "@@||amazon.de^$document",
+ "||biglemon.am/bg_poster/banner.jpg",
+ "winfuture.de###header_logo_link",
+ "###WerbungObenRechts10_GesamtDIV",
+ "###WerbungObenRechts8_GesamtDIV",
+ "###WerbungObenRechts9_GesamtDIV",
+ "###WerbungUntenLinks4_GesamtDIV",
+ "###WerbungUntenLinks7_GesamtDIV",
+ "###WerbungUntenLinks8_GesamtDIV",
+ "###WerbungUntenLinks9_GesamtDIV",
+ "###Werbung_Sky",
+ "###Werbung_Wide",
+ "###__ligatus_placeholder__",
+ "###ad-bereich1-08",
+ "###ad-bereich1-superbanner",
+ "###ad-bereich2-08",
+ "###ad-bereich2-skyscrapper"
];
var knownFilters = filters.map(modules.filterClasses.Filter.fromText);
@@ -236,14 +276,10 @@
knownSubscriptions[subscriptionUrl] = modules.subscriptionClasses.Subscription.fromURL(subscriptionUrl);
var customSubscription = knownSubscriptions["~user~786254"];
- var issues = {seenDataCorruption: false, filterlistsReinitialized: false};
- updateFromURL(issues);
- global.seenDataCorruption = issues.seenDataCorruption;
- global.filterlistsReinitialized = issues.filterlistsReinitialized;
+ global.seenDataCorruption = params.seenDataCorruption;
+ global.filterlistsReinitialized = params.filterlistsReinitialized;
- var events = {addSubscription: false};
- updateFromURL(events);
- if (events.addSubscription)
+ if (params.addSubscription)
{
// We don't know how long it will take for the page to fully load
// so we'll post the message after one second
« no previous file with comments | « README.md ('k') | locale/en-US/options.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld