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 24:
 
// ohm
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?(Ω|ohm|Ohm)s?([\s,.;:\)\(\\/)]W)/g, '$1 $2Ω$4');
 
// 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|M)([\s,.;:\)\(\\/)]W)/g, '$1 µ$3$4');
 
// 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|M)([\s,.;:\)\(\\/)]W)/g, '$1 k$2$3');
txt.value = txt.value.replace(/(\d)\-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|M)([\s,.;:\)\(\\/)]W)/g, '$1 k$2$3');
txt.value = txt.value.replace(/(\d) 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|M)([\s,.;:\)\(\\/)]W)/g, '$1 k$2$3');
 
// Hertz
Line 83:
 
// newton metre
//txt.value = txt.value.replace(/(N•m\W)N[-.·•\/]m(\W)/gi, 'N$1N·m$2');
 
// kilowatt
Line 91:
// mile per hour
txt.value = txt.value.replace(/m\.p\.h\./gi, 'mph');
txt.value = txt.value.replace(/mph([\s,.;:\W)\mph(\\/)]W)/gi, 'mph$11mph$2');
txt.value = txt.value.replace(/(\d)\s?mph/gi, '$1 mph');
txt.value = txt.value.replace(/(\d)\-mph/gi, '$1 mph');