Snap Preview Anywhere

Once again, this is what happens when I stop paying attention (to be fair, though, I was on vacation this time). As mentioned in various posts linked off of the Community Server Daily News, Snap (whom I had admittedly not heard of until today) has come up with a damn cool little tool called Snap Preview Anywhere that creates popup Javascript/HTML previews of the links on your site. Want to see it in action? Just roll over any link on this page! This is really handy for people like me who like to litter their blog posts with lots of pointless links.

While that's fancy enough on its own, what impressed me the most was how easy it is to implement on your site. You go through the sign up process and you add one Javascript reference to your site. That's it. Very cool stuff.

Well, it's almost that easy. Snap Preview Anywhere creates previews for every link on your page. This has the rather annoying side effect of previewing links back into your own site. Snap does provide a simple Javascript solution for disabling the previews on internal links, however:

<script type="text/javascript">
//<![CDATA[
    //change sites internal links to class "snap_nopreview"
    var links = document.getElementsByTagName('a');
    for (var l = 0; l < links.length; l++)
    {
        if(links[l].href.match(/^http:\/\/blog\.ninjafish\.net/))
        {
            links[l].className += " snap_nopreview";
        }
    }
//]]>
</script>

Add this script to the bottom of your page, before the </body> tag (it has to run after the page has rendered). Obviously, you'll want to change the search string to match your site instead of mine. There's also no reason why you can't use this to filter out domains other than your own.

[Update] If you use Scott Watermasysk's Share It module, you'll probably want to update that script to filter out the links that it creates. Here is the regex I am using to do just that:

/^http:\/\/(blog\.ninjafish\.net)|(del\.icio\.us\/post)|(www\.digg\.com\/submit)|(reddit\.com\/submit)/

Comments

Jason Fields said:

Heya,

First off thanks again for the compliments on Snap Preview Anywhere! Second, I wanted to inform you that we are working on a new version that by default will not render 'internal' links. This means that you will not need to add the extra little snippet of JScript code at the  anymore! Based upon a great deal of feedback from our current userbase we modified the logic of the system. You will still be able to manually flag certain 'internal' links to exhibit the preview bubble if you want them to though.

This new code version should be active/available very soon! I will keep you posted, but as soon as it is, anyone using our snippet currently will be automatically updated (the script sits on Snap servers after all).

Thanks for your support!

Best,

Jason Fields

Product Evangelist, Emerging Technologies

www.Snap.com

Community Server Daily News said:

news of the day a grab bag for what's happening in Community Server Jason Alexander answer's Don Dodge's

Prog said:

news of the day a grab bag for what's happening in Community Server Jason Alexander answer's Don Dodge's

Daily News List Blog said:

Justin Pierce (the Ninjafish) has added SnapPreview to his Community Server blog. It's official, all

Community Server Bits said:

Justin Pierce (the Ninjafish) has added SnapPreview to his Community Server blog. It's official, all