Tim Spalding

From Social Software Showcase
Jump to: navigation, search
<a name="The_Pig_Flies.21_:_How_JavaScript_and_the_DOM_made_LibraryThing_for_Libraries_and_will_change_how_you_think_about_your_OPAC"></a>

Contents

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

<a name="The_Myth"></a>

The Myth

  • Your OPAC sucks.
<a name="The_truth"></a>

The truth

  • Your OPAC sucks.
<a name="The_exhortation"></a>

The exhortation

  • Stop whining and do something about it:
<a name="The_problem"></a>

The problem

  • You can't get structured data out of your ILS/OPAC
  • The can't plug things into your OPAC
<a name="Other_problems"></a>

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.
<a name="The_solution"></a>

The solution

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

One Result: LibraryThing for Libraries

The web site: <a href="http://www.librarything.com/forlibraries/" class='external free' title="http://www.librarything.com/forlibraries/" rel="nofollow">http://www.librarything.com/forlibraries/</a>

<a name="Technical"></a>

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.
<a name="Examples_from_the_Danbury_Public_Library"></a>

Examples from the Danbury Public Library

<a name="Problems_we.27ve_overcome"></a>

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")
<a name="What_else_can_people_do"></a>

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