mirror of
https://github.com/kennethreitz-archive/gitx.git
synced 2026-06-05 23:40:18 +00:00
WebHistoryView: Add a link to display changed images
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
- (void) awakeFromNib
|
||||
{
|
||||
startFile = @"history";
|
||||
repository = historyController.repository;
|
||||
[super awakeFromNib];
|
||||
[historyController addObserver:self forKeyPath:@"webCommit" options:0 context:@"ChangedCommit"];
|
||||
}
|
||||
|
||||
@@ -172,7 +172,20 @@ var showDiff = function() {
|
||||
$("files").innerHTML += "<a href='#" + id + "'>" + name + "</a><br>";
|
||||
}
|
||||
|
||||
highlightDiff(commit.diff, $("diff"), { "newfile" : newfile });
|
||||
var binaryDiff = function(filename) {
|
||||
if (filename.match(/\.(png|jpg|pdf|icns|psd)$/i))
|
||||
return '<a href="#" onclick="return showImage(this, \'' + filename + '\')">Display image</a>';
|
||||
else
|
||||
return "Binary file differs";
|
||||
}
|
||||
|
||||
highlightDiff(commit.diff, $("diff"), { "newfile" : newfile, "binaryFile" : binaryDiff });
|
||||
}
|
||||
|
||||
var showImage = function(element, filename)
|
||||
{
|
||||
element.outerHTML = '<img src="GitX://' + commit.sha + '/' + filename + '">';
|
||||
return false;
|
||||
}
|
||||
|
||||
var loadExtendedCommit = function(commit)
|
||||
|
||||
Reference in New Issue
Block a user