MCPcopy Index your code
hub / github.com/XIU2/UserScript / blockUsers_question_answer_

Function blockUsers_question_answer_

Zhihu-Enhanced.user.js:627–644  ·  view source on GitHub ↗
(mutationsList, observer)

Source from the content-addressed store, hash-verified

625 };
626
627 const blockUsers_question_answer_ = (mutationsList, observer) => {
628 for (const mutation of mutationsList) {
629 for (const target of mutation.addedNodes) {
630 if (target.nodeType != 1) return
631 target.querySelectorAll('.List-item, .Card.AnswerCard').forEach(function(item){
632 let item1 = item.querySelector('.ContentItem.AnswerItem');
633 if (item1) {
634 menu_value('menu_customBlockUsers').forEach(function(item2){ // 遍历用户黑名单
635 if (item1.dataset.zop.indexOf('authorName":"' + item2 + '",') > -1) { // 找到就删除该回答
636 console.log('已屏蔽:' + item1.dataset.zop)
637 item.hidden = true;
638 }
639 })
640 }
641 })
642 }
643 }
644 };
645
646 if (location.pathname.indexOf('/answer/') > -1) { // 回答页(就是只有三个回答的页面)
647 const observer = new MutationObserver(blockUsers_question_answer_);

Callers

nothing calls this directly

Calls 1

menu_valueFunction · 0.70

Tested by

no test coverage detected