Bookmarklets

Sunday, May 01

I’ve been digging javascript a lot lately. Yeah, it’s always been around, lurking in the shadows of web development, but I’d never learned more than I needed to get by—open a new window here, select a group of checkboxes there, etc.

Inspired by the javascript remoting (AJAX) usage in Gmail, flickr, and all the apps resulting from the not so silent Ruby on Rails revolution, I’ve been mucking around with the old jabbascript more than ever.

I’ve also been reading a lot of other people’s work and making silly bookmarklets and things in my spare time for no good reason. If you don’t know what a bookmarklet is, then I’m not going to explain it. Move along.

New Instiki Page

Even though Backpack is quickly replacing Instiki for me, I still use Instiki a lot. This bookmarklet makes it easier to create a new Instiki page by using your selection as the title of the new page or prompting for one if there is no selection. Think of it like having a Backpack-style ‘Make a new page’ button for Instiki!

Tip: this bookmarklet assumes your Instiki wiki is running at http://localhost:2500/wiki/ if yours is not you’ll have to edit it (the bookmarklet, that is).

javascript:q = %22%22 + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt(%22[Instiki] You didn't select any text. Enter a page name:%22, %22%22); if (q!=null) location=%22http://localhost:2500/wiki/new/%22 + escape(q).replace(/ /g, %22+%22); void 0

Google Maps Search

Takes the current selection as a street address (i.e. 19 Strathcona) and then prompts for a city and state/prov (i.e. Fonthill, ON). If you don’t make a street selection, you’ll get prompted for one. I made this when my wife and I were searching for houses this spring and I wanted a quick way to look up addresses that I’d selected from the various real estate sites were were visiting.

Tip: you should customize this so it includes the city/state you’re likely to use most often to save yourself some typing.

javascript:q = %22%22 + (window.getSelection ? window.getSelection() : document.getSelection ? document.getSelection() : document.selection.createRange().text); if (!q) q = prompt(%22[Google] Enter a street address:%22, %22%22); c = prompt(%22Enter an city, state/province:%22, %22Anywhere, AZ%22); if (q!=null) window.open(%22http://maps.google.com/maps?q=%22 + escape(q) + %22, %22 + escape(c)); void 0

Whois Lookup from dnsstuff.com

Sometimes it’s handy to get whois information for the domain in your browser’s address bar. This bookmarklet will do just that, courtesy of http://dnsstuff.com.

javascript:location.href=%22http://dnsstuff.com/tools/whois.ch?ip=%22 + location.host + %22%22;

Comments

Leave a response