Index: trunk/extensions/HeaderTabs/skins-jquery/ext.headertabs.core.js |
— | — | @@ -23,9 +23,23 @@ |
24 | 24 | |
25 | 25 | var $tabs = $("#headertabs").tabs(); |
26 | 26 | |
27 | | -$tabs.children('div').removeAttr('style'); |
28 | | -$tabs.children('ul').children().removeAttr('style'); |
| 27 | +// delete the rule hiding unselected tabs |
| 28 | +var sheets = document.styleSheets; |
29 | 29 | |
| 30 | +// Could be somebody else inserted something, so we can not just delete rule 0 of sheet 0 |
| 31 | +outer: |
| 32 | +for (s = 0; s < sheets.length; s++ ) { |
| 33 | + var cursheet = sheets[s]; |
| 34 | + var rules = cursheet.cssRules? cursheet.cssRules: cursheet.rules // Yay IE |
| 35 | + |
| 36 | + for (r = 0; r < rules.length; r++){ |
| 37 | + if(rules[r].selectorText.toLowerCase()==".unselected"){ //find ".unselected" rule |
| 38 | + cursheet.deleteRule?cursheet.deleteRule(r):cursheet.removeRule(r); // Yay IE |
| 39 | + break outer; |
| 40 | + } |
| 41 | + } |
| 42 | +} |
| 43 | + |
30 | 44 | /* follow a # anchor to a tab OR a heading */ |
31 | 45 | var curHash = window.location.hash; |
32 | 46 | if ( curHash.indexOf( "#tab=" ) == 0 ) { |
Index: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php |
— | — | @@ -229,25 +229,27 @@ |
230 | 230 | if ( $i == 0 ) { |
231 | 231 | $tabhtml .= ' class="selected" '; |
232 | 232 | } else { // hide selector of all but first tab |
233 | | - $tabhtml .= ' style="display:none"'; |
| 233 | + $tabhtml .= ' class="unselected"'; |
234 | 234 | } |
235 | 235 | $tabhtml .= '><a href="#' . $tab['tabid'] . '">'.$tab['title'] . "</a></li>\n"; |
236 | 236 | } |
237 | 237 | $tabhtml .= '</ul>'; |
238 | 238 | |
239 | 239 | foreach ( $tabs as $i => $tab ) { |
240 | | - $tabhtml .= '<div id="' . $tab['tabid'] . '" class="section-'.$tab['section'].'"'; |
| 240 | + $tabhtml .= '<div id="' . $tab['tabid'] . '" class="section-'.$tab['section']; |
241 | 241 | |
242 | 242 | if ( $i != 0 ) { // hide content of all but first tab |
243 | | - $tabhtml .= ' style="display:none"'; |
| 243 | + $tabhtml .= ' unselected'; |
244 | 244 | } |
245 | 245 | |
246 | | - $tabhtml .= '><p>' . $tab['tabcontent'] . '</p></div>'; |
| 246 | + $tabhtml .= '"><p>' . $tab['tabcontent'] . '</p></div>'; |
247 | 247 | } |
248 | 248 | $tabhtml .= '</div>'; |
249 | 249 | |
250 | 250 | $text = $above . $tabhtml . $below; |
251 | 251 | |
| 252 | + $parser->getOutput()->addHeadItem(HTML::inlineScript( 'document.styleSheets[0].insertRule?document.styleSheets[0].insertRule(".unselected {display:none;}", 0):document.styleSheets[0].addRule(".unselected", "display:none");' ), true ); |
| 253 | + |
252 | 254 | return true; |
253 | 255 | } |
254 | 256 | |