| | |
| | | el = htmlToElement(popoverElement) |
| | | } else { |
| | | const linkDest = content[li.dataset.src.replace(/\/$/g, "").replace(basePath, "")] |
| | | console.log(linkDest.content) |
| | | if (linkDest) { |
| | | const popoverElement = `<div class="popover"> |
| | | <h3>${linkDest.title}</h3> |
| | |
| | | el = htmlToElement(popoverElement) |
| | | } |
| | | } |
| | | li.appendChild(el) |
| | | if (renderLatex) { |
| | | renderMathInElement(el, { |
| | | delimiters: [ |
| | | { left: '$$', right: '$$', display: false }, |
| | | { left: '$', right: '$', display: false }, |
| | | { left: '\\(', right: '\\)', display: false }, |
| | | { left: '\\[', right: '\\]', display: false } |
| | | ], |
| | | throwOnError: false |
| | | |
| | | if (el) { |
| | | li.appendChild(el) |
| | | if (renderLatex) { |
| | | renderMathInElement(el, { |
| | | delimiters: [ |
| | | { left: '$$', right: '$$', display: false }, |
| | | { left: '$', right: '$', display: false }, |
| | | { left: '\\(', right: '\\)', display: false }, |
| | | { left: '\\[', right: '\\]', display: false } |
| | | ], |
| | | throwOnError: false |
| | | }) |
| | | } |
| | | |
| | | li.addEventListener("mouseover", () => { |
| | | // fix tooltip positioning |
| | | window.FloatingUIDOM.computePosition(li, el, { |
| | | middleware: [window.FloatingUIDOM.offset(10), window.FloatingUIDOM.inline(), window.FloatingUIDOM.shift()], |
| | | }).then(({ x, y }) => { |
| | | Object.assign(el.style, { |
| | | left: `${x}px`, |
| | | top: `${y}px`, |
| | | }) |
| | | }) |
| | | |
| | | el.classList.add("visible") |
| | | }) |
| | | li.addEventListener("mouseout", () => { |
| | | el.classList.remove("visible") |
| | | }) |
| | | } |
| | | li.addEventListener("mouseover", () => { |
| | | el.classList.add("visible") |
| | | }) |
| | | li.addEventListener("mouseout", () => { |
| | | el.classList.remove("visible") |
| | | }) |
| | | |
| | | }) |
| | | }) |
| | | } |