1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
|
/*
This file is part of rhizi, a collaborative knowledge graph editor.
Copyright (C) 2014-2015 Rhizi
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* [!] order must match function args order
*/
define([
'buttons',
'devtools',
'drag_n_drop',
'feedback',
'history',
'keyshortcuts',
'model/core',
'robot',
'rz_core',
'textanalysis',
'textanalysis.ui',
'util',
'view/filter_menu',
'view/search',
'view/selection',
'view/filter',
],
/**
* [!] order must match define element order
*/
function(
buttons,
devtools,
drag_n_drop,
feedback,
history,
keyshortcuts,
model_core,
robot,
rz_core,
textanalysis,
textanalysis_ui,
util,
filter_menu,
search,
selection,
view_filter
) {
function fix_feedback_scrolling_to_visibility_causing_topbar_to_slide_slowly_in_webkit() {
$('.feedback-btn').attr('tabindex', -1);
}
function expand(obj){
if (!obj.savesize) {
obj.savesize = obj.size;
}
obj.size = Math.max(obj.savesize, obj.value.length);
}
this.main = function() {
var json;
console.log('Rhizi main started');
$('#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);
}
keyshortcuts.install();
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 (false && !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
view_filter.init();
model_core.init(rz_config);
rz_core.init();
textanalysis.init(rz_core.main_graph);
search.init();
filter_menu.init();
selection.setup_toolbar(rz_core.main_graph, rz_core.main_graph_view);
$.feedback({ajaxURL: rz_config.feedback_url});
fix_feedback_scrolling_to_visibility_causing_topbar_to_slide_slowly_in_webkit();
// setup debug
if (util.getParameterByName('debug')) {
$('#devtools').show();
rz_core.edit_graph.set_user('fakeuser');
rz_core.main_graph.set_user('fakeuser');
drag_n_drop.init();
} else {
// drag and drop prevented in normal operation (debug not set)
drag_n_drop.prevent_default_drop_behavior();
}
}
return {
main: main };
}
);
|