From b6f47539cd1a1dafe05ffd6fdc40bce4547c479d Mon Sep 17 00:00:00 2001 From: Tom Date: Tue, 18 Nov 2014 00:25:41 +0100 Subject: Add a blink comparator and pixel difference to image diffs Pixel difference uses CSS mix-blend-mode, which is supported currently only on Firefox >= 32 and on Safari >= 7.1. Implementation is behind a Javascript feature test. For other browsers, there's a blink comparator. Code changes: * ImageDiffHandler now takes the page it's used on as argument. We need that to get labels. DOM generated is a little bit different (new controls). * Diff pages adapted to new constructor of ImageDiffHandler. * CSS and Javascript changes implementing the new controls, making use of two new static image resources. Since I felt that the new controls deserved tooltips, I also gave the opacity slider a tooltip: changed to , and slider handle changed from
to . CSS ensures everything still displays the same (basically display:inline-block). * Supplied messages for English, French, and German for the new tooltips. Tested on IE8, Safari 6.1.6 & 7.1, Chrome 38, FF 33.1 & FF 3.6.13 --- src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java') diff --git a/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java b/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java index 71516ec8..ae737a53 100644 --- a/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java +++ b/src/main/java/com/gitblit/wicket/pages/BlobDiffPage.java @@ -52,7 +52,7 @@ public class BlobDiffPage extends RepositoryPage { if (StringUtils.isEmpty(baseObjectId)) { // use first parent RevCommit parent = commit.getParentCount() == 0 ? null : commit.getParent(0); - ImageDiffHandler handler = new ImageDiffHandler(getContextUrl(), repositoryName, + ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName, parent.getName(), commit.getName(), imageExtensions); diff = DiffUtils.getDiff(r, commit, blobPath, DiffOutputType.HTML, handler).content; if (handler.getImgDiffCount() > 0) { @@ -63,7 +63,7 @@ public class BlobDiffPage extends RepositoryPage { } else { // base commit specified RevCommit baseCommit = JGitUtils.getCommit(r, baseObjectId); - ImageDiffHandler handler = new ImageDiffHandler(getContextUrl(), repositoryName, + ImageDiffHandler handler = new ImageDiffHandler(this, repositoryName, baseCommit.getName(), commit.getName(), imageExtensions); diff = DiffUtils.getDiff(r, baseCommit, commit, blobPath, DiffOutputType.HTML, handler).content; if (handler.getImgDiffCount() > 0) { -- cgit v1.2.3