Index: trunk/extensions/HeaderTabs/skins-jquery/ext.headertabs.bare.css |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * A more Vector like tabs with normal sized text, blue links, and shiny tabs. |
| 3 | + * More Vector-like tabs, with normal sized text, blue links, and shiny tabs. |
4 | 4 | * |
5 | 5 | * @file |
6 | 6 | * @ingroup Extensions |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | /* JQuery UI tabs clearing styles by Olivier Finlay Beaton and 70.189.238.136 */ |
13 | 13 | #headertabs.bare.ui-widget { |
14 | 14 | font-family: inherit; |
15 | | - font-size: 1em; /* ie doesn't like inherit here */ |
| 15 | + font-size: 1em; /* IE doesn't like inherit here */ |
16 | 16 | } |
17 | 17 | |
18 | 18 | #headertabs.bare.ui-widget-content { |
— | — | @@ -37,14 +37,14 @@ |
38 | 38 | border-bottom-color: #cccccc; |
39 | 39 | } |
40 | 40 | |
41 | | -/* section by 70.189.238.136, for things I forgot, thanks! */ |
| 41 | +/* section by 70.189.238.136 */ |
42 | 42 | #headertabs.bare .ui-widget input, #headertabs.bare .ui-widget select, #headertabs.bare .ui-widget textarea, #headertabs.bare .ui-widget button { font-family: inherit; font-size: 1em; } /* ie doesn't like inherit here */ |
43 | 43 | #headertabs.bare .ui-widget-content a { color:#0645AD; } |
44 | 44 | #headertabs.bare .ui-widget-content a:visited { color:#0b0080; } |
45 | 45 | #headertabs.bare .ui-widget-content a.new { color:#CC2200; } |
46 | 46 | #headertabs.bare .ui-widget-content a.new:visited { color:#A55858; } |
47 | 47 | #headertabs.bare .ui-widget-content a.extiw { color:#3366BB; } |
48 | | -#headertabs.bare .ui-widget-content a.redirect { color:#308050; } /*Color redirect links*/ |
49 | | -#headertabs.bare .ui-widget-content a.redirect:visited { color:#3070A0; } /*Color redirect links*/ |
| 48 | +#headertabs.bare .ui-widget-content a.redirect { color:#308050; } |
| 49 | +#headertabs.bare .ui-widget-content a.redirect:visited { color:#3070A0; } |
50 | 50 | |
51 | | -/* end JQuery UI tabs style clearer */ |
\ No newline at end of file |
| 51 | +/* end JQuery UI tabs style clearer */ |
Index: trunk/extensions/HeaderTabs/skins-jquery/ext.headertabs.core.js |
— | — | @@ -1,5 +1,5 @@ |
2 | 2 | /** |
3 | | - * Version of the HeaderTabs class that uses jQuery and the ResourceLoader. |
| 3 | + * Javascript code for Header Tabs extension for MW 1.17+ |
4 | 4 | * |
5 | 5 | * @file |
6 | 6 | * @ingroup Extensions |
— | — | @@ -26,16 +26,16 @@ |
27 | 27 | /* follow a # anchor to a tab OR a heading */ |
28 | 28 | var curHash = window.location.hash; |
29 | 29 | if ( curHash.indexOf( "#tab=" ) == 0 ) { |
30 | | - // remove the fragment identifier, we're using it for the name of the tab in the jquery ui tabs |
31 | | - var tabName = curHash.replace( "#tab=", "" ); |
32 | | - $tabs.tabs('select', tabName); |
| 30 | + // remove the fragment identifier, we're using it for the name of the tab in the jquery ui tabs |
| 31 | + var tabName = curHash.replace( "#tab=", "" ); |
| 32 | + $tabs.tabs('select', tabName); |
33 | 33 | } else if (curHash != '') { |
34 | 34 | /* select tab in a fragment |
35 | 35 | thanks kboudloche, Alphos |
36 | 36 | http://forum.jquery.com/topic/jquery-ui-tabs-create-an-anchor-to-content-within-tab#14737000001187015 |
37 | 37 | */ |
38 | | - var tabName = $(curHash).closest('.ui-tabs-panel').attr('id'); |
39 | | - $tabs.tabs('select', tabNameEscape(tabName)); |
| 38 | + var tabName = $(curHash).closest('.ui-tabs-panel').attr('id'); |
| 39 | + $tabs.tabs('select', tabNameEscape(tabName)); |
40 | 40 | } |
41 | 41 | |
42 | 42 | function tabEditTabLink(hash) { |
— | — | @@ -85,4 +85,4 @@ |
86 | 86 | var href = $(this).attr('href'); |
87 | 87 | $tabs.tabs('select', tabNameEscape(href)); |
88 | 88 | return false; |
89 | | -} ); |
\ No newline at end of file |
| 89 | +} ); |
Index: trunk/extensions/HeaderTabs/skins-jquery/ext.headertabs.jquery-large.css |
— | — | @@ -1,5 +1,6 @@ |
2 | 2 | /** |
3 | | - * Default jquery styling with normal sized font and blue links. |
| 3 | + * Default jQuery styling, but with normal-sized font and blue (instead of |
| 4 | + * black)links. |
4 | 5 | * |
5 | 6 | * @file |
6 | 7 | * @ingroup Extensions |
— | — | @@ -8,20 +9,19 @@ |
9 | 10 | * @author Olivier Beaton |
10 | 11 | */ |
11 | 12 | |
12 | | -/* JQuery UI tabs clearing styles by Olivier Finlay Beaton and 70.189.238.136 */ |
13 | 13 | #headertabs.jquery-large.ui-widget { |
14 | 14 | font-family: inherit; |
15 | | - font-size: 1em; /* ie doesn't like inherit here */ |
| 15 | + font-size: 1em; /* IE doesn't like inherit here */ |
16 | 16 | } |
17 | 17 | |
18 | | -/* section by 70.189.238.136, for things I forgot, thanks! */ |
19 | | -#headertabs.jquery-large .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: inherit; font-size: 1em; } /* ie doesn't like inherit here */ |
| 18 | +/* section by 70.189.238.136 */ |
| 19 | +#headertabs.jquery-large .ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: inherit; font-size: 1em; } /* IE doesn't like inherit here */ |
20 | 20 | #headertabs.jquery-large .ui-widget-content a { color:#0645AD; } |
21 | 21 | #headertabs.jquery-large .ui-widget-content a:visited { color:#0b0080; } |
22 | 22 | #headertabs.jquery-large .ui-widget-content a.new { color:#CC2200; } |
23 | 23 | #headertabs.jquery-large .ui-widget-content a.new:visited { color:#A55858; } |
24 | 24 | #headertabs.jquery-large .ui-widget-content a.extiw { color:#3366BB; } |
25 | | -#headertabs.jquery-large .ui-widget-content a.redirect { color:#308050; } /*Color redirect links*/ |
26 | | -#headertabs.jquery-large .ui-widget-content a.redirect:visited { color:#3070A0; } /*Color redirect links*/ |
| 25 | +#headertabs.jquery-large .ui-widget-content a.redirect { color:#308050; } |
| 26 | +#headertabs.jquery-large .ui-widget-content a.redirect:visited { color:#3070A0; } |
27 | 27 | |
28 | | -/* end JQuery UI tabs style clearer */ |
\ No newline at end of file |
| 28 | +/* end JQuery UI tabs style clearer */ |
Index: trunk/extensions/HeaderTabs/HeaderTabs.php |
— | — | @@ -17,7 +17,7 @@ |
18 | 18 | // the file loaded depends on whether the ResourceLoader exists, which in |
19 | 19 | // turn depends on what version of MediaWiki this is - for MW 1.17+, |
20 | 20 | // HeaderTabs_body.jq.php will get loaded |
21 | | -$jquery = is_callable( array( 'OutputPage', 'addModules' ) ); |
| 21 | +$useJQuery = is_callable( array( 'OutputPage', 'addModules' ) ); |
22 | 22 | |
23 | 23 | $wgExtensionCredits['parserhook'][] = array( |
24 | 24 | 'path' => __FILE__, |
— | — | @@ -42,9 +42,9 @@ |
43 | 43 | $htEditTabLink = true; |
44 | 44 | |
45 | 45 | // Extension:Configure |
46 | | -if (isset($wgConfigureAdditionalExtensions) && is_array($wgConfigureAdditionalExtensions)) { |
| 46 | +if ( isset( $wgConfigureAdditionalExtensions ) && is_array( $wgConfigureAdditionalExtensions ) ) { |
47 | 47 | |
48 | | - /* (not our var to doc) |
| 48 | + /** |
49 | 49 | * attempt to tell Extension:Configure how to web configure our extension |
50 | 50 | * @since 2011-09-22, 0.2 |
51 | 51 | */ |
— | — | @@ -69,13 +69,13 @@ |
70 | 70 | |
71 | 71 | } // $wgConfigureAdditionalExtensions exists |
72 | 72 | |
73 | | -// used by both jquery and yui |
| 73 | +// used by both jQuery and YUI |
74 | 74 | $wgHooks['ParserFirstCallInit'][] = 'headerTabsParserFunctions'; |
75 | 75 | $wgHooks['LanguageGetMagic'][] = 'headerTabsLanguageGetMagic'; |
76 | 76 | $wgHooks['BeforePageDisplay'][] = 'HeaderTabs::addHTMLHeader'; |
77 | 77 | $wgHooks['ParserAfterTidy'][] = 'HeaderTabs::replaceFirstLevelHeaders'; |
78 | 78 | |
79 | | -if ($jquery) { |
| 79 | +if ( $useJQuery ) { |
80 | 80 | $wgAutoloadClasses['HeaderTabs'] = "$dir/HeaderTabs_body.jq.php"; |
81 | 81 | |
82 | 82 | $wgHooks['ResourceLoaderGetConfigVars'][] = 'HeaderTabs::addConfigVarsToJS'; |
— | — | @@ -96,9 +96,7 @@ |
97 | 97 | 'remoteExtPath' => 'HeaderTabs', |
98 | 98 | ); |
99 | 99 | |
100 | | - //end if jquery |
101 | | -} else { |
102 | | - // we are pre 1.17 and doing yui |
| 100 | +} else { // if ! $useJQuery |
103 | 101 | $wgAutoloadClasses['HeaderTabs'] = "$dir/HeaderTabs_body.yui.php"; |
104 | 102 | } |
105 | 103 | |
— | — | @@ -116,8 +114,8 @@ |
117 | 115 | //! @todo implement in tab parsing code instead... but problems like nowiki (2011-12-12, ofb) |
118 | 116 | // if you make them here, it will be article wide instead of tab-wide |
119 | 117 | // __NOTABTOC__, __TABTOC__, __NOEDITTAB__ |
120 | | - // and oneday with a special page: __NEWTABLINK__, __NONEWTABLINK__ |
121 | | - // and oneday if we can force toc generation: __FORCETABTOC__ |
| 118 | + // and one day with a special page: __NEWTABLINK__, __NONEWTABLINK__ |
| 119 | + // and one day if we can force toc generation: __FORCETABTOC__ |
122 | 120 | |
123 | 121 | //! @todo make this load a custom name from i18n file (2011-12-12, ofb) |
124 | 122 | // ensure to keep this name too for backwards compat |
— | — | @@ -126,4 +124,4 @@ |
127 | 125 | $magicWords['switchtablink'] = array ( 0, 'switchtablink' ); |
128 | 126 | } |
129 | 127 | return true; |
130 | | -} |
\ No newline at end of file |
| 128 | +} |
Index: trunk/extensions/HeaderTabs/HeaderTabs_body.jq.php |
— | — | @@ -22,7 +22,7 @@ |
23 | 23 | |
24 | 24 | //! @todo handle __NOTABTOC__, __TABTOC__, __FORCETABTOC__ here (2011-12-12, ofb) |
25 | 25 | |
26 | | - // where do we stop rendering tabs, and what is bellow it? |
| 26 | + // Where do we stop rendering tabs, and what is below it? |
27 | 27 | // if we don't have a stop point, then bail out |
28 | 28 | $aboveandbelow = explode( '<div id="nomoretabs"></div>', $text, 2 ); |
29 | 29 | if ( count( $aboveandbelow ) <= 1 ) { |
— | — | @@ -38,7 +38,7 @@ |
39 | 39 | wfDebugLog('headertabs', __METHOD__.': detected header handling, checking'); |
40 | 40 | |
41 | 41 | if ($below !== '') { |
42 | | - wfDebugLog('headertabs', __METHOD__.': we have text bellow our tabs'); |
| 42 | + wfDebugLog('headertabs', __METHOD__.': we have text below our tabs'); |
43 | 43 | } |
44 | 44 | |
45 | 45 | // grab the TOC |
— | — | @@ -182,20 +182,20 @@ |
183 | 183 | $tabtocraw = $tabtocmatches[0]; |
184 | 184 | $tabtoc = $tabtocraw; |
185 | 185 | $itempattern = '/<li class="toclevel-[0-9]+"><a href="(#[^"]+)"><span class="tocnumber">[0-9]+<\/span> <span class="toctext">([^<]+)<\/span><\/a><\/li>/'; |
186 | | - if (preg_match_all ( $itempattern , $tabtocraw, $tabtocitemmatches, PREG_SET_ORDER) > 0 ) { |
187 | | - foreach($tabtocitemmatches as $match) { |
| 186 | + if ( preg_match_all( $itempattern , $tabtocraw, $tabtocitemmatches, PREG_SET_ORDER ) > 0 ) { |
| 187 | + foreach( $tabtocitemmatches as $match ) { |
188 | 188 | $newitem = $match[0]; |
189 | 189 | |
190 | | - // 1.17 behaviour |
191 | | - if (strpos($match[2], '[edit] ') === 0) { |
192 | | - $newitem = str_replace($match[1], '#'.substr($match[1], 12), $newitem); |
193 | | - $newitem = str_replace($match[2], substr($match[2], 7), $newitem); |
194 | | - // 1.18+ behaviour |
195 | | - } elseif (trim(substr($match[2], 0, strlen($match[2])/2)) == trim(substr($match[2], strlen($match[2])/2))) { |
196 | | - $newitem = str_replace($match[1], '#'.trim(substr($match[1], (strlen($match[1])/2)+1)), $newitem); |
197 | | - $newitem = str_replace($match[2], trim(substr($match[2], strlen($match[2])/2)), $newitem); |
| 190 | + // 1.17 behavior |
| 191 | + if ( strpos( $match[2], '[edit] ' ) === 0 ) { |
| 192 | + $newitem = str_replace( $match[1], '#' . substr( $match[1], 12 ), $newitem ); |
| 193 | + $newitem = str_replace( $match[2], substr( $match[2], 7 ), $newitem ); |
| 194 | + // 1.18+ behavior |
| 195 | + } elseif ( trim( substr( $match[2], 0, strlen( $match[2] ) / 2 ) ) == trim( substr( $match[2], strlen( $match[2] ) / 2 ) ) ) { |
| 196 | + $newitem = str_replace( $match[1], '#' . trim( substr( $match[1], ( strlen( $match[1] ) / 2 ) + 1 ) ), $newitem ); |
| 197 | + $newitem = str_replace( $match[2], trim( substr( $match[2], strlen( $match[2] ) / 2 ) ), $newitem ); |
198 | 198 | } |
199 | | - $tabtoc = str_replace($match[0], $newitem, $tabtoc); |
| 199 | + $tabtoc = str_replace( $match[0], $newitem, $tabtoc ); |
200 | 200 | } |
201 | 201 | $content = $tabtoc.$content; |
202 | 202 | } |
— | — | @@ -210,13 +210,11 @@ |
211 | 211 | ) ); |
212 | 212 | } |
213 | 213 | |
214 | | - //! @todo see if we can't add the SMW factorbox stuff back in (2011-12-12, ofb) |
| 214 | + //! @todo see if we can't add the SMW factbox stuff back in (2011-12-12, ofb) |
215 | 215 | |
216 | 216 | wfDebugLog('headertabs', __METHOD__.': generated '.count($tabs).' tabs'); |
217 | 217 | |
218 | | - $tabhtml = ''; |
219 | | - |
220 | | - $tabhtml .= '<div id="headertabs"'; |
| 218 | + $tabhtml = '<div id="headertabs"'; |
221 | 219 | if (!empty($htStyle) && $htStyle !== 'jquery') { |
222 | 220 | $tabhtml .= ' class="'.$htStyle.'"'; |
223 | 221 | } |
— | — | @@ -248,8 +246,6 @@ |
249 | 247 | public static function addConfigVarsToJS( &$vars ) { |
250 | 248 | global $htUseHistory, $htEditTabLink; |
251 | 249 | |
252 | | - wfDebugLog('headertabs', __METHOD__.': adding globals'); |
253 | | - |
254 | 250 | $vars['htUseHistory'] = $htUseHistory; |
255 | 251 | $vars['htEditTabLink'] = $htEditTabLink; |
256 | 252 | |
— | — | @@ -263,16 +259,13 @@ |
264 | 260 | public static function addHTMLHeader( &$out ) { |
265 | 261 | global $htScriptPath,$htStyle; |
266 | 262 | |
267 | | - wfDebugLog('headertabs', __METHOD__.': loading javascript'); |
268 | | - |
269 | 263 | //! @todo we might be able to only load our js and styles if we are rendering tabs, speeding up pages that don't use it? but what about cached pages? (2011-12-12, ofb) |
270 | 264 | |
271 | 265 | $out->addModules( 'ext.headertabs' ); |
272 | 266 | |
273 | | - // add the stylesheet for our perticular style |
274 | | - if (!empty($htStyle) && $htStyle !== 'jquery') { |
275 | | - $styleFile = $htScriptPath.'/skins-jquery/ext.headertabs.'.$htStyle.'.css'; |
276 | | - wfDebugLog('headertabs', __METHOD__.': including style file: '.$styleFile); |
| 267 | + // Add the CSS file for the specified style. |
| 268 | + if ( !empty( $htStyle ) && $htStyle !== 'jquery' ) { |
| 269 | + $styleFile = $htScriptPath . '/skins-jquery/ext.headertabs.' . $htStyle . '.css'; |
277 | 270 | $out->addExtensionStyle( $styleFile ); |
278 | 271 | } |
279 | 272 | |