Jump to content

MediaWiki:Common.js: Difference between revisions

Jehan (talk | contribs)
No edit summary
Jehan (talk | contribs)
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 Table = document.getElementById( 'hideableTable' + tableIndex );
     var showTable = document.getElementById( 'hideableTable' + tableIndex );
var hideTable = document.getElementsByClassName( 'shown' );
   
   
     if ( !Table || !Button ) {
     if ( !showTable || !Button ) {
         return false;
         return false;
     }
     }
   
   
    var Rows = Table.rows;
var Rows = showTable.rows;
    var i;
var i;
   
   
    if ( Button.firstChild.data === hideCaption ) {
if ( Button.firstChild.data === hideCaption ) {
        for ( i = 0; i < Rows.length; i++ ) {
for ( i = 0; i < Rows.length; i++ ) {
            Rows[i].style.display = 'none';
Rows[i].style.display = 'none';
        }
}
        Button.firstChild.data = expandCaption;
Button.firstChild.data = expandCaption;
    } else {
} else {
        for ( i = 0; i < Rows.length; i++ ) {
for ( i = 0; i < Rows.length; i++ ) {
            Rows[i].style.display = '';
Rows[i].style.display = '';
        }
}
        Button.firstChild.data = hideCaption;
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";
}
};
};