FurAffinity Post Prechecker / Hider

Hides the deleted submission/journal entries

  1. // ==UserScript==
  2. // @name FurAffinity Post Prechecker / Hider
  3. // @namespace http://www.furaffinity.net/user/shywolf42
  4. // @description Hides the deleted submission/journal entries
  5. // @include *.furaffinity.net/msg/submissions*
  6. // @include *.furaffinity.net/msg/others*
  7. // @include *.furaffinity.net/favorites*
  8. // @version 2.0.1
  9. // @license CC-BY-NC
  10. // ==/UserScript==
  11.  
  12.  
  13. // Version 2
  14. // loosely based on FurAffinity Deleted Post Hider Version 1.4 by Xijque
  15.  
  16.  
  17. /*
  18. Journals and submissions containing at least one of the specified keywords (or rather Character-sequences)
  19. will be pre-checked for easier removal and optionally hidden, unless they contain a keyword in the whitelist.
  20.  
  21. This means a filter for "EF" will check/hide all journals or submissions containing this string case insensitively.
  22. I.e. "EF Meme" will be checked as well as "I'll put more effort into stuff"
  23. But with the whitelist you can keep the journals saying "EF video" by adding "video" to the whitelist.
  24.  
  25. Hidden Journals and submissions are still checked, so they will be deleted when you click the "remove selected" button.
  26.  
  27. All entries will be compared case insensitive
  28. */
  29.  
  30. var keywords_journal_whitelist = new Array();
  31. var keywords_journal = new Array("raffle", "commission", "sketch", "stream",
  32. "live", "closed", "slot", "sale", "auction", "free art");
  33.  
  34.  
  35. var keywords_submission_whitelist = new Array("sketch", "doodle", "dump", "result", "pinup", "comm", "donat", "request");
  36. var keywords_submission = new Array("stream");
  37.  
  38. // set to "true" (without quotation marks) to hide journal entries rather than just checking them.
  39. // Otherwise set to "false" (without quotation marks)
  40. var hide = false;
  41.  
  42. /*
  43. set to "true" (without quotation marks) to hide deleted favorites in the favorite entries even if
  44. hiding journals and submissions is set to false.
  45. */
  46. var hideDeletedFavs = false;
  47.  
  48.  
  49. var paths=[],cache=[],checks=[],exec,elem;
  50. if (exec=(/(submissions|others|favorites)/i).exec(window.location+"")) {
  51. switch (exec[1].toLowerCase()) {
  52. case 'submissions':
  53. var submissionTitles, curSubmission;
  54. submissionTitles = document.evaluate('id(\'messages-form\')//b/span',
  55. document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  56.  
  57. for (var i=0;i<submissionTitles.snapshotLength;i++) {
  58. var curSubmission = submissionTitles.snapshotItem(i);
  59. var title = curSubmission.title;
  60. if (shouldBePrechecked(title, keywords_submission, keywords_submission_whitelist)){
  61. var checkbox = document.evaluate('./ancestor::b', curSubmission, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  62. checkChecks(checkbox.snapshotItem(0));
  63. }
  64. }
  65. break;
  66.  
  67. case 'favorites':
  68. if (!hideDeletedFavs)
  69. break;
  70.  
  71. var favorites = document.evaluate("//span[text()='Submission has been deleted']/following::small/a[text()=' by the owner.']/ancestor::b",
  72. document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  73.  
  74. for (var i = favorites.snapshotLength - 1; i >= 0; i--) {
  75. favorites.snapshotItem(i).style.display="none";
  76. };
  77. break;
  78. case 'others':
  79.  
  80. // Preselect deleted Messages
  81. var journalTitles = document.evaluate(
  82. "//strong[text()='Comment']/following::strong[text()='Journal']/ancestor::li | " +
  83. "//span[text()='Removed']/following::small[text()='by the user']/ancestor::li | " +
  84. "//li[text()='The favorite has been removed by the user.'] | " +
  85. "//strong[text()='Journal has been deleted']/following::strong[text()='the poster']/ancestor::li"
  86. , document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  87.  
  88. for (var i = journalTitles.snapshotLength - 1; i >= 0; i--) {
  89. var curJournal = journalTitles.snapshotItem(i);
  90. checkChecks(curJournal);
  91. }
  92.  
  93. // Preselect Journals based on filters
  94. journalTitles = document.evaluate("id('messages-journals')/ul/li/a[1]", document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  95.  
  96. for (var i = journalTitles.snapshotLength - 1; i >= 0; i--) {
  97. var curJournal = journalTitles.snapshotItem(i);
  98. var title = curJournal.text;
  99.  
  100. if (shouldBePrechecked(title, keywords_journal, keywords_journal_whitelist)){
  101. var checkbox = document.evaluate('./ancestor::li', curJournal, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
  102. checkChecks(checkbox.snapshotItem(0));
  103. }
  104. };
  105. break;
  106. }
  107. }
  108.  
  109. function checkChecks(elem) {
  110. if (hide){
  111. elem.style.display='none';
  112. }
  113.  
  114. var checkbox = document.evaluate(".//input[@type='checkbox']", elem, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null).snapshotItem(0);
  115. checkbox.checked=true;
  116.  
  117. }
  118.  
  119. /*
  120. title: Title of the submission / journal
  121. blacklist: array of textsegments for preselection
  122. whitelist: array of textsegments for no preselection despite a match of "title" and "matches"
  123.  
  124. returns: true if the item should be preselected based, otherwise false.
  125. */
  126. function shouldBePrechecked(title, blacklist, whitelist){
  127. title = title.toLowerCase();
  128.  
  129. for (var i = blacklist.length - 1; i >= 0; i--) {
  130. if (title.match(blacklist[i].toLowerCase())){
  131. //on whitelist?
  132. for (var j = whitelist.length - 1; j >= 0; j--) {
  133. if (title.match(whitelist[j].toLowerCase())){
  134. return false;
  135. }
  136. }
  137. return true;
  138. }
  139. }
  140. }

QingJ © 2025

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