move scripts to standalone file; add favicon
This commit is contained in:
parent
a6f7597fb3
commit
ece6ff813b
4 changed files with 41 additions and 27 deletions
22
script.js
Normal file
22
script.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
const currentYear = new Date().getFullYear();
|
||||
const footerText =
|
||||
currentYear === 2024
|
||||
? "© 2024 NotAShelf"
|
||||
: `© 2024-${currentYear} NotAShelf`;
|
||||
document.getElementById("footer-text").textContent = footerText;
|
||||
|
||||
const tooltip = document.querySelector(".tooltip");
|
||||
const hoverItems = document.querySelectorAll(".hover-item");
|
||||
|
||||
hoverItems.forEach((item) => {
|
||||
item.addEventListener("mouseenter", (e) => {
|
||||
tooltip.innerText = e.target.dataset.content;
|
||||
tooltip.style.display = "block";
|
||||
tooltip.style.left = e.pageX + "px";
|
||||
tooltip.style.top = e.pageY - tooltip.offsetHeight - 35 + "px";
|
||||
});
|
||||
|
||||
item.addEventListener("mouseleave", () => {
|
||||
tooltip.style.display = "none";
|
||||
});
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue