-
Notifications
You must be signed in to change notification settings - Fork 0
/
link2footnotes.js
32 lines (22 loc) · 1.06 KB
/
link2footnotes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
$(document).ready(function(){
$('body').append('<div id="foot"><ul></ul></div>');
var link = $('body a')/*.find('selector')*/;
$.each(link, function(index,value,number_class, link_class){
/**######### Definition class #####*/
var number_class = 'number';
var link_class = 'link';
var li_class = 'li'
var ul_class = 'ul'
/**##############################*/
$(this).attr('name',index);
$a_sup = $('<a>');
$sup = $('<sup>').text(index);
$a_sup.append($sup).attr('href','#'+'note_' + index);
$(this).after($a_sup);
var $a = $('<a>').attr('href', value.href).attr('name','note_' + index).text(value.href);
var $ancor = $('<a>').attr('href', '#'+index).text(index);
var $span_a = $('<span>').addClass(number_class).append($a);
var $span_ancor = $('<span>').addClass(link_class).append($ancor);
$('#foot ul').addClass(ul_class).append($('<li>').addClass(li_class).append($span_ancor).append($span_a));
});
});