diff: able to highlight line with hashtag URL

This commit is contained in:
Unknwon
2017-02-20 16:16:32 -05:00
parent 491934784f
commit 934734a85a
7 changed files with 82 additions and 43 deletions

View File

@@ -542,6 +542,20 @@ function initRepository() {
$item.find(".bar .add").css("width", addPercent + "%");
});
}
$('.diff-file-box .lines-num').click(function () {
if ($(this).attr('id')) {
window.location.href = '#' + $(this).attr('id');
}
});
$(window).on('hashchange', function (e) {
$('.diff-file-box .lines-code.active').removeClass('active');
var m = window.location.hash.match(/^#diff-.+$/);
if (m) {
$(m[0]).siblings('.lines-code').addClass('active');
}
}).trigger('hashchange');
}
// Quick start and repository home