aboutsummaryrefslogtreecommitdiff
path: root/docker/crupest-nginx/sites/www/src/main.js
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2023-07-17 18:56:50 +0800
committercrupest <crupest@outlook.com>2023-07-17 18:56:50 +0800
commite866c53349b839c3e8bf44a6ff5aa4cb2e44ac76 (patch)
tree96e24e7fc2cd6f84ad632e48a5bc886d51e0fa61 /docker/crupest-nginx/sites/www/src/main.js
parente26541d21e4bc04d71745161a848eba49f52593a (diff)
downloadcrupest-e866c53349b839c3e8bf44a6ff5aa4cb2e44ac76.tar.gz
crupest-e866c53349b839c3e8bf44a6ff5aa4cb2e44ac76.tar.bz2
crupest-e866c53349b839c3e8bf44a6ff5aa4cb2e44ac76.zip
Now we have a bad slogan.
Diffstat (limited to 'docker/crupest-nginx/sites/www/src/main.js')
-rw-r--r--docker/crupest-nginx/sites/www/src/main.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/docker/crupest-nginx/sites/www/src/main.js b/docker/crupest-nginx/sites/www/src/main.js
index fd09605..5488581 100644
--- a/docker/crupest-nginx/sites/www/src/main.js
+++ b/docker/crupest-nginx/sites/www/src/main.js
@@ -14,6 +14,28 @@ for (let i = 0; i < 10; i++) {
colorStripContainer.appendChild(colorStripBlock);
}
+/** @type {HTMLDivElement} */
+const sloganElement = document.querySelector("#slogan");
+const sloganTextElement = document.querySelector("#slogan .slogan-text");
+
+/** @type {"good" | "bad"} */
+let sloganState = "good";
+const slogans = {
+ "good": sloganTextElement.textContent,
+ "bad": "The world is a piece of shit, so let's make it a little better!"
+}
+
+function toggleSlogan() {
+ const newState = sloganState === "good" ? "bad" : "good";
+ sloganElement.classList.remove(sloganState)
+ sloganElement.classList.add(newState);
+ sloganTextElement.textContent = slogans[newState];
+ sloganState = newState;
+}
+
+sloganElement.addEventListener("click", toggleSlogan);
+
+
document.addEventListener("DOMContentLoaded", async () => {
console.log("Try to fetch GitHub project(number: 2) of crupest.");