summaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorAlon Levy <alon@pobox.com>2014-12-16 17:37:42 +0200
committerAlon Levy <alon@pobox.com>2014-12-16 17:37:42 +0200
commitade19de410e0a789a921ec1666b278b2a64176d6 (patch)
treec4c54b106de93609ca7bb70a20fd4be696715dbe /src/main.js
parentc7d026b1d504323a8c61d51b726e5e8d2337fc4b (diff)
moving files around after repository merger
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/main.js b/src/main.js
deleted file mode 100644
index 863d0440..00000000
--- a/src/main.js
+++ /dev/null
@@ -1,94 +0,0 @@
-define(['textanalysis.ui', 'textanalysis', 'buttons', 'history', 'drag_n_drop', 'robot', 'model/core', 'rz_config', 'rz_core', 'view/selection', 'util', 'view/completer'],
-function(textanalysis_ui, textanalysis, buttons, history, drag_n_drop, robot, model_core, rz_config, rz_core, selection, util, completer) {
-
- function expand(obj){
- if (!obj.savesize) {
- obj.savesize = obj.size;
- }
- obj.size = Math.max(obj.savesize, obj.value.length);
- }
-
- this.main = function() {
- var json,
- search = $('#search'),
- search_completer = completer(search, $('#search-suggestion'),
- {triggerStart:' ', triggerEnd:' '});
-
- console.log('Rhizi main started');
- search_completer.options.plug(textanalysis.suggestions_options);
- drag_n_drop.init();
- $('#editname').onkeyup = function() { expand(this); };
- $('#editlinkname').onkeyup = function() { expand(this); };
- $('#textanalyser').onkeyup = function() { expand(this); };
-
- textanalysis_ui.main();
-
- json = util.getParameterByName('json');
- if (json) {
- rz_core.load_from_json(json);
- }
- if (util.getParameterByName('debug')) {
- $(document.body).addClass('debug');
- rz_core.graph.set_user('fakeuser');
- }
-
- document.body.onkeyup = function(e) {
- var key = (e.key || (e.charCode && String.fromCharCode(e.charCode))
- || (e.which && String.fromCharCode(e.which))).toLowerCase();
-
- if (e.altKey && e.ctrlKey && key == 'i') {
- $('#textanalyser').focus();
- }
- if (e.altKey && e.ctrlKey && key == 'o') {
- search.focus();
- }
- if (e.ctrlKey && key == 'z' && e.target.nodeName !== 'INPUT') {
- // TODO: rz_core.graph.undo();
- }
- };
- // TODO: move me somewhere
- function search_on_submit() {
- var text = search[0].value.trim(),
- r;
-
- try {
- r = new RegExp(text.replace(/ /, '|'), 'i');
- } catch (e) {
- return; // don't clear selection either
- }
- if (text.length > 0) {
- selection.byVisitors(function (n) { return n.name.match(r); });
- } else {
- selection.clear();
- }
- rz_core.update_view__graph(false);
- };
- search.on('input', search_on_submit);
- search.on('keydown', function(e) {
- if (e.which == 13 && !search_completer.handleEnter()) {
- e.preventDefault();
- search_on_submit(e);
- return false;
- }
- return undefined;
- });
-
- var intro_task_elem = $('#intro-task');
- // TODO: messages (why tasks?) - this one is special but we want them to be handled in their own file.
- if (!localStorage.intro_task_hide) {
- intro_task_elem.show();
- }
- $('#intro-task .task-close-button').click(function(e) {
- localStorage.intro_task_hide = true;
- intro_task_elem.hide();
- });
-
- // TODO: interaction between the hack above and this
- model_core.init(rz_config);
- textanalysis.init(rz_core.graph);
- }
-
- return {
- main: main };
- }
-);