Various Greasemonkey user scripts
Wrote a couple more more Greasemonkey user scripts last week:
- Allow Password Remembering removes the autocomplete="off" attributes that dictate the browser to never remember the tagged fields (usually for security or privacy reasons).
- Auto Reload reloads the configured urls every minute. It's useful for staying logged into some sites that have their sessions expire after a certain time (again, usually for security reasons). It's a bit different than the ability of the tabbrowser extension to reload tabs, as this script can cause frames to reload (not the whole document). I'll probably look into a way to configure this one to choose how often the url should be refreshed.
- O'Reilly Network Printer Friendly Redirect redirects to the printer friendly version of the O'Reilly Network pages, when they are loaded.
- Business 2.0 Printer Friendly Links and Redirect re-writes article links directly to their printer-friendly version, rather than the article summary page. If you happen to land on one of these interstital pages, it'll also redirect you to the printer-friendly version. This user script is mostly useful if you have access to the Business 2.0 online articles, which requires an issue access code (found in the printed magazine) or a subscription code (printed on the address label of the magazine for those who subscribe).
Update (2005/04/12): Added How Stuff Works - Printer Friendly, which redirects and re-write links to the printer-friendly version of "How Stuff Works" pages. It also prevents the links from opening in a new window.
Update (2005/04/18): Thanks to Logan for the various improvements and suggestions. I updated IGN Butler to be cleaner and also skip ads on a number of other sites (see comments below). It seems that IGN, GameSpy, RottenTomatoes, PlanetDoom, PlanetHalfLife,... are all part of the same network. I never noticed that RottenTomates has links and ads from IGN.______________________________________
Hi Julien, I like your two scripts, love the idea of rewriting links directly to the print-friendly pages. Strangely, even if you re-direct as opposed to rewrite, the "back" button in firefox refuses to recognize that you've visited the non-friendly page.
Besides, with a broadband connection, the redirect is neglegible.
For more ideas, check out my link below:
It's a bit like yours, but more flexible, since it covers loads of sites.
Can I add your two scripts to mine at some later stage?
RegardsPosted by: Samuel Ooi (April 13, 2005 03:23 PM) ______________________________________
Sure, feel free to include my scripts.
I noticed that Firefox "swallows" the page that causes the redirect. I kind of like it actually, otherwise pressing the back button would be a pain (you'd need to click twice...).
The IGNButler script works great. This could be easily modified to include gamespy.com and planet*.com (planetdoom, halflife, etc), they use the exact same stuff. Also, I'm not sure why the location is checked before skipInterstial() is run, it seems greasemonkey doesn't run the script unless it matches on the @include lines at the top, maybe that changed with recent versions?
Here's a patch:
Thanks Logan. I updated IGNButler with your patch.
The script does have some un-necessary stuff, as it was one of my first scripts and I followed the pattern from another script that had that problem ;-)Posted by: Julien Couvreur (April 15, 2005 04:25 PM) ______________________________________
Hello again. :)
When browsing the script requests, I came across one written for rottentomatoes.com, which also uses the fromint=1 thinger, but this one is just a two-liner, figured you'd be interested...
All you'd have to do is update the @include list and you've got something that'll work on ign.com, gamespy.com, planet*.com, etc..
It seems like this type of fullpage ad is pretty common, at least I don't think rottentomatoes.com has any relation to ign or gamespy.Posted by: logan (April 15, 2005 06:34 PM) ______________________________________
Thanks again for the tips logan. Mark's script is much simpler (mine also had an un-used function that I had not cleaned up...).
I updated the script to include IGN, GameSpy, RottenTomatoes and the various Planet* sites.
Auto Reload is great, but needs a timer.Posted by: Ottawa (May 11, 2005 03:43 PM) ______________________________________
Thanks for the scripts. I am trying to write a userscript for www.Devshed.com so that all the articles are redirected to their printable version as you have done for O'Reilly Network pages. But i am not able to find the URL pattern and moreover the printer friendly page opens in a new window. It would be really nice if you could guide me in this.
Sorry for super late response.
var xpath = "//a/font[contains(text(), 'PRINT')]";
var res = document.evaluate(xpath, document, null, XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);
"res.snapshotLength" should be 1.
"res.snapshotItem(0).parentNode.href" will have the value you care for.
Apply a regex to it to extract the print-friendly url.
This is Rolls-Royce of Cricket website. But I have found it unusable due to some programming problem of the site, or something on userend. I have never been able to stop auto reload of the page of the main web page. I do not have an iota of idea what is causing. Is it the Perl script, or something else? You -- the expert-- can help several million users who want to eliminate annoying reload of the main web page. Thanks a lot in advance.Posted by: Go (January 29, 2006 04:02 AM)