4 * @licstart The following is the entire license notice for the
5 * JavaScript code in this page.
7 * Copyright (C) 2025 David Polakovic
10 * The JavaScript code in this page is free software: you can
11 * redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GNU GPL) as published by the Free Software
13 * Foundation, either version 3 of the License, or (at your option)
14 * any later version. The code is distributed WITHOUT ANY WARRANTY;
15 * without even the implied warranty of MERCHANTABILITY or FITNESS
16 * FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
18 * As additional permission under GNU GPL version 3 section 7, you
19 * may distribute non-source (e.g., minimized or compacted) forms of
20 * that code without the copy of the GNU GPL normally required by
21 * section 4, provided you include this license notice and a URL
22 * through which recipients can access the Corresponding Source.
24 * @licend The above is the entire license notice
25 * for the JavaScript code in this page.
28 const dotImg = document.getElementById("toggleImageDot");
29 const spaceImg = document.getElementById("toggleImageSpace");
30 const dpoImg = document.getElementById("toggleImagedpo");
33 const keysPressed = {};
35 // Helper function to check for redirect
36 function checkRedirect(clickedKey) {
37 const requiredKeys = [".", "d", " "];
38 const otherKeys = requiredKeys.filter(k => k !== clickedKey);
40 if (keysPressed[otherKeys[0]] && keysPressed[otherKeys[1]]) {
41 window.location.href = "https://www.dpolakovic.space/ro";
45 // Mouse behavior for dot
47 dotImg.addEventListener("mousedown", () => {
48 dotImg.src = "./Pictures/dot2.png";
52 dotImg.addEventListener("mouseup", () => {
53 dotImg.src = "./Pictures/dot.png";
56 dotImg.addEventListener("mouseleave", () => {
57 dotImg.src = "./Pictures/dot.png";
61 // Mouse behavior for space
63 spaceImg.addEventListener("mousedown", () => {
64 spaceImg.src = "../Pictures/space2.png";
68 spaceImg.addEventListener("mouseup", () => {
69 spaceImg.src = "./Pictures/space.png";
72 spaceImg.addEventListener("mouseleave", () => {
73 spaceImg.src = "./Pictures/space.png";
77 // Mouse behavior for dpo
79 dpoImg.addEventListener("mousedown", () => {
80 dpoImg.src = "./Pictures/dpo2.png";
84 dpoImg.addEventListener("mouseup", () => {
85 dpoImg.src = "./Pictures/dpolakovic.png";
88 dpoImg.addEventListener("mouseleave", () => {
89 dpoImg.src = "./Pictures/dpolakovic.png";
94 document.addEventListener("keydown", (event) => {
95 keysPressed[event.key] = true;
97 if (dotImg && event.key === ".") {
98 dotImg.src = "./Pictures/dot2.png";
100 if (spaceImg && event.key === " ") {
101 spaceImg.src = "./Pictures/space2.png";
103 if (dpoImg && event.key === "d") {
104 dpoImg.src = "./Pictures/dpo2.png";
107 // Check if all three keys are pressed
108 if (keysPressed["."] && keysPressed["d"] && keysPressed[" "]) {
109 window.location.href = "https://www.dpolakovic.space/ro";
113 document.addEventListener("keyup", (event) => {
114 delete keysPressed[event.key];
116 if (dotImg && event.key === ".") {
117 dotImg.src = "./Pictures/dot.png";
119 if (spaceImg && event.key === " ") {
120 spaceImg.src = "./Pictures/space.png";
122 if (dpoImg && event.key === "d") {
123 dpoImg.src = "./Pictures/dpolakovic.png";