Commit 5f57234c authored by Sam Rose's avatar Sam Rose

Hightlight linenumber on page load

parent e9d75a4b
...@@ -25,6 +25,10 @@ require('./lib/utils/url_utility'); ...@@ -25,6 +25,10 @@ require('./lib/utils/url_utility');
isBound = true; isBound = true;
} }
if (gl.utils.getLocationHash()) {
this.highlightSelectedLine();
}
this.openAnchoredDiff(); this.openAnchoredDiff();
} }
...@@ -78,7 +82,7 @@ require('./lib/utils/url_utility'); ...@@ -78,7 +82,7 @@ require('./lib/utils/url_utility');
if (nothingHereBlock.length) { if (nothingHereBlock.length) {
const clickTarget = $('.js-file-title, .click-to-expand', diffFile); const clickTarget = $('.js-file-title, .click-to-expand', diffFile);
diffFile.data('singleFileDiff').toggleDiff(clickTarget, () => { diffFile.data('singleFileDiff').toggleDiff(clickTarget, () => {
this.highlighSelectedLine(); this.highlightSelectedLine();
if (cb) cb(); if (cb) cb();
}); });
} else if (cb) { } else if (cb) {
...@@ -94,7 +98,7 @@ require('./lib/utils/url_utility'); ...@@ -94,7 +98,7 @@ require('./lib/utils/url_utility');
} else { } else {
window.location.hash = hash; window.location.hash = hash;
} }
this.highlighSelectedLine(); this.highlightSelectedLine();
} }
diffViewType() { diffViewType() {
...@@ -108,7 +112,7 @@ require('./lib/utils/url_utility'); ...@@ -108,7 +112,7 @@ require('./lib/utils/url_utility');
return line.find('.diff-line-num').map((i, elm) => parseInt($(elm).data('linenumber'), 10)); return line.find('.diff-line-num').map((i, elm) => parseInt($(elm).data('linenumber'), 10));
} }
highlighSelectedLine() { highlightSelectedLine() {
const hash = gl.utils.getLocationHash(); const hash = gl.utils.getLocationHash();
const $diffFiles = $('.diff-file'); const $diffFiles = $('.diff-file');
$diffFiles.find('.hll').removeClass('hll'); $diffFiles.find('.hll').removeClass('hll');
......
---
title: Highlight line number if specified on diff pages when page loads
merge_request: 9664
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment