Merge pull request #3167 from Hypolite/bug/comment-box-undefined

Bug comment box undefined
This commit is contained in:
rabuzarus 2017-02-18 13:29:39 +01:00 committed by GitHub
commit d27b342f7d
2 changed files with 22 additions and 36 deletions

View file

@ -81,39 +81,25 @@ function showHideCommentBox(id) {
} }
function commentOpenUI(obj, id) { function commentOpenUI(obj, id) {
$(document).unbind( "click.commentOpen", handler ); $("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty");
// Choose an arbitrary tab index that's greater than what we're using in jot (3 of them)
var handler = function() { // The submit button gets tabindex + 1
if (obj.value == '') { $("#comment-edit-text-" + id).attr('tabindex','9');
$("#comment-edit-text-" + id).addClass("comment-edit-text-full").removeClass("comment-edit-text-empty"); $("#comment-edit-submit-" + id).attr('tabindex','10');
// Choose an arbitrary tab index that's greater than what we're using in jot (3 of them) $("#comment-edit-submit-wrapper-" + id).show();
// The submit button gets tabindex + 1 // initialize autosize for this comment
$("#comment-edit-text-" + id).attr('tabindex','9'); autosize($("#comment-edit-text-" + id + ".text-autosize"));
$("#comment-edit-submit-" + id).attr('tabindex','10');
$("#comment-edit-submit-wrapper-" + id).show();
// initialize autosize for this comment
autosize($("#comment-edit-text-" + id + ".text-autosize"));
}
};
$(document).bind( "click.commentOpen", handler );
} }
function commentCloseUI(obj, id) { function commentCloseUI(obj, id) {
$(document).unbind( "click.commentClose", handler ); if (obj.value === '') {
$("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty");
var handler = function() { $("#comment-edit-text-" + id).removeAttr('tabindex');
if (obj.value === '') { $("#comment-edit-submit-" + id).removeAttr('tabindex');
$("#comment-edit-text-" + id).removeClass("comment-edit-text-full").addClass("comment-edit-text-empty"); $("#comment-edit-submit-wrapper-" + id).hide();
$("#comment-edit-text-" + id).removeAttr('tabindex'); // destroy the automatic textarea resizing
$("#comment-edit-submit-" + id).removeAttr('tabindex'); autosize.destroy($("#comment-edit-text-" + id + ".text-autosize"));
$("#comment-edit-submit-wrapper-" + id).hide(); }
// destroy the automatic textarea resizing
autosize.destroy($("#comment-edit-text-" + id + ".text-autosize"));
}
};
$(document).bind( "click.commentClose", handler );
} }
function jotTextOpenUI(obj) { function jotTextOpenUI(obj) {