Skip to content

Commit

Permalink
HistoryView: Only show Gravatar if connected to the net
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
pieter committed Oct 19, 2008
1 parent 99b6afd commit 2550d19
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions html/commit.js
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

0 comments on commit 2550d19

Please sign in to comment.