I'm currently implementing Jribbble to pull my Dribbble shots into my new portfolio. I've got it set up to be able to pull in all shots I've assigned to a bucket - great!
One extra I'd like to do is to be able to randomise the results that get returned to ensure a good spread of my work is visible.
Current code is:
$.jribbble.setToken('3f99156fa1530d27432a9df8eb315e861d6b2fb4f59acaa210da8962e1427cf2');
$.jribbble.buckets(333465).shots({per_page: 12}).then(function(res) {
var html = [];
res.forEach(function(shot) {
html.push('<li class="shots--shot">');
html.push('<a href="' + shot.html_url + '" target="_blank">');
html.push('<img src="' + shot.images.normal + '">');
html.push('</a></li>');
});
$('.shots').html(html.join(''));
});
Anyone any ideas how I might go about this?
I've also tried randomising the results once they've been called using:
window.onload = function() {
var ul = document.querySelector('.shots');
for (var i = ul.children.length; i >= 0; i--) {
ul.appendChild(ul.children[Math.random() * i | 0]);
}
};
But I only get this error:
Uncaught TypeError: Failed to execute 'appendChild' on 'Node': parameter 1 is not of type 'Node'.
Any help much appreciated!