0

So I have this rule

www.foobar.com##div.annotation

It hides the div great. But how do I remove <div>?

The element is an annoying annotation cookie/whatever on top with CSS attribute position:fixed so I see transparent bar on top of the page.

4
  • you can't. at least not with ABP. ABP blocks certain requests from occurring, and hides elements; it does not remove elements. Commented Dec 29, 2015 at 20:59
  • @FrankThomas so no even a chance to apply CSS rule display:none?
    – Peter
    Commented Dec 29, 2015 at 21:00
  • Ads can tell if they are hidden, so the ABP folks force the add off-screen so the site can't tell that you are using ad blocking software. Commented Dec 29, 2015 at 21:03
  • @FrankThomas I understand thanks. I am surprised that there is no such options to do it. I guess I need to say hi to greasemonkey.
    – Peter
    Commented Dec 29, 2015 at 21:04

2 Answers 2

0

Try Greasemonkey:, and create new script

 // ==UserScript==
// @name           bleh somthing
// @description    ---s
// @version        1.0
// @license        Public Domain
// @grant          none
// @include        http*://*.DOMAIN.com/*
// @include        http://www.DOMAIN.com/.*
// ==/UserScript==


rem = document.querySelector('.annotation');
rem.parentNode.removeChild(rem);
0

I am using tampermonkey. This script is for deleting videos instead of hiding them. The example is specific for one site, but by analogy it can be done on any.

let listDeletes = [
    "/chennal/somestuff1",
    "/chennal/somestuff2",
    "/chennal/somestuff3",
    "/chennal/somestuff4",
    "/chennal/somestuff5",
    "/chennal/somestuff6",
    "/chennal/somestuff7",
    "/chennal/somestuff8",
    "/chennal/somestuff9",
];

function delBoxes() {

    for (let i = 0; i < listDeletes.length; i++) {
        document.querySelectorAll(`li a[href^="${listDeletes[i]}"`).forEach(e => e.closest('li').remove());
    }
}
delBoxes();

const observer = new MutationObserver(function (mutation) {
    mutation.forEach(function (mutation) {
        if (mutation.addedNodes.length) {
            delBoxes();
        }
    })
});
const playlistWrapper = document.querySelector('#videoPlaylist');
observer.observe(playlistWrapper, {
    childList: true
})
1
  • Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Mar 15, 2022 at 16:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .