Difference between revisions of "MediaWiki:Common.js"
The Beyond Skyrim Wiki — Hosted by UESP
(collapsible tables) |
(No difference)
|
Revision as of 16:41, 1 July 2017
/* Any JavaScript here will be loaded for all users on every page load. */
/** Collapsible tables *********************************************************
*
* Description: Allows tables to be collapsed, showing only the header. See
* http://www.mediawiki.org/wiki/Manual:Collapsible_tables.
* Maintainers: [[en:User:R. Koot]]
*/
window.autoCollapse = 2;
window.collapseCaption = 'hide';
window.expandCaption = 'show';
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 == window.collapseCaption ) {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = 'none';
}
Button.firstChild.data = window.expandCaption;
} else {
for ( var i = 1; i < Rows.length; i++ ) {
Rows[i].style.display = Rows[0].style.display;
}
Button.firstChild.data = window.collapseCaption;
}
}