362be453 by Jeff Balicki

fixed focus

1 parent cff0af30
...@@ -101,7 +101,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) { ...@@ -101,7 +101,7 @@ function ShowBox(pheight, pwidth, up, right, height, width, count, example) {
101 function HideBox() { 101 function HideBox() {
102 jQuery(document).ready(function($) { 102 jQuery(document).ready(function($) {
103 $('span').hide(); 103 $('span').hide();
104 console.log('hide'); 104 //console.log('hide');
105 var Qc = document.getElementById("Canvas"); 105 var Qc = document.getElementById("Canvas");
106 var Qctx = Qc.getContext("2d"); 106 var Qctx = Qc.getContext("2d");
107 Qctx.clearRect(0, 0, Qc.width, Qc.height); 107 Qctx.clearRect(0, 0, Qc.width, Qc.height);
...@@ -222,7 +222,7 @@ function changePdfOptions(json) { ...@@ -222,7 +222,7 @@ function changePdfOptions(json) {
222 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>'; 222 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
223 } 223 }
224 if (json[i].change_type == "img") { 224 if (json[i].change_type == "img") {
225 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>'; 225 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>';
226 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>'; 226 pdfChange += '<span id="span' + i + '">' + json[i].tips + '</span><br/>';
227 } 227 }
228 if (json[i].change_type == "date") { 228 if (json[i].change_type == "date") {
...@@ -307,12 +307,16 @@ function changePdfOptions(json) { ...@@ -307,12 +307,16 @@ function changePdfOptions(json) {
307 $(target).parent('label').find('.file-name').text(''); 307 $(target).parent('label').find('.file-name').text('');
308 } 308 }
309 $(target).parent('label').trigger('focus'); 309 $(target).parent('label').trigger('focus');
310
311
310 }); 312 });
311 313
312 $('.custom-file-input').keypress(function(event) { 314 $('.custom-file-input').keypress(function(event) {
313 if(event.which == 13) { 315 if(event.which == 13) {
314 $(this).trigger('click'); 316 $(this).trigger('click');
317
315 } 318 }
319
316 }); 320 });
317 $("#changes").submit(function(e) { 321 $("#changes").submit(function(e) {
318 e.preventDefault(); 322 e.preventDefault();
......