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

Commit ca84bf3

Browse files
committed
feature (print): allow to print via defined key
Change-Id: Iceedd49b20f87c9f48a0930155923f3ec5bf09ff
1 parent c641324 commit ca84bf3

File tree

6 files changed

+38
-0
lines changed

6 files changed

+38
-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',

resources/lang/en.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@
207207
"manual_print_linespace": "Enter used linespace while printing text on your picture.",
208208
"manual_print_locationx": "X-Coordinates of the text while printing text on your picture.",
209209
"manual_print_locationy": "Y-Coordinates of the text while printing text on your picture.",
210+
"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.",
210211
"manual_print_printing_time": "Enter in milliseconds, how long \"Started printing! Please wait....\" is displayed after a print job has started.",
211212
"manual_print_qrcode": "If enabled, a QR-Code is printed onto the right side of the picture while printing.",
212213
"manual_print_rotation": "Enter a value which is used as degrees a picture gets rotated at print.",
@@ -287,6 +288,7 @@
287288
"print_linespace": "Line spacing",
288289
"print_locationx": "X Coordinate",
289290
"print_locationy": "Y Coordinate",
291+
"print_print_key": "Key code which triggers printing",
290292
"print_printing_time": "Printing time",
291293
"print_qrcode": "QR-Code on the picture while printing",
292294
"print_rotation": "Text rotation",

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 (isPrinting) {
252+
console.log('Printing already in progress!');
253+
} else {
254+
$('#print-btn').trigger('click');
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 (isPrinting) {
905+
console.log('Printing already in progress!');
906+
} else {
907+
$('.printbtn').trigger('click');
908+
$('.printbtn').blur();
909+
}
910+
}
902911
});
903912

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

src/js/photoinit.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,4 +303,14 @@ function initPhotoSwipeFromDOM(gallerySelector) {
303303
}
304304

305305
$(gallerySelector).on('click', onThumbnailClick);
306+
307+
$(document).on('keyup', function (ev) {
308+
if (config.use_print && config.print_key && parseInt(config.print_key, 10) === ev.keyCode) {
309+
if (isPrinting) {
310+
console.log('Printing already in progress!');
311+
} else {
312+
$('.pswp__button--print').trigger('click');
313+
}
314+
}
315+
});
306316
}

0 commit comments

Comments
 (0)