github.js: simplify code

This commit is contained in:
XhmikosR 2013-03-02 08:43:09 +02:00 committed by Daniel Marjamäki
parent 9d195144ea
commit c807b12b37
2 changed files with 4 additions and 9 deletions

View File

@ -5,19 +5,14 @@ jQuery.fn.listCommits = function(username, repository, branch) {
var target = this;
$.getJSON('https://api.github.com/repos/' + username + '/' + repository + '/commits?sha=' + branch + '&callback=?', function(response) {
var commits = response.data;
var list = $('<ul class="rssfeeditems"/>');
var commits = response.data,
list = $('<ul class="rssfeeditems"/>');
target.empty().append(list);
$(commits).each(function(i) {
var githubUrl = 'https://github.com/' + username + '/' + repository + '/commit/' + this.sha,
shortMessage = cutLines(this.commit.message),
commitAuthor;
if (this.author !== null) {
commitAuthor = this.author.login;
}
commitAuthor = (this.author !== null) ? this.author.login : '';
if (commitAuthor) {
list.append('<li><a href="' + githubUrl + '">' + shortMessage + '</a> <em>by <strong>' + commitAuthor + '</strong></em></li>');

File diff suppressed because one or more lines are too long