diff options
Diffstat (limited to 'src/main.js')
| -rw-r--r-- | src/main.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/main.js b/src/main.js index b4f71001..feefcf57 100644 --- a/src/main.js +++ b/src/main.js @@ -1,5 +1,5 @@ -define(['textanalysis.ui', 'textanalysis', 'buttons', 'history', 'drag_n_drop', 'robot', 'model/core', 'rz_config', 'rz_core'], -function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, robot, model_core, rz_config, rz_core) { +define(['textanalysis.ui', 'textanalysis', 'buttons', 'history', 'drag_n_drop', 'robot', 'model/core', 'rz_config', 'rz_core', 'view/selection'], +function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, robot, model_core, rz_config, rz_core, selection) { function getParameterByName(name) { name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); @@ -43,6 +43,18 @@ function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, $('#search').focus(); } }; + // TODO: move me somewhere + $('#search').on('input', function(e) { + var text = this.value, + r = new RegExp(text.replace(' ', '|')); // TODO fails for quotes + console.log('search: ' + text); + if (text.length > 0) { + selection.byVisitors(function (n) { return n.name.match(r); }); + } else { + selection.clear(); + } + rz_core.update_view__graph(false); + }); // TODO: interaction between the hack above and this model_core.init(rz_config); textanalysis.init(); |
