Archive for the 'User Scripts' Category


Sunday, January 15th, 2006

Stylish, a Firefox extension by Jason Barnabe, lets you manage CSS rules to change the appearance of web sites.

Stylish is to CSS what Greasemonkey is to JavaScript. Stylish allows you to easily manage user styles for the application UI, all websites, or only certain websites. Stylish is better than using userChrome.css/userContent.css because styles are applied immediately instead of requiring a restart.

Some Greasemonkey scripts only add stylesheets. These scripts would work better as user stylesheet additions, because user style rules are applied immediately rather than only after the page finishes loading. Stylish makes it as easy to add a user stylesheet as it is to install Greasemonkey scripts.

You can use it with pre-written user style rules such as my examples or you can write your own as you use the extension. The test styles bookmarklet, which lets you experiment with added CSS rules, complements Stylish well.

Update 2005-02-11: Updated link to point to instead of the extension's forum thread.

Pornzilla update

Saturday, December 3rd, 2005

I added 5 extensions to Pornzilla. The new extensions are:

  • Browse Images - Use the Forward button or Alt+Shift+Right to go to the next image.
  • Location Navigator - Select a portion of a URL that varies, then navigate up or down.
  • Launchy - Open links to video files in an external player, streaming, so you can watch a video without waiting to download it. (Note that not all video players support streaming video; for example, WinAmp 5.111 hangs. VLC works well. Here's my launchy.xml for VLC.)
  • MediaPlayerConnectivity - Open embedded video in an external player, so you can use features like Full Screen.
  • Image Zoom - Convenient shortcuts for zooming images.

I also moved extensions that don't work in Firefox 1.5 yet onto a separate page. (I wrote a Greasemonkey script to help me determine which extensions had been updated for Firefox 1.5.)

Updated Greasemonkey scripts

Thursday, December 1st, 2005

I updated a few of my Greasemonkey scripts to work with versions of Greasemonkey that use XPCNativeWrappers. Greasemonkey 0.5 introduced the use of XPCNativeWrapper for the document object (but only when running on "Deer Park" builds of Firefox that were leading up to Firefox 1.5, not when running on Firefox 1.0.x). Greasemonkey 0.6.4 uses XPCNativeWrappers for everything except unsafeWindow, including the script's global scope. Using XPCNativeWrappers increases security but requires some scripts to be modified.

Most of my scripts didn't require any changes. Several only required minor changes to work with XPCNativeWrappers, such as using addEventListener instead of setting the onclick property.

The trickier scripts to fix had relied on the ability to set properties on DOM objects. I refactored Valid XHTML and Drag 43 Things to use closures instead.

Another problem I ran into was that the normal XMLHttpRequest syntax does not work with XPCNativeWrappers (bug 318489). instant voting used XMLHttpRequest, so I modified it to use GM_xmlhttpRequest instead.

I also updated Pike's Google Maps Mousewheel Zooming script to work with Greasemonkey 0.6.4. This was the most difficult script to update because it interacts with page scripts rather than just interacting with a DOM. The normal way for a Greasemonkey 0.6.4 script to interact with page scripts is to use unsafeWindow, but using it allows the page to see the source of your script, and in some cases allows the page to call GM_ functions. (It would be bad if an evil web page were able to use GM_xmlhttpRequest, since it is not restricted with a same-host policy.) One might argue that I trust Google, which is true, but I don't trust, which is also matched by the script's URL pattern. My version of the script works by setting location.href to a "javascript:" URL when it wants to call in-page functions. I think this is safe and hides the Greasemonkey script's functions from the JavaScript stack seen by webpage functions.

I also found out that my Valid XHTML script was broken in Greasemonkey 0.6.4 because it uses DOMParser, probably for the same reason scripts using XMLHttpRequest are broken. I gave up and used unsafeWindow to access DOMParser.

New user script: Bug attachment source

Tuesday, November 8th, 2005

I've been working with crash bugs in Firefox a lot lately, so I wrote a Greasemonkey script called Bug attachment source to make it easier to view the source of a Bugzilla attachment that would crash the browser if loaded normally. It adds a "source" link next to the mime type of attachments, except for text/plain attachments such as patches.

I have only tested it with Greasemonkey 0.6.3 and today's Firefox build from the Firefox 1.5 branch.

Endless Forum Pages user script

Monday, August 29th, 2005

The Endless Forum Pages user script makes phpBB forum pages infinitely long instead of limited to 15 posts per page. It loads the next page into a hidden iframe when you scroll to near the bottom of the page, and then it moves the posts from the iframe into the main page when the iframe finishes loading. If you hate clicking the tiny "Next" link on MozillaZine Forums topic pages (example) as much as I do, please try this script.

If you use this script, it is best to scroll using pgup/pgdn. If you scroll by dragging the scrollbar, your position will jump when the page gets longer.

Using this script shouldn't affect the load on forum servers much, because it only activates when you scroll to near the bottom of the page, which indicates that you're likely to continue reading.

This script works at MozillaZine Forums and The Blue Gryphon. You can try using it with other phpBB forums using Greasemonkey's "included pages" feature. Don't expect it to work at all phpBB forums, though, because phpBB forums are often customized a lot and the script is somewhat fragile.

Greasemonkey 0.4 pre-beta

Sunday, July 17th, 2005

Aaron Boodman posted Greasemonkey 0.4, attempt III today on the Greasemonkey mailing list. It is the first version of Greasemonkey that works in Deer Park alpha 2 and Firefox trunk builds. Earlier messages describe attempt I and new features, attempt 2, and the call for pre-beta testing. Instant Voting user script

Wednesday, May 25th, 2005 Instant Voting makes the vote links on submit your vote without taking you to another page. If the server accepts your vote, the script shows the item's new score, assuming nobody else has voted on the item since you loaded the page.

AutoLink filters

Tuesday, May 24th, 2005

If you've made new AutoLink filters, please post them in comments wrapped in <pre> or post them in your blog and use trackback. Feel free to request filters, too.

For tutorials and references on using regular expressions in JavaScript, see

Tips for testing filters:

  • Use the Edit button in Greasemonkey 0.3.3+. As soon as you save your changes in your text editor, they will apply the next time you load or reload a page.
  • Create a test page similar to autolink-test.html. Then you can test each change by saving autolink.user.js in your text editor and reloading the test page.
  • Use Thomas Russell's regular expression tool or the JavaScript Environment to test your regular expressions.