| 710 | } |
| 711 | |
| 712 | function blockUsers_comment() { |
| 713 | const callback = (mutationsList, observer) => { |
| 714 | for (const mutation of mutationsList) { |
| 715 | for (const target of mutation.addedNodes) { |
| 716 | if (target.nodeType != 1) return |
| 717 | //console.log(target) |
| 718 | if (target.tagName == 'DIV' && target.className.indexOf('css-') == 0 && target.dataset.id == undefined) { |
| 719 | let item = target.querySelector('a[href^="https://www.zhihu.com/people/"]>img.Avatar[alt][loading]') |
| 720 | if (item) { |
| 721 | //console.log(item) |
| 722 | menu_value('menu_customBlockUsers').forEach(function(item1){ // 遍历用户黑名单 |
| 723 | if (item.alt === item1) { // 找到就删除该搜索结果 |
| 724 | //console.log(item.alt,item1) |
| 725 | item.parentElement.parentElement.parentElement.parentElement.style.display = "none"; |
| 726 | } |
| 727 | }) |
| 728 | |
| 729 | // 添加屏蔽用户按钮(点赞、回复等按钮后面) |
| 730 | /*if (item) { |
| 731 | let footer = findParentElement(item, 'CommentItemV2-meta', true).parentElement.querySelector('.CommentItemV2-metaSibling > .CommentItemV2-footer'), |
| 732 | userid = item.parentElement; |
| 733 | if (userid && footer && !footer.lastElementChild.dataset.name) { |
| 734 | userid = userid.href.split('/')[4]; |
| 735 | footer.insertAdjacentHTML('beforeend',`<button type="button" data-name="${item.alt}" data-userid="${userid}" class="Button CommentItemV2-hoverBtn Button--plain"><span style="display: inline-flex; align-items: center;">​<svg class="Zi Zi--Like" fill="currentColor" viewBox="0 0 24 24" width="16" height="16" style="transform: rotate(180deg); margin-right: 5px;"><path d="M18.376 5.624c-3.498-3.499-9.254-3.499-12.752 0-3.499 3.498-3.499 9.254 0 12.752 3.498 3.499 9.254 3.499 12.752 0 3.499-3.498 3.499-9.14 0-12.752zm-1.693 1.693c2.37 2.37 2.596 6.094.678 8.69l-9.367-9.48c2.708-1.919 6.32-1.58 8.69.79zm-9.48 9.48c-2.37-2.37-2.595-6.095-.676-8.69l9.48 9.48c-2.822 1.918-6.433 1.58-8.803-.79z" fill-rule="evenodd"></path></svg></span>屏蔽用户</button>`); |
| 736 | footer.lastElementChild.onclick = function(){blockUsers_button_add(this.dataset.name, this.dataset.userid, false)} |
| 737 | } |
| 738 | }*/ |
| 739 | } |
| 740 | } |
| 741 | } |
| 742 | } |
| 743 | }; |
| 744 | const observer = new MutationObserver(callback); |
| 745 | observer.observe(document, { childList: true, subtree: true }); |
| 746 | } |
| 747 | |
| 748 | |
| 749 | // 添加屏蔽用户按钮(用户信息悬浮框中) |