Commit 2da84a727bc52304ded4129ea2df8a147f47c6e9
- Diff rendering mode:
- inline
- side by side
static/text-annotation.js
(16 / 2)
  | |||
36 | 36 | //$(document).mouseout(onHoverOut); | |
37 | 37 | }; | |
38 | 38 | window.listAnno = function() { // list annotations of current page | |
39 | console.log('listing annotations'); | ||
39 | //console.log('listing annotations'); | ||
40 | 40 | $.get(config.indexer + '/search?data=' + | |
41 | 41 | JSON.stringify({'where': window.location.search.split('url=')[1]}), | |
42 | 42 | function(data) { | |
… | … | ||
61 | 61 | //$(document).unbind('mouseover', onHover); | |
62 | 62 | //$(document).unbind('mouseout', onHoverOut); | |
63 | 63 | }; | |
64 | window.shiftBar = function() { | ||
65 | var margin_top = $('#annotate-bar').css('marginTop'); | ||
66 | var margin = Number(margin_top.split('px')[0]); | ||
67 | if(margin < 10) { | ||
68 | $('#annotate-bar').css('marginTop', (window.innerHeight-50)+'px'); | ||
69 | $('#shift-bar').html('⇑'); | ||
70 | } | ||
71 | else { | ||
72 | $('#annotate-bar').css('marginTop', '0px'); | ||
73 | $('#shift-bar').html('⇓'); | ||
74 | } | ||
75 | }; | ||
64 | 76 | var toolbar_template = function() { | |
65 | 77 | return '<div class="navbar">'+ | |
66 | 78 | '<div class="navbar-inner"> <ul class="nav">'+ | |
… | … | ||
84 | 84 | '<li><button class="btn" id="list-anno-btn" onclick="listAnno();">Annotations</button></li>' + | |
85 | 85 | '<li><a></a></li>'+ | |
86 | 86 | '<li><button class="btn" id="publish">Publish</button></li>' + | |
87 | '<li><a></a></li>'+ | ||
88 | '<li><button type="button" id="shift-bar" class="btn" onclick="shiftBar();">⇓</button></li>'+ | ||
87 | 89 | '</ul></div></div>' + | |
88 | 90 | '<div id="sweeted"></div> <div id="posted"></div> <div id="fail-posting"></div>'+ | |
89 | 91 | '<div id="list-anno" class="modal hide fade" role="dialog" aria-labelledby="list-anno-label" aria-hidden="true">'+ | |
… | … | ||
104 | 104 | window.shiftModal = function() { | |
105 | 105 | var margin_left = $('#list-anno').css('marginLeft'); | |
106 | 106 | var margin = Number(margin_left.split('px')[0]); | |
107 | console.log(margin); | ||
107 | //console.log(margin); | ||
108 | 108 | if(margin < 100) { | |
109 | 109 | $('#list-anno').css('marginLeft', '28%'); | |
110 | 110 | } |
static/tree.js
(20 / 12)
  | |||
42 | 42 | drawRGraph(); | |
43 | 43 | return; | |
44 | 44 | } | |
45 | console.log('Loading ontology file'); | ||
45 | //console.log('Loading ontology file'); | ||
46 | 46 | var url = 'static/graphs/GirijaKalyanaStory.json' | |
47 | 47 | $.ajax({ | |
48 | 48 | type: 'GET', | |
49 | 49 | url: url, | |
50 | 50 | dataType: 'json', | |
51 | 51 | success: function(data) { | |
52 | console.log('Ontology JSON loaded'); | ||
52 | //console.log('Ontology JSON loaded'); | ||
53 | 53 | ontology_json = data; | |
54 | 54 | drawRGraph(); | |
55 | 55 | }, | |
56 | 56 | error: function(xhr, errtype, errtext) { | |
57 | 57 | console.log('Could not load Ontology JSON!'); | |
58 | alert('Could not load Ontology JSON!'); | ||
58 | 59 | console.log(errtype, ':', errtext); | |
59 | 60 | } | |
60 | 61 | }); | |
… | … | ||
94 | 94 | }; | |
95 | 95 | ||
96 | 96 | var removeItem = function(event) { | |
97 | console.log($(event.currentTarget)); | ||
97 | //console.log($(event.currentTarget)); | ||
98 | 98 | var id = $(event.currentTarget).parent().parent().attr('id'); | |
99 | 99 | var node = id.split('-')[1]; | |
100 | 100 | $(event.currentTarget).parent().parent().remove(); | |
… | … | ||
121 | 121 | event.stopPropagation(); | |
122 | 122 | } | |
123 | 123 | //Log.write('centering node ', node.name); | |
124 | console.log('centering node', node.name); | ||
124 | //console.log('centering node', node.name); | ||
125 | 125 | RGraph.onClick(node.id, { | |
126 | 126 | hideLabels: false, | |
127 | 127 | onComplete: function() { | |
… | … | ||
152 | 152 | Stats.appendSelectedList(); | |
153 | 153 | }, | |
154 | 154 | remove: function(node) { | |
155 | console.log(node); | ||
155 | //console.log(node); | ||
156 | 156 | var idx = _.indexOf(sweet.nodes, node); | |
157 | 157 | if(idx !== -1) { | |
158 | 158 | sweet.nodes.splice(idx, 1); | |
… | … | ||
198 | 198 | var swts = ''; | |
199 | 199 | for(var i in sweet.swts) { | |
200 | 200 | var data = sweet.swts[i]; | |
201 | console.log(data); | ||
201 | //console.log(data); | ||
202 | 202 | var swt = '@'+data.who+' #'+data.what+' / '+data.where; | |
203 | 203 | swt += ' {' + data.how.join() + ' }'; | |
204 | 204 | swts += swt + '\n'; | |
205 | 205 | } | |
206 | console.log(swts); | ||
206 | //console.log(swts); | ||
207 | 207 | $('#sweeted').html(sweeted_template(swts)); | |
208 | 208 | $('#sweeted').show(); | |
209 | 209 | sweet.swts = []; | |
… | … | ||
248 | 248 | //span: 5, | |
249 | 249 | //height: 40, | |
250 | 250 | //width: 150, | |
251 | angularWidth: 100, | ||
251 | //angularWidth: 100, | ||
252 | 252 | //autoHeight: true, | |
253 | 253 | //autoWidth: true, | |
254 | 254 | dim: 10 | |
… | … | ||
265 | 265 | transition: $jit.Trans.Sine.easeIn, | |
266 | 266 | levelDistance: 150, | |
267 | 267 | onCreateLabel: function(domElement, node) { | |
268 | console.log('oncreatelabel'); | ||
268 | //console.log('oncreatelabel'); | ||
269 | 269 | }, | |
270 | 270 | onPlaceLabel: function(domElement, node) { | |
271 | console.log('onplacelabel'); | ||
271 | //console.log('onplacelabel'); | ||
272 | 272 | /*var style = domElement.style; | |
273 | 273 | var top = parseInt(style.top); | |
274 | 274 | console.log('top :', top); | |
275 | 275 | style.top = (top - 40) + 'px';*/ | |
276 | 276 | }, | |
277 | 277 | Events: { | |
278 | enableForEdges: true, | ||
278 | 279 | enable: true, | |
279 | type: 'Native', | ||
280 | onMouseEnter: function() { | ||
280 | type: 'auto', | ||
281 | onMouseEnter: function(node, event, e) { | ||
282 | console.log(node, event, e); | ||
281 | 283 | rgraph.canvas.getElement().style.cursor = 'pointer'; | |
282 | 284 | }, | |
283 | 285 | onMouseLeave: function() { | |
… | … | ||
291 | 291 | return; | |
292 | 292 | } | |
293 | 293 | centerNode(e, node); | |
294 | }, | ||
295 | onDragMove: function(node, eventInfo, e) { | ||
296 | var pos = eventInfo.getPos(); | ||
297 | node.pos.setc(pos.x, pos.y); | ||
298 | rgraph.plot(); | ||
294 | 299 | } | |
295 | 300 | } | |
296 | 301 | }); |