mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+14
-4
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user