CodePen
Code:
SocialDig({
selector: '.codepen',
service: 'codepen',
user: 'kjbrum',
}, function(data) {
if (data.data.length > 0) {
var list = document.createElement('div');
list.className = 'g g-s-2 pens';
// Loop through the pens
data.data.forEach(function(el, idx, arr) {
if (idx < 4) {
var item = document.createElement('div');
item.className = 'gi pen';
// Create the new pen iframe
item.innerHTML = '<iframe height="350" scrolling="no" src="//codepen.io/' + el.user.username + '/embed/' + el.id + '/?height=350&theme-id=light&default-tab=result&embed-version=2" frameborder="no" allowtransparency="true" allowfullscreen="true" style="width: 100%;">See the Pen <a href="' + el.link + '">' + el.title + '</a> by <a href="http://codepen.io/' + el.user.username + '">@' + el.user.username + '</a> on <a href="http://codepen.io">CodePen</a>.</iframe>';
// Add the new item to the list
list.appendChild(item);
}
});
// Add the list to the page
document.querySelector('.codepen').appendChild(list);
}
});