// This is the skin's only javascript file. If you want to add more JS files, you need to include them in skin.json's ResourceModules section, the way this one is. // The wrapper function is needed to make sure all of the mediawiki JS is loaded before the page's is, and load relevant parts for use here. mw.loader.using( [ 'mediawiki.jqueryMsg' ] ).then( () => { // This gets the user's current username, and puts it the user menu button. const username = mw.user.getName(); const buttons = document.getElementsByClassName('site-header-user'); for (const button of buttons) { if (username) { button.firstElementChild.textContent = username; } else { button.firstElementChild.textContent = mw.message( 'login' ).text(); } } // This replaces the text of the print link with the current 'print' system message. const print = document.getElementById('page-action-print').children[0]; print.textContent = mw.message( 'print' ).text(); const toctitle = document.getElementById('site-nav-toc').children[0]; toctitle.textContent = mw.message( 'toc' ).text(); } )