Fix Bug #28344 - “Links doesn't work inside collapsible toggles”
authorMark A. Hershberger <mah@users.mediawiki.org>
Thu, 16 Jun 2011 22:27:22 +0000 (22:27 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Thu, 16 Jun 2011 22:27:22 +0000 (22:27 +0000)
Patch from mybugs.mail

    If a link is added inside of a collapsible toggle and a user click on it, the
    target page should be opened.
    …
    The attached patch was tested locally and fixes this bug (clicking outside the
    link toogles the collapsed content, and clicking on the link opens the target
    page).

    PS: It is the same code which was used to fix the problem on Commons.

    http://commons.wikimedia.org/w/index.php?diff=45383826&oldid=45265712

CREDITS
resources/jquery/jquery.makeCollapsible.js

diff --git a/CREDITS b/CREDITS
index bf4f29e..8a6e199 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -125,6 +125,7 @@ following names for their contribution to the product.
 * Mormegil
 * MrPete
 * MZMcBride
+* mybugs.mail
 * Nakon
 * Nathan Larson
 * nephele
index d708afe..445213e 100644 (file)
@@ -176,6 +176,9 @@ $.fn.makeCollapsible = function() {
                        },
                        // Toggles collapsible and togglelink class
                        toggleLinkPremade = function( $that, e ) {
+                               if ( $(e.target).is('a') ) {
+                                       return true;
+                               }
                                var     $collapsible = $that.eq(0).closest( '.mw-collapsible.mw-made-collapsible' ).toggleClass( 'mw-collapsed' );
                                e.preventDefault();
                                e.stopPropagation();