Jump to content

MediaWiki:Common.js: Difference between revisions

From New Bradford
nb>Admin
Show the main menu pinned for logged-out visitors
 
m 1 revision imported
(No difference)

Revision as of 04:50, 27 October 2026

/* Logged-out visitors: show the main menu (Bestiary, Tameables, etc.) pinned on the left,
   the same way logged-in users see it. The Vector skin only pins it for logged-in users. */
( function () {
	if ( !mw.user.isAnon() ) {
		return;
	}
	function pinMainMenu() {
		var menu = document.getElementById( 'vector-main-menu' );
		var pinned = document.getElementById( 'vector-main-menu-pinned-container' );
		if ( !menu || !pinned || pinned.contains( menu ) ) {
			return;
		}
		pinned.appendChild( menu );
		var html = document.documentElement.classList;
		html.remove( 'vector-feature-main-menu-pinned-disabled' );
		html.add( 'vector-feature-main-menu-pinned-enabled' );
	}
	if ( document.readyState === 'loading' ) {
		document.addEventListener( 'DOMContentLoaded', pinMainMenu );
	} else {
		pinMainMenu();
	}
}() );