suburbia

Premshree's (品速力) Personal Weblog

etc.

Flickr Lightbox
suburbia
[info]premshree

Flickr Lightbox
Originally uploaded by Premshree Pillai.
Some folks were discussing Zooomr in an internal list. Someone mentioned the lightbox feature (try it here).

The feature is useful, most of the work had been done, and I was bored. So here you go, a Greasemonkey script that'll add the lightbox feature to Flickr. It works on any Flickr photos list-type pages (recent photos page, your friends page, favorites, any tag page, etc.).

Note: tested on Firefox 1.5, Greasemonkey 0.6.4 on OS X 10.4.3 and FreeBSD 4.10.

Enjoy!

Update (18/05): updated the script to work on Flickr gamma.

Watch Google videos in any country
suburbia
[info]premshree

I never used Google Video before. But now that some of Google’s tech talks are available online, I decided to take a look. Turns out I can’t view videos from India (and some other countries). This is the message you’d get, for example, when you try watching a Jessica Simpson video:

Thanks for your interest in Google Video.

Currently, the playback feature of Google Video isn't available in your country.

We hope to make this feature available more widely in the future, and we really appreciate your patience.

Of course, there are solutions, like using a proxy, etc. Anyway, here’s a Greasemonkey script to fix that thing.


360° Tagging (or Leveraging Existing Tagging Platforms)
suburbia
[info]premshree

Yahoo! 360°, as you know, doesn’t have the ability to tag entries as of now. I was wondering if there’s maybe a way I could add tagging to it. And then it struck me: Social Bookmarking!

Any sane social bookmarking site allows you to add a URL and associate a bunch of tags to it; and also has the capability to return a bunch of tags given a URL.

So, yeah, obviously it’s a Greasemonkey script. You get the idea now, I guess. I thought of using Yahoo!’s My Web 2.0 for this, but then there isn’t a push API. del.icio.us turned out to be my ideal candidate — they have post/get APIs, and they use HTTP authentication (which means no complications).

So this is how it works:

  • The script basically figure out the permalinks and titles of the blog posts, and store then as hidden variables in the forms that you see.
  • When you 'Add Tags', the permalink gets posted (through a PHP script proxy) as the URL to be bookmarked, and the title gets posted as the description (or the equivalent).
  • Now when you want to view posts with any tag, I just append a ?tag=foo to the blog URL, and it displays titles of all those posts, pointing to their permalinks.

Let’s take a look at a couple screenshots:

So to add a tag, you need to go to your My Blog page. Adding tags (space-delimited) is pretty straightforward, as you can see in the screenshot above. Now one problem is that I couldn’t find an API in del.icio.us that lets me add tags to an existing bookmarked URL. (I could maybe figure out tags for an existing URL, then add the new tag to the list, delete the URL, and then bookmark again... but, well, that’s too much of a pain.)

That's the same My Blog page when you pass a tag query to it — ?tag=code, in this case.

One thing — and an important one at that — lacking here is that only the logged-in user can make use of the tags. That’s kinda sad, but del.icio.us doesn’t have an API where I can do a tag lookup without requiring authentication information. Once they have such an API, it’d be pretty cool — all you’ll need to do is install (a modified version of) this script, and you’ll be able to see what others have tagged their posts, and browse their posts using tags.

So as of now what this script does is it makes your life easier if you want to categorize your blog posts... for you.

More interestingly, this script demonstrates how to leverage an existing tagging platform (del.icio.us, in this case), and make use of it in an application (Yahoo! 360°, in this case). Of course, using Greasemonkey is not really a solution but, hey, it works!

The script: 360.user.js.

NOTE: Like I mentioned earlier, the script uses a PHP proxy to interact with del.icio.us. Now I don’t do anything evil within the script but, if you’re like me, you might wanna get the source and host it on your box or something.


Greasemonkey Dict
suburbia
[info]premshree

It’s quite common to lookup dictionaries for words on web pages. I wrote a Greasemonkey script to make life a tad easier for me:

Now I don’t know if there’s such a script already. Anyway, doesn’t matter now. I’m using OneLook to fetch the definition. I know it’s probably not the best thing to do, however, I don’t know of any dictionary services that provide an API. Know any?

Well, I could set one up locally, but that’d work for me only. Oh well. Laters.

Oh yeah, using it: just double click on the word that you want to know the meaning of... if it does mean anything, a ncie box will appear, nothing happens otherwise.

Script’s here. That’s it for now from Monkeyland!


My Web 2.0 Search Results URL Tags Displayer
suburbia
[info]premshree

More Greasemonkey:

Well, if you haven’t figured, the script displays tags (tagged by My Web 2.0 users) for URLs for search results from Yahoo! and Google.

Good night from Monkeyland.


My Web 2.0 Page Tags Displayer
suburbia
[info]premshree

Yellow from Monkeyland once again.

My Web 2.0 is cool, as all of you’ll know. And we have an API—that means uber-cool shit. So, yeah, I hacked a little Greasemonkey script that does this:

Yeah, well, in case you didn’t get it, it basically displays the top (latest?—I’m not sure, and didn’t care to check) tags that the page you’re viewing has been tagged with by My Web 2.0 users. The screenshot above is a section from news.google.com. The thingie at the bottom-right is what the script does.

That’s it from Monkeyland for now.


Flickr Tags Autocomplete
suburbia
[info]premshree

Yeah, well, yet another Greasemonkey autocomplete script. If you go to Flickr’s Photos upload page, there’s no provision to select from your tags to add tags. Moreover, the default browser autocomplete obviously doesn’t understand Flickr’s space-delimited tagging. So when you type a character it’d provide you the entire set of tags that you might have typed earlier.

This script, on the other hand, has undergone rigorous training from folks at Flickrland and Monkeyland. After you type a space in the tags text box, the script will autocomplete for the character after the space. It’s kinda buggy, let me tell you. Get the script here. And don’t forget to set user_id—some-number@N00—in flickr_request().

That’s it from Monkeyland for now.


Skip Slashdot Comment Preview
suburbia
[info]premshree

On any of Slashdot’s Post Comment pages—this, for example:

...
Logged-in users aren't forced to preview their comments.
...

Now forcing users—whether Anonymous Cowards or not—to preview sucks. I hate it. And it’s stupid considering I can get rid of it. Here’s the Greasemonkey script you’d require. It adds a ‘Submit’ button on the page, and sets a hidden variable op—which, apparently, Slashdot uses to identify whether it’s a preview, or submit, or whatever—set to value Submit.

Well, I thought that alone would have done the job. Turned out there’s some more weird shit that it does internally—and I’m not terribly sure what all. My guess is that it does some session stuff, where it sets some flag to indicate that the comment-to-be-posted has been previewed. So, the script, when you click on submit, first does a xmlhttpRequest with op=Preview, and then submits the form. Seems to work.

That’s it from Monkeyland for now.