Thursday, September 15, 2005

Becoming a Greasemonkey, one banana at a time

Alright, so I've finally gotten around to my first real taste of creating Greasemonkey user scripts.

I was thinking about what scripts I could write that I might actually use: the best I could do was some little tweaks to the ole' fantasy football site.

Here's what's been annoying me. I look at my list of players and each has a little 'note' icon next to them - letting me know that there's some news to be read. To get to the news I go through this:
  1. click the note icon
  2. new window opens
  3. read
  4. close window
  5. Repeat for each player

It's not many steps but it's a pretty obvious spot where the UI really could make my life easier. So, I set out with the goal of creating a hidden div in the page - on mouseover of a note I'd show the div and simultaneously populate it with the guys news via xmlhttp. All was going well and the script was running well against html on my PC when I decided to actually point it to the real URLs. I hadn't noticed that the player notes and the list of players were from different domains! Ugh!

Anyway, in the interest of just getting the thing working I gave up on the xmlhttp/hidden div and switched over to opening a new window with the note. It's not so bad since I still close that window onmouseout, but it's not ideal.

Now I have:
  1. hover over note icon
  2. read
  3. mouse off to close note
  4. Repeat for each player


My goal was to write my first script and that I did, so we'll count it as a success. If anyone has any (somewhat) straightforward advice on getting around the single domain requirement for javascript (xmlhttp) it would be much appreciated!

0 Comments:

Post a Comment

<< Home