"MSDN Language Filter" user script
Just finished my MSDN Language Filter Greasemonkey user script. It removes the code samples for the languages you don't care about (say VB or JScript), on MSDN.
It lets you choose which language you want to filter out (see screenshot below) and remembers your preferences (using the new GreaseMonkey 0.3 data persistence APIs).
Here's a screenshot.
Update (2006-01-30): Updated the script to run in Greasmonkey 0.6.4 and Firefox 1.5.
Also included Ben Cartwright's fix for the SharePoint SDK (see comments below). Thanks Ben!
Hi Julien - Just installed this script and I'm not having much luck with it unfortunately. When I click on the language filter link, it just makes the bottom two frames completely disappear. For example when I go to the String class page:
I click the C# link, and for some reason it redirects me to:
Hmmm, any idea why this would be happening?
Couldn't repro the problem so far.
If not, what platform (Firefox version, GM version and OS) are you using?
Thanks,Posted by: Julien Couvreur (April 26, 2005 03:44 PM) ______________________________________
My version no's are:
I just checked the JS console and I found this error message popped up about
Error: GM_setValue is not defined
Very weird - does that mean that GM_setValue doesn't exist in GM 0.2.6?
...I just investigated it and apparently GM_setValue isn't in the last
stable release 0.2.6, you need to upgrade to 0.3b. Installed latest version
and..... Ha haaaa - It works! :)
Thanks for your help
Cool. I just fixed the script so that it alerts if you run it on an older version of GM.Posted by: Julien (April 26, 2005 03:47 PM) ______________________________________
Nice user script, Julien. Thanks for sharing it!
For some reason, though, the SharePoint SDK on MSDN uses a different set of tags for its code samples that the xpath "//span[@class = 'lang']" won't match.
Example page from the SDK: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/spptsdk/html/tscSPWeb_SV01013607.asp
Here's a quick patch to your script that I came up with to handle this oddball case:
// In the FilterLanguages function, change:
var xpath = "//span[@class = 'lang']";
var xpath = "//span[@class = 'lang'] | //pre[@class = 'signature']/p";
// Then, at the end of the function, change:
if (spanElement.tagName == 'P')
var pre = res.snapshotItem(i).parentNode;