Dug.js, a JSONP to HTML Script

Scripts

So you want to display your Dribbble shots, recent pins on Pinterest, 500px or Instagram photos, Github commits, or recently listened to music on your blog or site? Then this chunk of javascript from Rogie is for you.

It was designed to be a lightweight, simple, library-independent script to pull in feeds of content available on the web as JSONP (there’s lots of em!) to display on your site.

In it’s simplest form, you really only need two things.

  1. An api endpoint (jsonp callbacks supported)
  2. An HTML template to display the data
<script>
  dug({
      endpoint: 'http://api.dribbble.com/players/gonzodesign/shots',
      template: '<ul>\
          {{#shots}}\
            <li>\
                <a href="{{url}}" title="{{title}}">\
                    <img src="{{image_400_url}}" alt="Image of {{title}}">\
                </a>\
            </li>\
        {{/shots}}\
      </ul>'
  });
</script>
Dug.js

Share/Like