« October 2004 | Main | December 2004 »

November 30, 2004

Engadget Search Plugin for FireFox

Since I was in the mood of creating FireFox search plugins for sites I search on often, I decided to make a search plugin for engadget. So, here it is:

Install Engadget Search Plugin

Just click the link above, and it will appear in the search bar within FireFox.

Again, sorry for the crumby icon (I obviously have no design sense). If anyone can make a better one, let me know and I will update it.

November 30, 2004 in FireFox Search Plugins | Permalink | Comments (15)

XUL Planet FireFox Search Plugin

As I have been learning to develop FireFox extensions, I have found my self repeatedly doing searches over at XULPlanet. So, I decided to create a FireFox search plugin for XUL Planet to make it easier and quick to search the site.

Install XULPlanet FireFox Search Plugin

Just click the link above, and it will appear in the search bar within FireFox. Sorry for the crumby icon. If anyone can make a better one, let me know and I will add it.

Post any questions / suggestions in the comments.

November 30, 2004 in FireFox Search Plugins | Permalink | Comments (1)

November 29, 2004

Opening an Extension's About box from a FireFox Extension

Here is another quick FireFox extension tip (which took me forever to figure out). This code snippet shows how to open the About box for your extension from within the extension.

var aboutXULPath = "chrome://extensionname/content/about.xul";
openDialog(aboutXULPath, "", "chrome,modal");

Where aboutXULPath is the path to the about box XUL file specified in the extension's install.rdf file.

Post any suggestions / tips in the comments

November 29, 2004 in FireFox Development | Permalink | Comments (0)

Creating a new Tab from a FireFox Extension

Here is a quick tip on how you can create a new tab that opens to a specified URL via a FireFox extension:

	var myUrl = "http://mesh.typepad.com";
var tBrowser = document.getElementById("content");
var tab = tBrowser.addTab(myUrl);

Post any improvements and / or tips in the comments.

November 29, 2004 in FireFox Development | Permalink | Comments (5)

Debugging FireFox Extensions on OS X

If you are developing extensions on FireFox on OS X, and are having trouble getting your extension to install or work, you can get some additional debug information from FireFox by starting it from the terminal.

On OS X, you can do that with the following command:

/Applications/firefox.app/Contents/MacOS/firefox

If you need to start the ProfileManager you can do it like so:

/Applications/firefox.app/Contents/MacOS/firefox -ProfileManager

Note, you may need to change the path to point to where you installed the FireFox bundle.

Any debug or error information will then be sent to the terminal window, which can make it much easier to debug any problems that might arise.

You can find some additional tips on setting up your debug environment for extension development here.

November 29, 2004 in FireFox Development | Permalink | Comments (1)

November 28, 2004

Building and Packaging FireFox Extensions on OS X

I have been learning how to build FireFox extensions on OS X. Actually doing a build and packaging it to install and test the extension is a little involved (you have to create multiple jar files and and an xpi file). Luckily there are a couple of scripts available that basically automate this process:

I am running on OS X so I was using the Bash / Linux script. However, this needed a few tweaks to get it to work correctly. Basically, I had to fix some path errors, and also get it to not package the mac .DS_Store folders.

Here is the updated script, which is based on the script found here.

#!/bin/bash
# build.sh: build JAR and XPI files from source
# based on Nathan Yergler's build script
# Modified to work on OS X by Mike Chambers (http://mesh.typepad.com)

#### editable items (none of these can be blank)
APP_NAME=helloworld    # short-name, jar and xpi files name.
HAS_DEFAULTS=0       # whether the ext. provides default values for user prefs etc.
HAS_COMPONENTS=0     # whether the ext. includes any components
HAS_LOCALE=0         # package APP_NAME.jar/locale/ ?
HAS_SKIN=1           # package APP_NAME.jar/skin/ ?
KEEP_JAR=1           # leave the jar when done?
ROOT_FILES="license.txt install.rdf install.js" # put these files in root of xpi
#### editable items end

TMP_DIR=build.tmp

#uncomment to debug
#set -x

# remove any left-over files
rm $APP_NAME.jar
rm $APP_NAME.xpi
rm -rf $TMP_DIR

# create xpi directory layout and populate it
mkdir $TMP_DIR
mkdir $TMP_DIR/chrome

if [ $HAS_COMPONENTS = 1 ]; then
  mkdir $TMP_DIR/components
  cp components/* $TMP_DIR/components
fi

if [ $HAS_DEFAULTS = 1 ]; then
  DEFAULT_FILES="`find ./defaults -path '*DS_Store*' -prune -o -type f -print | grep -v \~`"
  cp --parents $DEFAULT_FILES $TMP_DIR
fi

# Copy other files to the root of future XPI.
cp $ROOT_FILES $TMP_DIR

# generate the JAR file, excluding .DS_Store and temporary files
zip -0 -r $TMP_DIR/chrome/$APP_NAME.jar `find content -path '*DS_Store*' -prune -o -type f -print | grep -v \~`
if [ $HAS_LOCALE = 1 ]; then
  zip -0 -r $TMP_DIR/chrome/$APP_NAME.jar `find locale -path '*DS_Store*' -prune -o -type f -print | grep -v \~`
fi
if [ $HAS_SKIN = 1 ]; then
  zip -0 -r $TMP_DIR/chrome/$APP_NAME.jar `find skin -path '*DS_Store*' -prune -o -type f -print | grep -v \~`
fi

# generate the XPI file
cd $TMP_DIR
zip -r ../$APP_NAME.xpi *
cd ..

if [ $KEEP_JAR = 1 ]; then
  # save the jar file
  mv $TMP_DIR/chrome/$APP_NAME.jar .
fi

# remove the working files
rm -rf $TMP_DIR

In order to use this, you need to set up the directory structure in a specific way. Using the HelloWorld extension from this tutorial (highly recommended), the directory structure would look like this:

You can download the files and directory structure from here.

Notice that the build.sh file is in the same directory as the install.rdf. In order to build the extension, edit the parameters at the top of the build.sh file (at a minimum set the APP_NAME variable to match your extension name), and then just run it from the terminal. If it doesn't run, make sure that it is set to be executable by running the following command:

chmod 755 ./build.sh

from the terminal.

Thanks to everyone in the Mozilla Extension forum for helping me out, roachfiend.com for a great extension tutorial, and to whoever wrote the Linux / Bash package script that the OS X script was based on.

November 28, 2004 in FireFox Development | Permalink | Comments (2)

November 06, 2004

NoMoreCopies App for OS X

I have put together a simple application for OS X that takes a character delimited list, and removes duplicates. Here is a screenshot:

You can download the app from here.

Note : Only tested on OS X 10.3.5

The app is free, but if you end up using it, send me a postcard.

USE AT YOUR OWN RISK.

November 6, 2004 in NoMoreCopies | Permalink | Comments (0)