Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 06:06:34 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-11-15 06:06:34 +0300
commit41d446ba3f0518097eb350b142ecfbeeb6be83e6 (patch)
tree465127e4d63fe9d0c61ab7f281737e588a04a4ae /app/assets/javascripts/line_highlighter.js
parent386e5740f68fc7f49bc7692a28e927d6ea5ab056 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/line_highlighter.js')
-rw-r--r--app/assets/javascripts/line_highlighter.js17
1 files changed, 8 insertions, 9 deletions
diff --git a/app/assets/javascripts/line_highlighter.js b/app/assets/javascripts/line_highlighter.js
index b6b96fe7bd5..dd868bb9f4c 100644
--- a/app/assets/javascripts/line_highlighter.js
+++ b/app/assets/javascripts/line_highlighter.js
@@ -1,4 +1,4 @@
-/* eslint-disable func-names, no-var, no-underscore-dangle, no-param-reassign, consistent-return, one-var, no-else-return */
+/* eslint-disable func-names, no-underscore-dangle, no-param-reassign, consistent-return, no-else-return */
import $ from 'jquery';
@@ -82,13 +82,13 @@ LineHighlighter.prototype.highlightHash = function(newHash) {
};
LineHighlighter.prototype.clickHandler = function(event) {
- var current, lineNumber, range;
+ let range;
event.preventDefault();
this.clearHighlight();
- lineNumber = $(event.target)
+ const lineNumber = $(event.target)
.closest('a')
.data('lineNumber');
- current = this.hashToRange(this._hash);
+ const current = this.hashToRange(this._hash);
if (!(current[0] && event.shiftKey)) {
// If there's no current selection, or there is but Shift wasn't held,
// treat this like a single-line selection.
@@ -121,12 +121,11 @@ LineHighlighter.prototype.clearHighlight = function() {
//
// Returns an Array
LineHighlighter.prototype.hashToRange = function(hash) {
- var first, last, matches;
// ?L(\d+)(?:-(\d+))?$/)
- matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/);
+ const matches = hash.match(/^#?L(\d+)(?:-(\d+))?$/);
if (matches && matches.length) {
- first = parseInt(matches[1], 10);
- last = matches[2] ? parseInt(matches[2], 10) : null;
+ const first = parseInt(matches[1], 10);
+ const last = matches[2] ? parseInt(matches[2], 10) : null;
return [first, last];
} else {
return [null, null];
@@ -160,7 +159,7 @@ LineHighlighter.prototype.highlightRange = function(range) {
// Set the URL hash string
LineHighlighter.prototype.setHash = function(firstLineNumber, lastLineNumber) {
- var hash;
+ let hash;
if (lastLineNumber) {
hash = `#L${firstLineNumber}-${lastLineNumber}`;
} else {