Skip to content
Snippets Groups Projects
Commit 1ce28b31 authored by Michael Kohlhase's avatar Michael Kohlhase
Browse files

this is what I want

parent 0b5c20e3
No related branches found
No related tags found
No related merge requests found
$(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", "");}
);
})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment