feat(tag): better behavior for tag with internal link

This commit is contained in:
Anhgelus Morhtuuzh 2024-12-10 22:21:32 +01:00
parent f06323ab2b
commit fb39dc533c
No known key found for this signature in database
GPG key ID: CAD341EFA92DDDE5

View file

@ -3,7 +3,8 @@ function setupEvents() {
t.addEventListener("click", _ => { t.addEventListener("click", _ => {
const link = t.getAttribute("data-href") const link = t.getAttribute("data-href")
if (link === null || link === "") return if (link === null || link === "") return
window.open(link) if (!link.startsWith(window.location.origin) && link.startsWith("https://")) window.open(link)
else changePage(link)
}) })
}) })