var timeoutId;
var currentTextId = null;
var annotation_data = null;
var annotationManager = null;
var menuConfigData = {
textSpans: null,
newGroupId: null,
selectedMentions: [],
recentSelectedEntityId: null,
recentSelectedEntity: null,
selectedEntities: [],
numSelectedEntities: 0,
selectedGroups: [],
numSelectedGroups: 0,
tieObjectOne: null,
tieObjectTwo: null,
tieMentionHoveredOne: null,
tieMentionHoveredTwo: null
};
var menu;
var mouseClicked = 0;
var menuTimer = null;
var getTexts = function(){
$.get({
url: 'json/texts',
success: function(data){
$('#response').html(JSON.stringify(data, null, 4));
if(data.success){
var textListDiv = $('#text-list');
var textListElm = $('
');
textListDiv.html('');
textListDiv.append(textListElm);
var i;
for(i = 0; i < data.texts.length; i++){
var text = data.texts[i];
textListElm.append('- '+
''+
text.title +' (processed: '+
((text.processed+'' == '1') ? 'yes' : 'no') +')'+
'
');
}
}
}
});
};
var upload = function(event){
console.log('Uploading form data...');
$.post({
url: 'json/texts',
data: new FormData($('#file-upload-form')[0]),
success: function(data){
$('#response').html(JSON.stringify(data, null, 4));
console.log(data.success, data.additional_data.id !== undefined);
// Keep fetching info about the book until it says that
// it's been processed.
if(data.success || data.additional_data.id !== undefined){
pollTextStatus(data.additional_data.id);
}
},
error: function(jqXHR, textStatus, errorThrown){
$('#response').html('ERROR: '+ errorThrown);
},
dataType: 'json',
processData: false,
contentType: false
});
event.preventDefault();
};
var displayAnnotation = function(){
// Clear the annotation list.
// $('#annotation-list').html('');
console.log("In displayAnnotation");
var charListOuterElm = $('#entity-list');
var charListElm = $('