-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathform.js
112 lines (93 loc) · 3.32 KB
/
form.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
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
window.addEventListener("load", function() {
const form = document.getElementById('my-form');
form.addEventListener("submit", function(e) {
e.preventDefault();
closeForm();
const data = new FormData(form);
const action = e.target.action;
fetch(action, {
method: 'POST',
body: data,
})
.then(() => {
hideRequest();
document.getElementById("bug").style.bottom = "08px";
})
});
});
window.addEventListener("load", function() {
const form = document.getElementById('my-form2');
form.addEventListener("submit", function(e) {
e.preventDefault();
closeBug();
const data = new FormData(form);
const action = e.target.action;
fetch(action, {
method: 'POST',
body: data,
})
.then(() => {
hideBug();
})
});
});
function hidebyID(idname)
{
document.querySelectorAll(".tabshow").forEach(e => e.classList.remove("tabbuttonactive"));
localStorage.setItem("show", idname)
document.querySelector(".tabshow[show='" + idname + "']").classList.add("tabbuttonactive")
if (idname == "all") {
var menu = document.querySelectorAll('#random > button')
for (var i = 0; menu[i]; i++) {
menu[i].style.display = "inline"
}
} else {
var menu = document.querySelectorAll('#random > button')
for (var i = 0; menu[i]; i++) {
menu[i].style.display = "none"
}
var menu = document.querySelectorAll('#random > .' + idname)
for (var i = 0; menu[i]; i++) {
menu[i].style.display = "inline-grid"
}
}
}
var show = localStorage.getItem("show") || "none"
document.querySelector(".tabshow[show='" + show + "']").classList.add("tabbuttonactive")
console.log(show)
if (show !== "all") {
var menu = document.querySelectorAll('#random > button')
for (var i = 0; menu[i]; i++) {
menu[i].style.display = "none"
}
var menu = document.querySelectorAll('#random > .' + show)
for (var i = 0; menu[i]; i++) {
menu[i].style.display = "inline-grid"
}
}
function displayQuestion(answer) {
document.getElementById(answer + 'Question').style.display = "block";
document.getElementById(answer + 'Question2').setAttribute('required', '');
if (answer == "game") { // hide the div that is not selected
document.getElementById('pr*xyQuestion').style.display = "none";
document.getElementById('pr*xyQuestion2').removeAttribute('required');
} else if (answer == "pr*xy") {
document.getElementById('gameQuestion').style.display = "none";
document.getElementById('gameQuestion2').removeAttribute('required');
}
}
function hideQuestion() {
document.getElementById('pr*xyQuestion').style.display = "none";
document.getElementById('pr*xyQuestion2').removeAttribute('required'); document.getElementById('gameQuestion').style.display = "none";
document.getElementById('gameQuestion2').removeAttribute('required');
}
function displayQuestionRequest(answer) {
document.getElementById(answer + 'Question').style.display = "block";
document.getElementById(answer + 'Question2').style.display = "none";
document.getElementById(answer + 'Question3').setAttribute('required', '');
}
function hideQuestionRequest() {
document.getElementById('emulatorQuestion').style.display = "none";
document.getElementById('emulatorQuestion2').style.display = "block";
document.getElementById('emulatorQuestion3').removeAttribute('required');
}