MediaWiki:Common.js: Difference between revisions

no edit summary
No edit summary
No edit summary
Line 44: Line 44:
var collapseCaption = "hide";
var collapseCaption = "hide";
var expandCaption = "show";
var expandCaption = "show";
/*Test results partial expand/collapse revision*/
 
/*Original version
window.collapseTable = function( tableIndex ){
    var Button = document.getElementById( "collapseButton" + tableIndex );
    var Table = document.getElementById( "collapsibleTable" + tableIndex );
    if ( !Table || !Button ) {
        return false;
    }
    var Rows = Table.rows;
    if ( Button.firstChild.data == collapseCaption ) {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = "none";
        }
        Button.firstChild.data = expandCaption;
    } else {
        for ( var i = 1; i < Rows.length; i++ ) {
            Rows[i].style.display = Rows[0].style.display;
        }
        Button.firstChild.data = collapseCaption;
    }
}
*/
 
/*Revised to provide alternate button labels for test results which now only partially expand/collapse*/
var partCollapseCaption = "collapse";
var partCollapseCaption = "collapse";
var partExpandCaption = "expand";
var partExpandCaption = "expand";
Line 57: Line 83:
   
   
     var Rows = Table.rows;
     var Rows = Table.rows;
 
    //Revised to check for either title
     if ( Button.firstChild.data == collapseCaption || Button.firstChild.data == partCollapseCaption) {
     if ( Button.firstChild.data == collapseCaption || Button.firstChild.data == partCollapseCaption) {
         for ( var i = 1; i < Rows.length; i++ ) {
         for ( var i = 1; i < Rows.length; i++ ) {
             Rows[i].style.display = "none";
             Rows[i].style.display = "none";
         }
         }
        //Revised to output button label appropriate for table
         Button.firstChild.data = (document.getElementById( "collapsibleTable" + tableIndex ).className.indexOf("testresults")!=-1?partExpandCaption:expandCaption);
         Button.firstChild.data = (document.getElementById( "collapsibleTable" + tableIndex ).className.indexOf("testresults")!=-1?partExpandCaption:expandCaption);
     } else {
     } else {
Line 67: Line 95:
             Rows[i].style.display = Rows[0].style.display;
             Rows[i].style.display = Rows[0].style.display;
         }
         }
        //Revised to output button label appropriate for table
         Button.firstChild.data = (document.getElementById( "collapsibleTable" + tableIndex ).className.indexOf("testresults")!=-1?partCollapseCaption:collapseCaption);
         Button.firstChild.data = (document.getElementById( "collapsibleTable" + tableIndex ).className.indexOf("testresults")!=-1?partCollapseCaption:collapseCaption);
     }
     }