HistoryView: Only show Gravatar if connected to the net

This invokes the SCNetwork framework to check if we can connect to a site
without problems. If we can't, we don't even try to show the gravatar.
This commit is contained in:
Pieter de Bie
2008-10-19 14:04:00 +02:00
parent 99b6afd37a
commit 2550d19130
+14 -4
View File
@@ -98,6 +98,19 @@ var gistie = function() {
}
var setGravatar = function(email, image) {
if (Controller && !Controller.isReachable_("www.gravatar.com"))
return;
if (!email) {
$("gravatar").src = "http://www.gravatar.com/avatar/?d=wavatar&s=60";
return;
}
$("gravatar").src = "http://www.gravatar.com/avatar/" +
hex_md5(commit.author_email) + "?d=wavatar&s=60";
}
var selectCommit = function(a) {
Controller.selectCommit_(a);
}
@@ -164,10 +177,7 @@ var loadCommit = function() {
$("details").innerHTML = "<a class='showdiff' href='' onclick='showDiffs(); return false;'>This is a large commit. Click here or press 'v' to view.</a>";
}
if (commit.author_email)
$("gravatar").src = "http://www.gravatar.com/avatar/" + hex_md5(commit.author_email) + "?d=wavatar&s=60";
else
$("gravatar").src = "http://www.gravatar.com/avatar/?d=wavatar&s=60";
setGravatar(commit.author_email, $("gravatar"));
scroll(0, 0);
}