Firefox 16 will be released in a couple of days. Among its many improvements, there’s the new Developer Toolbar. This toolbar is essentially a command line that allows you to execute commands on the developer tools, like inspecting elements, starting up the debugger and generating screenshots from web content. This feature is designed to be easily extensible, so I decided to give it a try. Here are my results.
I thought it was particularly useful that there is a screenshot command in it. Since I’m not much of a web developer, this is the command that struck me as most useful. So I decided to take the screenshot command and juice it up. I created a restartless extension that adds a new imgur command that, predictably, uploads screenshots to imgur.com instead of saving them locally.
Creating commands is surprisingly easy. There’s no documentation for it yet – that I know of – so it required some digging around. Since it made sense to base my code on the screenshot command, first I located its source. As you will see if you inspect that code, declaring commands is super simple, and something you can cobble together in a few minutes (sans localization). Once I had the base for my code, it was just a matter of looking into imgur’s API, and then code, debug, repeat.
I finally got it in a decent state.
The resulting code can be found on Github. It’s worth noting that the code won’t work as is, just because I decided not to publish the imgur API key I generated. If you want to fork the code, you just need to visit imgur’s API page, generate your own key and replace it in the code. However, if you want to give the add-on a try, here it is. It should work on Firefox 16 and later.
I created this add-on as an experiment, and as part of a Firefox Developer Tools presentation I’m giving later this week in Costa Rica. So, this is far from a finished product. A few things should be corrected, like the lack of localization and the fact that it doesn’t send any metadata (like the title and description) to imgur. So, if you’re interested in turning it into a decent add-on, be my guest .