diff --git a/config/config.inc.php b/config/config.inc.php index 3fb18249e..a5d1a3b64 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -72,6 +72,7 @@ // use for example https://keycode.info to get the key code $config['photo_key'] = null; $config['collage_key'] = null; +$config['print_key'] = null; // LANGUAGE // possible values: de, el, en, es, fr diff --git a/lib/configsetup.inc.php b/lib/configsetup.inc.php index 5aea21a5e..1bee21450 100644 --- a/lib/configsetup.inc.php +++ b/lib/configsetup.inc.php @@ -626,6 +626,12 @@ 'range_step' => 250, 'unit' => 'milliseconds' ], + 'print_key' => [ + 'type' => 'input', + 'name' => 'print_key', + 'placeholder' => '', + 'value' => $config['print_key'] + ], 'print_qrcode' => [ 'type' => 'checkbox', 'name' => 'print_qrcode', diff --git a/resources/lang/en.json b/resources/lang/en.json index 140c27bad..e8bb83dc7 100644 --- a/resources/lang/en.json +++ b/resources/lang/en.json @@ -207,6 +207,7 @@ "manual_print_linespace": "Enter used linespace while printing text on your picture.", "manual_print_locationx": "X-Coordinates of the text while printing text on your picture.", "manual_print_locationy": "Y-Coordinates of the text while printing text on your picture.", + "manual_print_print_key": "Specify the key id to use that key to print a picture (e.g. 13 is the enter key). For example use https://keycode.info to find out the key id.", "manual_print_printing_time": "Enter in milliseconds, how long \"Started printing! Please wait....\" is displayed after a print job has started.", "manual_print_qrcode": "If enabled, a QR-Code is printed onto the right side of the picture while printing.", "manual_print_rotation": "Enter a value which is used as degrees a picture gets rotated at print.", @@ -287,6 +288,7 @@ "print_linespace": "Line spacing", "print_locationx": "X Coordinate", "print_locationy": "Y Coordinate", + "print_print_key": "Key code which triggers printing", "print_printing_time": "Printing time", "print_qrcode": "QR-Code on the picture while printing", "print_rotation": "Text rotation", diff --git a/src/js/chromakeying.js b/src/js/chromakeying.js index ed0dc465d..110f3c75f 100644 --- a/src/js/chromakeying.js +++ b/src/js/chromakeying.js @@ -246,6 +246,16 @@ function closeHandler(ev) { } } +$(document).on('keyup', function (ev) { + if (config.use_print && config.print_key && parseInt(config.print_key, 10) === ev.keyCode) { + if (isPrinting) { + console.log('Printing already in progress!'); + } else { + $('#print-btn').trigger('click'); + } + } +}); + $(document).ready(function () { $('#save-btn').on('click', saveImageHandler); $('#print-btn').on('click', printImageHandler); diff --git a/src/js/core.js b/src/js/core.js index 347670255..fc5685fc7 100644 --- a/src/js/core.js +++ b/src/js/core.js @@ -899,6 +899,15 @@ const photoBooth = (function () { console.log('Taking photo already in progress!'); } } + + if (config.use_print && config.print_key && parseInt(config.print_key, 10) === ev.keyCode) { + if (isPrinting) { + console.log('Printing already in progress!'); + } else { + $('.printbtn').trigger('click'); + $('.printbtn').blur(); + } + } }); // clear Timeout to not reset the gallery, if you clicked anywhere diff --git a/src/js/photoinit.js b/src/js/photoinit.js index 0a39123f9..2f28aa80e 100644 --- a/src/js/photoinit.js +++ b/src/js/photoinit.js @@ -303,4 +303,14 @@ function initPhotoSwipeFromDOM(gallerySelector) { } $(gallerySelector).on('click', onThumbnailClick); + + $(document).on('keyup', function (ev) { + if (config.use_print && config.print_key && parseInt(config.print_key, 10) === ev.keyCode) { + if (isPrinting) { + console.log('Printing already in progress!'); + } else { + $('.pswp__button--print').trigger('click'); + } + } + }); }