block let user

屏蔽 lowendtalk 指定用户的帖子,支持点击用户名屏蔽

  1. // ==UserScript==
  2. // @name block let user
  3. // @namespace yournamespace
  4. // @version 1.1
  5. // @description 屏蔽 lowendtalk 指定用户的帖子,支持点击用户名屏蔽
  6. // @author ayasetan
  7. // @match https://lowendtalk.com/categories/offers*
  8. // @grant GM_getValue
  9. // @grant GM_setValue
  10. // @grant GM_deleteValue
  11. // @license MIT
  12. // ==/UserScript==
  13.  
  14. (function() {
  15. 'use strict';
  16.  
  17. // 从存储中获取屏蔽用户列表,如果没有则使用默认空数组
  18. let blockedUsers = JSON.parse(GM_getValue('blockedUsers', '[]'));
  19.  
  20. // 主功能:屏蔽帖子
  21. function hideBlockedUsers() {
  22. const items = document.querySelectorAll('.ItemDiscussion'); // 获取所有帖子的元素
  23.  
  24. items.forEach(item => {
  25. const authorLink = item.querySelector('.DiscussionAuthor a');
  26. if (!authorLink) return;
  27.  
  28. const username = authorLink.textContent.trim();
  29.  
  30. if (blockedUsers.includes(username)) {
  31. item.style.display = 'none'; // 隐藏被屏蔽用户的帖子
  32. } else {
  33. // 添加点击事件监听器
  34. authorLink.addEventListener('click', function(e) {
  35. e.preventDefault();
  36. e.stopPropagation();
  37.  
  38. if (confirm(`是否要屏蔽用户 ${username} 的所有帖子?`)) {
  39. if (!blockedUsers.includes(username)) {
  40. blockedUsers.push(username);
  41. GM_setValue('blockedUsers', JSON.stringify(blockedUsers));
  42. alert(`已屏蔽用户 ${username}`);
  43. hideBlockedUsers(); // 重新执行屏蔽
  44. }
  45. }
  46. });
  47. }
  48. });
  49. }
  50.  
  51. // 初始执行
  52. hideBlockedUsers();
  53.  
  54.  
  55. })();

QingJ © 2025

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