complete rewrite of the update ext (again)

much cleaner than previous version
affixed the [beta] tag since this still has a few issues (mainly error checking/displaying etc.)
This commit is contained in:
Daku
2014-02-15 03:44:53 +00:00
parent 134f9082fd
commit 50c2271ca6
3 changed files with 98 additions and 125 deletions

14
ext/update/script.js Normal file
View File

@ -0,0 +1,14 @@
$(function() {
if($('#updatecheck').length !== 0){
$.getJSON('https://api.github.com/repos/shish/shimmie2/commits', function(data){
var c = data[0];
$('#updatecheck').html('<a href="'+c['html_url']+'">'+c['sha']+'</a>' + " ("+c['commit']['message']+")");
var params = $.param({sha: c['sha'], date: c['commit']['committer']['date']});
$('#updatelink').attr('href', function(i, val){ return val + "?" + params; });
$('#updatelink').text("Update");
}).fail(function(){
$('#updatecheck').text("Loading failed. (Github down?)");
});
}
});