-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
204 lines (174 loc) · 6.69 KB
/
script.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
//funzione per la parte di ABOUT
function scrollAppear() {
var introText = document.querySelector('.side-text');
var sideImage = document.querySelector('.sideImage');
var introPosition = introText.getBoundingClientRect().top;
var imagePosition = sideImage.getBoundingClientRect().top;
var screenPosition = window.innerHeight / 1.2;
if(introPosition < screenPosition) {
introText.classList.add('side-text-appear');
}
if(imagePosition < screenPosition) {
sideImage.classList.add('sideImage-appear');
}
}
window.addEventListener('scroll', scrollAppear);
//menù laterale
function sideMenu(side) {
var menu = document.getElementById('side-menu');
if(side==0) {
menu.style = 'transform: translateX(0vh); position:fixed;';
}
else {
menu.style = 'transform: translateX(-100%);';
}
side++;
}
// For switching between navigation menus in mobile mode
var i = 2;
function switchTAB() {
var x = document.getElementById("list-switch");
if(i%2 == 0) {
document.getElementById("list-switch").style= "display: grid; height: 50vh; margin-left: 5%;";
document.getElementById("search-switch").style= "display: block; margin-left: 5%;";
}else {
document.getElementById("list-switch").style= "display: none;";
document.getElementById("search-switch").style= "display: none;";
}
i++;
}
// For LOGIN
var x = document.getElementById("login");
var y = document.getElementById("register");
var z = document.getElementById("btn");
var a = document.getElementById("log");
var b = document.getElementById("reg");
var w = document.getElementById("other");
function register() {
x.style.left = "-400px";
y.style.left = "50px";
z.style.left = "110px";
w.style.visibility = "hidden";
b.style.color = "#fff";
a.style.color = "#000";
}
function login() {
x.style.left = "50px";
y.style.left = "450px";
z.style.left = "0px";
w.style.visibility = "visible";
a.style.color = "#fff";
b.style.color = "#000";
}
// CheckBox Function
function goFurther(){
if (document.getElementById("chkAgree").checked == true) {
document.getElementById('btnSubmit').style = 'background: linear-gradient(to right, #FA4B37, #DF2771);';
}
else{
document.getElementById('btnSubmit').style = 'background: lightgray;';
}
}
function google() {
window.location.assign("https://accounts.google.com/signin/v2/identifier?service=accountsettings&continue=https%3A%2F%2Fmyaccount.google.com%2F%3Futm_source%3Dsign_in_no_continue&csig=AF-SEnbZHbi77CbAiuHE%3A1585466693&flowName=GlifWebSignIn&flowEntry=AddSession", "_blank");
}
// QUIZ Page
function quiz_teach(frame) {
document.getElementById('f1').style='display: none;';
document.getElementById('f2').style='display: none;';
document.getElementById('f3').style='display: none;';
document.getElementById('f4').style='display: none;';
document.getElementById('f5').style='display: none;';
document.getElementById('f6').style='display: none;';
document.getElementById('f7').style='display: none;';
if(frame == 1) {
document.getElementById('f1').style = 'display: block';
document.getElementById('deleteButton').style.display = "none";
document.getElementById('addButton').style.display = "none";
}
else if(document.getElementById('frame' + frame).src == "about:blank") {
document.getElementById('f' + frame).style = 'display: none';
document.getElementById('deleteButton').style.display = "none";
document.getElementById('addButton').style.display = "block";
document.getElementById('quiz_non_creato').style.display = "block";
}
else if(document.getElementById('frame' + frame).src != "") {
document.getElementById('f' + frame).style = 'display: block';
document.getElementById('addButton').style.display = "none";
document.getElementById('deleteButton').style.display = "block";
document.getElementById('quiz_non_creato').style.display = "none";
}
else alert('error');
}
// QUIZ Page
function quiz_stud(frame) {
document.getElementById('f1').style='display: none;';
document.getElementById('f2').style='display: none;';
document.getElementById('f3').style='display: none;';
document.getElementById('f4').style='display: none;';
document.getElementById('f5').style='display: none;';
document.getElementById('f6').style='display: none;';
if(frame == 1) document.getElementById('f1').style = 'display: block';
else if(frame == 2) document.getElementById('f2').style = 'display: block';
else if(frame == 3) document.getElementById('f3').style = 'display: block';
else if(frame == 4) document.getElementById('f4').style = 'display: block';
else if(frame == 5) document.getElementById('f5').style = 'display: block';
else if(frame == 6) document.getElementById('f6').style = 'display: block';
else alert('error');
}
function startquiz() {
document.getElementById('title').style = 'display: none;';
document.getElementById('panel').style = 'display: inline-flex;';
document.getElementById('left').style = 'display: block;';
document.getElementById('right').style = 'display: block;';
}
function searchdisplay() {
document.getElementById('searchpanel').style.display="block";
}
function display(n) {
var img1 = document.getElementById('img1');
var img2 = document.getElementById('img2');
var img3 = document.getElementById('img3');
var img4 = document.getElementById('img4');
var s1 = document.getElementById('s1');
var s2 = document.getElementById('s2');
var s3 = document.getElementById('s3');
var s4 = document.getElementById('s4');
img1.style = 'display: none;';
img2.style = 'display: none;';
img3.style = 'display: none;';
img4.style = 'display: none;';
s1.style = 'background: #DF2771; color: #FFF;';
s2.style = 'background: #DF2771; color: #FFF;';
s3.style = 'background: #DF2771; color: #FFF;';
s4.style = 'background: #DF2771; color: #FFF;';
if(n==1) {
img1.style = 'display: block;';
s1.style = 'background: #E5E8EF; color: #DF2771;';
}
if(n==2) {
img2.style = 'display: block;';
s2.style = 'background: #E5E8EF; color: #DF2771;';
}
if(n==3) {
img3.style = 'display: block;';
s3.style = 'background: #E5E8EF; color: #DF2771;';
}
if(n==4) {
img4.style = 'display: block;';
s4.style = 'background: #E5E8EF; color: #DF2771;';
}
}
function logout() {
localStorage.clear();
window.location.href = "../index.html";
}
function capitalize(str) {
let capitalized="";
let sliced=str.split(" ");
sliced.forEach(function(word) {
word=word.charAt(0).toUpperCase()+word.slice(1);
capitalized+=word+" ";
});
return capitalized;
}