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 34:
 
// Standardise kilometres per hour
txt.value = txt.value.replace(/(\d)\s?(km\/hr)/gi, '$1 km/h');
txt.value = txt.value.replace(/(\d)\s?(kph)/gi, '$1 km/h');
txt.value = txt.value.replace(/(\d)\s?(kmph)/gi, '$1 km/h');
txt.value = txt.value.replace(/(\d)\s?(kmh)/gi, '$1 km/h');
txt.value = txt.value.replace(/(\d)\s?(km\/h)/gi, '$1 km/h');
 
// Space before horsepower symbol
txt.value = txt.value.replace(/(\d)\s?(hp)/gi, '$1 hp');
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
Line 51:
 
// Standardise miles per hour and rpm
txt.value = txt.value.replace(/(\d)\s?(m.p.h.)/gi, '$1 mph');
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(/(\d)\s?(rpm)/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d) (rpm)/gi, '$1 rpm');
 
// Standardise symbol for pounds
Line 65 ⟶ 63:
 
// Standardise symbol for foot pounds
txt.value = txt.value.replace(/(\d)\s?(ft[ -.•\/]lb[fs])/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d)\s?(lb[fs][ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d)\s?(lb[ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d)\s?(ft[ -.•\/]lb)/gi, '$1 ft·lbf');
 
txt.value = txt.value.replace(/(\d) (lb[fs][ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (ft[ -.•\/]lb[fs])/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (lb[ -.•\/]ft)/gi, '$1 ft·lbf');
txt.value = txt.value.replace(/(\d) (ft[ -.•\/]lb)/gi, '$1 ft·lbf');
 
// Symbols for feet and inches