HistoryView: Don't show the 'loading commit' thing until after 500 ms.

This was annoying me a lot, so it's in stable :)

Signed-off-by: Pieter de Bie <pdebie@ai.rug.nl>
This commit is contained in:
Pieter de Bie
2009-09-17 23:40:38 +02:00
parent 34394d056b
commit 5972bd4f7f
+16 -2
View File
@@ -10,6 +10,7 @@ var Commit = function(obj) {
this.sha = obj.realSha();
this.parents = obj.parents;
this.subject = obj.subject;
this.notificationID = null;
// TODO:
// this.author_date instant
@@ -168,11 +169,12 @@ var loadCommit = function(commitObject, currentRef) {
// Which will be called from the controller once
// the commit details are in.
if (commit && commit.notificationID)
clearTimeout(commit.notificationID);
commit = new Commit(commitObject);
commit.currentRef = currentRef;
notify("Loading commit…", 0);
$("commitID").innerHTML = commit.sha;
$("authorID").innerHTML = commit.author_name;
$("subjectID").innerHTML = commit.subject.escapeHTML();
@@ -202,6 +204,13 @@ var loadCommit = function(commitObject, currentRef) {
"<a href='' onclick='selectCommit(this.innerHTML); return false;'>" +
commit.parents[i] + "</a></td>";
}
commit.notificationID = setTimeout(function() {
if (!commit.fullyLoaded)
notify("Loading commit…", 0);
commit.notificationID = null;
}, 500);
}
var showDiff = function() {
@@ -282,6 +291,11 @@ var loadCommitDetails = function(data)
{
commit.parseDetails(data);
if (commit.notificationID)
clearTimeout(commit.notificationID)
else
$("notification").style.display = "none";
var formatEmail = function(name, email) {
return email ? name + " &lt;<a href='mailto:" + email + "'>" + email + "</a>&gt;" : name;
}