A feature of some websites that really annoys me are so called “Welcome Screens”, otherwise known as full page advertisements that you have to click through to see the real page. (e.g. Forbes.com). This apparently annoys plenty of other people too, so I decided to write a simple GreaseMonkey script that will automatically get past the majority of these pages.
It is called “SkipWelcomeScreen”, funnily enough, and you can install it on Firefox 3 from it’s homepage at http://chofter.com/apps/?n=skipwelcomescreen
If you’re not interested in technical details, you can stop reading now.
Using Sizzle with Greasemonkey
To very quickly search the page for anchor tags, I used John Resigs very cool standalone query selector engine, Sizzle. However, it had to be modified very slightly to work in GreaseMonkey.
At the end of the Sizzle.js file, there is the line:
window.Sizzle = Sizzle;
which had to be changed to
unsafeWindow.Sizzle = Sizzle;
due to GreaseMonkey’s use of a sandbox.
Also, when calling Sizzle, it wasn’t possible to call it directly, like:
instead it has to be called using the unsafeWindow parameter:
Otherwise, it works perfectly, and is blisteringly fast.