Web: Use github.com API v3 for "Recent Commits"

This commit is contained in:
Tim Gerundt 2012-06-14 22:47:39 +02:00
parent f967142436
commit 2e2eece085
1 changed files with 5 additions and 5 deletions

View File

@ -4,14 +4,14 @@ jQuery.fn.listCommits = function(username, repository, branch) {
this.html('<span>Querying GitHub for recent commits&hellip;</span>');
var target = this;
$.getJSON('http://github.com/api/v2/json/commits/list/' + username + '/' + repository + '/' + branch + '?callback=?', function(data) {
var repos = data.commits;
$.getJSON('https://api.github.com/repos/' + username + '/' + repository + '/commits?sha=' + branch + '&callback=?', function(response) {
var commits = response.data;
var list = $('<ul/>');
target.empty().append(list);
$(repos).each(function(i) {
var githubUrl = 'https://github.com' + this.url;
var shortMessage = cutLines(this.message);
$(commits).each(function(i) {
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha;
var shortMessage = cutLines(this.commit.message);
var author = this.author.login;
if (author == '') {
author = this.author.name;