Software As She’s Developed

Mahemoff’s Podcast/Blog - Web, Programming, Usabilty from the Author of ‘Ajax Design Patterns’ (AjaxPatterns.org)

Software As She’s Developed header image 2

Weborandom - Now With Snapshots

May 1st, 2007 · 2 Comments

This mashup was just obvious. You've probably seen these snap.com website previews that hover over links on TechCrunch and various other sites. Can be useful and can be, well, a bit annoying, depending on the site in question. For Weborandom, though, there was no question. It just made eternal sense and I kept imagining it was there, so it was high time I added it in. Admittedly, Weborandom already provides a preview, so this is a kind of preview for a preview. Works for me anyway. With thanks to snap.com for providing their easy-to-integrate API, it's now live.

Go visit the new, new, Snapshots (TM)-enabled, Weborandom.com!!!

The main challenge was to make the previews refresh dynamically, which was achieved with a little On-Demand Javascript magic:

JAVASCRIPT:
  1. function refreshSnapshots() {
  2.   var head = document.getElementsByTagName("head")[0];
  3.   var script = $("snapshotScript");
  4.   if (script) { head.removeChild(script); }
  5.   script = document.createElement("script");
  6.   script.id = 'snapshotScript';
  7.   script.type = 'text/javascript';
  8.   script.src = "http://shots.snap.com/snap_shots.js?ap=1&key=d2e3ec72c47f90dc1ccf4c25de818ed2&sb=0&th=silver&cl=0&si=0&po=0&df=0&oi=0&link_icon=on&shots_trigger=icon&size=large&lang=en-us&domain=weborandom.com";
  9.   head.appendChild(script)
  10. }


I daresay the next installment will be the big one: search. It was originally intended to do that, but mysql fulltext queries crawl with several million records. I'll need to experiment with ferret and friends.

Categories: SoftwareDev

Tags:

2 responses so far ↓

  • 1 Great Sky // May 5, 2007 at 7:22 am

    Hello, Web-O-Random looks cool. Where did you get the idea?

  • 2 mahemoff // May 7, 2007 at 11:41 am

    Believe it or not, it stemmed from thinking it of the name. Sometimes websites happen like that. Once I decided to do a random web page website, it was clear Ajax would be involved, so …

Leave a Comment