User:Bobblewik/monobook.js/units nbsp.js: Difference between revisions

Content deleted Content added
Bobblewik (talk | contribs)
mNo edit summary
Bobblewik (talk | contribs)
mNo edit summary
Line 68:
txt.value = txt.value.replace(/(\d)\s?bhp/gi, '$1 bhp');
txt.value = txt.value.replace(/(\d)\s?shp/gi, '$1 shp');
 
// Space before 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');
txt.value = txt.value.replace(/(\d)\s?ft([\s,.;:\)\(\\/)])/gi, '$1 ft$2');
txt.value = txt.value.replace(/(\d)\-ft([\s,.;:\)\(\\/)])/gi, '$1 ft$2');
txt.value = txt.value.replace(/(\d)\s?rpm/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d)\-rpm/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d)\s?kg([\s,.;:\)\(\\/)])/gi, '$1 kg$2');
txt.value = txt.value.replace(/(\d)\-kg([\s,.;:\)\(\\/)])/gi, '$1 kg$2');
//space before 'm' only when lower case
txt.value = txt.value.replace(/(\d)\s?m([\s,.;:\)\(\\/)])/g, '$1 m$2');
txt.value = txt.value.replace(/(\d)\-m([\s,.;:\)\(\\/)])/g, '$1 m$2');
//txt.value = txt.value.replace(/(\d)\s?ml([\s,.;:\)\(\\/)])/g, '$1 ml$2');
//txt.value = txt.value.replace(/(\d)\-ml([\s,.;:\)\(\\/)])/g, '$1 ml$2');
txt.value = txt.value.replace(/(\d)\s?m(\W)/g, '$1 m$2');
txt.value = txt.value.replace(/(\d)\s?m(\w?\W)/g, '$1 m$2');
 
// miles per hour
Line 147 ⟶ 130:
// Ensure space is used
txt.value = txt.value.replace(/(\d)\s?(k|M|G)(bit|B)/g, '$1 $2$3');
 
// Space before 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');
txt.value = txt.value.replace(/(\d)\s?ft([\s,.;:\)\(\\/)])/gi, '$1 ft$2');
txt.value = txt.value.replace(/(\d)\-ft([\s,.;:\)\(\\/)])/gi, '$1 ft$2');
txt.value = txt.value.replace(/(\d)\s?rpm/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d)\-rpm/gi, '$1 rpm');
txt.value = txt.value.replace(/(\d)\s?kg([\s,.;:\)\(\\/)])/gi, '$1 kg$2');
txt.value = txt.value.replace(/(\d)\-kg([\s,.;:\)\(\\/)])/gi, '$1 kg$2');
//space before 'm' only when lower case
txt.value = txt.value.replace(/(\d)\s?m([\s,.;:\)\(\\/)])/g, '$1 m$2');
txt.value = txt.value.replace(/(\d)\-m([\s,.;:\)\(\\/)])/g, '$1 m$2');
//txt.value = txt.value.replace(/(\d)\s?ml([\s,.;:\)\(\\/)])/g, '$1 ml$2');
//txt.value = txt.value.replace(/(\d)\-ml([\s,.;:\)\(\\/)])/g, '$1 ml$2');
txt.value = txt.value.replace(/(\d)\s?m(\W)/g, '$1 m$2');
txt.value = txt.value.replace(/(\d)\s?m(\w?\W)/g, '$1 m$2');
 
 
 
// Common error