User:Bobblewik/monobook.js/unitformatter.js: Difference between revisions

Content deleted Content added
Bobblewik (talk | contribs)
mNo edit summary
Bobblewik (talk | contribs)
mNo edit summary
Line 47:
txt.value = txt.value.replace(/(\d)\s?shp/gi, '$1 shp');
 
// Space before other units
txt.value = txt.value.replace(/(\d)\s?cc([\s,.;:\)\(\\/)])/gi, '$1 cc$2');
txt.value = txt.value.replace(/(\d)\-cc([\s,.;:\)\(\\/)])/gi, '$1 cc$2');
Line 54:
txt.value = txt.value.replace(/(\d)\s?ml([\s,.;:\)\(\\/)])/gi, '$1 ml$2');
txt.value = txt.value.replace(/(\d)\-ml([\s,.;:\)\(\\/)])/gi, '$1 ml$2');
txt.value = txt.value.replace(/(\d)\s?ft([\s,.;:\)\(\\/)])/gi, '$1 ft$3');
txt.value = txt.value.replace(/(\d)\-ft([\s?rpm,.;:\)\(\\/)])/gi, '$1 rpmft$3');
txt.value = txt.value.replace(/(\d)\-s?rpm/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d)\-rpm/gi, '$1 rpm');
 
// Standardise miles per hour and rpm
txt.value = txt.value.replace(/m\.p\.h\./gi, 'mph');
txt.value = txt.value.replace(/mph/gi, 'mph');
Line 61 ⟶ 65:
txt.value = txt.value.replace(/(\d)\-mph/gi, '$1 mph');
 
txt.value = txt.value.replace(/rpm/gi, 'rpm');
txt.value = txt.value.replace(/(\d)\s?rpm/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d)\-rpm/gi, '$1 rpm');
 
// Standardise symbol for pounds
Line 86 ⟶ 87:
 
// Symbols for feet and inches
 
txt.value = txt.value.replace(/([^;°]\s?\s?)(\d{1,4})\s?(['’])\s?(\d{1,2})\s?(["”])/gi, '$1$2 ft $4 in');
 
// Space before ft symbol
txt.value = txt.value.replace(/(\d)\s?ft/gi, '$1 ft');
 
// Give digital value a percent symbol '%' instead of word