Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Block vk.com ad posts
// ==UserScript==
// @name Block vk.com ad posts
// @namespace https://gist.github.com/justdanpo
// @version 0.4
// @description Block vk.com ad posts
// @author den_po
// @include https://vk.com*
// @grant none
// ==/UserScript==
(function() {
var removeads = function(itm) {
[].forEach.call(itm.querySelectorAll('div.feed_row .wall_text_name_explain_promoted_post'),
function(node) {
node = node.closest('div.feed_row');
node.parentNode.removeChild(node);
});
[].forEach.call(itm.querySelectorAll('#ads_left'), function(node) {
node.parentNode.removeChild(node);
});
};
removeads(document);
document.addEventListener("DOMNodeInserted", function(evt) {
removeads(evt.relatedNode);
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.