1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Greasemonkey script to strip Lounge posts out of the "New Posts" page

Discussion in 'BlackHat Lounge' started by Warbucks, Jan 3, 2010.

  1. Warbucks

    Warbucks Junior Member

    Joined:
    Apr 6, 2009
    Messages:
    171
    Likes Received:
    209
    Occupation:
    Mogul.
    Location:
    Stately Warbucks Manor
    I like to use "New Posts" in the bar above to see what's happening on BHW. Unfortunately it's usually littered with Lounge posts, and I really don't care about them.

    Since I use Firefox and greasemonkey, and since BHW runs vbulletin I decided to see if anyone had done something about this on other forums. Turns out, they had.

    Code:
    http://userscripts.org/scripts/show/62041
    Is a userscript to do exactly that on some australian overclocking forum.

    A bit of hackery later, and I've got this:

    Code:
    // ==UserScript==
    // @name Vbulletin Remove BHW Lounge from New Posts
    // @namespace http://warbucks.org/bhwnolounge
    // @description vBulletin: Hides selected forums from search results
    // @include http://www.blackhatworld.com/blackhat-seo/search.php?*
    // ==/UserScript==
    
    // Add comma-delimited quoted names of forums to hide, e.g. "Forum1", "Forum2"
    var HIDDEN_FORUMS = new Array("BlackHat Lounge");
    
    var forumNamePredicates = ".= '" + HIDDEN_FORUMS.join("' or .= '") + "'";
    var xpathExpression = "id('threadslist')/tbody/tr[td/a[" + forumNamePredicates + "]]";
    var rows = document.evaluate(xpathExpression, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
    
    for(var i = 0; i < rows.snapshotLength; i++) {
    var row = rows.snapshotItem(i);
    row.style.display = "none";
    }
    
    I put it up for people to install at:

    Code:
    http://warbucks.org/bhw_no_lounge.user.js
    This will make lounge posts disappear entirely from your search results, all search results, including the "New Posts" page. If you need to search for something in the lounge, you'll have to disable greasemonkey.

    For those that don't have a damn clue what I'm talking about, greasemonkey is an extension to firefox that lets you modify websites to your liking with javascript.

    If you have greasemonkey installed and visit that warbucks.org page it'll ask if you want to install the script.

    Feel free to view the source of it to make sure it's the same as what I pasted above and that I'm not screwing you. If you click Install then the next time you view search results on BHW, boom, no Lounge.

    And yes, I'm fully aware of how ironic it is to be announcing a script to strip lounge posts on the lounge itself.
     
    • Thanks Thanks x 1