User:AndyZ/monobook.js/nbsp.js

winc('User:Omegatron/monobook.js/addlink.js');

function addnbsp{ theText = document.editform.wpTextbox1.value var memory = theText

var theText = theText.replace(/(\d)\sm\)/g,"$1 m)").replace(/(\d)\sfoot/g,"$1 foot").replace(/(\d)\sfeet/g,"$1 feet").replace(/(\d)\skm/g,"$1 km").replace(/(\d)\smi\s/g,"$1 mi ").replace(/(\d)\sft/g,"$1 ft").replace(/(\d)\skilo/g,"$1 kilo").replace(/(\d)\slb/g,"$1 lb").replace(/(\d)\spound/g,"$1 pound").replace(/(\d)\sgram/g,"$1 gram").replace(/(\d)\sliter/g,"$1 liter").replace(/(\d)\sml/g,"$1 ml").replace(/(\d)\sin\s/g,"$1 in ").replace(/(\d)\scm/g,"$1 cm").replace(/(\d)\scenti/g,"$1 centi").replace(/(\d)\sm\s/g,"$1 m ").replace(/(\d)\smile/g,"$1 mile").replace(/(\d)\sinch/g,"$1 inch").replace(/(\d)\sin\)/g,"$1 in ") if(theText==memory){ alert("Matched!")	} document.editform.wpTextbox1.value = theText }

addOnloadHook(function {    if(document.forms.editform) {        addLink('p-cactions', 'javascript:addnbsp', 'nbsp', 'ca-datefixer', 'Fixes some unit nbsp formatting', , );    } });