r106871 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r106870‎ | r106871 | r106872 >
Date:21:39, 20 December 2011
Author:foxtrott
Status:deferred
Tags:
Comment:
reduce page jumping during loading
Modified paths:
  • /trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php (modified) (history)
  • /trunk/extensions/HeaderTabs/skins-jquery/ext.headertabs.core.js (modified) (history)

Diff [purge]

Index: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php
@@ -227,14 +227,22 @@
228228 foreach ( $tabs as $i => $tab ) {
229229 $tabhtml .= '<li';
230230 if ( $i == 0 ) {
231 - $tabhtml .= ' class="selected"';
 231+ $tabhtml .= ' class="selected" ';
 232+ } else { // hide selector of all but first tab
 233+ $tabhtml .= ' style="display:none"';
232234 }
233235 $tabhtml .= '><a href="#' . $tab['tabid'] . '">'.$tab['title'] . "</a></li>\n";
234236 }
235237 $tabhtml .= '</ul>';
236238
237 - foreach ( $tabs as $tab ) {
238 - $tabhtml .= '<div id="' . $tab['tabid'] . '" class="section-'.$tab['section'].'"><p>' . $tab['tabcontent'] . '</p></div>';
 239+ foreach ( $tabs as $i => $tab ) {
 240+ $tabhtml .= '<div id="' . $tab['tabid'] . '" class="section-'.$tab['section'].'"';
 241+
 242+ if ( $i != 0 ) { // hide content of all but first tab
 243+ $tabhtml .= ' style="display:none"';
 244+ }
 245+
 246+ $tabhtml .= '><p>' . $tab['tabcontent'] . '</p></div>';
239247 }
240248 $tabhtml .= '</div>';
241249
Index: trunk/extensions/HeaderTabs/skins-jquery/ext.headertabs.core.js
@@ -23,6 +23,9 @@
2424
2525 var $tabs = $("#headertabs").tabs();
2626
 27+$tabs.children('div').removeAttr('style');
 28+$tabs.children('ul').children().removeAttr('style');
 29+
2730 /* follow a # anchor to a tab OR a heading */
2831 var curHash = window.location.hash;
2932 if ( curHash.indexOf( "#tab=" ) == 0 ) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r106984followup 106871: leave unselected tabs alone for no-script browsersfoxtrott21:53, 21 December 2011

Status & tagging log