Pinterest
Code:
SocialDig({
selector: '.pinterest',
service: 'pinterest',
auth: 'xxxxx'
}, function(data) {
if (data.data.length > 0) {
var list = document.createElement('div');
list.className = 'g g-s-2 boards';
// Loop through the boards
data.data.forEach(function(el, idx, arr) {
if (idx < 4) {
var item = document.createElement('div');
item.className = 'gi board';
item.innerHTML = '<a data-pin-do="embedBoard" data-pin-board-width="400" data-pin-scale-height="240" data-pin-scale-width="100" href="' + el.url + '"></a>';
// Add the new item to the list
list.appendChild(item);
}
});
// Add the list to the page
document.querySelector('.pinterest').appendChild(list);
// Add the embed script
var pinScript = document.createElement('script');
pinScript.src = '//assets.pinterest.com/js/pinit.js';
pinScript.async = true;
document.getElementsByTagName('body')[0].appendChild(pinScript);
}
});