Topic and Post remover

Removes posts and topics if user ID of author/post author is in bannedUsers. Needs to be denoted as ["jsp ID","jsp ID","jsp ID"] etc. JSP ID is the last part of link to their profile e.g https://forums.d2jsp.org/user.php?i=943266 <- 943266

当前为 2021-09-22 提交的版本,查看 最新版本

  1. // ==UserScript==
  2. // @name Topic and Post remover
  3. // @namespace http://tampermonkey.net/
  4. // @version 1
  5. // @description Removes posts and topics if user ID of author/post author is in bannedUsers. Needs to be denoted as ["jsp ID","jsp ID","jsp ID"] etc. JSP ID is the last part of link to their profile e.g https://forums.d2jsp.org/user.php?i=943266 <- 943266
  6. // @author Ehmmkay
  7. // @include https://forums.d2jsp.org/topic.php?t=*&f=*
  8. // @include https://forums.d2jsp.org/topic.php?t=*
  9. // @include https://forums.d2jsp.org/post.php
  10. // @include https://forums.d2jsp.org/forum.php?f=104
  11. // @icon https://www.google.com/s2/favicons?domain=d2jsp.org
  12. // @require https://code.jquery.com/jquery-latest.js
  13. // @grant none
  14. // ==/UserScript==
  15. var bannedUsers = ["381974"];
  16. function parsePosts(){
  17. $('dl').each(function(){
  18. if (typeof $('dt a', this).attr('href') !== 'undefined' && ~$('dt > a', this).attr('href').indexOf('user.php?i=')) {
  19. var userId = $('dt > a', this).attr('href').split("=")[1];
  20. if(bannedUsers.indexOf(userId) !== -1){
  21. this.remove()
  22. }
  23. }
  24. });
  25. }
  26. function parseTopics(){
  27. $('tr').each(function(){
  28. if (typeof $('td:nth-child(3) a', this).attr('href') !== 'undefined' && ~$('td:nth-child(3) a', this).attr('href').indexOf('user.php?i=')){
  29. var userId = $('td:nth-child(3) a', this).attr('href').split("=")[1];
  30. if(bannedUsers.indexOf(userId) !== -1){
  31. this.remove()
  32. }
  33. }
  34. });
  35. }
  36. parsePosts();
  37. parseTopics();