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.5
// @description Block vk.com ad posts
// @author den_po
// @include https://vk.com*
// @grant none
// ==/UserScript==
(function () {
function removeads(itm) {
for (let node of itm.querySelectorAll('div.feed_row .ads_ad_explain_title, div.feed_row .wall_text_name_explain_promoted_post')) {
node = node.closest('div.feed_row')
node.parentNode.removeChild(node)
}
for (const node of itm.querySelectorAll('#ads_left')) node.parentNode.removeChild(node)
}
removeads(document)
document.addEventListener("DOMNodeInserted", 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.