User:Whoop whoop pull up/refspace.js

// Removes unnecessary spaces immediately before inline references.

function autoEdRefspaces (str) {	str = str.replace(/ /g, ' '); // Takes care of spaces preceding unnamed references str = str.replace(/ <ref name/g, '<ref name'); // Takes care of spaces preceding named references return str; }

// To allow this script to be used even when not running AutoEd:

if (importScript("Wikipedia:AutoEd/core.js")) {   function autoEdFunctions { var txt = document.editform.wpTextbox1; var str = txt.value. replace(/ /g, ' '). replace(/ <ref name/g, '<ref name'); var newstr = autoEdRefspaces( str ); if (newstr != str) { txt.value = newstr; autoEdTag = " using a script"; }   }    autoEdLinkName  = "refSpace"; autoEdLinkHover = "Remove unnecessary spaces before reference tags"; autoEdTag      = ""; }