Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

More fun with the monkey

Cory Doctorow points to America from the Great Depression to World War II: Color Photographs from the FSA-OWI, 1939-1945, with the following observation:

Unfortunately, the organizational back-end for this is so primitive (especially in comparison with modern image-sharing and organizing sites like Flickr) that it, too, seems to hail from 1939-1945, making the site a real pain to navigate and use.

Thanks to Greasemonkey, great content spoiled by poor navigation is a solvable problem.

americanmemoryfixer.user.js includes the following improvements:

  • Changes the colour scheme to black-on-white, and the typeface to Verdana.
  • Removes all table borders.
  • Adds headings to some pages, and fixes various title tags.
  • Sets the default gallery view to be a set of thumbnails, rather than a list of names.
  • Displays a large image (as opposed to a thumbnail) when you view a photograph.

The scariest hack in the script is the way in which subject page titles are passed around. In the current site, if you visit a category page (such as Sharecroppers) the title of the category is not displayed on the page—even though it has been passed as a parameter in the URL. If you click a link (say to the Galley thumbnail page) the information in the URL is lost as well.

My solution was to extract the subject from the URL on that first page, then rewrite the other links to include an additional “&subject=Sharecroppers” parameter. This new parameter is ignored by the CGI scripts that power the site, but my Greasemonkey script watches out for it on subsequent pages and uses it to display a title (and further propagate it to other links on the page). It’s not a very robust solution, but it’s good enough.

There’s plenty of scope for further improvement—if you want to use my script as a starting point, please feel free.

This is More fun with the monkey by Simon Willison, posted on 17th September 2005.

Tagged ,

View blog reactions

Next: Working for Yahoo!

Previous: Firefox 1.5 developer highlights

13 comments

  1. Sweet! I gave up trying to look through those photos - just too much information. Thanks for the pretty hack!

    Geoff - 18th September 2005 05:54 - #

  2. Nice ! It's amazing what one can do with greasemonkey.

    Arnaud - 18th September 2005 13:06 - #

  3. How do I use it?

    S. McGillicuddy - 18th September 2005 13:35 - #

  4. First, install Firefox (if you don't already have it). Next, install Greasemonkey (instructions here). Then, install my user script (instructions and video here). Then you're done.

    Simon Willison - 18th September 2005 14:20 - #

  5. Thanks for the wonderful script! Your efforts are greatly appreciated!

    Julian - 18th September 2005 14:58 - #

  6. I keep trying to install the script, but the dialog that posp up doesn't include any URL's, etc. I have Greasmonkey installed (0.5.3) and have used a few scripts already. Any one else having trouble with this?

    Chris Bloom - 18th September 2005 14:59 - #

  7. Thank you.

    alexrose - 18th September 2005 17:10 - #

  8. Seems to work fine with Opera as a user-script, too.

    Dave D - 18th September 2005 21:41 - #

  9. The greasemonkey site warns that some people are having trouble with the plug in. I suggest you use the method to let Firefox install the script itself, rather than downloading the script separately (one good reason, the instructions on the site for manual placement of the script are platform specific, and can suggest an incorrect path). So... for those who have finally found something worth installing Greasemonkey for... Download and install Greasemonkey. Restart Firefox. Load the LOC photo archive URL to see it old school in another tab. Right Click on the script (URL at top of this page) to install the script. The script has a drop down dialog on install to show you the URLs it is associated with. Reload the LOC archive. Mo Better

    Blofield - 19th September 2005 06:15 - #

  10. Great work, Simon! But I hope that you've also been in contact with the site to suggest that they the implement the changes that you've Greasemonkey'd, so that all visitors may benefit, not just those who know about your sterling script. Naturally I realise that not all webmasters will take constructive criticism as it is intended, but most should, and I think that Greasemonkey scripts like this should be used as a positive force for improvement by showing people what their site *could* look like, thereby encouraging them to make it so.

    Marcus Tucker - 23rd September 2005 13:29 - #

  11. thank you.

    scristian - 2nd October 2005 21:46 - #

  12. I tried to fixes to Greasemonkey recommended here in the comments, but it still wasn't working. When I would try to install the script, whether by right-click, download-install, or opening the script page and then installing, I was getting a Greasemonkey dialog box that didn't have any content, and wouldn't let me add anything or even click the OK button.

    However, some poking around on mozdev led me to this post on Greaseblog about corruption weirdness in upgrades of Greasemonkey. I followed the instructions, and all was well.

    Just hoping this might help some people having extreme problems.

    The interface changes are a great improvement. Way easier on the eyes... Great work!

    Andrea - 14th October 2005 16:39 - #

  13. Thanks for this - it gave me the idea to extend your userscript with a regex that finds the unique id for each item, and then creates links to full metadata records in every available format for the item from the LoC's OAI server using the COinS-PMH approach (using another userscript that just speaks COinS-PMH). Written up here if you're interested.

    dchud - 7th November 2005 01:46 - #

Comments are closed.

Previously hosted at http://simon.incutio.com/archive/2005/09/17/monkeyfun

A django site