User:Writ Keeper/Scripts/elRemover.js

function removeELsWK {	var textToReplace = $("#wpTextbox1").text; var elRegex = /([^>] ?)\[http[^ \]]+ ?([^\]]*)\]/g var numberOfMatches = textToReplace.match(elRegex).length; $("#wpTextbox1").text(textToReplace.replaceAll(elRegex, "$1$2")); alert("Detected and replaced " + numberOfMatches + " external links; please preview changes to validate the replacements."); }

$(document).ready(function {	if ((mw.config.get("wgAction") === "edit" || mw.config.get("wgAction") === "submit") && mw.config.get("wgNamespaceNumber") === 0)	{

mw.loader.using("mediawiki.util").done( function 		{			mw.util.addPortletLink('p-cactions', '#', "remove external links", "ca-remove-els", "remove all external links in this section");			$("#ca-remove-els").click( function(event) {				event.preventDefault; return removeELsWK; });		});	} });