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] function refreshSnapshots() { var head = document.getElementsByTagName(“head”)[0]; var script = $(“snapshotScript”); if (script) { head.removeChild(script); } script = document.createElement(“script”); script.id = ‘snapshotScript’; script.type = ‘text/javascript’; 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”; head.appendChild(script) } [/javascript]
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.