summaryrefslogblamecommitdiff
path: root/blog/sbs_1/footnoter.js
blob: a1b2d8ba3e1cd65f6e5552513f50b5e9273518ec (plain) (tree)























                                                                                                                                    
//License: MIT
//Chrisoft Xiong 2017
var starting=0;
function footnoter()
{
	var footnotes=document.body.getElementsByTagName("footnote");
	for(var i=0;i<footnotes.length;++i)
	{
		var s=footnotes[i].innerHTML;
		footnotes[i].innerHTML="";//IE is stupid
		var a=document.createElement("a");
		a.setAttribute("id","n"+(starting+i+1));
		a.setAttribute("href","#note"+(starting+i+1));
		a.setAttribute("class","note");
		a.innerHTML="["+(starting+i+1)+"]";
		footnotes[i].parentNode.insertBefore(a,footnotes[i]);
		var span=document.createElement("span");
		span.setAttribute("class","TText");
		span.innerHTML="<a id=\"note"+(starting+i+1)+"\" href=\"#n"+(starting+i+1)+"\">["+(starting+i+1)+"]</a>: "+s+"<br>";
		document.getElementById("notediv").appendChild(span);
	}
	starting+=footnotes.length;
	while(footnotes.length)footnotes[0].remove();
}