Difference between revisions of "MediaWiki:Common.js"

From henk-wiki
Jump to navigation Jump to search
(Created page with "→‎Any JavaScript here will be loaded for all users on every page load.: var reflist = document.getElementsByTagName("reflist"); foreach(var refl in reflist){ var nlinks =...")
 
Line 8: Line 8:
 
foreach(var lnk in nlinks){
 
foreach(var lnk in nlinks){
 
if(document.getElementsByClassName("autonumber")[lnk].href){
 
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>";
+
lnkText+="<li>"+lnkIdx+": <a href='"+document.getElementsByClassName("autonumber")[lnk].href+"' target='_blank'>"+document.getElementsByClassName("autonumber")[lnk].href+"</a></li>";
 
lnkIdx++;
 
lnkIdx++;
 
}
 
}

Revision as of 12:39, 31 October 2020

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

var reflist = document.getElementsByTagName("reflist");
foreach(var refl in reflist){
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;
}