MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary |
No edit summary |
||
| Line 16: | Line 16: | ||
window.hideTable = function ( tableIndex ) { | window.hideTable = function ( tableIndex ) { | ||
var Button = document.getElementById( 'hideButton' + tableIndex ); | var Button = document.getElementById( 'hideButton' + tableIndex ); | ||
var | var showTable = document.getElementById( 'hideableTable' + tableIndex ); | ||
var hideTable = document.getElementsByClassName( 'shown' ); | |||
if ( ! | if ( !showTable || !Button ) { | ||
return false; | return false; | ||
} | } | ||
var Rows = showTable.rows; | |||
var i; | |||
if ( Button.firstChild.data === hideCaption ) { | |||
for ( i = 0; i < Rows.length; i++ ) { | |||
Rows[i].style.display = 'none'; | |||
} | |||
Button.firstChild.data = expandCaption; | |||
} else { | |||
for ( i = 0; i < Rows.length; i++ ) { | |||
Rows[i].style.display = ''; | |||
} | |||
Button.firstChild.data = hideCaption; | |||
} | |||
showTable.className = "shown"; | |||
if (hideTable) { | |||
var Rows = hideTable.rows; | |||
var i; | |||
for ( i = 0; i < Rows.length; i++ ) { | |||
Rows[i].style.display = 'none'; | |||
} | |||
hideTable.className = "hidden"; | |||
} | |||
}; | }; | ||