July 2005 Archives

Depiq user script update

I've updated the depiq user script. I've solved the problem of disembodied "Read More" links (Slashdot's HTML is FUBAR; the first story on a page is encapsulated in a paragraph except for its "Read More" bits, while subsequent stories on a page do not have the same parent paragraph). Because I'm more confident about the script's capabilities now, I've also changed the include list to handle all slashdot categories. Internally, I removed the closure (closures are not memory-friendly in IE), refactored the code a bit into functions, and added some logging (through the GM_log() functionality, you'll see it either in the Turnabout console in IE or the Javascript console in Firefox) to track the editor that posted each story that was found and to give a total count of how many stories were removed. Finally, I can't seem to keep the filenames straight. I'm sticking with "depiq.user.js" for now. You may have to uninstall the previous script before installing this new one.

As always, the script has been tested with IE/Turnabout and Firefox/Greasemonkey. Since this script is just basic DOM walking and manipulation, it should work in Opera 8 as well, but I've not done any testing there.

Depiq user script

Since I created a "userscripts" category on my blog, I figured I should post my other user scripts (okay, "user script" singular for now) in this category for easy access.

Here's the depiq user script. It removes Roland Piquepaille-submitted stories from the Slashdot home page (exactly why you would want to remove these submissions is explained in the comments of pretty much every Roland-submitted story -- ie, if you have to ask, you probably don't care enough to remove them). The inclusion list is only the main Slashdot page, so Roland stories will still show up in other sections (you could change the inclusion list, but I haven't tested that). It's not perfect, thanks to Slashdot's horribly awful HTML code. You might see some parentless "Read More" links, for example. That just tells you that the script is working.

Since I'm an Internet Explorer user (gasp!), this script works with both Firefox/Greasemonkey and IE/Turnabout (Turnabout is now my choice of Greasemonkey-like IE plugins, since I killed GreasemonkIE -- I really liked that name; maybe Turnabout could rename themselves to GreasemonkIE?). It might work in Opera 8, but I haven't tested it there. Feel free to let me know if it does or doesn't work, or update the script to work with Opera.

Any future scripts will be Firefox/Greasemonkey- and IE/Turnabout-compatible. I'll do my best to support Opera 8, but it's secondary to the other two (sorry, Opera users).

I hacked around a little bit on the forza-stats user script, and ended up with this:

  • Added a "podium percentage" statistic. This takes the number of 1st, 2nd, and 3rd place finishes (or as I like to call them, "win, place, and show"), and divides them by the total number of races.
  • Added an onsubmit handler to the gamertag input form. If you hit enter on the input box, it will act as though you clicked "Set".
  • Changed the color and opacity of the statistics bar. I changed it to a greyish color that better fit the Forza theme, and added a slight transparency so that you can see the header graphic obscured by the bar. Strictly cosmetic, since the bar wasn't obscuring any clickable bits, but it's still a nice change.
  • Added some nasty browser-detection code so that the bar can be "position: fixed" on Mozilla. IE doesn't support "position: fixed", and the hacks to support a fixed-like layout assume you have full control over the web page. Since I really don't want to try to completely re-layout the Forza community pages, I did this hack so that at least Firefox users can have a fixed bar. I was very hesitant about adding this browser check, since it may completely fail if you've changed Firefox's userAgent string to mimic IE, but I decided it was worth doing because Firefox has reached the point where it's an accepted browser and only really stupid pages require it to identify itself as MSIE. Worst case, if you've changed Firefox's userAgent to look like MSIE, the statistic bar will be positioned abosolutely at the top of the page rather than as a "floating" fixed element.
  • Added some cleanup code to unhook onclick and onsubmit handlers. This is an attempt to help stem IE's javascript memory leaks. Memory is still leaked, but the forza-stats script should be nicer about not leaking as much memory.
I also spent some time seeing if I could make this script work with Opera 8's user scripting support, but reliance on GM_* functions makes this difficult. I tried using a script that implements the GM_* functions, but ran into several problems:
  1. The GM_getValue implementation in that script is broken. It's trying to eval the stored value, which doesn't work when storing simple strings.
  2. The GM_xmlhttpRequest "implementation" is simply an aliasing of Opera's XMLHttpRequest object. That's not enough for a proper implementation of GM_xmlhttpRequest.
If those two items in the compatibility script were fixed, or if a different compatibility library was used (I don't normally use Opera, so I don't know what exists in terms of mimicking Greasemonkey functions), forza-stats may work in Opera. However, given the differing CSS implementations across browsers, the bar itself probably wouldn't look right (Opera supports "position: fixed", but my browser check may not handle Opera properly; the width of the bar may be incorrect; Opera doesn't support the opacity style or the filter style which is used to do opacity in IE; etc).

As before, forza-stats is compatible with both Mozilla/Greasemonkey and IE/Turnabout.

About this Archive

This page is an archive of entries from July 2005 listed from newest to oldest.

June 2005 is the previous archive.

September 2005 is the next archive.

Find recent content on the main index or look in the archives to find all content.



OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01