User:Benjaminthewill123123/undo.js

$(document).ready(function {      function makeLink(diff,oldid) {		var a = document.createElement('a');                var summary;                a.onclick = function{                      summary=prompt("Input summary:","");		      a.href = wgScript + '?title=' + wgPageName + '&action=edit' + '&undoafter=' + oldid + '&undo=' + diff + '&undoplus=yes&summary=' + summary;                };		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((wgAction == 'view' || wgAction =='historysubmit') && (getParam('diff') && getParam('diff') != 'prev' && getParam('diff') != 'next') && getParam('oldid')) { 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' && getParam('undoplus') && getParam('summary')!='null') { $('#wpSave').click; } });