Difference between revisions of "MediaWiki:Common.js"

From henk-wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
/* Any JavaScript here will be loaded for all users on every page load. */
 
/* Any JavaScript here will be loaded for all users on every page load. */
  
var reflist = document.getElementsByTagName("reflist");
+
var reflist = document.getElementsByTagName("p");
 
foreach(var refl in reflist){
 
foreach(var refl in reflist){
 +
if(document.getElementsByTagName("reflist")[refl].innerHTML.indexOf("<reflist")>=0){
 
var nlinks = document.getElementsByClassName("autonumber");
 
var nlinks = document.getElementsByClassName("autonumber");
 
var lnkTxt = "<ol>";
 
var lnkTxt = "<ol>";
Line 14: Line 15:
 
lnkTxt += "</ol>";
 
lnkTxt += "</ol>";
 
document.getElementsByTagName("reflist")[refl].innerHTML = lnkTxt;
 
document.getElementsByTagName("reflist")[refl].innerHTML = lnkTxt;
 +
}
 
}
 
}

Revision as of 12:44, 31 October 2020

/* Any JavaScript here will be loaded for all users on every page load. */

var reflist = document.getElementsByTagName("p");
foreach(var refl in reflist){
if(document.getElementsByTagName("reflist")[refl].innerHTML.indexOf("<reflist")>=0){
var nlinks = document.getElementsByClassName("autonumber");
var lnkTxt = "<ol>";
var lnkIdx = 1;
foreach(var lnk in nlinks){
if(document.getElementsByClassName("autonumber")[lnk].href){
lnkText+="<li>"+lnkIdx+": <a href='"+document.getElementsByClassName("autonumber")[lnk].href+"' target='_blank'>"+document.getElementsByClassName("autonumber")[lnk].href+"</a></li>";
lnkIdx++;
}
}
lnkTxt += "</ol>";
document.getElementsByTagName("reflist")[refl].innerHTML = lnkTxt;
}
}