https://www.mediawiki.org/wiki/Special:Code/MediaWiki/101262

Revision: 101262
Author:   liangent
Date:     2011-10-29 13:44:24 +0000 (Sat, 29 Oct 2011)
Log Message:
-----------
Allow custom toggle links to be specified by children with a certain class.
This enable templates using this feature to be used multiple times.

Modified Paths:
--------------
    
branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js

Modified: 
branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js
===================================================================
--- 
branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js
  2011-10-29 13:25:11 UTC (rev 101261)
+++ 
branches/liangent/makeCollapsible_custom/phase3/resources/jquery/jquery.makeCollapsible.js
  2011-10-29 13:44:24 UTC (rev 101262)
@@ -264,6 +264,26 @@
                                toggleLinkCustom( $customTogglers, null, $that 
);
                        }
 
+               // Custom toggle link specified by children with a certain class
+               } else if ( $that.hasClass( 'mw-customcollapsiblechildren' ) ) {
+
+                       var $customTogglers = $( '.mw-customtoggle', $that );
+
+                       // Double check that there is actually a customtoggle 
link
+                       if ( $customTogglers.length ) {
+                               $customTogglers.bind( 'click.mw-collapse', 
function( e ) {
+                                       toggleLinkCustom( $(this), e, $that );
+                               } );
+                       } else {
+                               mw.log( _fn + '<children> .mw-customtoggle: 
Missing toggler!' );
+                       }
+
+                       // Initial state
+                       if ( $that.hasClass( 'mw-collapsed' ) ) {
+                               $that.removeClass( 'mw-collapsed' );
+                               toggleLinkCustom( $customTogglers, null, $that 
);
+                       }
+
                // If this is not a custom case, do the default:
                // Wrap the contents add the toggle link
                } else {


_______________________________________________
MediaWiki-CVS mailing list
MediaWiki-CVS@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to