-
Notifications
You must be signed in to change notification settings - Fork 0
/
about.html
263 lines (236 loc) · 10.5 KB
/
about.html
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
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<link rel="manifest" href="manifest.json">
<link rel="shortcut icon" href="Assets/Gemini.svg" type="image/x-icon">
<title>About - Eco-Gemini</title>
</head>
<body>
<header>
<button id="darklight"><img id="lightdarkimg" src="Assets/Moon.svg" style="margin-bottom: -4.5px;" height="25"
width="25"> Switch Mode</button>
<ul id="end">
<li><a id="index" href="index.html" class="not-current"><img src="Assets/Home.svg" height="25" width="25"
style="margin-bottom: -4px;"> Home</a></li>
<li><a id="ecohr" href="eco-gemini.html" class="not-current"><img src="Assets/Gemini.svg" height="25" width="25"
style="margin-bottom: -4px;"> Eco-Gemini</a></li>
<li><a id="todoh" href="todo.html" class="not-current"><img src="Assets/Todo.svg" height="25" width="25"
style="margin-bottom: -4px;"> To Do</a></li>
<li><a id="daily" href="daily.html" class="not-current"><img src="Assets/Quiz.svg" height="25" width="25"
style="margin-bottom: -4px;"> Daily
Quiz</a></li>
<li><a id="leadh" href="leaderboard.html" class="not-current"><img src="Assets/Leaderboard.svg" height="25"
width="25" style="margin-bottom: -4px;"> Leaderboard</a></li>
<li><a class="current"><img src="Assets/About.svg" height="25" width="25"
style="margin-bottom: -4px; opacity: 0.5;" class="curimg"> About</a></li>
</ul>
</header>
<div id="formdiv">
<h1 class="main">About this project</h1>
<p id="p">This project is specially made for <a href="https://ai.google.dev/competition">the Gemini Developer API
Competition</a> by Hamza Elashry.</p>
<br>
</div>
<div id="contextmenu" hidden>
<a class="context" href="javascript:window.location.reload()">Refresh</a>
<hr>
<a class="context" href="index.html">Home</a>
<br>
<a class="context" href="eco-gemini.html">Eco-Gemini</a>
<br>
<a class="context" href="todo.html">To-Do</a>
<br>
<a class="context" href="daily.html">Daily quiz</a>
<br>
<a class="context" href="leaderboard.html">Leaderboard</a>
<br>
<a class="context" href="about.html">About</a>
</div>
<script type="module">
var light;
var list = ["button", "label", "a"];
list.forEach(element => {
document.querySelectorAll(element).forEach(html => {
html.addEventListener("click", () => new Audio("Assets/Click.mp3").play());
})
})
window.addEventListener("keydown", (e) => {
if (e.ctrlKey && e.key === "s") {
e.preventDefault();
}
});
window.addEventListener("keydown", (e) => {
if (e.keyCode == 9) {
e.preventDefault();
}
});
// Context menu
async function navigate(url) {
visChange0();
await delay(250);
window.location.href = url;
}
window.addEventListener("contextmenu", (e) => {
e.preventDefault();
document.getElementById("contextmenu").style.left = e.clientX + 'px';
document.getElementById("contextmenu").style.top = e.clientY + 'px';
document.getElementById("contextmenu").hidden = false;
});
window.addEventListener("mousedown", (e) => {
if (e.button == 0) {
if (document.elementFromPoint(e.clientX, e.clientY) !== document.getElementById("contextmenu")) {
if (!document.elementFromPoint(e.clientX, e.clientY).classList.contains("context")) {
document.getElementById("contextmenu").hidden = true;
}
}
}
});
document.querySelectorAll(".context").forEach(element => {
element.addEventListener("click", async (e) => {
e.preventDefault();
visChange0();
await delay(250);
window.location.href = element.href;
})
});
// End
if (!checkCookie("light")) {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
light = false;
}
else if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
light = true;
}
else {
light = true;
}
}
else {
light = (getCookie("light").toLowerCase().trimStart() === "true");
}
if (checkCookie("previous")) {
document.querySelectorAll("a")[Number(getCookie("previous"))].classList.add("previous");
}
setDayCookie("previous", "5");
const delay = ms => new Promise(res => setTimeout(res, ms));
document.getElementById("darklight").addEventListener("click", () => light = !light)
async function visChange0() {
document.getElementById("contextmenu").style.opacity = "0";
document.getElementById("formdiv").style.opacity = "0";
document.getElementById("formdiv").style.animationName = "curback";
document.getElementById("formdiv").style.animationDuration = "0.2s";
}
async function visChange1() {
document.getElementById("contextmenu").style.opacity = "1";
document.getElementById("formdiv").style.opacity = "1";
document.getElementById("formdiv").style.animationName = "revcurback";
document.getElementById("formdiv").style.animationDuration = "0.19s";
}
document.getElementById("index").addEventListener("mouseover", () => visChange0())
document.getElementById("index").addEventListener("mouseleave", () => visChange1())
document.getElementById("ecohr").addEventListener("mouseover", () => visChange0())
document.getElementById("ecohr").addEventListener("mouseleave", () => visChange1())
document.getElementById("leadh").addEventListener("mouseover", () => visChange0())
document.getElementById("leadh").addEventListener("mouseleave", () => visChange1())
document.getElementById("daily").addEventListener("mouseover", () => visChange0())
document.getElementById("daily").addEventListener("mouseleave", () => visChange1())
document.getElementById("todoh").addEventListener("mouseover", () => visChange0())
document.getElementById("todoh").addEventListener("mouseleave", () => visChange1())
function setDayCookie(cname, cvalue) {
var now = new Date();
var expire = new Date();
expire.setFullYear(now.getFullYear());
expire.setMonth(now.getMonth());
expire.setDate(now.getDate() + 1);
expire.setHours(0);
expire.setMinutes(0);
expire.setSeconds(0);
var expires = "expires=" + expire.toString();
document.cookie = cname + "=" + cvalue + "; " + expires + "; path=/";
}
function getCookie(cname) {
let name = cname + "=";
let decodedCookie = decodeURIComponent(document.cookie);
let ca = decodedCookie.split(';');
for (let i = 0; i < ca.length; i++) {
let c = ca[i];
while (c.charAt(0) == ' ') {
c = c.substring(1);
}
if (c.indexOf(name) == 0) {
return c.substring(name.length, c.length);
}
}
return "";
}
function checkCookie(cname) {
let cookie = getCookie(cname);
if (cookie != "") {
return true;
} else {
return false;
}
}
var animationOnce = !light;
async function f2() {
setDayCookie("light", light);
document.querySelectorAll(".context").forEach(element => {
element.style.color = document.querySelector("p").style.color;
});
if (light) { // Light mode
document.getElementById("formdiv").style.backgroundColor = "rgba(255, 255, 255, 0.8)"
document.querySelector("ul").style.backgroundColor = "rgb(0, 255, 149)";
document.getElementsByClassName("current")[0].style.color = "rgba(0, 0, 0, 1)";
document.getElementsByClassName("not-current")[0].style.color = "rgba(0, 0, 0, 1)";
document.getElementsByClassName("not-current")[1].style.color = "rgba(0, 0, 0, 1)";
document.getElementsByClassName("not-current")[2].style.color = "rgba(0, 0, 0, 1)";
document.getElementsByClassName("not-current")[3].style.color = "rgba(0, 0, 0, 1)";
document.getElementsByClassName("not-current")[4].style.color = "rgba(0, 0, 0, 1)";
document.getElementById("darklight").style.backgroundColor = "rgb(0, 255, 149)";
document.getElementById("darklight").style.color = "black";
document.getElementById("p").style.color = "black";
document.getElementById("lightdarkimg").src = "Assets/Moon.svg";
document.querySelector("html").style.backgroundImage = "linear-gradient(to left, rgb(73, 151, 73), rgb(39, 216, 157))";
if (animationOnce) {
document.getElementById("darklight").disabled = true;
document.querySelector("html").style.animation = "global 0.25s ease reverse";
await delay(250);
document.querySelector("html").style.animation = "none";
animationOnce = false;
document.getElementById("darklight").disabled = false;
}
}
else if (!light) { // Dark mode
document.getElementById("formdiv").style.backgroundColor = "rgba(0, 0, 0, 0.8)"
document.querySelector("ul").style.backgroundColor = "rgb(70, 124, 0)";
document.getElementsByClassName("current")[0].style.color = "rgba(255, 255, 0, 1)";
document.getElementsByClassName("not-current")[0].style.color = "rgba(255, 255, 0, 1)";
document.getElementsByClassName("not-current")[1].style.color = "rgba(255, 255, 0, 1)";
document.getElementsByClassName("not-current")[2].style.color = "rgba(255, 255, 0, 1)";
document.getElementsByClassName("not-current")[3].style.color = "rgba(255, 255, 0, 1)";
document.getElementsByClassName("not-current")[4].style.color = "rgba(255, 255, 0, 1)";
document.getElementById("darklight").style.backgroundColor = "rgba(70, 124, 0, 1)";
document.getElementById("darklight").style.color = "yellow";
document.getElementById("p").style.color = "yellow";
document.getElementById("lightdarkimg").src = "Assets/Sun.svg"
document.querySelector("html").style.backgroundImage = "linear-gradient(to left, rgb(23, 101, 23), rgb(0, 166, 100))";
if (!animationOnce) {
document.getElementById("darklight").disabled = true;
document.querySelector("html").style.animation = "global 0.25s ease";
await delay(250);
document.querySelector("html").style.animation = "none";
animationOnce = true;
document.getElementById("darklight").disabled = false;
}
}
}
while (true) {
f2();
await delay(1);
}
</script>
</body>
</html>