// Helper Javascript code that removes backlinks and upper arrows from <references/> formated data.
// Useful for text that calls the Bref template, since in that case backlinks point to display:none text.
var brefElementNodeType = 1;
function BrefHideBackLinks()
{
// Create array of all Tags with classname "references" and tagName "ol"
var brefAllReferencesTags = new Array();
brefAllReferencesTags = getElementsByClassName(document.body, "ol","references");
//Loop through list elements, blanking text in all child nodes other than <cite> and <span>
for (var i in brefAllReferencesTags)
{
var brefRefList = brefAllReferencesTags[i].childNodes;
for (var j in brefRefList)
{
// Leave embedded text between citation entries alone
if (brefRefList[j].nodeType == brefElementNodeType)
{
var brefRefListEntry = brefRefList[j].childNodes;
for (var k = brefRefListEntry.length - 1; k >= 0; --k)
{
// Only retain the <cite> and <span> tag text. Handle IE as well as other browsers
if (brefRefListEntry[k].nodeType != brefElementNodeType || (brefRefListEntry[k].tagName != "CITE" && brefRefListEntry[k].tagName != "SPAN"))
{
if (brefRefListEntry[k].innerText) // IE inner node
{
brefRefListEntry[k].innerText = "";
}
else if( brefRefListEntry[k].nodeName && brefRefListEntry[k].nodeName == "#text")
{ // IE list entry text
brefRefListEntry[k].nodeValue = "";
}
else if (brefRefListEntry[k].textContent)
{ // Others
brefRefListEntry[k].textContent = "";
}
}
}
}
}
}
}
//
// hook BrefHideBackLinks
//
addOnloadHook
(
function ()
{
BrefHideBackLinks();
}
);