Content deleted Content added
m revert self |
mNo edit summary |
||
Line 2:
var txt = document.editform.wpTextbox1;
// Convert
txt.value = txt.value.replace(/°/g, '°');
txt.value = txt.value.replace(/º/g, '°');
//Fix spelling error
txt.value = txt.value.replace(/celcius/gi, 'Celsius');
// Convert &sup into superscript ² symbol
Line 14 ⟶ 19:
// Convert various micro symbols into the actual micro symbol, make sure it's spaced
txt.value = txt.value.replace(/(\d)\s?(μ|μ|µ)(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|Ω|F|Wb|T|H|S|Bq|Gy|Sv|kat
// Convert capital K to lowercase k in units
txt.value = txt.value.replace(/(\d)\s?K(g|s|m|A|K|mol|cd|rad|sr|Hz|N|J|W|Pa|lm|lx|C|V|Ω|F|Wb|T|H|S|Bq|Gy|Sv|kat
//
txt.value = txt.value.replace(/
txt.value = txt.value.replace(/(\d)\
▲ txt.value = txt.value.replace(/(\d)\s?(khz)([\s,.\/\)])/gi, '$1 kHz$3');
▲ txt.value = txt.value.replace(/(\d)\s?(mhz)([\s,.\/\)])/gi, '$1 MHz$3');
▲ txt.value = txt.value.replace(/(\d)\s?(ghz)([\s,.\/\)])/gi, '$1 GHz$3');
▲ txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?(hz|HZ)([\s,.;:\)\(\\/)])/g, '$1 $2Hz$4');
// Fix kilometres
Line 41:
txt.value = txt.value.replace(/(\d)\s?km\/h/gi, '$1 km/h');
txt.value = txt.value.replace(/(\d)\-km\/h/gi, '$1 km/h');
// Space before horsepower symbol
Line 47 ⟶ 46:
txt.value = txt.value.replace(/(\d)\s?bhp/gi, '$1 bhp');
txt.value = txt.value.replace(/(\d)\s?shp/gi, '$1 shp');
// Space before other units
txt.value = txt.value.replace(/(\d)\s?cc/gi, '$1 cc');
txt.value = txt.value.replace(/(\d)\-cc/gi, '$1 cc');
txt.value = txt.value.replace(/(\d)\s?mm/gi, '$1 mm');
txt.value = txt.value.replace(/(\d)\-mm/gi, '$1 mm');
txt.value = txt.value.replace(/(\d)\s?ml/gi, '$1 ml');
txt.value = txt.value.replace(/(\d)\-ml/gi, '$1 ml');
// Standardise miles per hour and rpm
Line 59 ⟶ 60:
txt.value = txt.value.replace(/(\d)\s?mph/gi, '$1 mph');
txt.value = txt.value.replace(/(\d)\-mph/gi, '$1 mph');
txt.value = txt.value.replace(/rpm/gi, 'rpm');
Line 91:
//txt.value = txt.value.replace(/(eight[:= ]{1,2})\s?(\d)-(\d{1,2})([\s,.\/\)])/gi, '$1 $2 ft $3 in');
// Space before
txt.value = txt.value.replace(/(\d)\s?ft/gi, '$1 ft');
Line 101:
txt.value = txt.value.replace(/(\d)\s?(dB|B)\b/g, '$1 $2');
// Add a space before
txt.value = txt.value.replace(/(\d)\s?(
▲ txt.value = txt.value.replace(/(\d)\s?(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|n|p|f|a|z|y)(s)([\s,.;:\)\(\\/)])/g, '$1 $2$3$4');
// bps or b/s or bits/s --> bit/s
|