This repository has been archived by the owner on Aug 27, 2022. It is now read-only.
forked from andreknieriem/photobooth
-
-
Notifications
You must be signed in to change notification settings - Fork 39
/
diskusage.js
37 lines (37 loc) · 1.47 KB
/
diskusage.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* globals photoboothTools */
$(function () {
$('.download-zip-btn').on('click', function (e) {
e.preventDefault();
photoboothTools.modal.open('#save_mesg');
const data = {type: 'zip'};
$.ajax({
url: '../api/diskusage.php',
data: data,
dataType: 'json',
type: 'post',
success: function (response) {
photoboothTools.console.log('data', response);
setTimeout(function () {
if (response.success === 'zip') {
$.ajax({
url: '../' + config.folders.archives + '/' + response.file,
type: 'HEAD',
error: function () {
photoboothTools.console.log('ZIP does not exist!');
},
success: function () {
location.href = '../' + config.folders.archives + '/' + response.file;
}
});
}
photoboothTools.modal.close('#save_mesg');
$('.download-zip-btn').blur();
}, 10000);
},
error: function (jqXHR, textStatus) {
photoboothTools.console.log('Error while downloading: ', textStatus);
photoboothTools.modal.close('#save_mesg');
}
});
});
});