Anonymous

Difference between revisions of "MediaWiki:Common.js"

From Clicklaw Wikibooks
159 bytes added ,  20:58, 3 September 2018
Wrap addPortletLink reference
(Wrap addPortletLink reference)
Line 88: Line 88:
     var metaBase = "https://secure.wikimedia.org/wikipedia/meta";
     var metaBase = "https://secure.wikimedia.org/wikipedia/meta";
} else {
} else {
     var metaBase = "http://meta.wikimedia.org";
     var metaBase = "https://meta.wikimedia.org";
}
}
importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400")
importScriptURI(metaBase+"/w/index.php?title=MediaWiki:Wikiminiatlas.js&action=raw&ctype=text/javascript&smaxage=21600&maxage=86400")
Line 419: Line 419:
  *  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
  *  Maintainers: [[User:AzaToth]], [[User:R. Koot]], [[User:Alex Smotrov]]
  */
  */
 
// CLWB-214: wrap ensuring mediawiki.util is loaded.
if (wgPageName == 'Main_Page' || wgPageName == 'Talk:Main_Page')  
mw.loader.using(['mediawiki.util'] ).then( function () {
    addOnloadHook(function () {
    if (wgPageName == 'Main_Page' || wgPageName == 'Talk:Main_Page')  
        addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias',
        addOnloadHook(function () {
                'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias')
            addPortletLink('p-lang', 'http://meta.wikimedia.org/wiki/List_of_Wikipedias',
        var nstab = document.getElementById('ca-nstab-main')
                    'Complete list', 'interwiki-completelist', 'Complete list of Wikipedias')
        if (nstab && wgUserLanguage=='en') {
            var nstab = document.getElementById('ca-nstab-main')
            while (nstab.firstChild) nstab = nstab.firstChild
            if (nstab && wgUserLanguage=='en') {
            nstab.nodeValue = 'Main Page'
                while (nstab.firstChild) nstab = nstab.firstChild
                nstab.nodeValue = 'Main Page'
            }
         }
         }
     }
     )
)
} );