http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90863

Revision: 90863
Author:   yaron
Date:     2011-06-26 23:36:07 +0000 (Sun, 26 Jun 2011)
Log Message:
-----------
Follow-up to r82583 - this time, an actual fix (I think) for slashes in tab 
names

Modified Paths:
--------------
    trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php

Modified: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php
===================================================================
--- trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php  2011-06-26 23:32:46 UTC 
(rev 90862)
+++ trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php  2011-06-26 23:36:07 UTC 
(rev 90863)
@@ -36,9 +36,12 @@
                        for ( $i = 0; $i < ( count( $parts ) / 2 ); $i++ ) {
                                preg_match( '/id="(.*?)"/', $parts[$i * 2], 
$matches );
                                // Forward slashes in tab IDs cause a problem
-                               // in the jQuery UI tabs() function - just
-                               // replace them with an underline.
-                               $tabid = str_replace('/', '_', $matches[1]);
+                               // in the jQuery UI tabs() function -
+                               // replace them with two underlines (two, to
+                               // avoid conflicting with another tab that
+                               // might have the same name, but with a space
+                               // instead of a slash).
+                               $tabid = str_replace('.2F', '__', $matches[1]);
 
                                preg_match( 
'/<span.*?class="mw-headline".*?>\s*(.*?)\s*<\/h1>/', $parts[$i * 2], $matches 
);
                                $tabtitle = $matches[1];
@@ -91,6 +94,8 @@
        $(".tabLink").click( function() {
                var href = $(this).attr('href');
                var tabName = href.replace( "#tab=", "" );
+               // Fix for tabs with slashes in their name.
+               tabName = tabName.replace( "/", "__" );
                $("#headertabs").tabs('select', tabName);
                return false; //$htUseHistory;
        } );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to