MediaWiki:Common.js

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

/* Add cell-type classes to tables with the .feature-colors class */ var cells = document.querySelectorAll(".feature-colors td"); for (var i = 0; i < cells.length; i++) { if (cells[i].innerHTML.trim.toUpperCase == "Y") { cells[i].classList.add("feature-yes", "feature"); } else if (cells[i].innerHTML.trim.toUpperCase == "P") { cells[i].classList.add("feature-partial", "feature"); } else if (cells[i].innerHTML.trim.toUpperCase == "-") { cells[i].classList.add("feature-unavailable", "feature"); } else if (cells[i].innerHTML.trim.toUpperCase == "N") { cells[i].classList.add("feature"); }   }

/* Add cell-type classes to datatables */ var cells = document.querySelectorAll(".cargoTable td"); for (var i = 0; i < cells.length; i++) { if (cells[i].innerHTML.trim.toUpperCase == "Y") { cells[i].classList.add("feature-yes", "feature"); } else if (cells[i].innerHTML.trim.toUpperCase == "P") { cells[i].classList.add("feature-partial", "feature"); } else if (cells[i].innerHTML.trim.toUpperCase == "-") { cells[i].classList.add("feature-unavailable", "feature"); } else if (cells[i].innerHTML.trim.toUpperCase == "N") { cells[i].classList.add("feature"); }   }