User:Nx/Scripts/Addcomment.js

/* bottomedit Add an edit section link to the bottom of a section

importScript('User:Nx/Scripts/Shared.js');

function bottomedit { if (!(document.getElementById("ca-addsection"))) return; var bodyContent = document.getElementById("bodyContent"); var headings = getElementsByClassName(bodyContent,"*","mw-headline"); var i; var editsection2; var editsection; var j; var first; first = -1; for (i=0;i<headings.length && first < 0;++i) {   if (headings[i].parentNode.parentNode == bodyContent) { first = i;   } } j = first; for (i=first+1;iAdd comment" editsection2.className = "noprint"; bodyContent.insertBefore(editsection2,headings[i].parentNode); }     j = i;    } } if (first != -1) {   if (headings[j].parentNode.firstChild.className == "editsection") {     editsection = headings[j].parentNode.firstChild.firstChild.nextSibling; editsection2 = document.createElement("span"); editsection2.innerHTML = "Add comment" editsection2.className = "noprint"; var asb = document.getElementById("addsectionbottom"); if (asb != null) {       bodyContent.insertBefore(editsection2, asb); } else { var catlinks = document.getElementById("catlinks"); if (catlinks == null) {         bodyContent.appendChild(editsection2); } else { bodyContent.insertBefore(editsection2, catlinks); }     }    }  } }

addOnloadHook(bottomedit);