[HF] Hide threads from boards in the search page.

Hide threads from certain boards in your "View New Posts" page

  1. // ==UserScript==
  2. // @name [HF] Hide threads from boards in the search page.
  3. // @namespace @iNeo19
  4. // @version 1.1
  5. // @description Hide threads from certain boards in your "View New Posts" page
  6. // @author You
  7. // @match http://hackforums.net/search.php?action=results&sid=*
  8. // @grant none
  9. // ==/UserScript==
  10.  
  11. function getElementByXpath(path) {
  12. return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
  13. }
  14.  
  15. var badBoards = [
  16. "Call of Duty Series", "Hearthstone: Heroes of Warcraft", "CS:GO Lobby Talk"
  17. ];
  18.  
  19. (function() {
  20. 'use strict';
  21. var threadList = false;
  22. var threadTitleElement = null;
  23. var boardsNum = 0;
  24. var filteredBoards = 0;
  25. threadList = getElementByXpath('//*[@id="content"]/div[2]/table[2]/tbody');
  26. if (threadList) {
  27. var threads = threadList.getElementsByTagName("tr");
  28. for(var threadIndex=0;threadIndex<threads.length;threadIndex++) {
  29. var threadData = threads[threadIndex].getElementsByClassName("forumdisplay_regular");
  30. var boardTitleRow = threadData[1];
  31. if (boardTitleRow) {
  32. var boardTitleElement = boardTitleRow.getElementsByTagName("a");
  33. var boardTitle = boardTitleElement[0].innerHTML;
  34. if (badBoards.indexOf(boardTitle) > -1) {
  35. threads[threadIndex].style.display = "none";
  36. filteredBoards = filteredBoards + 1;
  37. }
  38. boardsNum = boardsNum + 1;
  39. }
  40.  
  41. }
  42. }
  43. var searchResults = getElementByXpath('//*[@id="content"]/div[2]/table[2]/tbody/tr[1]/td/strong');
  44. searchResults.innerHTML = searchResults.innerHTML + " <span style='font-size:10px;'><b> Filtered threads:</b> "+filteredBoards+"/"+boardsNum+"</span>";
  45. })();

QingJ © 2025

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