User:Ohconfucius/script/EngvarB.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:Ohconfucius/script/EngvarB. |
function BritEnglish(){
var txt=document.editform.wpTextbox1;
txt.value=txt.value.replace(/aluminum/g, 'aluminium');
txt.value=txt.value.replace(/artifact/g, 'artefact');
txt.value=txt.value.replace(/(ana|cata|hydro|para)lyz(e|ing)/g, '$1lys$2');
txt.value=txt.value.replace(/diarrhea/g, 'diarrhoea');
txt.value=txt.value.replace(/(de|of)fense/g, '$1fence');
txt.value=txt.value.replace(/\bfuror\b/g, 'furore');
txt.value=txt.value.replace(/([\s-])gray/g, '$1grey');
//txt.value=txt.value.replace(/judgment/g, 'judgement');
txt.value=txt.value.replace(/jewelry/g, 'jewellery');
txt.value=txt.value.replace(/maneuver(ab|ed|ing)/g, 'manoeuvr$1');
txt.value=txt.value.replace(/maneuver/g, 'manoeuvre');
txt.value=txt.value.replace(/ped(iatric|ophil)/g, 'paed$1');
txt.value=txt.value.replace(/skeptic/g, 'sceptic');
txt.value=txt.value.replace(/vapor(s?\W)/g, 'vapour$1');
//composite words
//txt.value=txt.value.replace(/onstage/g, 'on-stage');
txt.value=txt.value.replace(/(break|clean|lock|pick)up/g, '$1-up');
//latin words
txt.value=txt.value.replace(/gyneco/g, 'gynaeco');
txt.value=txt.value.replace(/hemo(globin|ly|phil)/g, 'haemo$1');
txt.value=txt.value.replace(/orthopedic/g, 'orthopaedic');
txt.value=txt.value.replace(/archeo/g, 'archaeo');
txt.value=txt.value.replace(/paleonto/g, 'palaeonto');
txt.value=txt.value.replace(/\benology/g, 'oenology');
txt.value=txt.value.replace(/\bestrogen/g, 'oestrogen');
txt.value=txt.value.replace(/\besthetic/g, 'aesthetic');
txt.value=txt.value.replace(/homeopath/g, 'homoeopath');
//txt.value=txt.value.replace(/medieval/g, 'mediaeval');
txt.value=txt.value.replace(/\brigor\b/g, 'rigour');
txt.value=txt.value.replace(/(an|leuk|septic|tox)emi(a|c)/g, '$1aemi$2');
//'f' words
txt.value=txt.value.replace(/sulfur/g, 'sulphur');
// non-redundant e
txt.value=txt.value.replace(/(lik|liv|rat|sal|siz|shak)(able)/g, '$1e$2');
txt.value=txt.value.replace(/(clam|harb|neighb|rum|savi?)or(ed|ful|ing|less|ly|s?\W)/g, '$1our$2');
txt.value=txt.value.replace(/neighborhood/g, 'neighbourhood');
txt.value=txt.value.replace(/behavior(al|s?\W)/g, 'behaviour$1');
txt.value=txt.value.replace(/(fav|hon)or(abl[ey]|ed|ing|s?\W)/g, '$1our$2');
txt.value=txt.value.replace(/(\W)labor(ed|ing|s?\W)/g, '$1labour$2');
txt.value=txt.value.replace(/(col|flav|hum)or(ed|ful|fully|ing|less|lessly|s\W)/g, '$1our$2');
txt.value=txt.value.replace(/\b(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)er(s?\b)/g, '$1re$2');
txt.value=txt.value.replace(/(cent|epicent|recent)er(ed|ing)/g, '$1r$2');
txt.value=txt.value.replace(/(centi|kilo|milli|-|\d\s)meter/g, '$1metre');
txt.value=txt.value.replace(/(centi|milli|deci|pico|hecto|\b)liter(s?\b)/g, '$1litre$2');
txt.value=txt.value.replace(/(dema|peda|mono|syna)gog(s?\W)/g, '$1gogue$2');
txt.value=txt.value.replace(/([^\\|\/|\-])(ana|cata|dia|epi|homo|mono|pro)log\b/g, '$1$2logue');
txt.value=txt.value.replace(/(\W[a-z]{3,12}[^s])iz(e[drs]?|ations?|ing)(\W)/g, '$1is$2$3');
txt.value=txt.value.replace(/(empha|synthe)siz(e[dr]|ing)/g, '$1sis$2');
txt.value=txt.value.replace(/(bev|jew|lev|mod|rev|trav)el(e[dr]|ing)/g, '$1ell$2');
txt.value=txt.value.replace(/(\b[a-z]{2,8}[^e])el(e[dr]|est|ing)\b/g, '$1ell$2');
txt.value=txt.value.replace(/(counci|counse|dia)l(e[dr]|ing|or)\b/gi, '$1ll$2');
txt.value=txt.value.replace(/(app|enthr|riv|sign|tot)al(e[dr]|ing)/g, '$1all$2');
txt.value=txt.value.replace(/ll(ful|ment)/g, 'l$1');
//reconvert special cases
txt.value=txt.value.replace(/(nobelpr|pics)ise/g, '$1ize');
// Add a tag to the summary box
var txt=document.editform.wpSummary;
var summary = "per [[WP:ENGVAR|British English]]";
if (txt.value.indexOf(summary) == -1) {
if (txt.value.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt.value += " | ";
}
txt.value += summary;
}
// document.forms.editform.wpMinoredit.checked = true;
document.editform.wpDiff.click();
}
addOnloadHook(function () {
if(document.forms.editform) {
// addPortletLink('p-tb', 'javascript:CommonTerms()', 'Delink common terms', 't-dmy', 'Regexp common terms', '', '');
// addPortletLink('p-tb', 'javascript:run_formatgeneral()', 'Add metric units', 'ca-unitfixer', 'Fixes some unit formatting', '', '');
// addPortletLink('p-tb', 'javascript:button_delink_dates_to_dmy()', 'Delink dates to dmy', 't-dmy', 'day month', '', '');
// addPortletLink('p-tb', 'javascript:button_delink_dates_to_mdy()', 'Delink dates to mdy', 't-mdy', 'month day', '', '');
addPortletLink('p-tb', 'javascript:BritEnglish()', 'British English', 't-dmy', 'converts to Brit English', '', '');
}
});