-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.js
115 lines (94 loc) · 3.04 KB
/
app.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
113
114
const hamburger = document.querySelector(".hamburger");
const navLinks = document.querySelector(".nav-links");
const links = document.querySelector(".nav-links li");
hamburger.addEventListener('click', ()=>{
navLinks.classList.toggle('open');
});
function checkResponse() {
const dropdown = document.querySelector('#selAct');
const val = dropdown.value;
const specifyInput = document.getElementById('specify');
const teacher = document.getElementById('teacher');
const specifyInputRow = document.getElementById('specifyRow');
const teacherRow = document.getElementById('teacherRow');
teacher.style.display='inline-block';
teacherRow.style.display='block';
if(val=='club' || val=='sport' || val=='other') {
specifyInput.style.display='inline-block';
specifyInputRow.style.display='block';
}
else {
specifyInput.style.display='none';
specifyInputRow.style.display='none';
}
if(val=='club') {
specifyInput.placeholder='Club Name';
teacher.placeholder = "Club Adviser";
}
else if(val=='sport') {
specifyInput.placeholder='Sport Name';
teacher.placeholder = "Coach";
}
else{
specifyInput.placeholder='Specify';
teacher.placeholder = "Teacher";
}
}
var i = 1;
var amtSlides = document.getElementsByClassName("slideB");
function changeSlides(a) {
i += a;
if(i < 1) {
i = amtSlides.length;
}
if (i > amtSlides.length) {
i = 1;
}
display(i);
}
function display(x) {
for (j = 0; j < amtSlides.length; j++) {
amtSlides[j].style.display = "none";
}
amtSlides[x-1].style.display = "block";
}
function sendAlert() {
var x = document.getElementsByTagName("form")
// Form submission
var selection = document.getElementById('selAct').value;
if (isValid() && (["club", "sport", "other"].includes(selection))){
if (
document.getElementById('specify').value != "" &&
document.getElementById('teacher').value != "" &&
document.getElementById('ID').value != "" &&
document.getElementById('EMail').value != "" &&
document.getElementById('Name').value != "" &&
document.getElementById('pickBus').value != ""
) {
x[0].submit()
alert('You have submitted!')
if (!isMobile()) {
signOut()
}
}
}
else if (isValid() && (["extra_help", "detention"].includes(selection))){
if (
document.getElementById('teacher').value != "" &&
document.getElementById('ID').value != "" &&
document.getElementById('EMail').value != "" &&
document.getElementById('Name').value != "" &&
document.getElementById('pickBus').value != ""
) {
x[0].submit()
alert('You have submitted!')
if (!isMobile()) {
signOut()
}
}
}
else {
let message = (isValid()) ? 'Invalid submission. Please fill out the whole form, or contact support at [email protected].' : 'Invalid submission. Please login with your school account'; //Based on if user is signed in with school domain account.
alert(message)
}
}