-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabout.js
More file actions
107 lines (89 loc) · 3.08 KB
/
Copy pathabout.js
File metadata and controls
107 lines (89 loc) · 3.08 KB
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
// === LUCIDE ICONS ===
lucide.createIcons();
// if (window.location.hostname === "da-meower.es.eu.org") {
// const notice = document.getElementById("mirror-notice");
// notice.style.display = "block";
// notice.addEventListener("click", () => {
// notice.classList.add("hiding");
// notice.addEventListener(
// "animationend",
// () => {
// notice.style.display = "none";
// },
// { once: true },
// );
// });
// }
// === NAMES SETUP ===
const allNames = ["Roxi", "Kit", "Romi", "Junix"];
const subdomain = location.hostname.split(".")[0];
const primaryName =
allNames.find((n) => n.toLowerCase() === subdomain.toLowerCase()) ?? "Roxi";
const orderedNames = [
primaryName,
...allNames.filter((n) => n !== primaryName),
];
// === NAVBAR NAME ===
document.querySelectorAll(".link-full").forEach((el) => {
el.textContent = el.textContent.replaceAll("roxi", primaryName.toLowerCase());
});
// === OTHER NAMES FOR ABOUT ===
const others = orderedNames.slice(1);
const othersText = others.slice(0, -1).join(", ") + " and " + others.at(-1);
document.querySelector(".other-names").textContent = othersText;
// === NAVBAR ===
document.fonts.ready.then(() => {
document.querySelectorAll(".nav-link").forEach((link) => {
const full = link.querySelector(".link-full");
const style = window.getComputedStyle(link);
const paddingLeft = parseFloat(style.paddingLeft);
const paddingRight = parseFloat(style.paddingRight);
const shortWidth = link.getBoundingClientRect().width;
const fullWidth = full.scrollWidth + paddingLeft + paddingRight;
link.style.width = shortWidth + "px";
link.addEventListener("mouseenter", () => {
link.style.width = fullWidth + "px";
});
link.addEventListener("mouseleave", () => {
link.style.width = shortWidth + "px";
});
});
});
// === HERO NAME TYPEWRITER ===
const base = primaryName;
const extra = "/" + orderedNames.slice(1).join("/");
const full = base + extra;
document.querySelectorAll(".hero-name").forEach((heroName) => {
heroName.textContent = primaryName;
let interval;
heroName.addEventListener("mouseenter", () => {
clearInterval(interval);
let i = base.length;
interval = setInterval(() => {
heroName.textContent = full.slice(0, i + 1);
i++;
if (i === full.length) clearInterval(interval);
}, 80);
});
heroName.addEventListener("mouseleave", () => {
clearInterval(interval);
let i = Math.max(heroName.textContent.length, base.length);
interval = setInterval(() => {
heroName.textContent = full.slice(0, i - 1);
i--;
if (i <= base.length) {
heroName.textContent = base;
clearInterval(interval);
}
}, 80);
});
});
document.title = `${full.toLowerCase()}'s page :3`;
// === CURRENT YEAR ===
document.getElementById("currentYear").textContent = new Date().getFullYear();
// === TAGLINES (commented out — not used on about page) ===
// const taglines = [ ... ];
// let lastIndex = -1;
// function setRandomTagline() { ... }
// setRandomTagline();
// setInterval(setRandomTagline, 7000);