Skip to content
Snippets Groups Projects
annot.js 819 B
Newer Older
  • Learn to ignore specific revisions
  • Tom Wiesing's avatar
    Tom Wiesing committed
    $(function(){
    
    Michael Kohlhase's avatar
    Michael Kohlhase committed
        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
    
    Tom Wiesing's avatar
    Tom Wiesing committed
    
        // given an element, find the element it defines
        // has to be of the form #id
    
    Michael Kohlhase's avatar
    Michael Kohlhase committed
        var getDeclElement = function(elem){
            var value = $(elem).attr(drefAttribute);
    	var declElement="*["+declAttribute+"='"+ value + "']";
    //	console.log("DeclElement=" + declElement);
            return $(declElement);
    
    Tom Wiesing's avatar
    Tom Wiesing committed
        }
    
        // find all elements that have the attribute
        // and add hover(enterHandler, leaveHandler) handlers
    
    Michael Kohlhase's avatar
    Michael Kohlhase committed
        $("*["+drefAttribute+"]").hover(
    	function(){getDeclElement(this).css("background-color", "orange");},
    	function(){getDeclElement(this).css("background-color", "");}
        );
    })