Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
8a9d0309
Commit
8a9d0309
authored
Nov 15, 2019
by
Lee Tickett
Committed by
Clement Ho
Nov 15, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove var from line_highlighter.js
parent
dddffc66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
9 deletions
+13
-9
app/assets/javascripts/line_highlighter.js
app/assets/javascripts/line_highlighter.js
+8
-9
changelogs/unreleased/remove_var_from_line_highlighter_js.yml
...gelogs/unreleased/remove_var_from_line_highlighter_js.yml
+5
-0
No files found.
app/assets/javascripts/line_highlighter.js
View file @
8a9d0309
/* 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
);
c
onst
c
urrent
=
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
{
...
...
changelogs/unreleased/remove_var_from_line_highlighter_js.yml
0 → 100644
View file @
8a9d0309
---
title
:
Remove var from line_highlighter.js
merge_request
:
20108
author
:
Lee Tickett
type
:
other
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment