Chiphell Helper

Chiphell 辅助,屏蔽帖子,拉黑用户

  1. // ==UserScript==
  2. // @name Chiphell Helper
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.3
  5. // @license GNU GPLv3
  6. // @description Chiphell 辅助,屏蔽帖子,拉黑用户
  7. // @author Ersic
  8. // @match http*://www.chiphell.com/*
  9. // @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
  10. // @grant unsafeWindow
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. var pathname = unsafeWindow.location.pathname;
  17.  
  18. // 帖子列表页
  19. if (pathname.indexOf("forum") != -1) {
  20. checkPost();
  21. // 添加屏蔽按钮
  22. document.querySelectorAll(".new").forEach((el, i) => {
  23. if (el.parentNode.parentNode.id.indexOf("normalthread_") != -1) {
  24. let pid = el.parentNode.parentNode.id.substring(13);
  25. let newEl = document.createElement("a");
  26. newEl.className = "closeprev y";
  27. newEl.href = "javascript:void(0);";
  28. newEl.setAttribute("pid", pid);
  29. newEl.title = "屏蔽";
  30. newEl.innerText = "屏蔽";
  31. newEl.onclick = function (event) {
  32. if (confirm("确认屏蔽")) {
  33. let pid = event.target.getAttribute("pid");
  34. if (pid) {
  35. let blockPost = JSON.parse(unsafeWindow.localStorage.getItem("blockPost"));
  36. if (blockPost == null) {
  37. blockPost = [];
  38. }
  39. blockPost.push(pid);
  40. unsafeWindow.localStorage.setItem("blockPost", JSON.stringify(blockPost));
  41. event.target.parentElement.parentElement.parentElement.remove();
  42. }
  43. }
  44. };
  45. el.querySelector(".tdpre").before(newEl);
  46. }
  47. });
  48. document.querySelectorAll(".common").forEach((el, i) => {
  49. if (el.parentNode.parentNode.id.indexOf("normalthread_") != -1) {
  50. let pid = el.parentNode.parentNode.id.substring(13);
  51. let newEl = document.createElement("a");
  52. newEl.className = "closeprev y";
  53. newEl.href = "javascript:void(0);";
  54. newEl.setAttribute("pid", pid);
  55. newEl.title = "屏蔽";
  56. newEl.innerText = "屏蔽";
  57. newEl.onclick = function (event) {
  58. if (confirm("确认屏蔽")) {
  59. let pid = event.target.getAttribute("pid");
  60. if (pid) {
  61. let blockPost = JSON.parse(unsafeWindow.localStorage.getItem("blockPost"));
  62. if (blockPost == null) {
  63. blockPost = [];
  64. }
  65. if (blockPost.indexOf(pid) == -1) {
  66. blockPost.push(pid);
  67. unsafeWindow.localStorage.setItem("blockPost", JSON.stringify(blockPost));
  68. }
  69. event.target.parentElement.parentElement.parentElement.remove();
  70. }
  71. }
  72. };
  73. el.querySelector(".tdpre").before(newEl);
  74. }
  75. });
  76. }
  77.  
  78. // 帖子详情页
  79. if (pathname.indexOf("thread") != -1) {
  80. checkUser();
  81. }
  82.  
  83. // 黑名单页
  84. if (unsafeWindow.location.href.indexOf("blacklist") != -1) {
  85. let blockUser = JSON.parse(unsafeWindow.localStorage.getItem("blockUser"));
  86. if (blockUser == null) {
  87. blockUser = [];
  88. }
  89. document.querySelectorAll(".buddy h4 .note").forEach((el, i) => {
  90. let uid = el.id.replace("friend_note_", "");
  91. if (blockUser.indexOf(uid) == -1) {
  92. blockUser.push(uid);
  93. unsafeWindow.localStorage.setItem("blockUser", JSON.stringify(blockUser));
  94. }
  95. });
  96. }
  97.  
  98. function checkPost() {
  99. let blockPost = JSON.parse(unsafeWindow.localStorage.getItem("blockPost"));
  100. if (blockPost == null) {
  101. blockPost = [];
  102. }
  103. let blockUser = JSON.parse(unsafeWindow.localStorage.getItem("blockUser"));
  104. if (blockUser == null) {
  105. blockUser = [];
  106. }
  107.  
  108. document.querySelectorAll("#threadlisttableid tbody").forEach((el, i) => {
  109. if (el.id.indexOf("normalthread_") != -1) {
  110. let pid = el.id.substring(el.id.indexOf("_") + 1);
  111. if (blockPost.indexOf(pid) != -1) {
  112. el.remove();
  113. } else {
  114. let linkEl = el.querySelectorAll(".by a");
  115. if (linkEl.length > 0) {
  116. let uid = linkEl[0].getAttribute("href").replace("space-uid-", "").replace(".html", "");
  117. if (blockUser.indexOf(uid) != -1) {
  118. el.remove();
  119. }
  120. }
  121. }
  122. }
  123. });
  124. }
  125.  
  126. function checkUser() {
  127. let blockUser = JSON.parse(unsafeWindow.localStorage.getItem("blockUser"));
  128. if (blockUser != null) {
  129. // 删除回复
  130. document.querySelectorAll(".authi .xw1 ").forEach((el, i) => {
  131. let uid = el.getAttribute("href").replace("space-uid-", "").replace(".html", "");
  132. if (blockUser.indexOf(uid) != -1) {
  133. el.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.remove();
  134. }
  135. });
  136. // 删除点评
  137. document.querySelectorAll(".pstl").forEach((el, i) => {
  138. let href = el.querySelectorAll(".xi2")[0].getAttribute("href");
  139. if (href) {
  140. let uid = href.replace("space-uid-", "").replace(".html", "");
  141. if (blockUser.indexOf(uid) != -1) {
  142. el.remove();
  143. }
  144. }
  145. });
  146. }
  147. }
  148. })();

QingJ © 2025

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