(Legally) Hacking Online Defensive Driving Course

Given the tendency for society to interpret hacking as an inherently illegal activity, I must first clarify what the meaning is in this context. While thefreedictionary.com has a definition that would suggest illegality:

To use one’s skill in computer programming to gain illegal or unauthorized access to a file or network.

This is only the second definition. The first (and relevant) definition listed is far less nefarious:

To write or refine computer programs skillfully.

In any event, I’ve said all of that as a very long preamble for the true topic of this post. I recently signed up to take an online defensive driving course on GetDefensive.com. In taking the course, I found it immediately frustrating that each page required the student to remain on that page for a set amount of time before proceeding to the next page of the course. This would not have been so bad, except that the time required for each page was significantly longer than the time I needed to absorb the information.

Once I had completed reading the content on a page, I would go off to another tab in my browser to work on something else, but then I ran into the issue of not knowing when the timer had completed, since it was only visible within the course tab. After making it about half way through the six-hour course, I had had enough. I decided to append the time remaining to the tab title so I could see how much time was remaining without needing to re-open the tab before it had finished.

GetDefensive.com Title HackRemembering my GreaseMonkey from when I had used Firefox, I went to see if something similar existed for Google Chrome. Apparently, Tampermonkey is the go-to for user script management in Chrome.

After playing with the new tool for a few minutes, I threw together a script that pulled the content from the existing count-down timer in the tab and had it duplicate that value in the title. You can see below for the solution I ended up with.

UPDATE (11/28/2013): I got another speeding ticket, which means I had a chance to revisit this solution and one small thing changed — the ID of the object we’re grabbing the time from. The code below is now up-to-date with this new ID.