From 5972bd4f7f194fce53f84c45ba68a4b63de22ffa Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Thu, 17 Sep 2009 23:40:38 +0200 Subject: [PATCH] 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 --- html/views/history/history.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/html/views/history/history.js b/html/views/history/history.js index 47d72b7..6cd7540 100644 --- a/html/views/history/history.js +++ b/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) { "" + commit.parents[i] + ""; } + + 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 + " <" + email + ">" : name; }