Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

Commit 9192167

Browse files
committed
print: allow to print via defined key
1 parent f7ebd18 commit 9192167

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

config/config.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@
7272
// use for example https://keycode.info to get the key code
7373
$config['photo_key'] = null;
7474
$config['collage_key'] = null;
75+
$config['print_key'] = null;
7576

7677
// LANGUAGE
7778
// possible values: de, el, en, es, fr

lib/configsetup.inc.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -626,6 +626,12 @@
626626
'range_step' => 250,
627627
'unit' => 'milliseconds'
628628
],
629+
'print_key' => [
630+
'type' => 'input',
631+
'name' => 'print_key',
632+
'placeholder' => '',
633+
'value' => $config['print_key']
634+
],
629635
'print_qrcode' => [
630636
'type' => 'checkbox',
631637
'name' => 'print_qrcode',

src/js/chromakeying.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,16 @@ function closeHandler(ev) {
246246
}
247247
}
248248

249+
$(document).on('keyup', function (ev) {
250+
if (config.use_print && config.print_key && parseInt(config.print_key, 10) === ev.keyCode) {
251+
if (!printing) {
252+
$('#print-btn').trigger('click');
253+
} else if (config.dev && printing) {
254+
console.log('Printing already in progress!');
255+
}
256+
}
257+
});
258+
249259
$(document).ready(function () {
250260
$('#save-btn').on('click', saveImageHandler);
251261
$('#print-btn').on('click', printImageHandler);

src/js/core.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,6 +899,15 @@ const photoBooth = (function () {
899899
console.log('Taking photo already in progress!');
900900
}
901901
}
902+
903+
if (config.use_print && config.print_key && parseInt(config.print_key, 10) === ev.keyCode) {
904+
if (!printing) {
905+
$('.printbtn').trigger('click');
906+
$('.printbtn').blur();
907+
} else if (config.dev && printing) {
908+
console.log('Printing already in progress!');
909+
}
910+
}
902911
});
903912

904913
// clear Timeout to not reset the gallery, if you clicked anywhere

0 commit comments

Comments
 (0)