MediaWiki:Common.js: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 29: | Line 29: | ||
ts_resortTable = function(evt) { | ts_resortTable = function(evt) { | ||
orig_ts_resortTable(evt); | orig_ts_resortTable(evt); | ||
grayRows( | |||
// Find the table | |||
var table = evt.target; | |||
while (table && table.tagName.toLowerCase() !== "table") { | |||
table = table.parentNode; | |||
} | |||
if (table) { | |||
grayRows(table); | |||
} | |||
} | } | ||
Revision as of 23:36, 29 September 2007
/* Any JavaScript here will be loaded for all users on every page load. */
// Highlight every other line in the software tables
var orig_onload = window.onload;
window.onload = function(e) {
if (orig_onload != null) {
orig_onload(e);
}
var tables = document.getElementsByTagName("table");
for (var t = 0; t < tables.length; t++) {
if (tables[t].className.indexOf("software") >= 0) {
grayRows(tables[t]);
}
}
}
function grayRows(table) {
var rows = table.rows;
for (var r = 0; r < rows.length; r++) {
if (r % 2 == 1) {
rows[r].className = "grayrow";
} else {
rows[r].className = "";
}
}
}
var orig_ts_resortTable = ts_resortTable;
ts_resortTable = function(evt) {
orig_ts_resortTable(evt);
// Find the table
var table = evt.target;
while (table && table.tagName.toLowerCase() !== "table") {
table = table.parentNode;
}
if (table) {
grayRows(table);
}
}