Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I know about AdBlock extension. But in general, I don't want to block all ads. I'd like an extension, which allows me to Ctrl-click (or use another shortcut-click) on an ad which is disturbing and intelligently remove it from the page that I am browsing.

I know it could be done also, by right clicking on a page, opening the Inspection panel, click on the Loop tool, click the add, go up the DOM and highlight <object> and press Delete. But it's too long.

I remember once reading about a fancy jquery something, which blows elements on page in a spectacular way (unfortunately no idea what was the name). Perhaps something like this would do. Anything, the simpler, the better, But not automatic, just allow me to click&go. (in fact, it could allow to get rid of anything on the page, not only ad)

share|improve this question
add comment

1 Answer

up vote 3 down vote accepted

You can actually achieve this with AdBlock:

  • To avoid it from blocking anything by default, uncheck all items in the Filter lists.

  • To block a specific ad, right-click it and choose AdBlock -> Block this ad.

This would have the advantage of remembering your actions.

If you don't want to use AdBlock, you could try out this simple user script:

// ==UserScript==
// @name          NukeIt
// @description   Nukes HTML elements with a single click.
// ==/UserScript==

var nukeItSetup = function() {
    function nukeIt(what) {
        if(!event.ctrlKey)
            return;
        event.preventDefault();
        var now = Number(new Date());
        if(now < nukeItTimer)
            return;
        nukeItTimer = now + 100;
        if(event.altKey) {
            if(nukeItElements.length)
                nukeItElements.pop().style.display = nukeItProperties.pop();
        }
        else {
            nukeItElements.push(what);
            nukeItProperties.push(what.style.display);
            what.style.display = 'none';
        }   
    }
    var all = document.getElementsByTagName('*');
    for(var i = 0, j = all.length; i < j; i++)
        all[i].addEventListener('contextmenu', function(){nukeIt(this)});
}

var script = document.createElement('script');
script.innerHTML = 'var nukeItTimer = 0, nukeItElements = [], nukeItProperties = []; (' + nukeItSetup.toString() + ')();';
document.body.appendChild(script);

How to use:

  • To install, (temporarily) save the code as nuke-it.user.js, drag and drop the file in Chrome and click Continue when asked if you want to.

  • To hide a HTML element, right-click it while pressing Ctrl.

  • To unhide the elements you hid (in reverse order), right-click anywhere while pressing Ctrl + Alt.

share|improve this answer
    
Thanks, AdBlock indeed has this option, it was just a little hidden. I also installed NukeIt (by dragging it on the browser address bar) and it's really nice. It sometimes doesn't work on flash, e.g. on YouTube it won't delete the main video. But it nukes ads and it's funny! –  camcam Jul 16 '12 at 14:00
    
@camcam: That's because they placed a bunch of HTML elements over each other. If you click it several times, it will eventually disappear. –  Dennis Jul 16 '12 at 14:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.