Page 1 of 1

Greasemonkey script for xkcd comics

Posted: Sat Oct 11, 2008 5:35 pm UTC
by chibu
Hi everyone,

I was reading through comics this morning, and since I use Firefox, I kept getting annoyed by having to right-click and look at the image properties every time i wanted to read the comic's title tag (or more than the first few characters anyway). So, i decided it was more efficient to spend a few minutes writing a script to deal with it instead. I ended up with making it so that when you click on the comic image, it displays the title text below it. Clicking a second times hides it again. It works pretty well except for comics that are also links.

This would have been the end of it, but then I started getting annoyed by having to aim my mouse to click on the navigation buttons. I find that it distracts me from the hilarity of the comic. SO, I decided to also code in some Mouse Gentrues. Drag right for the next comic, Left for the previous, up for the First, and finally, down for the latest comic. This can be done anywhere on the page... anywhere other than on the comic itself that is...

So, after spending a considerable amount of time reading the rules, I plan to blatantly violate them. Well, just the one actually. Since I signed up for the forums to share this, I figured it was silly to wait until I posted a few times in other threads before writing this one (though I do plan to eventually). In short, I thought it was kind of a waste to keep it to myself, so here it is: http://www.chibu.net/files/xkcd_image_title.user.js

Obviously, you will need to be using Firefox, and have Greasemonkey installed to use the script. Feel free to look at the source first to make sure that it doesn't do anything bad to you (it doesn't). The images uploaded to imageshack (used for the Mouse Gestures) are not mine, but were found by googling "Free arrow icons" or something. Also, I'd be happy to update it if anyone has any other suggestions. It currently has no comments, becuase I wasn't planning to make it public until just now. If anything needs explaining, feel free to ask. And let me know what you think of it otherwise.

Thanks,
~ Chibu

Re: Greasemonkey script for xkcd comics

Posted: Sat Oct 11, 2008 6:07 pm UTC
by jaap
If you can upgrade Firefox to version 3, you won't have this problem. I think there was also a plugin for version 2 that fixes it.

Re: Greasemonkey script for xkcd comics

Posted: Sat Oct 11, 2008 6:16 pm UTC
by chibu
jaap wrote:If you can upgrade Firefox to version 3, you won't have this problem. I think there was also a plugin for version 2 that fixes it.


Oh cool. That makes sense. I know there is a plugin somewhere for Firefox 2, but I didn't want to look for it, and now I don't need to. And I'm not sure why I don't like Firefox 3, it's probably irrational since I only used it for about 5 minutes, so I won't try to make up reasons for it. But for now I'll probably stick with Firefox 2.

And more importantly, Firefox 3 doesn't add Mouse Gestures! XD

Re: Greasemonkey script for xkcd comics

Posted: Sun Oct 12, 2008 9:09 am UTC
by Baxter
chibu wrote:And more importantly, Firefox 3 doesn't add Mouse Gestures! XD


https://addons.mozilla.org/en-US/firefox/addon/6366 no?

Re: Greasemonkey script for xkcd comics

Posted: Sun Oct 12, 2008 10:02 am UTC
by chibu


lol, fair enough ^-^

Re: Greasemonkey script for xkcd comics

Posted: Mon Oct 27, 2008 10:40 pm UTC
by sehku17
This is sweet, but I often prefer keyboard shortcuts.

There is a function GM_registerMenuCommand which can bind these functions to menu items, as well as hotkeys. This is part of the greasemonkey API. (http://greasemonkey.mozdev.org/authoring.html)

However, I was unable to bind the functions to hotkeys like I wanted. I'll hack around with it, but I thought you should consider that as an addition.