website/js/customElements/404Buttons.js

66 lines
1.9 KiB
JavaScript

class notFoundButtons extends HTMLElement {
constructor() {
super();
this.windowResized = false;
const redButton = document.createElement("div");
redButton.classList.add("button");
redButton.classList.add("red");
this.appendChild(redButton);
const yellowButton = document.createElement("div");
yellowButton.classList.add("button");
yellowButton.classList.add("yellow");
this.appendChild(yellowButton);
const greenButton = document.createElement("div");
greenButton.classList.add("button");
greenButton.classList.add("green");
this.appendChild(greenButton);
greenButton.onclick
greenButton.onclick = () => {
const terminal = document.querySelector(".terminal-window");
if (!this.windowResized) {
terminal.style.width = "95%";
terminal.style.height = "95%";
terminal.style.top = "2%";
this.windowResized = true;
} else {
terminal.style.width = "37.5rem";
terminal.style.height = "22.5rem";
terminal.style.top = "10.5rem";
}
}
redButton.onclick = () => {
location.href = "https://jonasled.de";
}
}
getWidth() {
return Math.max(
document.body.scrollWidth,
document.documentElement.scrollWidth,
document.body.offsetWidth,
document.documentElement.offsetWidth,
document.documentElement.clientWidth
);
}
getHeight() {
return Math.max(
document.body.scrollHeight,
document.documentElement.scrollHeight,
document.body.offsetHeight,
document.documentElement.offsetHeight,
document.documentElement.clientHeight
);
}
}
customElements.define("jl-404_buttons", notFoundButtons);