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

Commit

Permalink
print: allow to print via defined key
Browse files Browse the repository at this point in the history
  • Loading branch information
andi34 committed Sep 16, 2020
1 parent f7ebd18 commit 9192167
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions lib/configsetup.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 10 additions & 0 deletions src/js/chromakeying.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
9 changes: 9 additions & 0 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9192167

Please sign in to comment.