diff --git a/module/bug/js/batchcreate.js b/module/bug/js/batchcreate.js index 28d0230bbd..88405b439c 100644 --- a/module/bug/js/batchcreate.js +++ b/module/bug/js/batchcreate.js @@ -136,3 +136,15 @@ if(navigator.userAgent.indexOf("Firefox") < 0) this.style.height = (this.scrollHeight + 2) + "px"; }); } + +$(document).keydown(function(event) +{ + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } +}); \ No newline at end of file diff --git a/module/story/js/batchcreate.js b/module/story/js/batchcreate.js index a931a89f9f..48b612bf7d 100644 --- a/module/story/js/batchcreate.js +++ b/module/story/js/batchcreate.js @@ -33,7 +33,19 @@ $(document).on('mousedown', 'select', function() } $(this).val(value); } -}) +}); + +$(document).keydown(function(event) +{ + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } +}); if(navigator.userAgent.indexOf("Firefox") < 0) { diff --git a/module/story/js/batchedit.js b/module/story/js/batchedit.js index 790c960aeb..2faf80e809 100644 --- a/module/story/js/batchedit.js +++ b/module/story/js/batchedit.js @@ -90,4 +90,4 @@ $(document).on('change', 'select', function() $(this).trigger("chosen:updated"); $(this).trigger("change"); } -}) +}); diff --git a/module/task/js/batchcreate.js b/module/task/js/batchcreate.js index 79ec55162f..f45e71ab36 100755 --- a/module/task/js/batchcreate.js +++ b/module/task/js/batchcreate.js @@ -153,5 +153,16 @@ $(function() if($.cookie('zeroTask') == 'true') toggleZeroTaskStory(); if(storyID != 0) setStoryRelated(0); -}) + $(document).keydown(function(event) + { + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } + }); +}); diff --git a/module/task/js/batchedit.js b/module/task/js/batchedit.js index 7c4ad12144..b181c7fdc6 100644 --- a/module/task/js/batchedit.js +++ b/module/task/js/batchedit.js @@ -44,4 +44,5 @@ $(document).on('change', 'select', function() $(this).trigger("chosen:updated"); $(this).trigger("change"); } -}) +}); + diff --git a/module/testcase/js/batchcreate.js b/module/testcase/js/batchcreate.js index 0291853257..8239848949 100644 --- a/module/testcase/js/batchcreate.js +++ b/module/testcase/js/batchcreate.js @@ -57,6 +57,18 @@ $(document).ready(function() $(this).val(value); } }); + + $(document).keydown(function(event) + { + if(event.keyCode == 38) + { + inputFocusJump('up'); + } + else if(event.keyCode == 40) + { + inputFocusJump('down'); + } + }); }); /** diff --git a/module/testcase/js/batchedit.js b/module/testcase/js/batchedit.js index 9e68699ff6..33667f298e 100644 --- a/module/testcase/js/batchedit.js +++ b/module/testcase/js/batchedit.js @@ -75,4 +75,4 @@ $(document).on('change', 'select', function() $(this).trigger("chosen:updated"); $(this).trigger("change"); } -}) +}); diff --git a/www/js/my.full.js b/www/js/my.full.js index 31ed1f085d..3322dae22a 100644 --- a/www/js/my.full.js +++ b/www/js/my.full.js @@ -1941,6 +1941,28 @@ function revertModuleCookie() } } +/** + * Focus move up or down for input. + * + * @param type up|down + */ +function inputFocusJump(type){ + var hasFocus = $('input').is(':focus'); + if(hasFocus) + { + var title = $("input:focus").attr('name').replace(/\[\d]/g, ''); + var $input = $(":input[name^=" + title + "]:text:not(:disabled):not([name*='%'])"); + var num = $input.length; + var index = parseInt($("input:focus").attr('name').replace(/[^0-9]/g, '')); + var nextIndex = type == 'down' ? index + 1 : index - 1; + + if(nextIndex < num && nextIndex >= 0) + { + $input[nextIndex].focus(); + } + } +} + /* Ping the server every some minutes to keep the session. */ needPing = true;