r90863 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90862‎ | r90863 | r90864 >
Date:23:36, 26 June 2011
Author:yaron
Status:deferred
Tags:
Comment:
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) (history)

Diff [purge]

Index: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php
@@ -36,9 +36,12 @@
3737 for ( $i = 0; $i < ( count( $parts ) / 2 ); $i++ ) {
3838 preg_match( '/id="(.*?)"/', $parts[$i * 2], $matches );
3939 // Forward slashes in tab IDs cause a problem
40 - // in the jQuery UI tabs() function - just
41 - // replace them with an underline.
42 - $tabid = str_replace('/', '_', $matches[1]);
 40+ // in the jQuery UI tabs() function -
 41+ // replace them with two underlines (two, to
 42+ // avoid conflicting with another tab that
 43+ // might have the same name, but with a space
 44+ // instead of a slash).
 45+ $tabid = str_replace('.2F', '__', $matches[1]);
4346
4447 preg_match( '/<span.*?class="mw-headline".*?>\s*(.*?)\s*<\/h1>/', $parts[$i * 2], $matches );
4548 $tabtitle = $matches[1];
@@ -91,6 +94,8 @@
9295 $(".tabLink").click( function() {
9396 var href = $(this).attr('href');
9497 var tabName = href.replace( "#tab=", "" );
 98+ // Fix for tabs with slashes in their name.
 99+ tabName = tabName.replace( "/", "__" );
95100 $("#headertabs").tabs('select', tabName);
96101 return false; //$htUseHistory;
97102 } );

Follow-up revisions

RevisionCommit summaryAuthorDate
r90869Follow-up to r90863 - changed tab-name handling to work for all special chara...yaron05:07, 27 June 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r82583Simplified (handling for MW < 1.16 isn't necessary); added fix for tabs with ...yaron23:47, 21 February 2011

Status & tagging log