User:Suppa chuppa/undoplus.js

$(document).ready(function {      function makeLink(diff,oldid,summary) {		var a = document.createElement('a');		a.href = wgScript + '?title=' + getParam('title') + '&action=edit' + '&undoafter=' + oldid + '&undo=' + diff;		a.title = 'Undo this edit';		a.appendChild(document.createTextNode('undo+'));		return a;       }       function getParam(name) {		name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');		var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');  		var results = regex.exec(window.location.href);		if (results == null) {			return '';		} else {			return decodeURIComponent(results[1]);		}       }       if(getParam('diff')) {                var undo = document.getElementById('mw-diff-ntitle1').firstChild;		undo.appendChild(document.createTextNode(' (')); undo.appendChild(makeLink(getParam('diff'),getParam('oldid'));		undo.appendChild(document.createTextNode(')')); }      else if(wgAction == 'edit') { document.getElementById('wpSummary').value += 'Undid revision(s) from revision ' + getParam('diff') + ' to ' + getParam('oldid'); } });