MediaWiki:Common.js

/* Any JavaScript here will be loaded for all users on every page load. */ /* Standard edit summaries * jQuery version of Sikon's fillEditSummaries * @author Grunny - taken from Wookieepedia */ function fillEditSummaries { if ( !$( '#wpSummaryLabel' ).length ) { return; }	$.get( mw.config.get( 'wgScript' ), { title: 'Template:Stdsummaries', action: 'raw', ctype: 'text/plain' } ).done( function( data ) {		var	$summaryOptionsList,			$summaryLabel = $( '#wpSummaryLabel' ),			lines = data.split( '\n' ),			$wrapper = $( ' ').addClass( 'edit-widemode-hide' ).text( 'Standard summaries: ' );		$summaryOptionsList = $( ' ' ).attr( 'id', 'stdEditSummaries' ).change( function { var editSummary = $( this ).val; if ( editSummary !== '' ) { $( '#wpSummary' ).val( editSummary ); }		} );		for ( var i = 0; i < lines.length; i++ ) {			var editSummaryText = ( lines[i].indexOf( '-- ' ) === 0 ) ? lines[i].substring(3) : '';			$summaryOptionsList.append( $( ' ' ).val( editSummaryText ).text( lines[i] ) );		}		$summaryLabel.prepend( $wrapper.append( $summaryOptionsList ) );	} ); } $(fillEditSummaries);