What's a simple way in Google Chrome to insert Javascript into sites?

bhuga picture bhuga · Aug 24, 2011 · Viewed 32.6k times · Source

I would like to be able to add custom snippets of javascript to any site that matches a regex. This is mostly because of sites that I use daily because of specialized content, but which have a poor design. I want to be able to do something like:

  • Visit site See that sidebar overwrites content
  • Whip out developer tools, find div id for sidebar
  • Edit a snippet of javascript which is executed on document.ready for this domain:

    $('#sidebar-right').remove();
    

A bit of searching for user scripts tells me that I need to be writing a Chrome extension, which seems unfortunate and overkill. Is there not an easier way, or an extension which is nothing but a javascript editor that assigns snippets to domains? I'd really like to be able to edit in Chrome itself, or at least have a file that I can just leave open in MacVim all the time. An extension requires unloading/installing to update as far as I can tell.

If I just had one big javascript file, that would be fine. I'd just wrap my customizations in domain checks.

Bonus love if I can write in CoffeeScript.

Answer