Web: Add recent commits to devinfo page

This commit is contained in:
Tim Gerundt 2011-01-16 14:55:32 +01:00
parent fab5be4472
commit 95e24cf8cb
2 changed files with 27 additions and 0 deletions

View File

@ -7,6 +7,13 @@
<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />
<link rel="alternate" type="application/atom+xml" title="Recent Commits to cppcheck:master"
href="https://github.com/danmar/cppcheck/commits/master.atom" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script>
<script src="/site/js/github.js" type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$("#github-commits").listCommits("danmar", "cppcheck", "master");
});
</script>
</head>
<body>
<div id="header">
@ -35,6 +42,8 @@ cppcheck git repository</a>. To download it, run the following command:</p>
<pre>git clone git://github.com/danmar/cppcheck.git</pre>
<p>You can also <a href="https://github.com/danmar/cppcheck/downloads">download
the latest sources in a zip or tgz archive</a> from the github website.</p>
<h3>Recent Commits</h3>
<div id="github-commits"><a href="https://github.com/danmar/cppcheck/commits/master">View recent commits&hellip;</a></div>
<h2>Doxygen</h2>
<ul>
<li><a href="/doxyoutput/">Output</a></li>

18
htdocs/site/js/github.js Normal file
View File

@ -0,0 +1,18 @@
// Inspired by:
// http://aboutcode.net/2010/11/11/list-github-projects-using-javascript.html
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;
var list = $('<ul/>');
target.empty().append(list);
$(repos).each(function(i) {
list.append('<li><a href="' + this.url + '">' + this.message + '</a> by <strong>' + this.author.login + '</strong></li>');
if (i == 9) return false;
});
});
};