Updated Library Search Extension

With the release of Firefox 1.5, I've updated the codebase for the librarysearch extension to work with the new code base.

Mozilla Addons

I noticed something odd today at the Mozilla Addons site. If you look at the site in Firefox (at least in my 1.0.6) you see what appears to be a broken site:

small-firefox

However, when you look at the same site in the evil IE, the site renders properly:

small-ie

LibrarySearch Firefox Extension

For a while now I've been playing around with Firefox extensions. The idea I had was to highlight some text (say a book title from a footnote in an online article) and see if our library had the item. My first attempt at this was a couple of years ago when I wrote a couple of bookmarklets to do this.

When I started using very useful extensions for Firefox, I decided this was a great opportunity to learn some new technology and create something useful. Last year I released a first version of the LibrarySearch extension as a test to see if I could do it. Today, I'm releasing a newer version that is based on the very popular Define Word extension.

After installing the extension (there's installation code with the link on the right, though you'll need to allow the site to install software; you can also download the extension and load it from the File menu), when you select text in the browser and right-click, a new context menu appears (Look up selection) that allows you to select which library/resource you would like to pass your selected text to search. This then opens a new tab with the launched search.

Knowing this isn't for everyone, you can modify these defaults in extension's options (Tools > Extensions). You can choose to open the search in the same window, a new window, or a new tab (default). You may also add, edit, modify any of the default search engines to your liking. If you ever mess it up, you can then click on the restore defaults button and start over.

One More Reason to Love Firefox

I was reading PC World last night, and I ran across an article where the author mentioned John Haller's Portable Firefox. This portable version sits on your flash drive and allows you to take your extensions, bookmarks, and plugins with you where ever you are.

I downloaded a version and put it on the SanDisk Cruzer Micro that's on my key chain and went to town. I have to admit that this is one of the coolest things I've seen this week (last week's coolest thing still has to be the Google Map API).

Working at a university, we have a lot of kiosk computers that function basically as a web browser (and IE at that). Haller's version of Firefox allows me to walk up to any of these computers and instantly have access to all of my bookmarks.

If this wasn't useful enough in itself, there is also Portable Thunderbird, Portable Sunbird, Portable NVu, and Portable OpenOffice. Portable Thunderbird is actually (at least for me) more useful than Portable Firefox. Being able to walk up to any computer and use my email client the way I set it up is really great (as long as the outgoing SMTP server doesn't change when you plug into another network). Also, the Portable OpenOffice can save your butt when you need to draft a memo from a public machine.

Software Pod

I just added some of the software I've worked on. The search plugins are also at Mozdev.org in their Mycroft Project. The Library Search extension was my first stab at an extension; it adds a context menu to Firefox when you select text to send the selected text to our library catalog, or pretty much any other type of search service.

The CF_GnuPG is a Java/ColdFusion wrapper that I wrote for an article a while back for the ColdFusion Developer's Journal (Public-Key Encryption: Making strong encryption nearly painless).

Extension Success

I've spent the better part of this morning building my first extension for Firefox. I have to admit it was a lot easier that I thought (after I figured out the JS). My extension adds a context menu to the right-click menu and also the Tools menu that allows people to highlight text on a webpage and search the library's online catalog for the book.

The hardest part was figuring out the function to call do the search. I was trying to use

document.getSelection();

which I had used in a bookmarklet a while back, but it kept returning a null value. As it turns out, when you're calling a the selected text from a function, you actually need

document.selection.createRange().text;

at least in my Firefox 1.0 and IE 6 browsers (and it needs to be called with an onMouseDown event)! However, you can directly access from the onClick event this:

javascript:alert(document.getSelection());

As far as the extension goes, most of the stuff is writing some XML (RDF format) telling the browser what's where with the workhorse with the bulk of the work being done by this:

function search(){
   var criteria = ';
   
   if (window.searchection){
      criteria = window.searchection();
   }
   else if (document.searchection){
      criteria = document.searchection();
   }
   else if (document.selection){
      criteria = document.selection.createRange().text;
   }
   else return;
   
   //search    if(!criteria){
      criteria = prompt("Search Criteria...");
   }
   
   if(criteria) {
      location.href='http://lion.wm.edu/uhtbin/cgisirsi/0/0/5?searchdata1=' + escape(criteria);
   }
}

Firefox plugins

Had a few minutes this weekend while visiting family in SW VA and started playing with Firefox plugins to search LION and William and Mary.

The William and Mary one was fairly straight forward as Google produces nice content. There is a slight bug in the one I wrote for LION in Mozilla browsers as the sidebar does not show the search results produced by the search. However, it works nicely in Firefox.

To generate the base, I used Mycroft for examples until I found that they had a plugin generator available. The tool isn't quite robust enought to help much in generating a solution for the LION problem though...I may need to wait until we upgrade the library system to iBistro and then rework the output to fix the Mozilla bug.

Anyway, there's an RSS feed along with source checking (I set it for every three days for these items). You can check these out for yourself here.

Faster Firefox

Doing some looking around, I found a neat Firefox hack that greatly increases the speed of Firefox.

If you open your (Firefox) browser and type about:config, you will get a list of configuration parameters. Filter the list for "network.http.p" which will give you a short list of parameters to work with.

There are three changes to preferences and one addition that you can do to make Firefox fly:

  1. Find network.http.pipelining and double-click to make its value true
  2. Find network.http.proxy.pipelining and double-click to make its value true
  3. Find network.http.pipelining.maxrequest and change its value to 30
  4. Add a new preference by right-clicking in an empty area and selecting New ->Integer from the menu. Enter the name of "nglayout.initialpaint.delay" and set its value to 0

Just restart Firefox and get ready to go much faster!