Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

MediaWiki:Citizen.js

MediaWiki interface page
Revision as of 20:31, 15 June 2026 by Cranio is thinking (talk | contribs) (Indice: nel rail sopra la TOC nativa (riuso TOC); float dove il rail non c'è)

Note: After publishing, you may have to bypass your browser's cache to see the changes.

  • Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
  • Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
  • Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* All JavaScript here will be loaded for users of the Citizen skin */

/* Indice d'archivio: dove esiste il rail di Citizen (pagine con sezioni) lo
   mettiamo lì, SOPRA la TOC nativa (che riusiamo); dove il rail non esiste
   (pagine senza sezioni) l'indice resta una colonna flottante (.ai-rail) e non
   sparisce mai. Sulla Dashboard l'indice non ha .ai-rail (è nel suo layout),
   quindi questo hook non lo tocca. */
mw.hook( 'wikipage.content' ).add( function () {
	var box = document.querySelector( '.archivio-indice.ai-rail' );
	if ( !box ) {
		return;
	}
	var rail =
		document.querySelector( '.citizen-page-sidebar' ) ||
		document.querySelector( '.citizen-sidebar' ) ||
		document.querySelector( '.citizen-toc-container' );
	if ( !rail ) {
		return; // niente rail: l'indice resta flottante nel contenuto
	}
	box.classList.remove( 'ai-rail' ); // via il float
	box.classList.add( 'ai-in-rail' );
	rail.prepend( box ); // indice sopra la TOC nativa
} );