blob: f3f2bd830ef77ca94994f29c886488937f31a4bb (
plain)
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
|
function showContentBox() {
let elem = document.getElementById('backgroundTint');
elem.classList.remove('hidden');
elem.classList.add('shown');
elem = document.getElementById('contentBox');
elem.classList.remove('hidden');
elem.classList.add('shown');
}
function hideContentBox() {
let elem = document.getElementById('backgroundTint');
elem.classList.remove('shown');
elem.classList.add('hidden');
elem = document.getElementById('contentBox');
elem.classList.remove('shown');
elem.classList.add('hidden');
}
function showForm() {
let newEntryBtn = document.getElementById('newEntryBtn');
newEntryBtn.style.display = 'none';
showContentBox();
let contentBox = document.getElementById('contentBox');
while (contentBox.firstChild)
contentBox.removeChild(contentBox.firstChild);
contentBox.appendChild(elementFromHTML(baseFormFields));
return contentBox;
}
function hideForm() {
let newEntryBtn = document.getElementById('newEntryBtn');
newEntryBtn.style.display = 'inline';
let contentBox = document.getElementById('contentBox');
while (contentBox.firstChild)
contentBox.removeChild(contentBox.firstChild);
hideContentBox();
}
function showEditForm() {
let contentBox = showForm();
contentBox.firstChild.appendChild(elementFromHTML(formEditButtons));
contentBox.firstChild.action = '/api/update';
}
function showCreateForm() {
let contentBox = showForm();
contentBox.firstChild.appendChild(elementFromHTML(formCreateButtons));
contentBox.firstChild.action = '/api/add';
document.getElementById('formServiceId').disabled = false;
}
|