移除文章下方的阅读和评论文字和数
先css干掉下面的阅读数和评论数,搞定第一步
/** 去掉文章下方的阅读数 */ #post_view_count{ display: none; } /** 去掉文章下方的评论数 */ #post_comment_count{ display: none; }
第二步 页脚添加一下代码
<script> // 暴力移除所有相关元素 document.querySelectorAll('.postDesc').forEach(div => { [...div.childNodes].forEach(node => { if(node.textContent.match(/阅读\(|评论\(/)) { node.remove(); } // 移除孤立分隔符 else if(node.textContent === '|') { const siblings = [...node.parentNode.childNodes]; if(siblings.filter(n => n.nodeType === 3).length > 1) { node.remove(); } } // 新增:处理残留的右括号 else if(node.textContent.trim() === ')') { node.remove(); } }); }); </script>

浙公网安备 33010602011771号