MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 3:
// Extra functionality for RAM/ROM maps
$(function() {
constvar tables = document.getElementsByClassName("ram_rom_map");
for (var i = 0; i < tables.length; i++) {
constvar table = tables[i];
// Sort table by the first column
table.getElementsByTagName("th")[0].click();
// Add the ending address to the length column
constvar rows = table.getElementsByTagName("tbody")[0].children;
for (var j = 0; j < rows.length; j++) {
constvar row = rows[j];
constvar address = row.children[0].innerText;
constvar length = parseInt(row.children[1].innerText);
constvar endAddress = address.substr(0, 4) + (parseInt(address.substr(4, 4), 16) + length).toString(16).padStart(4, "0");
row.children[1].title = "[" + address + ", " + endAddress + ")";
}