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

Unified Diff: files/whitelist.js

Issue 8493027: Acquired Opera AdBlock code (Closed)
Patch Set: Created Oct. 8, 2012, 5:58 a.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 | « files/translators.js ('k') | help.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: files/whitelist.js
===================================================================
new file mode 100644
--- /dev/null
+++ b/files/whitelist.js
@@ -0,0 +1,13 @@
+const whitelist = {
+ check: function(url) {
+ rules = lists.whitelist.get();
+ for(i in rules) {
+ if(url.match(this.regex(rules[i])))
+ return false;
+ }
+ return true;
+ },
+ regex: function(rule) {
+ return RegExp(rule.replace(".","\\.").replace("*",".*").replace("[","\\[").replace("(","\\(").replace("||","[a-z]+://([a-z]+\\.){0,2}").replace("^","[!\"#$&'()*+,/:;<=>?@[\\]\\\\^`{}|~]"));
+ }
+};
« no previous file with comments | « files/translators.js ('k') | help.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld