hide S1 ads (x)

隐藏大量发帖无人回复者(就是你,广告哥)的帖子,自动加载下一页以凑到30贴以上

  1. // ==UserScript==
  2. // @name hide S1 ads (x)
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.4
  5. // @description 隐藏大量发帖无人回复者(就是你,广告哥)的帖子,自动加载下一页以凑到30贴以上
  6. // @author whzfjk
  7. // @match https://bbs.saraba1st.com/2b/forum-*-*.html
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function killAds() {
  12. 'use strict';
  13.  
  14. var post_threshold = 4;
  15. var replied_threshold = 2;
  16.  
  17. var rst = document.evaluate( '//*[starts-with(@id, "normalthread_")]', document, null, XPathResult.ANY_TYPE, null);
  18. var post = rst.iterateNext();
  19. var collect = new Map();
  20. var remain = 0;
  21. while (post) {
  22. remain += 1;
  23. var name = post.querySelector('cite > a').text;
  24. if (!collect.get(name)) {
  25. collect.set(name, {cnt: 0, noreply_cnt: 0, posts: []});
  26. }
  27. var ent = collect.get(name);
  28. ent.cnt += 1;
  29. var reply = parseInt(post.querySelector('tr > td.num > a').text);
  30. if (reply === 0) {
  31. ent.noreply_cnt += 1;
  32. }
  33. ent.posts.push(post);
  34. post = rst.iterateNext();
  35. }
  36.  
  37. for (var [k, v] of collect) {
  38. if (v.cnt > post_threshold && v.cnt - v.noreply_cnt < replied_threshold) {
  39. console.log("prepare to hide " + k);
  40. for (var p of v.posts) {
  41. p.hidden = true;
  42. }
  43. remain -= v.posts.length;
  44. }
  45. }
  46.  
  47. return remain;
  48. }
  49.  
  50. (function() {
  51. 'use strict';
  52. var nextPage = document.querySelector('#autopbn');
  53. for (var posts = killAds(); posts < 30; posts = killAds()) {
  54. console.log('need more posts');
  55. nextPage.click();
  56. }
  57. })();

QingJ © 2025

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