mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
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:
+13
-7
@@ -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 + " <<a href='mailto:" + commit.author_email + "'>" + commit.author_email + "</a>>";
|
||||
$("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>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,4 +27,13 @@ hr {
|
||||
background-color: #999;
|
||||
}
|
||||
|
||||
a {
|
||||
color: rgb(20, 79, 174);
|
||||
}
|
||||
|
||||
a.showdiff {
|
||||
text-decoration: none;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user