Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AnnotationMockup
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
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tom Wiesing
AnnotationMockup
Commits
1ce28b31
Commit
1ce28b31
authored
7 years ago
by
Michael Kohlhase
Browse files
Options
Downloads
Patches
Plain Diff
this is what I want
parent
0b5c20e3
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
js/annot.js
+12
-13
12 additions, 13 deletions
js/annot.js
with
12 additions
and
13 deletions
js/annot.js
+
12
−
13
View file @
1ce28b31
$
(
function
(){
var
annotationAttribute
=
"
data-defines
"
;
// the attribute that we use for annotation
var
declAttribute
=
"
data-decl
"
;
// the attribute that we use for annotation of declarations
var
drefAttribute
=
"
data-dref
"
;
// the attribute that we use for annotation for declaration references
// given an element, find the element it defines
// has to be of the form #id
var
getDefinedElement
=
function
(
elem
){
var
selector
=
$
(
elem
).
attr
(
annotationAttribute
).
substring
(
1
);
return
$
(
document
.
getElementById
(
selector
));
var
getDeclElement
=
function
(
elem
){
var
value
=
$
(
elem
).
attr
(
drefAttribute
);
var
declElement
=
"
*[
"
+
declAttribute
+
"
='
"
+
value
+
"
']
"
;
// console.log("DeclElement=" + declElement);
return
$
(
declElement
);
}
// find all elements that have the attribute
// and add hover(enterHandler, leaveHandler) handlers
$
(
"
*[
"
+
annotationAttribute
+
"
]
"
).
hover
(
function
(){
getDefinedElement
(
this
).
attr
(
"
mathbackground
"
,
"
red
"
);
$
(
this
).
css
(
"
background-color
"
,
"
orange
"
);
},
function
(){
getDefinedElement
(
this
).
removeAttr
(
"
mathbackground
"
);
$
(
this
).
css
(
"
background-color
"
,
""
);
});
$
(
"
*[
"
+
drefAttribute
+
"
]
"
).
hover
(
function
(){
getDeclElement
(
this
).
css
(
"
background-color
"
,
"
orange
"
);},
function
(){
getDeclElement
(
this
).
css
(
"
background-color
"
,
""
);}
);
})
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