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

Commit

Permalink
feature (print): allow to print via defined key
Browse files Browse the repository at this point in the history
Change-Id: Iceedd49b20f87c9f48a0930155923f3ec5bf09ff
  • Loading branch information
andi34 committed Sep 16, 2020
1 parent c641324 commit ca84bf3
Show file tree
Hide file tree
Showing 6 changed files with 38 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
2 changes: 2 additions & 0 deletions resources/lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -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 <a href=\"https://keycode.info\" target=\"_blank\">https://keycode.info</a> 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.",
Expand Down Expand Up @@ -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",
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 (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);
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 (isPrinting) {
console.log('Printing already in progress!');
} else {
$('.printbtn').trigger('click');
$('.printbtn').blur();
}
}
});

// clear Timeout to not reset the gallery, if you clicked anywhere
Expand Down
10 changes: 10 additions & 0 deletions src/js/photoinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
}
});
}

0 comments on commit ca84bf3

Please sign in to comment.