From 31c71dbdb48dcc8b3df65684f2f75e3aca0a6c5a Mon Sep 17 00:00:00 2001 From: Krinkle Date: Mon, 27 Dec 2010 16:43:50 +0000 Subject: [PATCH] The toggle link may be in any of the cells of the first row. The default will stick to the last cell but when detecting premade links, it now scans the entire first row instead of just the last cell. --- resources/jquery/jquery.makeCollapsible.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/resources/jquery/jquery.makeCollapsible.js b/resources/jquery/jquery.makeCollapsible.js index 5b27238061..e662dae0c6 100644 --- a/resources/jquery/jquery.makeCollapsible.js +++ b/resources/jquery/jquery.makeCollapsible.js @@ -162,7 +162,7 @@ $.fn.makeCollapsible = function() { // (ie. outside the container or deeper inside the tree) // Then: Locate the custom toggle link(s) and bind them if ( $that.attr( 'id' ).indexOf( 'mw-customcollapsible-' ) === 0 ) { - // @FIXME: Incomplete + var thatId = $that.attr( 'id' ), $customTogglers = $( '.' + thatId.replace( 'mw-customcollapsible', 'mw-customtoggle' ) ); mw.log( 'Found custom collapsible: #' + thatId ); @@ -186,13 +186,13 @@ $.fn.makeCollapsible = function() { // Elements are treated differently if ( $that.is( 'table' ) ) { - // The toggle-link will be in the last cell (td or th) of the first row - var $lastCell = $( 'tr:first th, tr:first td', that ).eq(-1), - $toggle = $lastCell.find( '> .mw-collapsible-toggle' ); + // The toggle-link will be in one the the cells (td or th) of the first row + var $firstRowCells = $( 'tr:first th, tr:first td', that ), + $toggle = $firstRowCells.find( '> .mw-collapsible-toggle' ); - // If theres no toggle link, add it + // If theres no toggle link, add it to the last cell if ( !$toggle.size() ) { - $lastCell.prepend( $toggleLink ); + $firstRowCells.eq(-1).prepend( $toggleLink ); } else { $toggleLink = $toggle.unbind( 'click.mw-collapse' ).bind( 'click.mw-collapse', function( e ){ toggleLinkDefault( this, e ); -- 2.20.1