mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
@@ -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 + " <<a href='mailto:" + email + "'>" + email + "</a>>" : name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user