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/src/js/chromakeying.js b/src/js/chromakeying.js index f81adbc98..1fc431cc4 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 (!printing) { + $('#print-btn').trigger('click'); + } else if (config.dev && printing) { + console.log('Printing already in progress!'); + } + } +}); + $(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 da810461c..0cc53432d 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 (!printing) { + $('.printbtn').trigger('click'); + $('.printbtn').blur(); + } else if (config.dev && printing) { + console.log('Printing already in progress!'); + } + } }); // clear Timeout to not reset the gallery, if you clicked anywhere