fix(js): avoid removing homepage link

- to avoid removing .onion from homepage
This commit is contained in:
Ming Di Leom 2022-06-27 12:48:17 +00:00
parent cd0cc953de
commit 6ae6c9dacc
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 2 additions and 1 deletions

View File

@ -60,7 +60,8 @@ if (document.location.hostname.endsWith('.onion')) {
const navLink = document.querySelectorAll('a.main-nav-link, a.mobile-nav-link-a')
navLink.forEach((ele) => {
const eleHref = new URL(ele.href)
if (eleHref.pathname === document.location.pathname) {
const docPath = document.location.pathname
if (eleHref.pathname !== '/' && eleHref.pathname === docPath) {
const span = document.createElement('span')
span.className = ele.className
span.textContent = ele.textContent