- 'isMainPage' : function( alsoRelated ) {
- var isRelatedToMainpage = false;
-
- // Don't insert colon between namespace and title if the namespace is empty (eg. main namespace)
- var namespace = mw.config.get( 'wgFormattedNamespaces' )[mw.config.get( 'wgNamespaceNumber' )];
- namespace = namespace ? namespace + ':' : '';
-
- // We can't use (wgMainPageTitle == wgPageName) since the latter is escaped (underscores) and has other
- // slight variations that make comparison harder.
- var isTheMainPage = mw.config.get( 'wgMainPageTitle' ) === ( namespace + mw.config.get( 'wgTitle' ) );
-
- // Also check for the title in related namespaces ?
- if ( typeof alsoRelated !== 'undefined' && alsoRelated === true ) {
- var tabLink = $( '#ca-talk' ).prev().find( 'a:first' ).attr( 'href' );
- isRelatedToMainpage = tabLink === mw.util.wikiGetlink( mw.config.get( 'wgMainPageTitle' ) );
-
- return isRelatedToMainpage || isTheMainPage;
- }
-
- return isTheMainPage;