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

Add QR code close button #316

Merged
merged 4 commits into from
Sep 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,4 @@ If you like my work and like to keep me motivated you can buy me a coconut water
- [Christian Tarne](https://github.com/Metropo)
- [DeNeD1](https://github.com/DeNeD1)
- [DIY89](https://github.com/DIY89)

- [mhellmeier](https://github.com/mhellmeier)
26 changes: 18 additions & 8 deletions src/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -692,15 +692,25 @@ const photoBooth = (function () {
// Add QR Code Image
const qrCodeModal = $('#qrCode');
photoboothTools.modal.empty(qrCodeModal);
$('<img src="api/qrcode.php?filename=' + filename + '"/>').on('load', function () {
const body = qrCodeModal.find('.modal__body');
const body = qrCodeModal.find('.modal__body');
$('<button>')
.on('click touchstart', function (ev) {
ev.preventDefault();
ev.stopPropagation();

$(this).appendTo(body);
$('<p>')
.css('max-width', this.width + 'px')
.html(photoboothTools.getTranslation('qrHelp') + '</br><b>' + config.webserver.ssid + '</b>')
.appendTo(body);
});
photoboothTools.modal.close('#qrCode');
})
.append($('<i>').addClass('fa fa-times'))
.css('float', 'right')
.appendTo(body);
$('<img src="api/qrcode.php?filename=' + filename + '"/>')
.on('load', function () {
$('<p>')
.css('max-width', this.width + 'px')
.html(photoboothTools.getTranslation('qrHelp') + '</br><b>' + config.webserver.ssid + '</b>')
.appendTo(body);
})
.appendTo(body);

// Add Print Link
$(document).off('click touchstart', '.printbtn');
Expand Down
9 changes: 9 additions & 0 deletions src/js/photoinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,15 @@ function initPhotoSwipeFromDOM(gallerySelector) {
let img = gallery.currItem.src;
img = img.split('\\').pop().split('/').pop();

$('<button>')
.on('click touchstart', function (ev) {
ev.preventDefault();
ev.stopPropagation();
$('.pswp__qr').empty().removeClass('qr-active').fadeOut('fast');
})
.append($('<i>').addClass('fa fa-times'))
.css('float', 'right')
.appendTo(pswpQR);
$('<img>')
.attr('src', 'api/qrcode.php?filename=' + img)
.appendTo(pswpQR);
Expand Down