Last active
November 5, 2021 23:21
-
-
Save justdanpo/9cea2203cd88bcb46d473b29dfce1b63 to your computer and use it in GitHub Desktop.
Block vk.com ad posts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Block vk.com ad posts | |
// @namespace https://gist.github.com/justdanpo | |
// @version 0.6 | |
// @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_box, 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