Jump to content

User:Thespaceface/MetricFirstAmericanSpelling.js

From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Wikipedia:Bypass your cache.
for(var i = 0;i < 100; i++){
var b = document.getElementById("collapseButton" + i);
if(b === null || b === undefined){
break;
}
b.click();
}
var txt = document.getElementById('mw-content-text' );
var h = txt.innerHTML.replace(/([0-9.,]+) miles \(([0-9.,]+)&nbsp;km\)/g,'$2 kilometers ($1 mi)');
h = h.replace(/([0-9.,]+)&nbsp;miles&nbsp;\(([0-9.,]+)&nbsp;km\)/g,'$2 kilometers ($1 mi)');
h = h.replace(/([0-9.,]+)&nbsp;miles&nbsp;\(([0-9.,]+) km\)/g,'$2 kilometers ($1 mi)');
h = h.replace(/([0-9.,]+–[0-9.,]+) miles \(([0-9.,]+–[0-9.,]+)&nbsp;km\)/g,'$2 kilometers ($1 mi)');
h = h.replace(/([0-9.,]+–[0-9.,]+) feet \(([0-9.,]+–[0-9.,]+)&nbsp;m\)/g,'$2 meters ($1 ft)');
h = h.replace(/([0-9.,]+–[0-9.,]+) inches \(([0-9.,]+–[0-9.,]+)&nbsp;mm\)/g,'$2 millimeters ($1 in)');
h = h.replace(/([0-9.,]+)-mile \(([0-9.,]+)&nbsp;km\)/g,'$2-kilometer ($1 mi)');
h = h.replace(/([0-9,.]+&nbsp;)(<sup.*<\/sup>)&nbsp;miles&nbsp;\(([0-9.,]+)&nbsp;km\)/g,'$3$2 kilometers ($1 mi)');
h = h.replace(/([0-9,.]+&nbsp;)(<sup.*<\/sup>)&nbsp;miles&nbsp;\(([0-9.,]+) km\)/g,'$3$2 kilometers ($1 mi)');
h = h.replace(/([0-9.,]+)-mile \(([0-9.,]+)-km\)/g,'$2-kilometer ($1-mi)');
h = h.replace(/([0-9.,]+)-foot \(([0-9.,]+)&nbsp;m\)/g,'$2-meter ($1 ft)');
h = h.replace(/([0-9,.]+)-mile-long \(([0-9,.]+)&nbsp;km\)/g,'$2-kilometer-long ($1 mi)');
h = h.replace(/([0-9,.]+ acres) \(([0-9,.]+&nbsp;ha)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+) pounds \(([0-9,.]+)&nbsp;kg\)/g,'$2 kilograms ($1 lb)');
h = h.replace(/([0-9,.]+ acres) \(([0-9,.]+&nbsp;km<sup>2<\/sup>)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;acres) \(([0-9,.]+&nbsp;km<sup>2<\/sup>)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;acres) \(([0-9,.]+&nbsp;ha)\)/g,'$2 ($1)');
h = h.replace(/(−?[0-9,.]+) feet \((−?[0-9.,]+)&nbsp;m\)/g,'$2 meters ($1 ft)');
h = h.replace(/(−?[0-9,.]+) feet \((−?[0-9.,]+) m\)/g,'$2 meters ($1 ft)');
h = h.replace(/(−?[0-9,.]+ ft) \((−?[0-9,.]+&nbsp;m)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+) yards \(([0-9.,]+)&nbsp;m\)/g,'$2 meters ($1 yd)');
h = h.replace(/([0-9,.]+) yd \(([0-9.,]+)&nbsp;m\)/g,'$2 m ($1 yd)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft) \((−?[0-9,.]+ m)\)/g,'$2 ($1)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft) \((−?[0-9,.]+&nbsp;m)\)/g,'$2 ($1)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft)&nbsp; \((−?[0-9,.]+ m)\)/g,'$2 ($1)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft)&nbsp; \((−?[0-9,.]+&nbsp;m)\)/g,'$2 ($1)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft)&nbsp;\((−?[0-9,.]+ m)\)/g,'$2 ($1)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft)&nbsp;\((−?[0-9,.]+&nbsp;m)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+)-square-foot \((−?[0-9,.]+)&nbsp;m<sup>2<\/sup>\)/g,'$2-square-meter ($1 ft<sup>2</sup>)');
h = h.replace(/([0-9,.]+ sq ft) \(([0-9,.]+&nbsp;m<sup>2<\/sup>)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;sq&nbsp;ft) \(([0-9,.]+&nbsp;m<sup>2<\/sup>)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+) per square mile \(([0-9,.]+)\/km<sup>2<\/sup>\)/g,'$2 per square kilometer ($1/sq mi)');
h = h.replace(/([0-9,.]+) per square&nbsp;mile \(([0-9,.]+)\/km²\)/g,'$2 per square kilometer ($1/sq mi)');
h = h.replace(/([0-9,.]+) per square mile \(([0-9,.]+)\/km²\)/g,'$2 per square kilometer ($1/sq mi)');
h = h.replace(/([0-9,.]+) people per square mile \(([0-9,.]+)\/km²\)/g,'$2 people per square kilometer ($1/sq mi)');
h = h.replace(/([0-9,.]+) people per square mile \(([0-9,.]+)\/km<sup>2<\/sup>\)/g,'$2 people per square kilometer ($1/sq mi)');
h = h.replace(/([0-9,.]+) inhabitants per square mile \(([0-9,.]+)\/km<sup>2<\/sup>\)/g,'$2 inhabitants per square kilometer ($1/sq mi)');
h = h.replace(/([0-9,.−-]+ °F) \(([0-9,.−-]+&nbsp;°C)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.−-]+&nbsp;°F) \(([0-9,.−-]+&nbsp;°C)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.−-]+ F) \(([0-9,.−-]+ C)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.−-]+&nbsp;F) \(([0-9,.−-]+&nbsp;C)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+ mi) \(([0-9,.]+&nbsp;km)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;sq&nbsp;mi) \(([0-9,.]+&nbsp;km<sup>2<\/sup>)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+) square miles \(([0-9,.]+)&nbsp;km<sup>2<\/sup>\)/g,'$2 square kilometers ($1 sq mi)');
h = h.replace(/([0-9,.]+)&nbsp;square&nbsp;miles \(([0-9,.]+)&nbsp;km<sup>2<\/sup>\)/g,'$2 square kilometers ($1 sq mi)');
h = h.replace(/([0-9,.]+&nbsp;sq&nbsp;mi) \(([0-9,.]+&nbsp;km²)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;mi) \(([0-9,.]+&nbsp;km)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;in) \(([0-9,.]+&nbsp;cm)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+)&nbsp;inches \(([0-9,.]+)&nbsp;cm\)/g,'$2 centimeters ($1 in)');
h = h.replace(/([0-9,.]+ in) \(([0-9,.]+&nbsp;cm)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+) inches \(([0-9,.]+)&nbsp;cm\)/g,'$2 centimeters ($1 in)');
h = h.replace(/([0-9,.]+&nbsp;in) \(([0-9,.]+&nbsp;mm)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+)&nbsp;inches \(([0-9,.]+)&nbsp;mm\)/g,'$2 millimeters ($1 in)');
h = h.replace(/([0-9,.]+ in) \(([0-9,.]+&nbsp;mm)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+) inches \(([0-9,.]+)&nbsp;mm\)/g,'$2 millimeters ($1 in)');
h = h.replace(/(−?[0-9,.]+&nbsp;ft) \((−?[0-9,.]+&nbsp;m)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+\/sq&nbsp;mi) \(([0-9,.]+\/km<sup>2<\/sup>)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+\/sq&nbsp;mi) \(([0-9,.]+\/km²)\)/g,'$2 ($1)');
h = h.replace(/([0-9,.]+&nbsp;mi)(<sup.*<\/sup>) \(([0-9.,]+&nbsp;km)\)/g,'$3$2 ($1)');
h = h.replace(/([0-9,.]+)-foot-wide \(([0-9.,]+)&nbsp;m\)/g,'$2-meter-wide ($1 ft)');
h = h.replace(/([0-9,.]+) miles per hour \(([0-9.,]+)&nbsp;km\/h\)/g,'$2 kilometers per hour ($1 mph)');
h = h.replace(/([0-9,.]+) miles per hour \(([0-9.,]+)&nbsp;kilometers per hour\)/g,'$2 kilometers per hour ($1 miles per hour)');
h = h.replace(/([0-9,.]+) mph \(([0-9.,]+)&nbsp;km\/h\)/g,'$2 km/h ($1 mph)');
h = h.replace(/([0-9,.]+)&nbsp;mph \(([0-9.,]+)&nbsp;km\/h\)/g,'$2 km/h ($1 mph)');
h = h.replace(/([0-9,.]+) mph \(([0-9.,]+) km\/h\)/g,'$2 km/h ($1 mph)');
h = h.replace(/a quarter mile \(400&nbsp;m\)/g,'400 meters (0.25 mi)');
h = h.replace(/quarter mile \(400&nbsp;m\)/g,'400 meters (0.25 mi)');
txt.innerHTML = h;