This repository was 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 35
Expand file tree
/
Copy pathdebugpanel.js
More file actions
92 lines (79 loc) · 2.9 KB
/
Copy pathdebugpanel.js
File metadata and controls
92 lines (79 loc) · 2.9 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
$(function () {
let autoRefreshActive = false;
// Click on nav bar element populates content page
$('.adminnavlistelement').click(function (e) {
e.preventDefault();
$('.adminnavlistelement').removeClass('active');
$(this).addClass('active');
$.ajax({
url: '../api/serverInfo.php',
method: 'GET',
dataType: 'text',
data: {
content: this.id
},
success: (data) => {
$('.debugcontent').html('<pre>' + data + '</pre>');
if (autoRefreshActive) {
$('html,body').animate({scrollTop: $('#admincontentpage').height()}, 0);
}
},
error: (jqXHR) => {
$('.debugcontent').html('ERROR: No data available - Server Response <' + jqXHR.responseText);
}
});
return false;
});
// menu toggle button for topnavbar (small screen sizes)
$('#admintopnavbarmenutoggle').on('click', function () {
$('.adminsidebar').toggle();
if (window.matchMedia('screen and (min-width: 701px)').matches) {
if ($('#adminsidebar').is(':visible')) {
$('#admincontentpage').css('margin-left', '200px');
} else {
$('#admincontentpage').css('margin-left', '0px');
}
}
});
// back button for topnavbar (small screen sizes)
$('#admintopnavbarback').on('click', function () {
location.assign('../');
});
// check padding of settings content on window resize
window.addEventListener('resize', onWindowResize);
function onWindowResize() {
if (window.matchMedia('screen and (max-width: 700px)').matches) {
$('#admincontentpage').css('margin-left', '0px');
} else if ($('#adminsidebar').is(':visible')) {
$('#admincontentpage').css('margin-left', '200px');
}
}
// autorefresh button
$('#debugpanel_autorefresh').on('click', function () {
if ($('input', this).is(':checked') === autoRefreshActive) {
// filter double events where no change
return;
}
autoRefreshActive = $('input', this).is(':checked');
autoRefresh();
});
// autorefresh function
const autoRefresh = function () {
if (!autoRefreshActive) {
return false;
}
$('.adminnavlistelement.active').trigger('click');
setTimeout(autoRefresh, 1000);
return true;
};
// Localization of toggle button text
$('.toggle').click(function () {
if ($('input', this).is(':checked')) {
$('.toggleTextON', this).removeClass('hidden');
$('.toggleTextOFF', this).addClass('hidden');
} else {
$('.toggleTextOFF', this).removeClass('hidden');
$('.toggleTextON', this).addClass('hidden');
}
});
});