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 92:
txt.value = txt.value.replace(/(\d)\-mph/gi, '$1 mph');
 
// Standardisepounds symbol for poundsweight
txt.value = txt.value.replace(/(\d)\s?lbs?/gi, '$1 lb');
txt.value = txt.value.replace(/(\d\+?)\s?lbs?/gi, '$1 lb');
Line 98:
txt.value = txt.value.replace(/(\d)\s?(\[\[lbs\]\])/gi, '$1 \[\[Pound (mass)|lb\]\]');
 
// Standardisenewton symbol for yardsmetres
txt.value = txt.value.replace(/(\d)\s?yds(\W)/gi, '$1 yd$2');
txt.value = txt.value.replace(/(\d) yds(\W)/gi, '$1 yd$2');
 
// Standardise symbol for newton metres
//txt.value = txt.value.replace(/(N•m)/gi, 'N·m');
 
// Standardise symbol for kilowatts
txt.value = txt.value.replace(/(\d)\s?kW([\s,.;:\)\(\\/)])/g, '$1 kW$2');
txt.value = txt.value.replace(/(\d)\-kW([\s,.;:\)\(\\/)])/g, '$1 kW$2');
 
// Standardise symbol for foot pounds
txt.value = txt.value.replace(/ft[ -.·•\/]lb[fs]/gi, 'ft·lbf');
txt.value = txt.value.replace(/ft[ -.·•\/]lbf/gi, 'ft·lbf');
Line 118 ⟶ 114:
//txt.value = txt.value.replace(/lb[ -.•\/]ft/gi, 'ft·lbf');
 
// Symbols for feet and inches
txt.value = txt.value.replace(/([^;°h][^;°h]\s)(\d{1,4})\s?['’]\s?(\d{1,2})\s?["”][^NESW]/g, '$1$2 ft $3 in');
txt.value = txt.value.replace(/([\(\|]\d{1,4})\s?['’]\s?(\d{1,2})\s?["”][^NESW]/g, '$1 ft $2 in');
txt.value = txt.value.replace(/(\d)\s?ft\s(\d{1,2})\s?in/gi, '$1 ft $2 in');
//Symbols for square feet
 
//Symbols for square feet
txt.value = txt.value.replace(/sq\.?\s?ft?/gi, 'sq ft');
txt.value = txt.value.replace(/ft\.\)/gi, 'ft)');
 
// yards
txt.value = txt.value.replace(/(\d)\s?yds(\W)/gi, '$1 yd$2');
txt.value = txt.value.replace(/(\d) yds(\W)/gi, '$1 yd$2');
txt.value = txt.value.replace(/sq\.?\s?yds?/gi, 'sq yd');
txt.value = txt.value.replace(/yd\.\)/gi, 'yd)');
 
// Give digital value a percent symbol '%' instead of word