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 12:
txt.value = txt.value.replace(/°\s?(celsius)/gi, '°C');
txt.value = txt.value.replace(/(\d)\s?(°[CF])/g, '$1 $2');
txt.value = txt.value.replace(/deg\s?([CF])/g, '°$1');
 
// Celsius spelling errors
Line 19 ⟶ 20:
txt.value = txt.value.replace(/centigrade/gi, 'Celsius');
 
// Convert &sup intoto superscript ² symbol
txt.value = txt.value.replace(/²/g, '²');
txt.value = txt.value.replace(/³/g, '³');
 
// 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?(\W)/g, '$1 $2Ω$4');
 
// Convert various micro symbols into the actual micro symbol, make sure it's spaced
Line 93 ⟶ 91:
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');
 
// 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?(\W)/g, '$1 $2Ω$4');
 
// mile per hour