362be453 by Jeff Balicki

fixed focus

1 parent cff0af30
......@@ -101,7 +101,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
function HideBox() {
jQuery(document).ready(function($) {
$('span').hide();
console.log('hide');
//console.log('hide');
var Qc = document.getElementById("Canvas");
var Qctx = Qc.getContext("2d");
Qctx.clearRect(0, 0, Qc.width, Qc.height);
......@@ -222,7 +222,7 @@ function changePdfOptions(json) {
pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
}
if (json[i].change_type == "img") {
pdfChange += json[i].names + ':<label id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input tabindex="-1" onfocusout="HideBox()" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" class="fileupload upload required" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button"></span><strong>Browse</strong></span></label>';
pdfChange += json[i].names + ':<label onfocusout="HideBox()" onfocus=" ShowBox(' + json[0].pheight + ',' + json[0].pwidth + ',' + json[i].locationUp + ',' + json[i].locationRight + ',' + json[i].height + ',' + json[i].width + ',' + i + ',\'' + example + '\')" id="focusButton' + i + '" class="custom-file-input" tabindex="0"><input tabindex="-1" class="fileupload upload required" id="changescontent[' + i + ']" type="file" name="content[' + i + ']" ><span class="file-button"><span class="file-name file-button"></span><strong>Browse</strong></span></label>';
pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
}
if (json[i].change_type == "date") {
......@@ -307,12 +307,16 @@ function changePdfOptions(json) {
$(target).parent('label').find('.file-name').text('');
}
$(target).parent('label').trigger('focus');
});
$('.custom-file-input').keypress(function(event) {
if(event.which == 13) {
$(this).trigger('click');
}
});
$("#changes").submit(function(e) {
e.preventDefault();
......