MediaWiki:Common.js: Difference between revisions

Template:Notes toggle
No edit summary
(Template:Notes toggle)
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. */
function toggleReferences() {
  var x = document.getElementById("content");
  var y = x.getElementsByClassName("reference");
  var i;
  for (i = 0; i < y.length; i++) {
    if (y[i].style.display === "none") {
      y[i].style.display = "inline";
    } else {
      y[i].style.display = "none";
    }
  }
  var z = x.getElementsByClassName("mw-references-wrap");
  var i;
  for (i = 0; i < z.length; i++) {
    if (z[i].style.display === "none") {
      z[i].style.display = "inline";
    } else {
      z[i].style.display = "none";
    }
  }
}