Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
// Create some search-and-replace tools - this uses a slightly modified version// of [[User:Gerbrant/edit/regexReplace.js]])mw.loader.load('https://en.wikipedia.org/w/index.php?title=User:Topbanana/regexReplace.js&action=raw&ctype=text/javascript');functionRLRL_SR_Utility(){strAdvert=' - [[w:en:WP:RLR|You can help!]]';// Check if we are editingif(document.getElementById("editform")){// Check for and extract parametersparSearch=mw.util.getParamValue('RLRLS');parReplace=mw.util.getParamValue('RLRLR');parRedirect=mw.util.getParamValue('RLRLRD');// First check if we are being asked to create a redirectif(parRedirect){// Check we have no other parametersif(parSearch||parReplace)return;// Check the edit box is emptyif(document.forms.editform.wpTextbox1.value.length>0)return;// Correct the parameters providedparRedirect=unescape(decodeURIComponent(parRedirect.replace(/_/g," ")));// Okay, populate the edit box and summarydocument.forms.editform.wpTextbox1.value='#REDIRECT [['+parRedirect+']]';document.forms.editform.wpSummary.value='Link repair: Redirecting page to '+parRedirect+strAdvert;document.forms.editform.wpWatchthis.checked=false;return;}// Okay, not a redirect. Check if we are being asked to search-and-replace// If we've not got a useful set of parameters, give up if(!parSearch||!parReplace)return;// Correct the parameters providedparSearch=unescape(decodeURIComponent(parSearch.replace(/_/g," ")));parReplace=unescape(decodeURIComponent(parReplace.replace(/_/g," ")));// Check for Template namespace prefixif(parSearch.indexOf("Template:")==0&&parReplace.indexOf("Template:")==0){parSearch=parSearch.slice(9);parReplace=parReplace.slice(9);}// Escape any characters with special meanings in regular expressionsparRegex=parSearch.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");// Specifically ignore the case of the first letterparRegex='['+parRegex.substring(0,1).toUpperCase()+parRegex.substring(0,1).toLowerCase()+']'+parRegex.substring(1);// Find and manipulate the search and replace controlscreateRegexControls();document.getElementById('tbRegex_SearchCaseSensitive').checked=true;document.getElementById('tbRegex_SearchTextBox').value=parRegex;document.getElementById('tbRegex_FindButton').click();document.getElementById('tbRegex_ReplaceTextBox').value=parReplace;// Populate the edit summarydocument.forms.editform.wpSummary.value='Link repair: '+parSearch+' -> '+parReplace+strAdvert;document.forms.editform.wpMinoredit.checked=true;}// Check if we are editingif(document.getElementById("movepage")){// Check for and extract parametersparNewNS=mw.util.getParamValue('RLRLMNS');parNewTitle=mw.util.getParamValue('RLRLMNT');// If we've not got a useful set of parameters, give up if(!parNewNS||!parNewTitle)return;// Correct the parameters providedparNewTitle=unescape(decodeURIComponent(parNewTitle.replace(/_/g," ")));document.getElementById('wpNewTitleNs').value=parNewNS;document.getElementById('wpNewTitleMain').value=parNewTitle;// Populate the edit summarydocument.getElementById('wpReason').value=strAdvert;}};addOnloadHook(RLRL_SR_Utility);