From 415ee91b50ec05797d105be70d71ce444966d378 Mon Sep 17 00:00:00 2001 From: Pieter de Bie Date: Mon, 1 Dec 2008 15:56:14 +0100 Subject: [PATCH] WebHistoryView: Add a link to display changed images --- PBWebHistoryController.m | 1 + html/views/history/history.js | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/PBWebHistoryController.m b/PBWebHistoryController.m index 1b49fa4..522aaa1 100644 --- a/PBWebHistoryController.m +++ b/PBWebHistoryController.m @@ -15,6 +15,7 @@ - (void) awakeFromNib { startFile = @"history"; + repository = historyController.repository; [super awakeFromNib]; [historyController addObserver:self forKeyPath:@"webCommit" options:0 context:@"ChangedCommit"]; } diff --git a/html/views/history/history.js b/html/views/history/history.js index 140fa9a..fb836df 100644 --- a/html/views/history/history.js +++ b/html/views/history/history.js @@ -172,7 +172,20 @@ var showDiff = function() { $("files").innerHTML += "" + name + "
"; } - highlightDiff(commit.diff, $("diff"), { "newfile" : newfile }); + var binaryDiff = function(filename) { + if (filename.match(/\.(png|jpg|pdf|icns|psd)$/i)) + return 'Display image'; + else + return "Binary file differs"; + } + + highlightDiff(commit.diff, $("diff"), { "newfile" : newfile, "binaryFile" : binaryDiff }); +} + +var showImage = function(element, filename) +{ + element.outerHTML = ''; + return false; } var loadExtendedCommit = function(commit)