User:Equazcion/NewSectionSummary.js

if ( $('input[name="wpSection"][value="new"]').length > 0) { preSum = $('#wpSummary').attr('value'); $('#wpSummary').attr('value','').attr('name','wpSectionTitle'); var summary = '  ' + 'Edit summary (Briefly describe the changes you have made)' + '  '; $('.editOptions').prepend(summary); preSumReg = /\/\* (.*?) \*\/ (.*)/; var preSumRaw = preSumReg.exec(preSum); if (preSumRaw != null){ $('[name="wpSectionTitle"]').attr('value', preSumRaw[1]); if (preSumRaw[2] == ''){ $('[name="wpSummary"]').attr('value', 'new section'); } else { $('[name="wpSummary"]').attr('value', preSumRaw[2]); }		//$('.mw-content-ltr h2:first').html(preSumRaw[1]); }	var rawTitle = $('.mw-headline:first').html; var titleReg = /\/\* (.*?) \*\//; var fixedTitle = titleReg.exec(rawTitle); if (fixedTitle != null) $('.mw-headline:first').html(fixedTitle[1]); $('#editform').submit(function{		var title = $('[name="wpSectionTitle"]').attr('value');		var summary = ($('[name="wpSummary"]').attr('value') == '') ? 'new section': $('[name="wpSummary"]').attr('value');		$('[name="wpSummary"]').attr('value', '/* ' + title + ' */ ' + summary); 	}); }