#52: added highlighting for multi lines

This commit is contained in:
Vokhmin Alexey V 2013-03-28 18:20:46 +04:00
parent 4f40327293
commit 230c46539d
2 changed files with 22 additions and 2 deletions

View File

@ -18,7 +18,27 @@ $(document).ready(function() {
function highlightShow(id) {
$('.highlight-line').remove();
$(id).append('<div class="highlight-line"></div>');
var from = to = id.substring(2);
if (/[0-9]+\-L[0-9]+$/.test(from)) {
var index = to.indexOf('-');
to = to.substring(index + 2);
from = from.substring(0, index);
}
from = parseInt(from);
to = parseInt(to);
if (from && to) {
if (from > to) {
var x = to; to = from; from = x;
}
var el = $('#L' + from);
$(document).scrollTop( el.offset().top );
while (el.length > 0) {
el.append('<div class="highlight-line"></div>');
if (from == to) { return true; }
from += 1;
el = $('#L' + from);
}
}
}
function highlightDiff(id) {

View File

@ -333,7 +333,7 @@ article div.file table {
width: 805px;
height: 12px;
margin: -12px 0 0 50px;
opacity: 0.5;
opacity: 0.6;
position: absolute;
}