From 4d5d18cf7948b42a821d6a418f725cbfdcc7a15d Mon Sep 17 00:00:00 2001 From: carstenklapp Date: Tue, 11 Dec 2001 05:51:14 +0000 Subject: [PATCH] Moved some diff colouring to css. Appearance looks identical to previous non-css method of colouring in: IE5, Mozilla (and presumably NS6), iCab, Opera, OmniWeb. git-svn-id: svn://svn.code.sf.net/p/phpwiki/code/trunk@745 96ab9672-09ca-45d6-a79d-3d69d39ca109 --- lib/diff.php | 18 +++++++++--------- phpwiki.css | 13 +++++++++++++ 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/diff.php b/lib/diff.php index 677e29156..de008eaad 100644 --- a/lib/diff.php +++ b/lib/diff.php @@ -1,5 +1,5 @@ '#cccccc', 'width' => "1%"), $prefix); + $prefix = Element('td', array('class' => 'diff-notation', 'width' => "1%"), $prefix); reset($lines); while (list ($junk, $line) = each($lines)) { $line = rtrim($line); $line = empty($line) ? ' ' : htmlspecialchars($line); $html .= Element('tr', array('valign' => 'top'), - $prefix . Element('td', array('bgcolor' => $color), + $prefix . Element('td', array('class' => $color), Element('tt', $line))); } return $html; @@ -949,22 +949,22 @@ class WikiDiffFormatter $prefix = array('c' => $this->context_prefix, 'a' => $this->adds_prefix, 'd' => $this->deletes_prefix); - $color = array('c' => '#ffffff', - 'a' => '#ffcccc', - 'd' => '#ccffcc'); + $color = array('c' => 'diff-unchanged', + 'a' => 'diff-added', + 'd' => 'diff-deleted'); $diff = ''; for (reset($hunks); $hunk = current($hunks); next($hunks)) { if (!empty($hunk['c'])) $diff .= $this->_emit_lines($hunk['c'], - $this->context_prefix, '#ffffff'); + $this->context_prefix, 'diff-unchanged'); if (!empty($hunk['d'])) $diff .= $this->_emit_lines($hunk['d'], - $this->deletes_prefix, '#ccffcc'); + $this->deletes_prefix, 'diff-deleted'); if (!empty($hunk['a'])) $diff .= $this->_emit_lines($hunk['a'], - $this->adds_prefix, '#ffcccc'); + $this->adds_prefix, 'diff-added'); } diff --git a/phpwiki.css b/phpwiki.css index bc36499d4..427ac5acd 100644 --- a/phpwiki.css +++ b/phpwiki.css @@ -225,6 +225,19 @@ div.transclusion { margin: 0.5ex 0px; } +.diff-added { + background: #cfc; +} +.diff-deleted { + background: #fcc; +} +.diff-unchanged { + background: white; +} +.diff-notation { + background: #ccc; +} + /* For emacs users * * Local Variables: -- 2.45.0