sean cassidy : Genius Blocker

in: programming

I was listening to Reply All today and they were talking about the context of this Sara Morrison tweet about Genius's web annotation tool. Apparently, a lot of people are mad about Genius essentially adding a comments section to people's websites and having each word and sentence criticized when they didn't agree to it1. I hate comments on sites so I totally understand.

Naturally, I wanted to look into it to see if I could put control back in the hands of the content creators. Turns out it's real easy. Here's the code:

var geniusBlockerObserver = new MutationObserver(function(mutations) {
    mutations.forEach(function(mutation) {
        if (mutation.addedNodes.length > 0) {
            for (var i = 0; i < mutation.addedNodes.length; i++) {
                var item = mutation.addedNodes[i];
                if (item.tagName !== undefined) {
                    if (item.tagName.startsWith("GENIUS")) {
                        document.body.removeChild(item);
                    }
                }
            }
        }
    });
});

geniusBlockerObserver.observe(document.body, {childList: true});

Simply put this in a JavaScript file on your site, or put it between two <script> tags and that's it! No more philistines commenting on your beautifully purple prose. Here's a simple copy paste solution:

<script
src="https://raw.githubusercontent.com/cxxr/GeniusBlocker/master/genius-blocker.js"></script>

You can also grab the code for GeniusBlocker on Github.

Fork me on GitHub


  1. Whoa! Annotate this sentence as "Sloppy writing", please. 

Sean is the Head of Security at Asana, a work management platform for teams.

Follow @sean_a_cassidy