mirror of
https://github.com/jackyzha0/quartz.git
synced 2025-12-19 10:54:06 -06:00
Refactor anchor link generation logic
This commit is contained in:
parent
4cff705548
commit
fc3df9aa01
@ -41,8 +41,9 @@ document.addEventListener("nav", () => {
|
||||
document.addEventListener("nav", () => {
|
||||
const els = document.querySelectorAll("a[role=anchor]")
|
||||
for (let i = 0; i < els.length; i++) {
|
||||
if (els[i].getAttribute("href")) {
|
||||
const anchorLink = `${window.location.href}${els[i].getAttribute("href")}`
|
||||
const href = els[i].getAttribute("href")
|
||||
if (href) {
|
||||
const anchorLink = new URL(href, window.location.href).toString()
|
||||
const svgAnchor = els[i].innerHTML
|
||||
function onClick() {
|
||||
navigator.clipboard.writeText(anchorLink).then(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user