From 0fa37ba0246f4b9c23b04be97bb9aee270b51592 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 16 Jun 2008 03:27:52 +0200 Subject: [PATCH] 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 :) --- html/commit.js | 20 +++++++++++++------- html/commits.css | 9 +++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/html/commit.js b/html/commit.js index 616fae0..22099f9 100644 --- a/html/commit.js +++ b/html/commit.js @@ -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 + " <" + commit.author_email + ">"; $("date").innerHTML = commit.author_date; @@ -48,12 +57,9 @@ var doeHet = function() { }); $("message").innerHTML = commit.message.replace(/\n/g,"
"); - 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 = "This is a large commit. Click here to show the diff."; } } diff --git a/html/commits.css b/html/commits.css index 406ae17..244d59f 100644 --- a/html/commits.css +++ b/html/commits.css @@ -27,4 +27,13 @@ hr { background-color: #999; } +a { + color: rgb(20, 79, 174); +} + +a.showdiff { + text-decoration: none; + font-size: 1.3em; +} +