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

Commit

Permalink
Javascript fixes to enable iPad2 (going back to es5)
Browse files Browse the repository at this point in the history
Change-Id: I03647db7ab6911555472084a26c05599282ebfc4
  • Loading branch information
jacques42 authored and andi34 committed Apr 5, 2020
1 parent e15607a commit 98e9055
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 43 deletions.
4 changes: 2 additions & 2 deletions gallery.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
<script type="text/javascript" src="resources/lang/<?php echo $config['language']; ?>.js"></script>
<script>
$(function() {
let reloadElement = $('<a class="gallery__reload">');
var reloadElement = $('<a class="gallery__reload">');
reloadElement.append('<i class="fa fa-refresh"></i>');
reloadElement.attr('href', '#');
reloadElement.on('click', () => photoBooth.reloadPage());
reloadElement.on('click', function() { photoBooth.reloadPage(); } );
reloadElement.appendTo('.gallery__header');

$('.gallery__close').hide();
Expand Down
4 changes: 2 additions & 2 deletions resources/js/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ $(function() {
$.ajax({
url: '../api/checkVersion.php',
method: 'GET',
success: (data) => {
let message = 'Error';
success: function(data) {
var message = 'Error';
$('#checkVersion').empty();
console.log('data', data)
if (!data.updateAvailable) {
Expand Down
2 changes: 1 addition & 1 deletion resources/js/adminshortcut.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* exported adminsettings */
let admincount = 0;
var admincount = 0;

function countreset() {
admincount = 0;
Expand Down
26 changes: 13 additions & 13 deletions resources/js/chromakeying.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* globals MarvinColorModelConverter AlphaBoundary MarvinImage */
/* exported setBackgroundImage */
let mainImage;
let mainImageWidth;
let mainImageHeight;
let backgroundImage;
var mainImage;
var mainImageWidth;
var mainImageHeight;
var backgroundImage;

function greenToTransparency(imageIn, imageOut) {
for (let y = 0; y < imageIn.getHeight(); y++) {
for (let x = 0; x < imageIn.getWidth(); x++) {
for (var y = 0; y < imageIn.getHeight(); y++) {
for (var x = 0; x < imageIn.getWidth(); x++) {

const color = imageIn.getIntColor(x, y);
const hsv = MarvinColorModelConverter.rgbToHsv([color]);
Expand All @@ -22,8 +22,8 @@ function greenToTransparency(imageIn, imageOut) {
}

function reduceGreen(image) {
for (let y = 0; y < image.getHeight(); y++) {
for (let x = 0; x < image.getWidth(); x++) {
for (var y = 0; y < image.getHeight(); y++) {
for (var x = 0; x < image.getWidth(); x++) {
const r = image.getIntComponent0(x, y);
const g = image.getIntComponent1(x, y);
const b = image.getIntComponent2(x, y);
Expand All @@ -43,8 +43,8 @@ function reduceGreen(image) {

function alphaBoundary(imageOut, radius) {
const ab = new AlphaBoundary();
for (let y = 0; y < imageOut.getHeight(); y++) {
for (let x = 0; x < imageOut.getWidth(); x++) {
for (var y = 0; y < imageOut.getHeight(); y++) {
for (var x = 0; x < imageOut.getWidth(); x++) {
ab.alphaRadius(imageOut, x, y, radius);
}
}
Expand Down Expand Up @@ -164,12 +164,12 @@ function printImageHandler(ev) {
$('#print_mesg').addClass('modal--show');

setTimeout(function () {
saveImage((data) => {
saveImage(function(data) {
if (!data.success) {
return;
}

printImage(data.filename, () => {
printImage(data.filename, function() {
setTimeout(function () {
$('#print_mesg').removeClass('modal--show');
$('#print-btn').blur();
Expand All @@ -185,7 +185,7 @@ function saveImageHandler(ev) {
$('#save_mesg').addClass('modal--show');

setTimeout(function () {
saveImage(() => {
saveImage(function() {
setTimeout(function () {
$('#save_mesg').removeClass('modal--show');
$('#save-btn').blur();
Expand Down
40 changes: 20 additions & 20 deletions resources/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const photoBooth = (function () {
videoView = $('#video--view').get(0),
videoSensor = document.querySelector('#video--sensor');

let timeOut,
var timeOut,
nextCollageNumber = 0,
currentCollageFile = '',
imgFilter = config.default_imagefilter;
Expand Down Expand Up @@ -151,7 +151,7 @@ const photoBooth = (function () {
}

loader.addClass('open');
public.startCountdown(nextCollageNumber ? config.collage_cntdwn_time : config.cntdwn_time, $('#counter'), () => {
public.startCountdown(nextCollageNumber ? config.collage_cntdwn_time : config.cntdwn_time, $('#counter'), function() {
public.cheese(photoStyle);
});
}
Expand Down Expand Up @@ -184,7 +184,7 @@ const photoBooth = (function () {
error: 'No preview by device cam available!'
});
} else {
setTimeout(() => {
setTimeout(function() {
public.takePic(photoStyle);
}, config.cheese_time);
}
Expand Down Expand Up @@ -244,11 +244,11 @@ const photoBooth = (function () {
$('#video--sensor').hide();

if (config.continuous_collage) {
setTimeout(() => {
setTimeout(function() {
public.thrill('collage');
}, 1000);
} else {
$('<a class="btn" href="#">' + L10N.nextPhoto + '</a>').appendTo('.loading').click((ev) => {
$('<a class="btn" href="#">' + L10N.nextPhoto + '</a>').appendTo('.loading').click(function(ev) {
ev.preventDefault();

public.thrill('collage');
Expand Down Expand Up @@ -292,7 +292,7 @@ const photoBooth = (function () {

if (photoStyle === 'photo' && config.image_preview_before_processing) {
const preloadImage = new Image();
preloadImage.onload = () => {
preloadImage.onload = function() {
$('#loader').css('background-image', `url(${tempImageUrl})`);
$('#loader').addClass('showBackgroundImage');
}
Expand All @@ -307,7 +307,7 @@ const photoBooth = (function () {
filter: imgFilter,
isCollage: photoStyle === 'collage',
},
success: (data) => {
success: function(data) {
console.log('picture processed', data);

if (data.error) {
Expand All @@ -316,7 +316,7 @@ const photoBooth = (function () {
public.renderPic(data.file);
}
},
error: (jqXHR, textStatus) => {
error: function(jqXHR, textStatus) {
console.log('An error occurred', textStatus);

public.errorPic({
Expand Down Expand Up @@ -344,15 +344,15 @@ const photoBooth = (function () {
e.preventDefault();
e.stopPropagation();

public.printImage(filename, () => {
public.printImage(filename, function() {
public.reloadPage();
});
});

resultPage.find('.deletebtn').off('click').on('click', (ev) => {
resultPage.find('.deletebtn').off('click').on('click', function(ev) {
ev.preventDefault();

public.deleteImage(filename, (data) => {
public.deleteImage(filename, function(data) {
if (data.success) {
public.reloadPage();
} else {
Expand All @@ -367,7 +367,7 @@ const photoBooth = (function () {
const imageUrl = config.folders.images + '/' + filename;

const preloadImage = new Image();
preloadImage.onload = () => {
preloadImage.onload = function() {
resultPage.css({
'background-image': `url(${imageUrl}?filter=${imgFilter})`,
});
Expand All @@ -392,10 +392,10 @@ const photoBooth = (function () {
public.addImage = function (imageName) {
const thumbImg = new Image();
const bigImg = new Image();
let thumbSize = '';
let bigSize = '';
var thumbSize = '';
var bigSize = '';

let imgtoLoad = 2;
var imgtoLoad = 2;

thumbImg.onload = function () {
thumbSize = this.width + 'x' + this.height;
Expand Down Expand Up @@ -436,7 +436,7 @@ const photoBooth = (function () {

gallery.addClass('gallery--open');

setTimeout(() => gallery.find('.gallery__inner').show(), 300);
setTimeout(function() { gallery.find('.gallery__inner').show();}, 300);
}

public.resetMailForm = function () {
Expand All @@ -446,8 +446,8 @@ const photoBooth = (function () {

// Countdown Function
public.startCountdown = function (start, element, cb) {
let count = 0;
let current = start;
var count = 0;
var current = start;

function timerFunction() {
element.text(current);
Expand All @@ -456,7 +456,7 @@ const photoBooth = (function () {
element.removeClass('tick');

if (count < start) {
window.setTimeout(() => element.addClass('tick'), 50);
window.setTimeout(function() { element.addClass('tick'); }, 50);
window.setTimeout(timerFunction, 1000);
} else {
cb();
Expand Down Expand Up @@ -492,7 +492,7 @@ const photoBooth = (function () {
data: {
file: imageName,
},
success: (data) => {
success: function(data) {
cb(data);
}
});
Expand Down
11 changes: 6 additions & 5 deletions resources/js/photoinit.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* global photoBooth */
function initPhotoSwipeFromDOM (gallerySelector) {

let gallery,
var gallery,
ssRunning = false,
ssOnce = false;

Expand Down Expand Up @@ -72,6 +72,7 @@ function initPhotoSwipeFromDOM (gallerySelector) {
shareEl: false,
zoomEl: false,
fullscreenEl: false,
tapToToggleControls: false
};

// Pass data to PhotoSwipe and initialize it
Expand All @@ -81,14 +82,14 @@ function initPhotoSwipeFromDOM (gallerySelector) {
setSlideshowState(ssButtonClass, false);

// see: http://photoswipe.com/documentation/responsive-images.html
let realViewportWidth,
var realViewportWidth,
useLargeImages = false,
firstResize = true,
imageSrcWillChange;

gallery.listen('beforeResize', function () {

let dpiRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
var dpiRatio = window.devicePixelRatio ? window.devicePixelRatio : 1;
dpiRatio = Math.min(dpiRatio, 2.5);
realViewportWidth = gallery.viewportSize.x * dpiRatio;

Expand Down Expand Up @@ -167,7 +168,7 @@ function initPhotoSwipeFromDOM (gallerySelector) {
pswpQR.removeClass('qr-active').fadeOut('fast');
} else {
pswpQR.empty();
let img = gallery.currItem.src;
var img = gallery.currItem.src;
img = img.split('\\').pop().split('/').pop();

$('<img>').attr('src', 'api/qrcode.php?filename=' + img).appendTo(pswpQR);
Expand All @@ -183,7 +184,7 @@ function initPhotoSwipeFromDOM (gallerySelector) {

const img = gallery.currItem.src.split('\\').pop().split('/').pop();

photoBooth.printImage(img, () => {
photoBooth.printImage(img, function() {
gallery.close();
});
});
Expand Down

0 comments on commit 98e9055

Please sign in to comment.