summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-04 00:57:55 +0200
committerAlon Levy <alon@pobox.com>2014-12-04 01:20:18 +0200
commitbf096d5589fe119f42f96a2a9c6235db486e87ff (patch)
tree76207390420bde5ad49808c21c08ea58b104a559
parent0e177f7b3e13c8c3860aca648c06df64e1744f02 (diff)
search: prevent default enter event
-rw-r--r--src/main.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/main.js b/src/main.js
index 4f58c7e0..e3c5599f 100644
--- a/src/main.js
+++ b/src/main.js
@@ -38,13 +38,20 @@ function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop,
// TODO: move me somewhere
$('#search').on('input', function(e) {
var text = this.value,
- r = new RegExp(text.replace(' ', '|')); // TODO fails for quotes
+ r = new RegExp(text.trim()); // TODO fails for quotes
if (text.length > 0) {
selection.byVisitors(function (n) { return n.name.match(r); });
} else {
selection.clear();
}
rz_core.update_view__graph(false);
+ e.preventDefault();
+ });
+ $('#search').on('keypress', function(e) {
+ if (e.which == 13) {
+ return false;
+ }
+ return undefined;
});
var intro_task_elem = $('#intro-task');