User:Ahecht/Scripts/ETp.js

// /* Close Edit Template requests on talk page */ function ETp { var wpTextbox = document.getElementById("wpTextbox1"); wpTextbox.value = wpTextbox.value.replace(/{{edit (.*?)(?:\|answered=[^}\|]*(.*?))?}}/g, ""); var userMatch = /\[\[User:(.*?)[\|\]]/i.exec(wpTextbox.value)[1] wpTextbox.value = wpTextbox.value.replace(/\n$/, ""); wpTextbox.value = wpTextbox.value.concat("\n: d. --","\n\n"); document.getElementById("wpSummary").value = document.getElementById("wpSummary").value.concat("Answered ",userMatch,"'s edit request: Done"); }

if ((mw.config.get('wgNamespaceNumber') == 11 || mw.config.get('wgNamespaceNumber') == 829) && (document.getElementById("wpTextbox1") !== null)){ //Template talk: and Module talk: $.when(mw.loader.using('mediawiki.util'), $.ready ).then(		function {	   	mw.util.addPortletLink( 'p-tb', '', 'Close ETp', 'ETpLink', 'Close Edit Template request on talk page.',null,null);			document.getElementById("ETpLink").getElementsByTagName("a")[0].setAttribute('onclick', 'ETp;return false;');		}	); } //