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

Unified Diff: block.js

Issue 5279235799252992: Issue 491 - Validate custom filters (Closed)
Patch Set: Created Nov. 19, 2014, 3:26 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 | « background.js ('k') | lib/filterValidation.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: block.js
===================================================================
--- a/block.js
+++ b/block.js
@@ -64,12 +64,20 @@
function addFilters()
{
- // Tell the background page to add the filters
- var filters = document.getElementById("filters").value.split(/[\r\n]+/)
- .map(function(f) {return f.replace(/^\s+/, "").replace(/\s+$/, "");})
- .filter(function(f) {return f != "";});
- ext.backgroundPage.sendMessage({type: "add-filters", filters: filters});
- closeDialog(true);
+ ext.backgroundPage.sendMessage(
+ {
+ type: "add-filters",
+ text: document.getElementById("filters").value
+ },
+
+ function(response)
+ {
+ if (response.status == "ok")
+ closeDialog(true);
+ else
+ alert(response.error);
+ }
+ );
}
function closeDialog(success)
« no previous file with comments | « background.js ('k') | lib/filterValidation.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld