forked from foundation/foundation-sites
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Proposed fix for issue foundation#17. Populates gihub info via call t…
…o github APIs clientside in javascript
- Loading branch information
1 parent
6f81b3a
commit 7bd8766
Showing
3 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
$(document).ready(function() { | ||
$.ajax({ | ||
url: "http://github.com/api/v2/json/commits/list/zurb/foundation/master", | ||
dataType: 'jsonp', | ||
success: function(json) { | ||
var latest = json.commits[0]; | ||
console.log(latest); | ||
var stamp = new Date(latest.committed_date); | ||
console.log(stamp.toDateString()); | ||
var stampString = month[stamp.getMonth()] + ' ' + stamp.getDate() + ', ' + stamp.getFullYear(); | ||
console.log(stampString); | ||
$('#latestCommitMessage').text(latest.message); | ||
$('#latestCommitTime').text(stampString); | ||
$('#latestCommitURL').html('Commit ' + latest.id + ' »'); | ||
$('#latestCommitURL').attr('href', "https://github.com" + latest.url); | ||
} | ||
}); | ||
$.ajax({ | ||
url: "http://github.com/api/v2/json/repos/show/zurb/foundation/tags", | ||
dataType: 'jsonp', | ||
success: function(json) { | ||
var tags = []; | ||
for ( var key in json.tags ) { | ||
tags.push(key) | ||
} | ||
console.log(tags[tags.length - 1]); | ||
$('#latestVersion').text(tags[tags.length - 1]); | ||
} | ||
}); | ||
var month=new Array(12); | ||
month[0]="Jan"; | ||
month[1]="Feb"; | ||
month[2]="Mar"; | ||
month[3]="Apr"; | ||
month[4]="May"; | ||
month[5]="Jun"; | ||
month[6]="Jul"; | ||
month[7]="Aug"; | ||
month[8]="Sep"; | ||
month[9]="Oct"; | ||
month[10]="Nov"; | ||
month[11]="Dec"; | ||
}); |
This file contains 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
This file contains 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