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 33:
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)(\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)(\W)/g, '$1 k$2$3');
 
// Hertz
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)?hz/gi, '$1 $2Hz');
txt.value = txt.value.replace(/(\d)\-(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?hz/gi, '$1 $2Hz');
 
//metre: space before 'm' only when lower case
txt.value = txt.value.replace(/(\d)\s?m(\W)/g, '$1 m$2');
txt.value = txt.value.replace(/(\d)\-m(\W)/g, '$1 m$2');
 
// millimetre
//txt.value = txt.value.replace(/(\d)\s?mm(\W)/g, '$1 mm$2');
//txt.value = txt.value.replace(/(\d)\-mm(\W)/g, '$1 mm$2');
 
// kilometre
Line 88:
txt.value = txt.value.replace(/(\d)\s?kW(\W)/g, '$1 kW$2');
txt.value = txt.value.replace(/(\d)\-kW(\W)/g, '$1 kW$2');
 
// Hertz
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)?hz/gi, '$1 $2Hz');
txt.value = txt.value.replace(/(\d)\-(Y|Z|E|P|T|G|M|k|K|h|da|d|c|m|µ|μ|µ|n|p|f|a|z|y)?hz/gi, '$1 $2Hz');
 
// mile per hour