-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript.js
More file actions
30 lines (28 loc) · 918 Bytes
/
script.js
File metadata and controls
30 lines (28 loc) · 918 Bytes
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
document.addEventListener("DOMContentLoaded", () => {
const heading = document.querySelector("h1");
if (heading) {
heading.addEventListener("click", () => {
heading.classList.toggle("spin");
});
}
const paragraphs = document.querySelectorAll("p");
paragraphs.forEach((paragraph) => {
const textLength = paragraph.textContent.trim().length;
// Longer text gets a smaller growth factor to reduce layout jump.
const growth = Math.max(1.06, Math.min(1.3, 1.3 - textLength / 420));
paragraph.style.setProperty("--hover-scale", growth.toFixed(2));
});
});
function _scrambleIt(b, a, c) {
const email = `${a}@${b}${c}`;
const reversed = email.split("").reverse().join("");
document.write(
"<a onclick=\"this.href='mailto:" +
email +
"';return true;\" style=\"cursor:pointer;\">" +
'<span style="unicode-bidi:bidi-override;direction:rtl;">' +
reversed +
"</span>" +
"</a>",
);
}