User:SpikeToronto/common.js/standardeditsummaries.js

Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// ============================================================
// Standard edit summaries
// ============================================================

$(function() {
	var $label = $('#wpSummaryLabel');
	if (!$label.length) {
		return;
	}

	$combo = $('<select />').attr('id', 'stdSummaries').change(function() {
		var val = $(this).val();
		if (val != '') {
			$('#wpSummaryEnhanced,#wpSummary').val(val);
		}
	});

	$label.prepend('<br />').prepend($combo).prepend('Summaries: ');

	$.ajax({
		'dataType': 'text',
		'data': {
			'title': 'User:SpikeToronto/Template:Stdsummaries',
			'action': 'raw',
			'ctype': 'text/plain'
		},
		'url': mw.config.get('wgScript'),
		'success': function(data) {
			var lines = data.split("\n");
			for (var i in lines) {
				var val = (lines[i].indexOf('-- ') == 0) ? lines[i].substring(3) : '';
				var $opt = $('<option />').val(val).text(lines[i]);
				$combo.append($opt);
			}
		}
	});
});