Tim Spalding

From Social Software Showcase

Jump to: navigation, search

The Pig Flies! : How JavaScript and the DOM made LibraryThing for Libraries and will change how you think about your OPAC

The Myth

  • Your OPAC sucks.

The truth

  • Your OPAC sucks.

The exhortation

  • Stop whining and do something about it:

The problem

  • You can't get structured data out of your ILS/OPAC
  • The can't plug things into your OPAC

Other problems

  • Ajax is great, but you can't use Ajax across domains. This is called "cross-site scripting." Cross site scripting is baaaad, baaaad.
  • Getting a scripting language onto your OPAC's domain can be hard or impossible.
  • You may not have control over your OPAC templates. (eg., you only have control over the footer on the page).
  • The HTML on the OPAC itself is childishly poor.

The solution

  • You can get your data, either:
      <li>Export your data; </li><li>Screen-scrape your data. </li>
  • Use JavaScript and the DOM
      <li>JavaScript allows cross-site scripting. </li><li>JavaScript can request and re-request all day long. (The trick is to dynamically insert <script> tags into the header.) </li><li>On the server side, your JavaScript must be generated (ie., with PHP, Perl, Ruby, etc.) </li>

One Result: LibraryThing for Libraries

The web site: http://www.librarything.com/forlibraries/

Technical

  • Export: Grabs ISBN, title, author. (Originally we grabbed just ISBN and scraped; what a pain.)
  • Trigger: We use ISBNs. There are other ways, but ISBNs are easy because of the checksum.
  • Programming: Javascript, PHP, MySQL.
  • Testing: Greasemonkey. Oh yeah. We can show a library what it will look like without any work on their side.
  • Cross-OPAC. We've had minimal problems with different OPACs.
  • Accessibility. We link to an outside page, which looks at the referrer. This works quite well. Anyway, we're more accessible than the OPAC itself.

Examples from the Danbury Public Library

  • The book Bridge Jones' Diary. Includes:
      <li>Recommended books </li><li>Semi-FRBR "other editions" </li><li>Tags. Click on a tag and get a relevancy-ranked list of books that have that tag. This "tag browser" is a fine example of just how much you can do with JavaScript re-requests, CSS and the DOM. I didn't program it, so I feel okay saying that it's a frickin' work of art. </li>

Problems we've overcome

  • OPAC have such lousy HTML. We do a lot of "third blue table to the left of the ..." work. Tedious, but solveable.
  • Sometimes the "browse history" on some OPACs includes ISBNs. We have to correct for that (ie., "discard ISBNs within a menu")

What else can people do

There is no limit to what you can add to your OPAC. Some ideas:

  • Add social interactivity: tagging, ratings, reviews
  • Add spell-check
  • Add links to outside resources (eg., full text versions)
  • Buy LibraryThing for Libraries and make us all rich as Croesus
Personal tools