2023-11-28 02:07:29 +00:00
|
|
|
const header_links = document.getElementById("header-links");
|
|
|
|
const hamburger = document.getElementById("header-links-toggle");
|
|
|
|
|
2023-10-02 05:30:54 +00:00
|
|
|
function type_out(e) {
|
|
|
|
const text = e.innerText;
|
|
|
|
const original = e.innerHTML;
|
|
|
|
const delay = 25;
|
|
|
|
let chars = 0;
|
2024-05-17 12:23:12 +00:00
|
|
|
let html = "";
|
2023-10-02 05:30:54 +00:00
|
|
|
|
|
|
|
function insert_char(character, parent) {
|
2024-05-17 12:23:12 +00:00
|
|
|
if (chars == 0) parent.innerHTML = "";
|
2023-10-02 05:30:54 +00:00
|
|
|
const c = document.createElement("span");
|
|
|
|
c.innerText = character;
|
|
|
|
parent.appendChild(c);
|
|
|
|
c.classList.add("newchar");
|
|
|
|
}
|
|
|
|
|
|
|
|
function normalize() {
|
|
|
|
e.innerHTML = original;
|
|
|
|
}
|
|
|
|
|
|
|
|
function increment_char() {
|
2024-05-17 12:23:12 +00:00
|
|
|
const newchar = text.substring(chars, chars + 1);
|
2023-10-02 05:30:54 +00:00
|
|
|
insert_char(newchar, e);
|
|
|
|
chars++;
|
|
|
|
if (chars <= text.length) {
|
|
|
|
setTimeout(increment_char, delay);
|
|
|
|
} else {
|
|
|
|
setTimeout(normalize, 250);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
increment_char();
|
|
|
|
}
|
|
|
|
|
|
|
|
function fill_list(list) {
|
2023-10-15 02:08:45 +00:00
|
|
|
const items = list.querySelectorAll("li a, li span");
|
2023-10-02 05:30:54 +00:00
|
|
|
items.innerText = "";
|
|
|
|
const delay = 100;
|
|
|
|
|
|
|
|
items.forEach((item, iter) => {
|
|
|
|
item.style.animationDelay = `${iter * delay}ms`;
|
|
|
|
item.style.animationPlayState = "playing";
|
|
|
|
});
|
|
|
|
}
|
2023-10-15 03:23:53 +00:00
|
|
|
|
|
|
|
[...document.querySelectorAll("h1, h2, h3, h4, h5, h6")]
|
|
|
|
.filter((e) => e.innerText != "")
|
|
|
|
.forEach((e) => {
|
|
|
|
type_out(e);
|
|
|
|
});
|
|
|
|
[...document.querySelectorAll("ol, ul")]
|
|
|
|
.filter((e) => e.innerText != "")
|
|
|
|
.forEach((e) => {
|
|
|
|
fill_list(e);
|
|
|
|
});
|
|
|
|
|
2023-11-28 02:07:29 +00:00
|
|
|
function toggle_header_links() {
|
|
|
|
header_links.classList.toggle("open");
|
|
|
|
}
|
|
|
|
|
|
|
|
document.addEventListener("click", event => {
|
|
|
|
if (!header_links.contains(event.target) && !hamburger.contains(event.target)) {
|
|
|
|
header_links.classList.remove("open");
|
|
|
|
}
|
2024-05-17 12:23:12 +00:00
|
|
|
});
|