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

Chrome: Fade out marketplace posts

Discussion in 'HTML & JavaScript' started by m4dm4n, Apr 26, 2015.

  1. m4dm4n

    m4dm4n Regular Member

    Joined:
    Sep 15, 2010
    Messages:
    223
    Likes Received:
    92
    Occupation:
    /dev/full
    Location:
    /dev/urandom
    If you're like me and don't want to see market posts on the bhw home page, you can use this:

    Code:
    // ==UserScript==
    // @match http://www.blackhatworld.com/
    // ==/UserScript==
    var _loader = function(w)
    {
        var bad = [
            'affiliate-programs-cpa-networks',
            'content-copywriting',
            'domains-websites-sale',
            'hosting',
            'hot-deals',
            'images-logos-videos',
            'misc',
            'proxies-sale',
            'seo-link-building',
            'seo-other',
            'seo-packages',
            'social-media',
            'web-design'
        ];
         var list = document.querySelectorAll("#homepage h4.threadtitle a")
    
    
         for ( var i = 0 ; i < list.length ; i++ )
         {
             var href = list[i].href;
             var parts = href.split('/');
             var businessEnd = parts.slice(-2,-1)[0];
             if ( bad.indexOf(businessEnd) != -1 )
             {
                 var trContainer = list[i].parentNode.parentNode.parentNode.parentNode;
                 trContainer.className = 'grayed';
             }
         }
    
    
         sheet = window.document.styleSheets[3];
         sheet.insertRule('tr.grayed * { color: #333 !important; font-weight: normal !important; }', sheet.cssRules.length);
    
    
    }
    var c = document.createElement('script');
    c.text = '(' + _loader + ')(window);';
    document.head.appendChild(c);
    
    To use this: save it in something like market.user.js on your desktop, go to extensions in chrome and drag it from your desktop to the extensions page, then refresh bhw and it should work
    This is the end result: ( The posts are not removed, only grayed out. This only works on the home page, forums / subforums are not affected )
    market.jpg
     
    • Thanks Thanks x 2
  2. jazzc

    jazzc Moderator Staff Member Moderator Jr. VIP

    Joined:
    Jan 27, 2009
    Messages:
    2,642
    Likes Received:
    11,355
    Occupation:
    Pusillanimous Knitter
    Location:
    Buenos Aires
    Settings -> General Settings -> Forums To Exclude From View

    ;)

    Kudos on the userscript though :)
     
    • Thanks Thanks x 1
  3. m4dm4n

    m4dm4n Regular Member

    Joined:
    Sep 15, 2010
    Messages:
    223
    Likes Received:
    92
    Occupation:
    /dev/full
    Location:
    /dev/urandom
    I did not know that :). The advantage with this is that they still appear but you can normally just scan over them.