User:Date delinker/EngvarB.js
外观
注意:保存之后,你必须清除浏览器缓存才能看到做出的更改。Google Chrome、Firefox、Microsoft Edge及Safari:按住⇧ Shift键并单击工具栏的“刷新”按钮。参阅Help:绕过浏览器缓存以获取更多帮助。
function protectwords(){
var box=document.editform.wpTextbox1;
var txt = box.value;
//txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(?:xx)([^\.]{0,20}\.)/g, '$1$2$3');
unprotectwords();
txt=txt.replace(/(natalipr|nobelpr|musicpr)(ize)/g, '$1xXx$2');
txt=txt.replace(/(<.+?>[^<]+?)(al)(uminum)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ar)(tifact)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ana|cata|hydro|para)(lyz)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ly)(zing)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(di)(arrhea)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(de|of)(fense)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(fu)(ror)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(gr)(ay)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(je)(welry)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ma)(neuver)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(pe)(diatric)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(pe)(dophil)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(sk)(eptic)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(in)(quir(?:e|ing|y))([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(va)(por)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(on)(stage)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(break|clean|lock|pick)(up)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(he)(mo)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(or)(thopedic)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ar)(cheo)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(pa)(leonto)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(en)(ology)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(es)(ophag)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(es)(trogen)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(es)(thetic)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ho)(meopath)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(me)(dieval)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ri)(gor)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(an|leuk|septic|tox)(emi)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(su)(lfur)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(lik|liv|rat|sal|siz|shak)(able)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(clam|glam|harb|neighb|rum|savi?)(or)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(behavi|col|fl?av|hon|hum|lab)(or)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(mo)(ld)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)(er)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(cent|epicent|recent)(er)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(centi|kilo|milli|\d\s)(meter)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(centi|milli|deci|pico|hecto)(liter)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(dema|peda|mono|syna)(gog)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(ana|cata|dia|epi|homo|mono|pro)(log)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(iz)(e[drs]?|ations?|ing)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(el)(e[dr]|est|ing)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(counci|dia)(le[dr]|ling|lor)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(<.+?>[^<]+?)(app|enthr|riv|sign|tot)(ale[dr]|aling)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
//repeating to catch second instances within quotations
txt=txt.replace(/(<.+?>[^<]+?)(iz)(e[drs]?|ations?|ing)([^<]+?<\/.+?>)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(al)(uminum)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ar)(tifact)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ana|cata|hydro|para)(lyz)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ly)(zing)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(di)(arrhea)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(de|of)(fense)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(fu)(ror)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(gr)(ay)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(je)(welry)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ma)(neuver)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(pe)(diatric)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(pe)(dophil)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(sk)(eptic)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(in)(quir(?:e|ing|y))([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(on)(stage)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(break|clean|lock|pick)(up)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(he)(mo)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(or)(thopedic)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ar)(cheo)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(pa)(leonto)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(en)(ology)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(es)(ophag)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(es)(trogen)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(es)(thetic)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ho)(meopath)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(me)(dieval)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ri)(gor)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(an|leuk|septic|tox)(emi)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(su)(lfur)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(lik|liv|rat|sal|siz|shak)(able)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(clam|glam|harb|neighb|rum|savi?)(or)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(behavi|col|fl?av|hon|hum|lab)(or)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(mo)(ld)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)(er)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(cent|epicent|recent)(er)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(centi|kilo|milli|\d\s)(meter)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(centi|milli|deci|pico|hecto)(liter)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(dema|peda|mono|syna)(gog)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(ana|cata|dia|epi|homo|mono|pro)(log)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(iz)(e[drs]?|ations?|ing)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(el)(e[dr]|est|ing)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(counci|dia)(le[dr]|ling|lor)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[Category:[^\]]*?)(app|enthr|riv|sign|tot)(ale[dr]|aling)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[de:[^\]]*?)(spiel)(er)([^\]]*?\])/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(al)(uminum)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ar)(tifact)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ana|cata|hydro|para)(lyz)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ly)(zing)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(di)(arrhea)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(de|of)(fense)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(fu)(ror)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(gr)(ay)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(je)(welry)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ma)(neuver)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(pe)(diatric)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(pe)(dophil)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(sk)(eptic)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(in)(quir(?:e|ing|y))([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(va)(por)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(on)(stage)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(break|clean|lock|pick)(up)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(he)(mo)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(or)(thopedic)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ar)(cheo)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(pa)(leonto)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(en)(ology)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(es)(ophag)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(es)(trogen)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(es)(thetic)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ho)(meopath)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(me)(dieval)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ri)(gor)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(an|leuk|septic|tox)(emi)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(su)(lfur)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(lik|liv|rat|sal|siz|shak)(able)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(clam|glam|harb|neighb|rum|savi?)(or)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(behavi|col|fl?av|hon|hum|lab)(or)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(mo)(ld)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)(er)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(cent|epicent|recent)(er)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(centi|kilo|milli|\d\s)(meter)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(centi|milli|deci|pico|hecto)(liter)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(dema|peda|mono|syna)(gog)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(ana|cata|dia|epi|homo|mono|pro)(log)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(iz)(e[drs]?|ations?|ing)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(bev|jew|lev|mod|rev|trav)(el)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})([a-z]{2,8}[^egl\b])(el)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(counci|dia)(le[dr]|ling|lor)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
txt=txt.replace(/(\[(?:file|image):[^\.]{0,20})(app|enthr|riv|sign|tot)(ale[dr]|aling)([^\.]{0,20}\.)/g, '$1$2xXx$3$4');
//protection for quotations in templates
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(al)(uminum)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ar)(tifact)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ana|cata|hydro|para)(lyz)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ly)(zing)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(di)(arrhea)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(de|of)(fense)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(fu)(ror)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(gr)(ay)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(je)(welry)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ma)(neuver)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(pe)(diatric)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(pe)(dophil)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(sk)(eptic)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(in)(quir(?:e|ing|y))([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(va)(por)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(on)(stage)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(break|clean|lock|pick)(up)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(he)(mo)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(or)(thopedic)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ar)(cheo)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(pa)(leonto)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(en)(ology)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(es)(ophag)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(es)(trogen)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(es)(thetic)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ho)(meopath)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(me)(dieval)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ri)(gor)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(an|leuk|septic|tox)(emi)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(su)(lfur)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(lik|liv|rat|sal|siz|shak)(able)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(clam|glam|harb|neighb|rum|savi?)(or)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(behavi|col|fl?av|hon|hum|lab)(or)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(mo)(ld)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)(er)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(cent|epicent|recent)(er)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(centi|kilo|milli|\d\s)(meter)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(centi|milli|deci|pico|hecto)(liter)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(dema|peda|mono|syna)(gog)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(ana|cata|dia|epi|homo|mono|pro)(log)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(iz)(e[drs]?|ations?|ing)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(el)(e[dr]|est|ing)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(counci|dia)(le[dr]|ling|lor)([^}]*?})/g, '$1$2xXx$3$4');
txt=txt.replace(/({[^{]{0,6}quot[^\|]{1,7}\s?\|[^}]*?)(app|enthr|riv|sign|tot)(ale[dr]|aling)([^}]*?})/g, '$1$2xXx$3$4');
box.value = txt;
}
function Simple(){
var box=document.editform.wpTextbox1;
var txt = box.value;
//protectwords()
txt=txt.replace(/([^\w\d\-\/])aluminum/g, '$1aluminium');
txt=txt.replace(/([^\w\d\-\/])artifact/g, '$1artefact');
txt=txt.replace(/([^\w\d\-\/])(ana|cata|hydro|para)lyz(e|ing)/g, '$1$2lys$3');
txt=txt.replace(/([^\w\d\-\/])diarrhea/g, '$1diarrhoea');
txt=txt.replace(/([^\w\d\-\/])(de|of)fense/g, '$1$2fence');
txt=txt.replace(/([^\w\d\-\/])furor([^\w\d\-\/])/g, '$1furore$2');
txt=txt.replace(/([^\w\d\-\/])(light-|dark-|\s)gray/g, '$1$2grey');
// txt=txt.replace(/([^\w\d\-\/])judgment/g, '$1judgement');
txt=txt.replace(/([^\w\d\-\/])jewelry/g, '$1jewellery');
txt=txt.replace(/([^\w\d\-\/])maneuver(ab|ed|ing)/g, '$1manoeuvr$2');
txt=txt.replace(/([^\w\d\-\/])maneuver/g, '$1manoeuvre');
txt=txt.replace(/([^\w\d\-\/])ped(iatric|ophil)/g, '$1paed$2');
txt=txt.replace(/([^\w\d\-\/])skeptic/g, '$1sceptic');
txt=txt.replace(/([^\w\d\-\/])in(quir(?:e|ing))/g, '$1en$2');
txt=txt.replace(/([^\w\d\-\/])vapor(s?[^\w\d\-\/])/g, '$1vapour$2');
//composite words
// txt=txt.replace(/([^\w\d\-\/])onstage/g, '$1on-stage');
txt=txt.replace(/([^\w\d\-\/])(break|lock|pick)up/g, '$1$2-up');
//latin words
txt=txt.replace(/([^\w\d\-\/])gyneco/g, '$1gynaeco');
txt=txt.replace(/([^\w\d\-\/])hemo(globin|ly|phil)/g, '$1haemo$2');
txt=txt.replace(/([^\w\d\-\/])orthopedic/g, '$1orthopaedic');
txt=txt.replace(/([^\w\d\-\/])archeo/g, '$1archaeo');
txt=txt.replace(/([^\w\d\-\/])paleonto/g, '$1palaeonto');
txt=txt.replace(/([^\w\d\-\/])enology/g, '$1oenology');
txt=txt.replace(/([^\w\d\-\/])esophag/g, '$1oesophag');
txt=txt.replace(/([^\w\d\-\/])estrogen/g, '$1oestrogen');
txt=txt.replace(/([^\w\d\-\/])esthetic/g, '$1aesthetic');
txt=txt.replace(/([^\w\d\-\/])homeopath/g, '$1homoeopath');
// txt=txt.replace(/([^\w\d\-\/])medieval([^\w\d\-\/])/g, '$1mediaeval$2');
txt=txt.replace(/([^\w\d\-\/])rigor([^\w\d\-\/])/g, '$1rigour');
txt=txt.replace(/([^\w\d\-\/])(an|leuk|septic|tox)emi(a|c)/g, '$1$2aemi$3');
//'f' words
txt=txt.replace(/([^\w\d\-\/])sulfur/g, '$1sulphur');
// non-redundant e
txt=txt.replace(/([^\w\d\-\/])(lik|liv|rat|sal|siz|shak)(able)/g, '$1$2e$3');
//'~our' words
txt=txt.replace(/([^\w\d\-\/])(clam|glam|harb|neighb|rum|savi?)or(ed|ful|ing|less|ly|s|)([^\w\d\-\/])/g, '$1$2our$3$4');
txt=txt.replace(/([^\w\d\-\/])neighborhood/g, '$1neighbourhood');
txt=txt.replace(/([^\w\d\-\/])behavior(al|s?[^\w\d\-\/])/g, '$1behaviour$2');
txt=txt.replace(/([^\w\d\-\/])(fav|hon)or(abl[ey]|ed|ing|s|)([^\w\d\-\/])/g, '$1$2our$3$4');
txt=txt.replace(/([^\w\d\-\/])labor(e[dr]|ing|s?\W)/g, '$1labour$2');
txt=txt.replace(/([^\w\d\-\/\|])(flav|hum)or(ed|ful|fully|ings?|less|lessly|s\W)/g, '$1$2our$3');
txt=txt.replace(/([^\w\d\-\/\|])color(ed|ful|fully|ings?|less|lessly)/g, '$1colour$2');
// txt=txt.replace(/([^\w\d\-\/\|])colors([^\W\s]|[\s]*[^=])/g, '$1colours$2');
txt=txt.replace(/( [\w\D]*\-)(col|flav|hum)ored/g, '$1$2oured');
txt=txt.replace(/([^\w\d\-\/])mold(ed|ing|s?\W)/g, '$1mould$2');
//'~re~' words
txt=txt.replace(/([^\w\d\-\/=])(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)er(ed|ing)/g, '$1$2r$3');
txt=txt.replace(/([^\w\d\-\/])(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)er(s?\W)/g, '$1$2re$3');
txt=txt.replace(/([^\w\d\-\/=])(cent|epicent|recent)er(ed|ing)/g, '$1$2r$3');
txt=txt.replace(/([^\w\d\-\/=])(cent|epicent|recent)ers/g, '$1$2res');
txt=txt.replace(/([^\w\d\-\/])(centi|kilo|milli|-|\d\s)meter/g, '$1$2metre');
txt=txt.replace(/([^\w\d\-\/])(centi|milli|deci|pico|hecto|\b)liter(s?\b)/g, '$1$2litre$3');
txt=txt.replace(/([^\w\d\-\/])(dema|peda|mono|syna)gog(s?\W)/g, '$1$2gogue$3');
txt=txt.replace(/([^\w\d\\\/\-])(ana|cata|dia|epi|homo|mono|pro)log(s?[^\w\d\-\/])/g, '$1$2logue$3');
// txt=txt.replace(/([^\w\d\-\/])(\W[a-z]{3,12}[^s\b])iz(e[drs]?|ations?|ing)/g, '$1$2is$3');
// txt=txt.replace(/([^\w\d\-\/])(empha|synthe)siz(e|ing)/g, '$1$2sis$3');
//'~l' words where the 'l' doubles as past and present participle
txt=txt.replace(/([^\w\d\-\/])(bev|jew|lev|mod|rev|trav)el(e[dr]|ing)/g, '$1$2ell$3');
txt=txt.replace(/([^\w\d\-\/])([a-z]{2,8}[^egl ])el(e[dr]|est|ing)([^\w\d\-\/])/g, '$1$2ell$3$4');
txt=txt.replace(/([^\w\d\-\/])(counci|dia)l(e[dr]|ing|ors?)([^\w\d\-\/])/gi, '$1$2ll$3$4');
txt=txt.replace(/([^\w\d\-\/])(app|enthr|riv|sign|tot)al(e[dr]|ing)/g, '$1$2all$3');
txt=txt.replace(/(\s[\w]*)ll(ful|ment)/g, '$1l$2');
//reconvert special cases
txt=txt.replace(/(nobelpr|pics)ise/g, '$1ize');
// unprotectwords()
box.value = txt;
}
function OxEnglish() {
unprotectwords();
protectwords();
Simple();
re_zwords();
unprotectwords();
insert_EngvarOx()
edit_summary();
}
function BritishEnglish() {
unprotectwords();
protectwords();
Simple();
zwords();
unprotectwords();
insert_EngvarB()
edit_summary();
}
function Simpleplus() {
unprotectwords();
Simple();
zwords();
unprotectwords();
insert_EngvarB()
edit_summary();
}
function zwords(){
var box=document.editform.wpTextbox1;
var txt = box.value;
txt=txt.replace(/([^\w\d\-][a-z]{3,12}[^s ])iz(e[drs]?|ation|ing)(\W)/g, '$1is$2$3');
txt=txt.replace(/([^\w\d\-][\w]{3,12}[^s ])iz(e[drs]?|ations|ing)(\W)/gi, '$1is$2$3'); //also capitalised
txt=txt.replace(/(empha|synthe)siz(e|ing)/g, '$1sis$2');
box.value = txt;
}
function re_zwords(){
//converts s-words into Oxford z-words
var txt=document.editform.wpTextbox1;
var txt = box.value;
txt=txt.replace(/([^\w\d\-][a-z]{5,12})is(ations?)(\W)/g, '$1iz$2$3');
txt=txt.replace(/([^\w\d\-][a-z]{0,12}(?:[aeiou][^aeiou]|al))is(e[drs]?|ing)(\W)/g, '$1iz$2$3')
txt=txt.replace(/(empha|synthe)sis(e|ing)/g, '$1siz$2');
box.value = txt;
}
function unprotectwords(){
var box=document.editform.wpTextbox1;
var txt = box.value;
txt=txt.replace(/(\w)xXx(\w)/g, '$1$2');
box.value = txt;
}
function insert_EngvarB(){
var box=document.editform.wpTextbox1;
var txt = box.value;
// Add a template to the article identifying English variant
txt=txt.replace(/{{(EngvarOx)}}/gi, '{{EngvarB}}');
if (txt.search(/{{EngvarB}}/gi) == -1)
{
box.value='{{EngvarB}}\r\n'+txt;
}
}
function insert_EngvarOx(){
var box=document.editform.wpTextbox1;
var txt = box.value;
// Add a template to the article identifying English variant
if (txt.search(/{{EngvarOx}}/gi) == -1)
{
box.value='{{EngvarOx}}\r\n'+txt;
}
}
function edit_summary(){
// Add a tag to the summary box
var form=document.editform.wpSummary;
var txt = form.value;
var summary = "rendering [[WP:ENGVAR|consistent British spelling]] by [[User:Ohconfucius/EngvarB|script]]";
if (txt.indexOf(summary) == -1) {
if (txt.match(/[^\*\/\s][^\/\s]?\s*$/)) {
txt += " | ";
}
txt += summary;
}
// document.forms.editform.wpMinoredit.checked = true;
form.value=txt;
// document.editform.wpDiff.click();
}
addOnloadHook(function () {
if(document.forms.editform) {
addPortletLink('p-tb', 'javascript:BritishEnglish()', 'BRITISH English', 'British spelling ', 'converts to Brit English', '', '');
addPortletLink('p-tb', 'javascript:OxEnglish()', 'OXFORD English', 'OED spelling ', 'converts to Oxford English', '', '');
addPortletLink('p-tb', 'javascript:protectwords()', 'Protect Words', 't-mdy', 'month day', '', '');
// addPortletLink('p-tb', 'javascript:Simpleplus()', 'Speedy convert to British', 'British spelling ', 'converts everything to Brit English', '', '');
}
});