Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Block ad posts
// ==UserScript==
// @name Block ad posts
// @namespace
// @version 0.5
// @description Block ad posts
// @author den_po
// @include*
// @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')
for (const node of itm.querySelectorAll('#ads_left')) node.parentNode.removeChild(node)
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.