use arrow keys to add/remove article
This commit is contained in:
parent
437233fd10
commit
9443f86298
1 changed files with 21 additions and 7 deletions
|
@ -617,8 +617,8 @@ $(document).ready(function() {
|
|||
var articleSelect = $('#article_autocomplete');
|
||||
var articleId = $('#article_id');
|
||||
var articleNb = $('#article_number');
|
||||
// 8:Backspace|9:Tab|13:Enter|46:DEL|112-117:F1-6|119-123:F8-F12
|
||||
var normalKeys = /^(8|9|13|46|112|113|114|115|116|117|119|120|121|122|123)$/;
|
||||
// 8:Backspace|9:Tab|13:Enter|38-40:Arrows|46:DEL|112-117:F1-6|119-123:F8-F12
|
||||
var normalKeys = /^(8|9|13|37|38|39|40|46|112|113|114|115|116|117|119|120|121|122|123)$/;
|
||||
var articlesList = [];
|
||||
|
||||
function deleteNonMatching(array, str) {
|
||||
|
@ -818,11 +818,25 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
$(document).on('keydown', function (e) {
|
||||
if (e.keyCode == 46) {
|
||||
// DEL (Suppr)
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
deleteFromBasket($(this).data('opeindex'));
|
||||
});
|
||||
switch(e.which) {
|
||||
case 46:
|
||||
// DEL (Suppr)
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
deleteFromBasket($(this).data('opeindex'));
|
||||
});
|
||||
break;
|
||||
case 38:
|
||||
// Arrow up
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
addExistingPurchase($(this).data('opeindex'), 1);
|
||||
});
|
||||
break;
|
||||
case 40:
|
||||
// Arrow down
|
||||
basket_container.find('.ui-selected').each(function () {
|
||||
addExistingPurchase($(this).data('opeindex'), -1);
|
||||
});
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue