User:Gerbrant/edit/selectionReplacer.js

switch(wgAction) { case "edit": case "submit": loadModule("Gerbrant.edit.selection", function(m)	{		hookEvent("load", function {			if(document.getElementById("wpTextbox1")) module("Gerbrant.edit.selectionReplacer", function(c, s, e, p)				{					var f;					switch(arguments.length)					{					case 1: f = function{ return c; }; break;					case 2: f = typeof s == "function" ? s : function(a){ return s; }; break;					case 3: f = function(a){ return s + a + e; }; break;					default: f = function(a){ return s + (a == "" ? p : a) + e; };					}					this.show = function{ m.replaceSelection(f); };					this.caption = c;				}); });	}); }