mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-24 13:24:05 -06:00
chore: rename function to enhance readability
This commit is contained in:
parent
71823c5f89
commit
9ac43636e1
@ -7,7 +7,7 @@ async function mouseEnterHandler(
|
||||
this: HTMLAnchorElement,
|
||||
{ clientX, clientY }: { clientX: number; clientY: number },
|
||||
) {
|
||||
inActivePopover()
|
||||
clearActivePopover()
|
||||
|
||||
const link = this
|
||||
link.id = link.innerText
|
||||
@ -110,7 +110,7 @@ async function mouseEnterHandler(
|
||||
}
|
||||
}
|
||||
|
||||
function inActivePopover() {
|
||||
function clearActivePopover() {
|
||||
const allPopoverElements = document.querySelectorAll(".popover")
|
||||
if (allPopoverElements) {
|
||||
allPopoverElements.forEach((popoverElement) =>
|
||||
@ -122,11 +122,11 @@ function inActivePopover() {
|
||||
document.addEventListener("nav", () => {
|
||||
const links = [...document.getElementsByClassName("internal")] as HTMLAnchorElement[]
|
||||
for (const link of links) {
|
||||
link.addEventListener("mouseleave", inActivePopover)
|
||||
link.addEventListener("mouseleave", clearActivePopover)
|
||||
link.addEventListener("mouseenter", mouseEnterHandler)
|
||||
window.addCleanup(() => {
|
||||
link.removeEventListener("mouseenter", mouseEnterHandler)
|
||||
link.removeEventListener("mouseleave", inActivePopover)
|
||||
link.removeEventListener("mouseleave", clearActivePopover)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user