Commit 2da84a727bc52304ded4129ea2df8a147f47c6e9

The annotation bar can now be shifted to top or bottom
  
3636 //$(document).mouseout(onHoverOut);
3737 };
3838 window.listAnno = function() { // list annotations of current page
39 console.log('listing annotations');
39 //console.log('listing annotations');
4040 $.get(config.indexer + '/search?data=' +
4141 JSON.stringify({'where': window.location.search.split('url=')[1]}),
4242 function(data) {
6161 //$(document).unbind('mouseover', onHover);
6262 //$(document).unbind('mouseout', onHoverOut);
6363 };
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('&uArr;');
70 }
71 else {
72 $('#annotate-bar').css('marginTop', '0px');
73 $('#shift-bar').html('&dArr;');
74 }
75 };
6476 var toolbar_template = function() {
6577 return '<div class="navbar">'+
6678 '<div class="navbar-inner"> <ul class="nav">'+
8484 '<li><button class="btn" id="list-anno-btn" onclick="listAnno();">Annotations</button></li>' +
8585 '<li><a></a></li>'+
8686 '<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();">&dArr;</button></li>'+
8789 '</ul></div></div>' +
8890 '<div id="sweeted"></div> <div id="posted"></div> <div id="fail-posting"></div>'+
8991 '<div id="list-anno" class="modal hide fade" role="dialog" aria-labelledby="list-anno-label" aria-hidden="true">'+
104104 window.shiftModal = function() {
105105 var margin_left = $('#list-anno').css('marginLeft');
106106 var margin = Number(margin_left.split('px')[0]);
107 console.log(margin);
107 //console.log(margin);
108108 if(margin < 100) {
109109 $('#list-anno').css('marginLeft', '28%');
110110 }
  
4242 drawRGraph();
4343 return;
4444 }
45 console.log('Loading ontology file');
45 //console.log('Loading ontology file');
4646 var url = 'static/graphs/GirijaKalyanaStory.json'
4747 $.ajax({
4848 type: 'GET',
4949 url: url,
5050 dataType: 'json',
5151 success: function(data) {
52 console.log('Ontology JSON loaded');
52 //console.log('Ontology JSON loaded');
5353 ontology_json = data;
5454 drawRGraph();
5555 },
5656 error: function(xhr, errtype, errtext) {
5757 console.log('Could not load Ontology JSON!');
58 alert('Could not load Ontology JSON!');
5859 console.log(errtype, ':', errtext);
5960 }
6061 });
9494};
9595
9696var removeItem = function(event) {
97 console.log($(event.currentTarget));
97 //console.log($(event.currentTarget));
9898 var id = $(event.currentTarget).parent().parent().attr('id');
9999 var node = id.split('-')[1];
100100 $(event.currentTarget).parent().parent().remove();
121121 event.stopPropagation();
122122 }
123123 //Log.write('centering node ', node.name);
124 console.log('centering node', node.name);
124 //console.log('centering node', node.name);
125125 RGraph.onClick(node.id, {
126126 hideLabels: false,
127127 onComplete: function() {
152152 Stats.appendSelectedList();
153153 },
154154 remove: function(node) {
155 console.log(node);
155 //console.log(node);
156156 var idx = _.indexOf(sweet.nodes, node);
157157 if(idx !== -1) {
158158 sweet.nodes.splice(idx, 1);
198198 var swts = '';
199199 for(var i in sweet.swts) {
200200 var data = sweet.swts[i];
201 console.log(data);
201 //console.log(data);
202202 var swt = '@'+data.who+' #'+data.what+' / '+data.where;
203203 swt += ' {' + data.how.join() + ' }';
204204 swts += swt + '\n';
205205 }
206 console.log(swts);
206 //console.log(swts);
207207 $('#sweeted').html(sweeted_template(swts));
208208 $('#sweeted').show();
209209 sweet.swts = [];
248248 //span: 5,
249249 //height: 40,
250250 //width: 150,
251 angularWidth: 100,
251 //angularWidth: 100,
252252 //autoHeight: true,
253253 //autoWidth: true,
254254 dim: 10
265265 transition: $jit.Trans.Sine.easeIn,
266266 levelDistance: 150,
267267 onCreateLabel: function(domElement, node) {
268 console.log('oncreatelabel');
268 //console.log('oncreatelabel');
269269 },
270270 onPlaceLabel: function(domElement, node) {
271 console.log('onplacelabel');
271 //console.log('onplacelabel');
272272 /*var style = domElement.style;
273273 var top = parseInt(style.top);
274274 console.log('top :', top);
275275 style.top = (top - 40) + 'px';*/
276276 },
277277 Events: {
278 enableForEdges: true,
278279 enable: true,
279 type: 'Native',
280 onMouseEnter: function() {
280 type: 'auto',
281 onMouseEnter: function(node, event, e) {
282 console.log(node, event, e);
281283 rgraph.canvas.getElement().style.cursor = 'pointer';
282284 },
283285 onMouseLeave: function() {
291291 return;
292292 }
293293 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();
294299 }
295300 }
296301 });