Index: branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js |
— | — | @@ -264,6 +264,26 @@ |
265 | 265 | toggleLinkCustom( $customTogglers, null, $that ); |
266 | 266 | } |
267 | 267 | |
| 268 | + // Custom toggle link specified by children with a certain class |
| 269 | + } else if ( $that.hasClass( 'mw-customcollapsiblechildren' ) ) { |
| 270 | + |
| 271 | + var $customTogglers = $( '.mw-customtoggle', $that ); |
| 272 | + |
| 273 | + // Double check that there is actually a customtoggle link |
| 274 | + if ( $customTogglers.length ) { |
| 275 | + $customTogglers.bind( 'click.mw-collapse', function( e ) { |
| 276 | + toggleLinkCustom( $(this), e, $that ); |
| 277 | + } ); |
| 278 | + } else { |
| 279 | + mw.log( _fn + '<children> .mw-customtoggle: Missing toggler!' ); |
| 280 | + } |
| 281 | + |
| 282 | + // Initial state |
| 283 | + if ( $that.hasClass( 'mw-collapsed' ) ) { |
| 284 | + $that.removeClass( 'mw-collapsed' ); |
| 285 | + toggleLinkCustom( $customTogglers, null, $that ); |
| 286 | + } |
| 287 | + |
268 | 288 | // If this is not a custom case, do the default: |
269 | 289 | // Wrap the contents add the toggle link |
270 | 290 | } else { |