随手写了一个油猴脚本,简单测试一下还可以。给你提供一个思路,你根据需求自己调整一下吧。
// @
match https://www.zhihu.com/question/*(function() {
'use strict';
const answersContainer=document.querySelector("#QuestionAnswers-answers .AnswersNavWrapper");
const callback = (mutationList, observer) => {
mutationList.forEach((mutation) => {
switch(mutation.type) {
case 'childList':
answersContainer.querySelectorAll(".List-item .RichText-MCNLinkCardContainer").forEach(card=>{
if(card?.offsetParent && card.offsetParent.hidden!=true){
card.offsetParent.hidden=true;
}
});
break;
}
});
};
const observer = new MutationObserver(callback);
observer.observe(answersContainer, { childList: true,subtree: true});
})();