Hiding adversment posts on vk.com

How can we hide adverstment posts on vk.com’ news band? Fortunatelly, vk.com’s administration helped us with it – there are special mark on every adverstment post (at bottom part).
We just need to write little JS script, which would remove adverstment post, using these special marks.

We will use a so-called userscript, the javascript code, that included on desired web-site with use of GreasyMonkey/TamperMonkey.

Script installation:

1. Install browser extension, used to run user scripts:

For FireFox it’s GreaseMonkey
For Google Chrome, and browsers, based on it, that doesn’t have their own extensions markets (like Chromium, Vivaldi) it’s TamperMonkey
For Opera there it’s own version TamperMonkey

2. Copy script code from here: https://github.com/MihanEntalpo/VkHideAds/blob/master/script.js

Or right from this page:

// ==UserScript==
// @name        vk.com block adverstment posts
// @namespace   mihanentalpo.me
// @description Block adversment posts on vk.com
// @include     https://vk.com/*
// @match       https://vk.com/*
// @match       http://vk.com/*
// @version     1
// @grant       none
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js
// ==/UserScript==

(function(){
    
    function seek_and_destroy()
    {
        //Removing posts "adversment post"
        $('.wall_text_name_explain_promoted_post.post_link').parents(".feed_row,.post").remove();
        //Removing blocks "Adverstment in community... "
        $('.wall_marked_as_ads').parents(".feed_row,.post").remove();
        //Removing adverstment blocks at left side
        $("#ads_left").remove();
    }
    
    $(function(){
        setInterval(seek_and_destroy, 1500);
    });
    
})();

3. Create new script in GreasyMonkey / TamperMonkey, and insert the code inside it.

4. Check, if the script is working:

4.1. Open webpage vk.com, or, if it’s already opened, reload it.

4.2. Scroll news band down, and look for adversment posts. Make sure, that there are no any of them. In theory, you could see one of the adversments for 1.5 seconds, but after that, it’ll disapear. This happens because the script check for adversment every 1.5 seconds.

All is done!


So, what do you think ?