Nintendo Wii forums Forum for writers phpBB mods Essays on copyright Dating advice Narnia forums

GreaseMonkey script for Bioware forums

I wanted to do a little bit of JavaScript work, and I figured that creating my first GreaseMonkey script would be an ideal way to do it.  Even more, I figured a simple one-liner would be an easy start.  Ha ha on me.  I was wrong.

What I wanted to do was to stop the Bioware forums from setting the focus on the login field.  Because they do that, I cannot scroll with the mouse wheel.  It is very annoying to have to click outside of the login box on every single page that I read.  So I figured I'd just use the JavaScript blur() to stop the page from being lame, right?  Wrong.

Even with my simple one-liner, I encountered a show-stopping problem that uncovered a nuance in how GreaseMonkey scripts are run.  The Bioware site runs this:

window.onload = startItUp;

...And that "startItUp" function is what puts the focus on the field.  The problem?  GreaseMonkey scripts are run before window.onload, effectively removing their ability to rewrite the page.  If you are a page owner and would like to defeat any GreaseMonkey scripts, all you have to do is run your functions on window.onload, and GreaseMonkey scripts will not be able to overwrite you.


Admitting defeat is not easy, so I worked with Rod Mcguire on the GreaseMonkey group, and we found that adding a setTimeout to my code would effectively delay the code execution until after the window.onload.  This is possible because setTimeout is asynchronous.  So my little one-liner, which took 2 minutes to write, took 3 or 4 hours to debug and complete – and in the end, wasn't much of a one-liner anymore.  Here it is:

function() {
function () {

If you read the Bioware forums and are annoyed with how it interferes with scrolling, then you are free to install this script in your GreaseMonkey-compatible browser.


« Some lolcatz 4 u | Main | GreaseMonkey script for Digg friends stuff »

Nav by tag: greasemonkey
Main | GreaseMonkey script for Digg friends stuff »
Nav by tag: tech
« Custom Profile Fields 1.2.1 for phpBB | Main | GreaseMonkey script for Digg friends stuff »
Bookmark It! Technorati Netvouz DZone ThisNext Wists blinkbits BlinkList blogmarks blogtercimlap Blue Dot Bumpzee co.mments connotea DotNetKicks Fark feedmelinks Fleck Furl Gwar Haohao Hemidemi IndiaGram IndianPad Internetmedia LinkaGoGo Linkter Ma.gnolia MyShare Netscape NewsVine PlugIM PopCurrent ppnow RawSugar Reddit Shadows Simpy Slashdot Smarking Spurl Webride YahooMyWeb

TrackBack URL for this entry:

Comments (11)
deatieseE writes:

This is my first message. Please don't delete it. Thanks
jsh39shd2 [url=]link[/url]

Oxipmesse writes:

j4j3h4kj5 [url=]link[/url]

Annomocak writes:

Hello my friends! Who are you!?

milsseageab writes:

Please one more post about that.I wonder how you got so good. This is really a fascinating blog, lots of stuff thcat I can get into. One thing I just want to say is that your Blog is so perfect

icopsjoiree writes:

scarlet ortiz desnuda
delete plz

Vernontiz writes:

Vernontiz writes:

Vernontiz writes:

Vernontiz writes:

WilliamCups writes:

Post a comment

Verification (needed to reduce spam):