Hightlight linenumber on page load

This commit is contained in:
Sam Rose 2017-03-02 08:43:52 -05:00
parent e9d75a4b85
commit 5f57234c58
2 changed files with 11 additions and 3 deletions

View file

@ -25,6 +25,10 @@ require('./lib/utils/url_utility');
isBound = true;
}
if (gl.utils.getLocationHash()) {
this.highlightSelectedLine();
}
this.openAnchoredDiff();
}
@ -78,7 +82,7 @@ require('./lib/utils/url_utility');
if (nothingHereBlock.length) {
const clickTarget = $('.js-file-title, .click-to-expand', diffFile);
diffFile.data('singleFileDiff').toggleDiff(clickTarget, () => {
this.highlighSelectedLine();
this.highlightSelectedLine();
if (cb) cb();
});
} else if (cb) {
@ -94,7 +98,7 @@ require('./lib/utils/url_utility');
} else {
window.location.hash = hash;
}
this.highlighSelectedLine();
this.highlightSelectedLine();
}
diffViewType() {
@ -108,7 +112,7 @@ require('./lib/utils/url_utility');
return line.find('.diff-line-num').map((i, elm) => parseInt($(elm).data('linenumber'), 10));
}
highlighSelectedLine() {
highlightSelectedLine() {
const hash = gl.utils.getLocationHash();
const $diffFiles = $('.diff-file');
$diffFiles.find('.hll').removeClass('hll');

View file

@ -0,0 +1,4 @@
---
title: Highlight line number if specified on diff pages when page loads
merge_request: 9664
author: