diff options
author | Tim Zallmann <tzallmann@gitlab.com> | 2017-10-05 12:54:46 +0300 |
---|---|---|
committer | Tim Zallmann <tzallmann@gitlab.com> | 2017-10-05 12:54:46 +0300 |
commit | 8b16f1074ddb6ea6a5404d37409ab81002f28d52 (patch) | |
tree | aca5904f189a8353fd56942b2c28a2bfbdab7923 /app/assets/javascripts/line_highlighter.js | |
parent | 8d14a95638d7d6b52254b192b3e54296e22fddc3 (diff) |
Refactored Highlighting mechanism
Diffstat (limited to 'app/assets/javascripts/line_highlighter.js')
-rw-r--r-- | app/assets/javascripts/line_highlighter.js | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/app/assets/javascripts/line_highlighter.js b/app/assets/javascripts/line_highlighter.js index a16d00b5cef..9999b5a200c 100644 --- a/app/assets/javascripts/line_highlighter.js +++ b/app/assets/javascripts/line_highlighter.js @@ -54,12 +54,14 @@ LineHighlighter.prototype.bindEvents = function() { $fileHolder.on('highlight:line', this.highlightHash); }; -LineHighlighter.prototype.highlightHash = function() { - var range; +LineHighlighter.prototype.highlightHash = function(newHash) { + let range; + if (newHash) this._hash = newHash; + + this.clearHighlight(); if (this._hash !== '') { range = this.hashToRange(this._hash); - if (range[0]) { this.highlightRange(range); const lineSelector = `#L${range[0]}`; @@ -131,6 +133,7 @@ LineHighlighter.prototype.hashToRange = function(hash) { // // lineNumber - Line number to highlight LineHighlighter.prototype.highlightLine = function(lineNumber) { + console.log('LINE : ' + lineNumber); return $("#LC" + lineNumber).addClass(this.highlightLineClass); }; |