March 2005 Archives

GreasemonkIE update

| 5 Comments

New update for GreasemonkIE!

Changes:

  • Added an interface to load user scripts. No more XML modification. Download your script first, and then open "Tools ->Add User Script..." to load the script into GreasemonkIE. I still haven't hooked up to the context menu.
  • Added Tony Juricic's mscoree.dll wrapper, so now explorer.exe doesn't hold onto the GreasemonkIE assembly.
To upgrade, remove the old MSI (either using "msiexec /x greasemonkie.msi" from wherever you downloaded the MSI, or through Add/Remove Programs) and install this new one.

As a bonus, I've written my first brand-new user script: De-Piquepaille Slashdot. This script removes Roland Piquepaille-submitted stories from the Slashdot front page (I wrote it on a whim). Tested with Greasemonkey and GreasemonkIE.

Lately, I've been working on a side project to bring the Greasemonkey concept of user scripts to Internet Explorer. Thus, GreasemonkIE. It's still in a very early state, and I haven't had a chance to get in all of the functionality that I'd like. However, I feel that it's far enough along that I can put out there for others to use. You can download it here. It's packaged as a Windows Installer. You'll need to restart IE after it's installed (you may need to close IE before installation). There's no gui interaction so once the progress dialog goes away, it's done.

Known issues:

  • There's no nice way to install user scripts. For now, you'll have to do that by hand (see below). I'm working on adding an entry to the IE context menu for anchor tags, but that's not as clean as I'd like (only scripts can be added to IE context menus, so rather than adding an entry that calls a method in the BHO directly, I have to add an entry that calls a script that instantiates a COM class in the BHO that adds a script, and that's been causing some problems). Alternatively, I may just provide a GUI that will let you add already-downloaded scripts to GreasemonkIE.
  • GreasemonkIE is written as a BHO, so you may get warnings from some anti-spyware software. If it prompts you for confirmation, allow it to install.
  • Since GreasemonkIE is written in C#, you'll need to install the .NET framework if you don't already have it.
  • Also because GreasemonkIE is written in C#, I haven't yet found a good way to stop explorer.exe from loading the BHO. This means that you may have problems uninstalling GreasemonkIE if you've opened any Explorer windows (iexplore.exe will release the assembly reference when it's closed, but explorer.exe will not because it doesn't close until you log out or reboot). Logging out or rebooting will allow you to uninstall GreasemonkIE.
  • User scripts aren't re-applied if you refresh a web page. Internet Explorer doesn't fire the OnDocumentComplete event for page reloads, and I haven't had a chance to investigate other options.

Installing user scripts: GreasemonkIE should write an XML file under your user's application data directory ("C:\Documents and Settings\username\Application Data\GreasemonkIE\greasemonkie.xml", for example). If the folder or XML file doesn't exist, you can create them by hand. To install a new user script, add a new <script> node to greasemonkie.xml under the <scripts> node. For example, to install a user script "inline.player.user.js" that was downloaded to "C:\documents and settings\username\Application Data\GreasemonkIE\scripts\", add the following XML:

<script fileName="c:\documents and settings\username\Application Data\GreasemonkIE\scripts\inline.player.user.js" enabled="true" />
GreasemonkIE will pick up any changes to the greasemonkie.xml file and load them on the next page load. Once you've installed some user scripts, you can manage them (includes, excludes, enabled, uninstall) from the "Manage User Scripts..." entry in IE's Tool menu.

I've included Dimitri Glazkov's html-xpath.js script with GreasemonkIE, which supports a good bit of the DOM Level 3 XPath implementation, but it's by no means perfect. It's also quite slow, so I'd recommend avoiding user scripts that use xpath queries. Also, due to inherent differences in the Javascript implementation between IE and FireFox, many user scripts simply will not work with GreasemonkIE. I've tested some, and here's what I've found:

Scripts that work:

Scripts that don't work:
  • Gmail: Adding Persistent Searches
  • Google Suggest - A previous version worked using setTimeout, but this script was recently updated to use addEventListener instead, which IE's scripting model doesn't support. I ran into this on a few other scripts, and I may be able to build a work-around to support addEventListener.
  • (I didn't try a whole lot of scripts, so just because this section is small doesn't mean most scripts work)
In general, scripts that use XPath queries may work but slowly. Scripts that don't use any FireFox-specific script code should work perfectly. Scripts that do won't work at all. As with xpath support, I may be able to build work-arounds for many of these issues, but others will never work.

Enjoy!

About this Archive

This page is an archive of entries from March 2005 listed from newest to oldest.

January 2005 is the previous archive.

April 2005 is the next archive.

Find recent content on the main index or look in the archives to find all content.

Ads

Pages

OpenID accepted here Learn more about OpenID
Powered by Movable Type 5.01