Index: trunk/phase3/includes/OutputPage.php |
— | — | @@ -2662,6 +2662,7 @@ |
2663 | 2663 | 'wgUserGroups' => $this->getUser()->getEffectiveGroups(), |
2664 | 2664 | 'wgCategories' => $this->getCategories(), |
2665 | 2665 | 'wgBreakFrames' => $this->getFrameOptions() == 'DENY', |
| 2666 | + 'wgIsMainPage' => $title->isMainPage(), |
2666 | 2667 | ); |
2667 | 2668 | if ( $wgContLang->hasVariants() ) { |
2668 | 2669 | $vars['wgUserVariant'] = $wgContLang->getPreferredVariant(); |
Index: trunk/phase3/resources/mediawiki.util/mediawiki.util.js |
— | — | @@ -272,32 +272,12 @@ |
273 | 273 | |
274 | 274 | /** |
275 | 275 | * Checks wether the current page is the wiki's main page. |
276 | | - * This function requires the document to be ready! |
277 | 276 | * |
278 | | - * @param alsoRelated Boolean value, if true this function also returns true if the current page is |
279 | | - * in an associated namespace page of the main page rather than the main page itself (eg. talk page) |
280 | 277 | * @return Boolean |
| 278 | + * @deprecated to be removed in 1.18: Use wgIsMainPage in mw.config instead. |
281 | 279 | */ |
282 | | - 'isMainPage' : function( alsoRelated ) { |
283 | | - var isRelatedToMainpage = false; |
284 | | - |
285 | | - // Don't insert colon between namespace and title if the namespace is empty (eg. main namespace) |
286 | | - var namespace = mw.config.get( 'wgFormattedNamespaces' )[mw.config.get( 'wgNamespaceNumber' )]; |
287 | | - namespace = namespace ? namespace + ':' : ''; |
288 | | - |
289 | | - // We can't use (wgMainPageTitle == wgPageName) since the latter is escaped (underscores) and has other |
290 | | - // slight variations that make comparison harder. |
291 | | - var isTheMainPage = mw.config.get( 'wgMainPageTitle' ) === ( namespace + mw.config.get( 'wgTitle' ) ); |
292 | | - |
293 | | - // Also check for the title in related namespaces ? |
294 | | - if ( typeof alsoRelated !== 'undefined' && alsoRelated === true ) { |
295 | | - var tabLink = $( '#ca-talk' ).prev().find( 'a:first' ).attr( 'href' ); |
296 | | - isRelatedToMainpage = tabLink === mw.util.wikiGetlink( mw.config.get( 'wgMainPageTitle' ) ); |
297 | | - |
298 | | - return isRelatedToMainpage || isTheMainPage; |
299 | | - } |
300 | | - |
301 | | - return isTheMainPage; |
| 280 | + 'isMainPage' : function() { |
| 281 | + return mw.config.get( 'wgIsMainPage' ); |
302 | 282 | }, |
303 | 283 | |
304 | 284 | |