User:Aidan9382/scripts/citation-error-banner.js

// Add alert to the top when there are citation maintanence or error messages (Like in show preview, yet more hackily coded)

var maintCount = document.getElementsByClassName("cs1-maint").length; var errorCount = document.getElementsByClassName("error").length; var CS1errorCount = document.getElementsByClassName("cs1-visible-error").length + document.getElementsByClassName("cs1-hidden-error").length; if (errorCount + CS1errorCount > 0 && document.getElementById("bodyContent") && !document.getElementById("wikiPreview")) { var notice = document.createElement("div"); notice.className = "mw-message-box mw-message-box-warning"; var finalText = " X "; if (errorCount > 0) { finalText += " "+errorCount+" strong error message(s) are present "; }	if (CS1errorCount > 0) { finalText += " "+CS1errorCount+" error message(s) are present "; }	if (maintCount > 0) { finalText += " "+maintCount+" maintenance message(s) are present "; }	notice.innerHTML = finalText+"→ Go to references"; notice.firstChild.onclick = function{notice.remove;}; var bc = document.getElementById("bodyContent"); bc.insertBefore(notice,bc.children[0]); }