Last active
August 29, 2015 13:59
-
-
Save fleeting/10681281 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(function() { | |
$('.js-simpleGH').each(function() { | |
var el = $(this); | |
var repo = el.data('repo'); //monkeecreate/jquery.simpleWeather | |
$.when( | |
$.ajax({ url: 'https://api.github.com/repos/'+repo, dataType: 'jsonp' }), | |
$.ajax({ url: 'https://api.github.com/repos/'+repo+'/tags', dataType: 'jsonp' }) | |
).done(function(repoData, repoTags) { | |
var data = repoData[0].data; | |
var tag = repoTags[0].data[0]; | |
var html = ''; | |
if(tag) | |
html += '<i class="fa fa-rocket"></i> <span class="release">'+tag.name+'</span> '; | |
if(data.stargazers_count) | |
html += '<i class="fa fa-star"></i> <span class="stars">'+data.stargazers_count+'</span> '; | |
if(data.forks_count) | |
html += '<i class="fa fa-code-fork"></i> <span class="forks">'+data.forks_count+'</span> '; | |
$('.project-meta', el).prepend(html); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment