User:JPxG/Difformatter.js

// Fix URLs to oldids and diffs and etc, and replace them with wikilinks to Special:Permalink or Special:Diff.

function doDifformat { //alert("This part works"); tbox = String(document.editform.wpTextbox1.value); // Get the text from the edit box and store it as "tbox". //alert("This part works too"); tbox = tbox.replaceAll("[https://en.wikipedia.org/w/index.php?diff=", "[[Special:Diff/");	tbox = tbox.replaceAll("https://en.wikipedia.org/w/index.php?diff=", "Special:Diff/");	tbox = tbox.replaceAll("https://en.wikipedia.org/wiki/Special%3ADiff%2F", "Special:Diff/");   tbox = tbox.replaceAll("https://en.wikipedia.org/w/index.php?title=User:JPxG/sandboxcss&diff=prev&oldid=", "Special:Diff/");	//alert("This part works also also");	document.editform.wpTextbox1.value = tbox;	//alert("And this part"); } // function to replace the stuff with the other stuff

addOnloadHook(function {	if (document.editform) {		mw.util.addPortletLink("p-cactions", "javascript:doDifformat", "Difformat", "ca-difformat", "Fix diff/permalinks", "");	} }); // onloadhook //