Skip to content

Commit

Permalink
Merge pull request #469 from lesser0/patch-1
Browse files Browse the repository at this point in the history
更新 移除高亮链接 功能(知乎修改了高亮链接地址,脚本进行了相应修改)
  • Loading branch information
XIU2 authored Aug 22, 2024
2 parents 7f3590f + 519c0bc commit e824c64
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Zhihu-Enhanced.user.js
Original file line number Diff line number Diff line change
Expand Up @@ -1033,7 +1033,7 @@ function removeHighlightLink() {
for (const mutation of mutationsList) {
for (const target of mutation.addedNodes) {
if (target.nodeType != 1 || target.tagName != 'A') break
if (target.dataset.zaNotTrackLink && target.href.indexOf('https://www.zhihu.com/search?q=') > -1) {
if (target.dataset.zaNotTrackLink && target.href.indexOf('https://zhida.zhihu.com/search?q=') > -1) {
target.parentElement.replaceWith(target.textContent);
}
}
Expand All @@ -1043,7 +1043,7 @@ function removeHighlightLink() {
observer.observe(document, { childList: true, subtree: true });

// 针对的是打开网页后直接加载的前面几个回答(上面哪些是针对动态加载的回答)
document.querySelectorAll('span > a[data-za-not-track-link][href^="https://www.zhihu.com/search?q="]').forEach(e => e.parentElement.replaceWith(e.textContent))
document.querySelectorAll('span > a[data-za-not-track-link][href^="https://zhida.zhihu.com/search?q="]').forEach(e => e.parentElement.replaceWith(e.textContent))
}


Expand Down

0 comments on commit e824c64

Please sign in to comment.