隐藏微信公众号后台发表记录页已删除文章并自动跳转页码

公众号运营者必备神器,治好强迫症

  1. // ==UserScript==
  2. // @name 隐藏微信公众号后台发表记录页已删除文章并自动跳转页码
  3. // @namespace Violentmonkey Scripts
  4. // @match https://mp.weixin.qq.com/cgi-bin/appmsgpublish*
  5. // @grant none
  6. // @version 1.0
  7. // @author 微信公众号搜:汁识
  8. // @license MIT
  9. // @description 公众号运营者必备神器,治好强迫症
  10. // ==/UserScript==
  11.  
  12.  
  13. (function() {
  14. 'use strict';
  15.  
  16. // 获取所有包含已删除消息的 span 元素
  17. const deletedSpans = document.querySelectorAll('span.weui-desktop-mass__status_text');
  18.  
  19. // 遍历所有的 span 元素
  20. for(let i = 0; i < deletedSpans.length; i++){
  21. if(deletedSpans[i].textContent.includes('已删除')){ // 判断 span 元素的文本内容是否包含 "已删除"
  22. let parentDiv = deletedSpans[i].closest('div.weui-desktop-block'); // 找到最近的 weui-desktop-block 父级 div
  23. if(parentDiv !== null){
  24. parentDiv.style.display = 'none'; // 隐藏该父级 div
  25. }
  26. }
  27. }
  28.  
  29. // 获取所有的 weui-desktop-block 元素
  30. const blocks = document.querySelectorAll('div.publish_content.publish_record_history div.weui-desktop-block');
  31.  
  32. // 判断是否所有的 weui-desktop-block 元素都被隐藏了
  33. const allHidden = Array.from(blocks).every(block => block.style.display === 'none');
  34.  
  35. if(allHidden){
  36. // 获取当前页码
  37. const currentPage = document.querySelector('label.weui-desktop-pagination__num_current');
  38.  
  39. // 获取下一页码
  40. const nextPage = currentPage.nextElementSibling;
  41.  
  42. // 如果下一页存在,则跳转到下一页
  43. if(nextPage !== null){
  44. setTimeout(() => {
  45. nextPage.click();
  46. }, 1000);
  47. }
  48. }
  49. })();
  50.  

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址