BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
3079a2d6
Commit
3079a2d6
authored
Apr 13, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow LineHighlighter to be triggered by event
parent
121c5f66
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
line_highlighter.js
app/assets/javascripts/line_highlighter.js
+13
-7
No files found.
app/assets/javascripts/line_highlighter.js
View file @
3079a2d6
...
...
@@ -41,7 +41,6 @@ require('vendor/jquery.scrollTo');
LineHighlighter
.
prototype
.
_hash
=
''
;
function
LineHighlighter
(
hash
)
{
var
range
;
if
(
hash
==
null
)
{
// Initialize a LineHighlighter object
//
...
...
@@ -51,10 +50,21 @@ require('vendor/jquery.scrollTo');
this
.
setHash
=
bind
(
this
.
setHash
,
this
);
this
.
highlightLine
=
bind
(
this
.
highlightLine
,
this
);
this
.
clickHandler
=
bind
(
this
.
clickHandler
,
this
);
this
.
highlightHash
=
this
.
highlightHash
.
bind
(
this
);
this
.
_hash
=
hash
;
this
.
bindEvents
();
if
(
hash
!==
''
)
{
range
=
this
.
hashToRange
(
hash
);
this
.
highlightHash
();
}
LineHighlighter
.
prototype
.
bindEvents
=
function
()
{
$
(
'#blob-content-holder'
).
on
(
'click'
,
'a[data-line-number]'
,
this
.
clickHandler
);
$
(
'#blob-content-holder'
).
on
(
'highlight:line'
,
this
.
highlightHash
);
};
LineHighlighter
.
prototype
.
highlightHash
=
function
()
{
var
range
;
if
(
this
.
_hash
!==
''
)
{
range
=
this
.
hashToRange
(
this
.
_hash
);
if
(
range
[
0
])
{
this
.
highlightRange
(
range
);
$
.
scrollTo
(
"#L"
+
range
[
0
],
{
...
...
@@ -64,10 +74,6 @@ require('vendor/jquery.scrollTo');
});
}
}
}
LineHighlighter
.
prototype
.
bindEvents
=
function
()
{
$
(
'#blob-content-holder'
).
on
(
'click'
,
'a[data-line-number]'
,
this
.
clickHandler
);
};
LineHighlighter
.
prototype
.
clickHandler
=
function
(
event
)
{
...
...
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