Note: After saving, you have to bypass your browser's cache to see the changes. Internet Explorer: press Ctrl-F5, Mozilla: hold down Shift while clicking Reload (or press Ctrl-Shift-R), Opera/Konqueror: press F5, Safari: hold down Shift + Alt while clicking Reload, Chrome: hold down Shift while clicking Reload.
/**
 * @author Dschwen, 2008‎–2013
 * @author Dori, 2008‎
 * @author Sfu, 2010‎
 * @author Rillke, 2013‎
 * @author Krinkle, 2013
 */
/* jshint laxcomma: true, smarttabs: true */
/* global mw,$ */
//<nowiki>
$(function(){
	var old_onsubmit = null
	  , form = $('#editform')[0]
	  , edit = $('#wpTextbox1')
	  , month = [ 'January', 'February', 'March', 'April', 'May', 'June', 
	  			  'July', 'August', 'September', 'October', 'November', 'December'];

	// check if form and textarea are found
	if (!form || edit.length===0) return;
	
	function convertSignatues() {
		var now = new Date()
		  , userName = mw.config.get('wgUserName') || (window.Geo || {}).IP;

		var minute = now.getUTCMinutes();
		if (minute < 10) { minute = '0' + minute; }

		var hour = now.getUTCHours();
		if (hour < 10) { hour = '0' + hour; }

		var signature = '[[User:' + userName + '|' + userName + ']] ' +
			hour + ':' + minute + ', ' + now.getUTCDate() + ' ' +
			month[ now.getUTCMonth() ] + ' ' + now.getUTCFullYear() + ' (UTC)';

		edit.val( edit.val().replace(/~~~~/g, signature) );

		if (old_onsubmit) {
			old_onsubmit();
		}

		return true;
	}

	// replace all occurences of ~~~~ that remain from the last edit
	// with the the unsubstituted signatures maintenance template
	edit.val( edit.val().replace(/~~~~/g, '{{Unsubstituted signature}}') );

	// using $().on('submit') is not reliable
	old_onsubmit = form.onsubmit;
	form.onsubmit = convertSignatues;
	
});
//</nowiki>