Firefox Ejournal Search Plugin
Lately, I've gotten completely fed up with Ex Libris's e-journal search engine for my library's SFX database. It contains javascript to power the search engine which, could be good and even should be good (witness the goodness which is AJAX). However, this particular implementation borders on unusable and offers nothing but obfuscation.
I could have simply implemented my own version of the E-journal Locator page but, since I almost never use the A-Z browse listing, I realized that it would be really useful to have it as a Firefox Ejournal search plugin instead. So, here's the process of doing it. There is also a link on my plugin page to a more in-depth tutorial that shows how to write a Firefox plugin for Open WorldCat. Nifty.
The rest of this blog entry is a small tutorial on how I went about writing the Ejournal Search plugin.
Stripped of all the javascript, a working version of the Ex Libris search form looks like this:
<form name="az_user_form" method="get" action="http://sfx3.exlibrisgroup.com:9003/syracuse/a-z/default"> <input type="text" name="pattern" value="" /> <input type="hidden" name="current_view" value="detail" /> <input type="hidden" name="service" value="" /> <input type="hidden" name="perform" value="searchTitle" /> <input type="hidden" name="type" value="textSearch" /> <input type="hidden" name="letter_group" value="" /> <input type="hidden" name="textSearchType" value="contains" /> <input type="submit" /> </form>
Actually, since I knew that I was going to turn this into a Firefox search plugin, I eliminated two radio button choices for the "textSearchType" field and implemented it as a hidden field with the value of "contains" (contains any title word or word fragment).
To convert this form into a Firefox plugin, we simply convert it line by line following a few simple rules. The top part of the form with the method and action, gets turned into the following search header in the plugin:
<search version="7.1" name="SUL Ejournal Search" description="SUL Ejournal Search" action="http://sfx3.exlibrisgroup.com:9003/syracuse/a-z/default" searchForm="http://sfx3.exlibrisgroup.com:9003/syracuse/a-z/default" method="get" >
The <search> field has a name attribute which is displayed as the name of the plugin when it is installed in Firefox.
The text input box from the form
<input type="text" name="pattern" value="" />
becomes
<input name="pattern" user="">
in the plugin, stripping out type="text" and changing value="" in the form to user="" in the plugin. This is the section that receives the user's search statements.
The hidden fields in the form are similarly transformed. For example, the hidden field in the form with name="textSearchType"
<input type="hidden" name="textSearchType" value="contains" />
transforms to
<input name="textSearchType" value="contains">
in the plugin simply by removing the form's type="hidden" attribute. Except for the user input field, all other search fields in the original form, no matter what the original type, are necessarily treated as hidden fields in the plugin.
The <interpret> tag in the plugin is a holdover from the origins of the plugin search protocol as part of Apple's Sherlock search engine scripting language. Just about anything can go here since Firefox ignores it.
Finally, you code in the <browser> tag to indicate where updates can be found.
The final plugin looks as follows:
<search version="7.1" name="SUL Ejournal Search" description="SUL Ejournal Search" action="http://sfx3.exlibrisgroup.com:9003/syracuse/a-z/default" searchForm="http://sfx3.exlibrisgroup.com:9003/syracuse/a-z/default" method="get" > <input name="pattern" user=""> <input name="current_view" value="detail"> <input name="service" value=""> <input name="perform" value="searchTitle"> <input name="type" value="textSearch"> <input name="letter_group" value=""> <input name="textSearchType" value="contains"> <interpret browserResultType="result" charset = "ISO-8859-1" resultListStart="<html>" resultListEnd="</html>" resultItemStart="<body>" resultItemEnd="</body>" > </search> <browser update="http://tomkeays.com/library/plugins/sul_ej.src" updateIcon="http://tomkeays.com/library/plugins/sul_ej.gif" updateCheckDays="30" >
Posted by Tom on May 15, 2006