MediaWiki:Gadget-NewSection.js

Da Semi del Verbo, l'enciclopedia dell'influenza del Vangelo sulla cultura

Nota: dopo aver pubblicato, potrebbe essere necessario pulire la cache del proprio browser per vedere i cambiamenti.

  • Firefox / Safari: tieni premuto il tasto delle maiuscole Shift e fai clic su Ricarica, oppure premi Ctrl-F5 o Ctrl-R (⌘-R su Mac)
  • Google Chrome: premi Ctrl-Shift-R (⌘-Shift-R su un Mac)
  • Internet Explorer / Edge: tieni premuto il tasto Ctrl e fai clic su Aggiorna, oppure premi Ctrl-F5
  • Opera: premi Ctrl-F5.
/**
 * create a "New section" link for the last section header (if present for that page at all)
 */
( function ( mw, $ ) {
	mw.hook( 'wikipage.content' ).add( function ( $content ) {
		var $newSectionLink = $( '#ca-addsection a' );
		if ( $newSectionLink.length ) {
			// add it within the brackets of last section
			$content.find( 'span.mw-editsection:last a:last' )
			.after(
				$newSectionLink.clone() // create a copy
				// lowercase text
				.text( $newSectionLink.text().toLowerCase() )
				// avoid duplicate accesskey
				.removeAttr( 'accesskey' ).updateTooltipAccessKeys()
			)
			.after( ' | ' ); // see [[MediaWiki:Pipe-separator]]
		}
	} );
}( mediaWiki, jQuery ) );