| 1194 | |
| 1195 | // 移除高亮链接 |
| 1196 | function cleanHighlightLink() { |
| 1197 | if (!menu_value('menu_cleanHighlightLink')) return; |
| 1198 | const callback = (mutationsList, observer) => { |
| 1199 | for (const mutation of mutationsList) { |
| 1200 | for (const target of mutation.addedNodes) { |
| 1201 | if (target.nodeType != 1 || target.tagName != 'A') break |
| 1202 | if (target.dataset.zaNotTrackLink && target.href.indexOf('https://zhida.zhihu.com/search?') > -1) { |
| 1203 | target.parentElement.replaceWith(target.textContent); |
| 1204 | } |
| 1205 | } |
| 1206 | } |
| 1207 | }; |
| 1208 | const observer = new MutationObserver(callback); |
| 1209 | observer.observe(document, { childList: true, subtree: true }); |
| 1210 | |
| 1211 | // 针对的是打开网页后直接加载的前面几个回答(上面哪些是针对动态加载的回答) |
| 1212 | document.querySelectorAll('span > a[data-za-not-track-link][href^="https://zhida.zhihu.com/search?"]').forEach(e => e.parentElement.replaceWith(e.textContent)) |
| 1213 | } |
| 1214 | |
| 1215 | |
| 1216 | // 屏蔽盐选内容 |