Only show commits if they are of reasonable size

This shows a link people should click if they want to display a huge diff
(more than 10k lines). This speeds up the browsing a lot :)
This commit is contained in:
Pieter de Bie
2008-06-16 03:27:52 +02:00
parent e6da252ee0
commit 0fa37ba024
2 changed files with 22 additions and 7 deletions
+13 -7
View File
@@ -1,3 +1,4 @@
var commit;
var Commit = Class.create({
initialize: function(obj) {
this.raw = obj.details;
@@ -31,8 +32,16 @@ var selectCommit = function(a) {
Controller.selectCommit_(a);
}
var showDiffs = function() {
$("details").hide();
$("details").innerHTML = commit.diff;
highlightDiffs();
$("details").show();
}
var doeHet = function() {
var commit = new Commit(CommitObject);
commit = new Commit(CommitObject);
$("commitID").innerHTML = commit.sha;
$("authorID").innerHTML = commit.author_name + " &lt;<a href='mailto:" + commit.author_email + "'>" + commit.author_email + "</a>&gt;";
$("date").innerHTML = commit.author_date;
@@ -48,12 +57,9 @@ var doeHet = function() {
});
$("message").innerHTML = commit.message.replace(/\n/g,"<br>");
if (commit.diff.length < 1000000) {
$("details").hide();
$("details").innerHTML = commit.diff;
highlightDiffs();
$("details").show();
if (commit.diff.length < 10000) {
showDiffs();
} else {
$("details").innerHTML = "This diff is currently too large to watch in detailed mode";
$("details").innerHTML = "<a class='showdiff' href='' onclick='showDiffs(); return false;'>This is a large commit. Click here to show the diff.</a>";
}
}
+9
View File
@@ -27,4 +27,13 @@ hr {
background-color: #999;
}
a {
color: rgb(20, 79, 174);
}
a.showdiff {
text-decoration: none;
font-size: 1.3em;
}