From: Calin Crisan Date: Sun, 11 Jan 2015 16:06:32 +0000 (+0200) Subject: arrow keys can now be used to navigate through media files previews X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=ece3e62dc47e8fb338750bdb0511fb5ccb3e6129;p=motioneye-debian arrow keys can now be used to navigate through media files previews --- diff --git a/static/js/main.js b/static/js/main.js index b114f0a..4dd7dfb 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -2000,6 +2000,24 @@ function runPictureDialog(entries, pos, mediaType) { updatePicture(); }); + function bodyKeyDown(e) { + switch (e.which) { + case 37: + if (prevArrow.is(':visible')) { + prevArrow.click(); + } + break; + + case 39: + if (nextArrow.is(':visible')) { + nextArrow.click(); + } + break; + } + } + + $('body').on('keydown', bodyKeyDown); + img.load(updateModalDialogPosition); runModalDialog({ @@ -2016,7 +2034,10 @@ function runPictureDialog(entries, pos, mediaType) { ], content: content, stack: true, - onShow: updatePicture + onShow: updatePicture, + onClose: function () { + $('body').off('keydown', bodyKeyDown); + } }); }