Greasy Fork

Greasy Fork is available in English.

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

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

当前为 2016-05-12 提交的版本,查看 最新版本

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Greasemonkey 油猴子Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Violentmonkey 暴力猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴Userscripts ,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey 篡改猴,才能安装此脚本。

您需要先安装一款用户脚本管理器扩展后才能安装此脚本。

(我已经安装了用户脚本管理器,让我安装!)

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展,比如 Stylus,才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

您需要先安装一款用户样式管理器扩展后才能安装此样式。

(我已经安装了用户样式管理器,让我安装!)

// ==UserScript==
// @name         [HF] Hide threads from boards in the search page.
// @namespace    @iNeo19
// @version      1.1
// @description  Hide threads from certain boards in your "View New Posts" page
// @author       You
// @match        http://hackforums.net/search.php?action=results&sid=*
// @grant        none
// ==/UserScript==

function getElementByXpath(path) {
  return document.evaluate(path, document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue;
}

var badBoards = [
    "Vices", "Market", "Premium Sellers Section", "E-Whoring", "Counter Strike", "Science, Religion, Philosophy, and Politics", "Website Market", "Currency Exchange",
    "Cryptography and Encryption Market", "Secondary Sellers Market", "Secondary Sellers Market", "Jtag/RGH Mods", "Ebook Bazaar", "Buyers Bay", "Monetizing Techniques",
    "Appraisals and Pricing", "Grand Theft Auto", "Call of Duty Series", "Social Networking Services", "Cryptography, Encryption, and Decryption", "Gamertags",
    "Hashing and Ciphers", "Hearthstone: Heroes of Warcraft", "Server Stress Testing", "Online Accounts", "CPA / PPD Make Money", "Remote Administration Tools",
    "Investment Strategies and Markets","CS:GO Lobby Talk", "Service Offerings", "Non-Free Accounts"
];

(function() {
    'use strict';
    var threadList = false;
    var threadTitleElement = null;
    var boardsNum = 0;
    var filteredBoards = 0;
    threadList = getElementByXpath('//*[@id="content"]/div[2]/table[2]/tbody');
    if (threadList) {
        var threads = threadList.getElementsByTagName("tr");
        for(var threadIndex=0;threadIndex<threads.length;threadIndex++) {
            var threadData = threads[threadIndex].getElementsByClassName("forumdisplay_regular");
            var boardTitleRow = threadData[1];
            if (boardTitleRow) {
                var boardTitleElement = boardTitleRow.getElementsByTagName("a");
                var boardTitle = boardTitleElement[0].innerHTML;
                if (badBoards.indexOf(boardTitle) > -1) {
                    threads[threadIndex].style.display = "none";
                    filteredBoards = filteredBoards + 1;
                }
                boardsNum = boardsNum + 1;
            }

        }
    }
    var searchResults = getElementByXpath('//*[@id="content"]/div[2]/table[2]/tbody/tr[1]/td/strong');
    searchResults.innerHTML = searchResults.innerHTML + "  <span style='font-size:10px;'><b> Filtered threads:</b> "+filteredBoards+"/"+boardsNum+"</span>";
})();