Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
fltrail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fides
fltrail
Commits
c5b6c3d6
Commit
c5b6c3d6
authored
6 years ago
by
Sven Kästle
Browse files
Options
Downloads
Patches
Plain Diff
feat: Scroll to highlighted text on card hover
parent
a049883e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js
+6
-1
6 additions, 1 deletion
...samforschen/src/main/webapp/assets/js/annotationScript.js
gemeinsamforschen/src/main/webapp/pages/annotation-document.jsp
+2
-0
2 additions, 0 deletions
...samforschen/src/main/webapp/pages/annotation-document.jsp
with
8 additions
and
1 deletion
gemeinsamforschen/src/main/webapp/assets/js/annotationScript.js
+
6
−
1
View file @
c5b6c3d6
...
@@ -341,6 +341,11 @@ function displayAnnotation(annotation) {
...
@@ -341,6 +341,11 @@ function displayAnnotation(annotation) {
.
data
(
'
annotation
'
,
annotation
)
.
data
(
'
annotation
'
,
annotation
)
.
mouseenter
(
function
()
{
.
mouseenter
(
function
()
{
addHighlightedText
(
annotation
.
body
.
startCharacter
,
annotation
.
body
.
endCharacter
,
annotation
.
userToken
);
addHighlightedText
(
annotation
.
body
.
startCharacter
,
annotation
.
body
.
endCharacter
,
annotation
.
userToken
);
// scroll document text to anchor element
let
documentText
=
$
(
'
#documentText
'
);
let
anchor
=
$
(
'
#anchor
'
);
documentText
.
scrollTo
(
anchor
);
})
})
.
mouseleave
(
function
()
{
.
mouseleave
(
function
()
{
deleteHighlightedText
();
deleteHighlightedText
();
...
@@ -362,7 +367,7 @@ function displayAnnotation(annotation) {
...
@@ -362,7 +367,7 @@ function displayAnnotation(annotation) {
*/
*/
function
addHighlightedText
(
startCharacter
,
endCharacter
,
userToken
)
{
function
addHighlightedText
(
startCharacter
,
endCharacter
,
userToken
)
{
// create <span> tag with the annotated text
// create <span> tag with the annotated text
var
replacement
=
$
(
'
<span></span>
'
).
css
(
'
background-color
'
,
getUserColor
(
userToken
)).
html
(
documentText
.
slice
(
startCharacter
,
endCharacter
));
var
replacement
=
$
(
'
<span></span>
'
).
attr
(
'
id
'
,
'
anchor
'
).
css
(
'
background-color
'
,
getUserColor
(
userToken
)).
html
(
documentText
.
slice
(
startCharacter
,
endCharacter
));
// wrap an <p> tag around the replacement, get its parent (the <p>) and ask for the html
// wrap an <p> tag around the replacement, get its parent (the <p>) and ask for the html
var
replacementHtml
=
replacement
.
wrap
(
'
<p/>
'
).
parent
().
html
();
var
replacementHtml
=
replacement
.
wrap
(
'
<p/>
'
).
parent
().
html
();
...
...
This diff is collapsed.
Click to expand it.
gemeinsamforschen/src/main/webapp/pages/annotation-document.jsp
+
2
−
0
View file @
c5b6c3d6
...
@@ -20,6 +20,8 @@
...
@@ -20,6 +20,8 @@
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"
type=
"text/javascript"
></script>
<script
src=
"https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"
type=
"text/javascript"
></script>
<!-- js - contextMenu script -->
<!-- js - contextMenu script -->
<script
src=
"https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js"
type=
"text/javascript"
></script>
<script
src=
"https://swisnl.github.io/jQuery-contextMenu/dist/jquery.contextMenu.js"
type=
"text/javascript"
></script>
<!-- js - scrollTo -->
<script
src=
"//cdn.jsdelivr.net/npm/jquery.scrollto@2.1.2/jquery.scrollTo.min.js"
></script>
<!-- js - annotation websocket script -->
<!-- js - annotation websocket script -->
<script
src=
"../assets/js/annotationWebsocket.js"
></script>
<script
src=
"../assets/js/annotationWebsocket.js"
></script>
<!-- js - annotation REST script -->
<!-- js - annotation REST script -->
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment