Skip to content
Merged
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
34 changes: 22 additions & 12 deletions assets/js/remotebuzzer-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,39 +218,44 @@ function initRemoteBuzzerFromDOM() {
// vars
const api = {};
api.waitingToProcessCollage = false;
api.needsReload = false;
api.chromaCapture = typeof onCaptureChromaView !== 'undefined';

api.init = function () {
// nothing to init
};

api.enabled = function () {
return (
config.remotebuzzer.usebuttons &&
typeof onStandaloneGalleryView === 'undefined' &&
typeof onCaptureChromaView === 'undefined'
);
return config.remotebuzzer.usebuttons && typeof onStandaloneGalleryView === 'undefined';
};

api.takePicture = function () {
if (this.enabled() && config.picture.enabled) {
photoBooth.thrill('photo');
if (this.chromaCapture) {
if (!this.needsReload) {
this.needsReload = true;
photoBooth.thrill('chroma');
}
} else {
photoBooth.thrill('photo');
}
}
};

api.takeCustom = function () {
if (this.enabled() && config.custom.enabled) {
if (this.enabled() && !this.chromaCapture && config.custom.enabled) {
photoBooth.thrill('custom');
}
};

api.takeVideo = function () {
if (this.enabled() && config.video.enabled) {
if (this.enabled() && !this.chromaCapture && config.video.enabled) {
photoBooth.thrill('video');
}
};

api.takeCollage = function () {
if (this.enabled() && config.collage.enabled) {
if (this.enabled() && !this.chromaCapture && config.collage.enabled) {
this.waitingToProcessCollage = false;
photoBooth.thrill('collage');
}
Expand All @@ -267,8 +272,13 @@ function initRemoteBuzzerFromDOM() {

api.print = function () {
if ($('.stage[data-stage="result"]').is(':visible')) {
$('.printbtn').trigger('click');
$('.printbtn').trigger('blur');
if (this.chromaCapture) {
$('[data-command="print-btn"]').trigger('click');
$('[data-command="print-btn"]').trigger('blur');
} else {
$('[data-command="printbtn"]').trigger('click');
$('[data-command="printbtn"]').trigger('blur');
}
} else if ($('.pswp__button--print').is(':visible')) {
$('.pswp__button--print').trigger('click');
} else {
Expand All @@ -277,7 +287,7 @@ function initRemoteBuzzerFromDOM() {
};

api.move2usb = function () {
if (this.enabled()) {
if (this.enabled() && !this.chromaCapture) {
photoBooth.thrill('move2usb');
}
};
Expand Down
Loading