MediaWiki:Gadget-NewSection.js

Da Cathopedia, l'enciclopedia cattolica.
Vai alla navigazione Vai alla ricerca

Nota: Dopo aver salvato le preferenze, perché i cambi abbiano effetto, devi bypassare la cache del tuo browser. Mozilla / Firefox / Safari: tieni premuto Shift mentre clicchi Reload, o premi Ctrl-Shift-R (Cmd-Shift-R per Apple Mac); Google Chrome: premi Ctrl o Shift mentre clicchi F5; IE: premi Ctrl mentre clicchi Refresh, o premi Ctrl-F5; Konqueror:: clicca semplicemente il pulsante di Reload, o premi F5; se usi Opera devi cancellare completamente la chache nel menu Tools→Preferences.

/**
 * 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 ) );