Greasemonkey script for xkcd comics

A place to discuss the implementation and style of computer programs.

Moderators: phlip, Moderators General, Prelates

chibu
Posts: 15
Joined: Sat Oct 11, 2008 4:38 pm UTC

Greasemonkey script for xkcd comics

Postby chibu » Sat Oct 11, 2008 5:35 pm UTC

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

User avatar
jaap
Posts: 2094
Joined: Fri Jul 06, 2007 7:06 am UTC
Contact:

Re: Greasemonkey script for xkcd comics

Postby jaap » Sat Oct 11, 2008 6:07 pm UTC

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.

chibu
Posts: 15
Joined: Sat Oct 11, 2008 4:38 pm UTC

Re: Greasemonkey script for xkcd comics

Postby chibu » Sat Oct 11, 2008 6:16 pm UTC

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

User avatar
Baxter
Posts: 46
Joined: Sun Oct 12, 2008 3:30 am UTC

Re: Greasemonkey script for xkcd comics

Postby Baxter » Sun Oct 12, 2008 9:09 am UTC

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


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

chibu
Posts: 15
Joined: Sat Oct 11, 2008 4:38 pm UTC

Re: Greasemonkey script for xkcd comics

Postby chibu » Sun Oct 12, 2008 10:02 am UTC



lol, fair enough ^-^

User avatar
sehku17
Posts: 27
Joined: Mon Oct 20, 2008 9:35 pm UTC
Location: Missouri, USA

Re: Greasemonkey script for xkcd comics

Postby sehku17 » Mon Oct 27, 2008 10:40 pm UTC

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.
The box said "Requires Windows 2000 or better," so I installed Linux.


Return to “Coding”

Who is online

Users browsing this forum: No registered users and 4 guests