User:DoriSmith/scripts/getdiff.js

// Adds a "Diff" tab which pops up a prompt box; put in a url and get back a function wpTextboxDiff { var theURL = prompt("Enter URL:",""); if (theURL) { var theTitle = getParam('title'); var theDiff = getParam('diff'); var theOldid = getParam('oldid'); var diffTxt = "Not a valid URL";

if (theTitle !=  && theDiff != ) { diffTxt = ''; }		if (theTitle !=  && theDiff == ) { diffTxt = ''; }		prompt("Your template is:",diffTxt); }

function getParam(name) { var result = ''; var start = theURL.indexOf("?"+name+"="); if (start < 0) start = theURL.indexOf("&"+name+"="); if (start >= 0) { start += name.length+2; var end = theURL.indexOf("&",start)-1; if (end < 0) { end = theURL.length; if (theURL.charCodeAt(end-1)<48) end-=2; }			for (var i=start; i<=end; i++) { var c = theURL.charAt(i); result += (c=='+' || c=='_') ? ' ' : c;			} }		return unescape(result); } }

$(function {   mw.util.addPortletLink('p-cactions', 'javascript:wpTextboxDiff', 'Diff', 'ca-diff', 'Diff window', '', document.getElementById('ca-history')); });