> `cat /dev/urandom` since well after you started_ 

c u t u p @ c u t u p . o r g

 xml 

[javascript bookmarklet] last modified: 03/25/2007 02:03 pm

The little-big thing that got me comfortable reading books on my laptop was realizing that the shape of my browser window was important. There I am, reading Accelerando! and something wasn't right.

I resized my browser window narrow and tall, like a paperback book, and all the sudden it was no problem. I didn't realize how wide the columns of the Internets are! And how much of a difference it makes. I read a lot, I guess I'm wired up this way now.

It got me to thinking - I'm always resizing my browser window anyway, and there's basically one size I like by default, wide and covering most of the screen of my 12" pbook.

I don't have a javascript bone in my body, but a bunch of googling and one ask.metafilter question later, I had a couple of pieces of javascript that I could have in my Bookmarks Bar that resize and move the browser window.

This one:

javascript:resizeTo(600,screen.availHeight-40);moveTo(2,2)

is nice for reading long-form book type writing. And:

javascript:resizeTo(screen.availWidth-50,screen.availHeight-40);moveTo(2,2)

is the default browse setting I like.

It should be obvious how to customize these to your liking. Just enter the code as Location in a new bookmark, and throw it in the Bookmarks Toolbar Folder in Firefox. They work in Safari too. When I got FF 1.5 beta they stopped working - I had to go to Preferences -> Content -> Javascript Advanced, and check "move or resize existing windows", which was disabled by default.

Also, here's another interesting piece of javascript for a bookmarklet:

javascript:location.href='http://your_path_here?'+escape(location.href)

What this does is goes to the href= page and makes the page you clicked the bookmarklet on available as $_ENV['QUERY_STRING']. Useful for del.icio.us-style bookmarking and stuff.




[All Posts] [top]

tags:

bookmarklet
javascript