<commit_before>annotorious.plugin.DenichePlugin.prototype._extendEditor = function(annotator) {
	var fieldsEl = document.getElementById('fields');
	annotator.editor.addField(fieldsEl);

	anno.addHandler('onSelectionCompleted', function(ev) {
		// HACK:
		// set shape when new selection is completed so we can use it in the YUI autocompletion plugins.
		anno.currentShape = ev.shape;
	});

	anno.addHandler('onEditorShown', function(annotation) {
		// HACK:
		// set shape when adding to existing annotation so we can use it in the YUI autocompletion plugins.
		if (annotation && annotation.shapes) {
			anno.currentShape = annotation.shapes[0];
		}
		YUI().use('node', 'event', function(Y) {
			Y.one('a.annotorious-editor-button-save').setHTML('Done'); // Hack: turn save into done button
			Y.all('li.tagitem').each(function(tagNode) {
				if (annotation && annotation.targetId == tagNode.getAttribute('targetId'))
					tagNode.show();
				else
					tagNode.hide();

			})
		})
	});
}

<commit_msg>fix broken cancel/done button logic<commit_after>annotorious.plugin.DenichePlugin.prototype._extendEditor = function(annotator) {
	var oSelf = this;
	var fieldsEl = document.getElementById('fields');

	this.saveButton   = document.getElementsByClassName('annotorious-editor-button-save').item(0); 
	this.cancelButton = document.getElementsByClassName('annotorious-editor-button-cancel').item(0); 

	annotator.editor.addField(fieldsEl);
	this.saveButton.innerHTML = "Done";

	anno.addHandler('onSelectionCompleted', function(ev) {
		// HACK:
		// set shape when new selection is completed 
		// so we can use it in the YUI autocompletion plugins.
		anno.currentShape = ev.shape;

	});

	anno.addHandler('onEditorShown', function(annotation) {
		// HACK:
		// set shape when adding to existing annotation 
		// so we can use it in the YUI autocompletion plugins.
		if (annotation && annotation.shapes) {
			anno.currentShape = annotation.shapes[0];
			oSelf.cancelButton.style.display="none";
			oSelf.saveButton.style.display="inline-block";
		} else {
			oSelf.saveButton.style.display="none";
			oSelf.cancelButton.style.display="inline-block";
		}

		YUI().use('node', 'event', function(Y) {
			// Y.one('a.annotorious-editor-button-save').setHTML('Done'); // Hack: turn save into done button
			Y.all('li.tagitem').each(function(tagNode) {
				if (annotation && annotation.targetId == tagNode.getAttribute('targetId'))
					tagNode.show();
				else
					tagNode.hide();

			})
		})
	});
}


{'fraction_non_alphanumeric': 0.14314354450681635, 'fraction_numerical': 0.0016038492381716118, 'mean_word_length': 4.1871101871101875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2940202', 'n_tokens_mistral': 859, 'n_tokens_neox': 762, 'n_words': 160}