Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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>
  • Loading branch information...
commit 5972bd4f7f194fce53f84c45ba68a4b63de22ffa 1 parent 34394d0
@pieter pieter authored
Showing with 16 additions and 2 deletions.
  1. +16 −2 html/views/history/history.js
View
18 html/views/history/history.js
@@ -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;
}
Please sign in to comment.
Something went wrong with that request. Please try again.