User:Lightmouse/monobook.js/script.js: Difference between revisions

Content deleted Content added
No edit summary
No edit summary
Line 238:
//square metre
txt.value=txt.value.replace(/(\d)(?:\s|-| |)sq(?:\s|\.\s|-| )m([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 m²$2');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:sqmm2|sqft)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
 
// millimetre
Line 259:
txt.value=txt.value.replace(/(\d)(\s|-| )\[\[km²\]\]/gi, '$1$2km²');
txt.value=txt.value.replace(/(\d)\s?sq\.?(?:\s|-| |)kms?(\s|\.)/gi, '$1 km²$2');
txt.value=txt.value.replace(/({convert\|\d{1,16})00\|ha/g, '$1|sqkmkm2');
txt.value=txt.value.replace(/({convert\|\d{1,16})(\d)0\|ha/g, '$1.$2|sqkmkm2');
txt.value=txt.value.replace(/({convert\|\d{1,16})(\d\d)\|ha/g, '$1.$2|sqkmkm2');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|sqmi\|)ha/g, '$1sqkm1km2');
txt.value=txt.value.replace(/({convert\|\d{1,16}\|(?:sqkmkm2|sqmi)[^\}]{0,16})\|lk=(?:on|in|out)/g, '$1');
txt.value=txt.value.replace(/({convert\|\d{3,16}\|acre\|)ha/g, '$1sqkm1km2');
 
//kilometre per second
Line 318:
txt.value=txt.value.replace(/(\d)(\s|-)square(\s|-)ft/gi, '$1 sq ft');
txt.value=txt.value.replace(/(\d) square ft/gi, '$1 sq ft');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(\d[\d,\.]{0,16})(?:\s|-| |)sq(?:\s|-| |)ft([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|sqft|sqmm2|abbr=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(\d[\d,\.]{0,16})(?:\s|-| |)square(?:\s|-| |)feet([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|sqft|sqmm2}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(\d[\d,\.]{0,16})(?:\s|-| |)square(?:\s|-| |)foot([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|sqft|sqmm2|sing=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)thousand(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000|sqft|sqmm2|abbr=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)thousand(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000|sqft|sqmm2}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)thousand(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000|sqft|sqmm2|sing=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000000|sqft|sqmm2|abbr=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000000|sqft|sqmm2}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000000|sqft|sqmm2|sing=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$300000|sqft|sqmm2|abbr=on}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$300000|sqft|sqmm2}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$300000|sqft|sqmm2|sing=on}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)ft([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$30000|sqft|sqmm2|abbr=on}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)feet([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$30000|sqft|sqmm2}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:sq|square)\.?(?:\s|-| |)foot([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$30000|sqft|sqmm2|sing=on}}$4');
 
//feet per second
Line 481:
txt.value=txt.value.replace(/(sq)(?:\s|-| |)(mile)/gi, '$1uare $2');
// square mile:plural
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(\d[\d,\.]{0,16})(?:\s|-| |)square(?:\s|-| |)miles([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|sqmi|sqkmkm2}}$3');
// square mile:singular
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(\d[\d,\.]{0,16})(?:\s|-| |)square(?:\s|-| |)mile([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|sqmi|sqkmkm2|sing=on}}$3');
// square mile:abbreviated
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)(\d[\d,\.]{0,16})(?:\s|-| |)sq(?:\s|-| |)mi([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2|sqmi|sqkmkm2|abbr=on}}$3');
 
//acre foot:plural
Line 500:
txt.value=txt.value.replace(/(\d)-(acre)/gi, '$1 $2');
txt.value=txt.value.replace(/(\d)(?:\s|-| |)surface(?:\s|-| |)acre/gi, '$1 acre');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)thousand(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000|acre|sqkmkm2}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)thousand(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000|acre|sqkmkm2|sing=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)million(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000000|acre|sqkmkm2}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})(?:\s|-| |)million(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2000000|acre|sqkmkm2|sing=on}}$3');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$300000|acre|sqkmkm2}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d)(?:\s|-| |)million(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$300000|acre|sqkmkm2|sing=on}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$30000|acre|sqkmkm2}}$4');
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{1,16})\.(\d\d)(?:\s|-| |)million(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1{{convert|$2$30000|acre|sqkmkm2|sing=on}}$4');
txt.value=txt.value.replace(/([^y]\sone(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 (4,000 km²)$2');
txt.value=txt.value.replace(/(\sa(?:\s|-| |)million(?:\s|-| |)acres?)([:;,\.?!]?\s[^\d\(\)\/\\])/gi, '$1 (4,000 km²)$2');
Line 521:
 
//acre:plural
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-| |)(?:acres|\[\[acres\]\]|\[\[acre\]\]s)([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1{{convert|$2|acre|sqkmkm2}}$3');
//acre:singular
txt.value=txt.value.replace(/([^\d\(\)\/\\]\s)([\d,]{3,16}[\d,\.]{0,16})(?:\s|-| |)(?:acre|\[\[acre\]\])([:;,\.?!]?\s[^\d\(\)\/\\])/g, '$1{{convert|$2|acre|sqkmkm2|sing=on}}$3');
 
//undo protection for acre feet