1jQuery(function ($) { 2 $(':header').each(function(){ 3 var id = $(this).attr('id'); 4 if (!id) { 5 // https://github.com/Dric/dokuwiki-titlesanchorlink/issues/1 6 return; 7 } 8 var name = $(this).text(); 9 $(this).append('<a title="Link to '+name+'" id="anchor__'+id+'" class="__anchor" href="#'+id+'"><img src="'+DOKU_BASE+'lib/plugins/titlesanchorlink/images/anchor.png" class="__anchor_icon" /></a>'); 10 }); 11 12 $(':header').mouseover(function() { 13 var id = $(this).attr('id'); 14 $('#anchor__'+id).show(); 15 }).mouseout(function(){ 16 var id = $(this).attr('id'); 17 $('#anchor__'+id).hide(); 18 }); 19}); 20