Jump to content

Snippets/Editsection inline

From mediawiki.org
How to use Snippets
List of Snippets
Editsection inline
Language(s): JavaScript
Compatible with: MediaWiki 1.17+ (Vector)

Description

[edit]

Moves the [edit] link from the opposite edge to the side of the heading title itself

Code

[edit]
/**
 * Move the [edit] link from the opposite edge to the side of the heading title itself
 *
 * @source https://www.mediawiki.org/wiki/Snippets/Editsection_inline
 * @revision 2014-04-27
 */
jQuery( function( $ ) {
	if ( $.inArray( mw.config.get('editsection-inline'), [ 'no', false ]) !== -1 ) {
		return;
	}

	mw.util.addCSS( '.editsection{float:none!important;margin-left:1em}' );
	mw.util.$content.find('.editsection').each( function() {
		var $what = $(this).parent().children();
		$what.first().before( $what.last() );
	});
});