Misplaced Pages

User:फ़िलप्रो/script/EN-IN.js

Article snapshot taken from[REDACTED] with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:फ़िलप्रो
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:फ़िलप्रो/script/EN-IN.
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 Misplaced Pages:Bypass your cache.
// This script converts spellings into Indian English spellings.
// PLEASE READ THE DOCUMENTATION at ] (click on the link above) before using.
// This javascript tool predominately based off of User:Ohconfucius's work and is modified to include Indian English.
// Feedback and constructive criticism are welcome. 
// As I am a scripting newbie, any technical advice on the 'hows and the wherefores' are especially welcome.

/*************
*** Regex menu framework
*** by ] <http://meta.wikimedia.org/User:Pathoschild/Scripts/Regex_menu_framework>
***	- adds a sidebar menu of user-defined scripts.
*************/
mw.loader.load('//meta.wikimedia.org/search/?title=User:Pathoschild/Scripts/Regex_menu_framework.js&action=raw&ctype=text/javascript');
 
/* menu links */
// In the function below, add more lines like "regexTool('link text','function_name()')" to add
// links to the sidebar menu. The function name is the function defined in rfmscripts() below.
function rmflinks() {
	regexTool('Custom regex','custom()'); // a default tool which performs regex input in a dynamic form
	regexTool('Edit my regexes ↗','function opennew(url) { window.open(url); }; opennew(mw.config.get("wgServer") + mw.config.get("wgScript") + "?title=User:" + mw.config.get("wgUserName") + "/IE.js&action=edit");');
 
	regexTool('• Protect words','ohc_protect_ENGVAR()');
	regexTool('• Flip IMP','Ohc_flip_IMP()');
	regexTool('• Flip SI','Ohc_flip_SI()');
	regexTool('• Indian','SetEnglish("I")');
	regexTool('• Universal British','SetEnglish("A")');
	regexTool('• BRITISH (Oxford)','SetEnglish("Ox")');
	regexTool('• CANADIAN','SetEnglish("C")');
 
	//Fix formatting of links in the sidebar
	var r = document.getElementById('p-regex');
	if (r){
		r.className += ' portal';
		var d = r.getElementsByTagName('div');
		if (d) d.className += ' pBody body';
	}
}
 
/* scripts */
// Below, define the functions linked to from rmflinks() above. These functions can use any JavaScript,
// but there is a set of simplified tools documented at
// http://meta.wikimedia.org/User:Pathoschild/Script:Regex_menu_framework .
 
/** ------------------------------------------------------------------------ **/
/// PROTECTION BY STRING SUBSTITUTION
 
var linkmap=;
function ohc_protect_ENGVAR()
{
    // protects categories, templates, link pipings, quotes, etc
    // the sensitive part is stored and replaced with a unique identifier,
    // which is later replaced with the stored part.
 
    var protect_function = function(s, begin, replace, end) {
        linkmap.push(replace);
        return begin + "⍌"+(linkmap.length-1)+"⍍" + end;
    };
 
//    regex(/(pre)(string)(post)/gi, protect_function); //template
    regex(/(<blockquote>)(.*?)(<\/blockquote>)/gi, protect_function);
    regex(/({\| class= ?\"wikitable ?\")(*?)(\|})/gi, protect_function);
    regex(/(<table*?>)(*)(<\/table>)/gi, protect_function);
    regex(/(<timeline*?>)(*)(<\/timeline>)/gi, protect_function);
    regex(/(\|\s*style\s*=*)(color|center)(*\|)/gi, protect_function);
    regex(/(<\/?*)(center)(*>)/gi, protect_function);
 
    regex(/(<ref*?>)(*)(<\/ref>)/gi, protect_function);
    regex(/(<ref name=)(*)(\/>)/gi, protect_function);
    regex(/(\{{0,12}(?:quot{1,7}\s?|sic|(?:not a |)typo|as written)\|)(+)(\})/gi, protect_function);
    regex(/()(*)()/gi, protect_function); //double quotes
 
    regex(/((?:Category|Image):)(]*)(])/gi, protect_function); //cats, images
    regex(/((?:image\d?|image_skyline|imagelocation\d?|image(?:map|name)|img|pic)\s*=)(*)()/gi, protect_function); //images within templates infoboxes etc
    regex(/(.)(cite encyclopedia\s*\|)(.)/gi, protect_function);
    regex(/(\|)(\s*colors(?:_label|)\s*)(=)/gi, protect_function);
    regex(/(\|)(\s*analog\s*)(=)/gi, protect_function);
    regex(/((?:url)\s*=)(*)()/gi, protect_function); //urls within templates infoboxes etc
    regex(/(\]*)(\])/gi, protect_function);
    regex(/(\]*)(])/gi, protect_function);
    regex(/(\]*)(\|)/gi, protect_function); //pipings
    regex(/(.)(Back in the U.S.S.R.)(.)/gi, protect_function); //title of work
    regex(/(.)(Born in the U.S.A.)(.)/gi, protect_function); //title of work
    regex(/(\{(?:See ?also|Main))(\|*)(\})/gi, protect_function); //see also and main templates
    regex(/(\{\{(?:external|wide )image\s?\|)(+)(\})/gi, protect_function);
    regex(/(\{\{(?:harvnb|wikisource)\|)(+)(\})/gi, protect_function);
    regex(/(\{\{)((?:NYT|WSJ)topic\|*)(\}\})/gi, protect_function);
    regex(/(\{\{\w*)(]*)(\}\})/gi, protect_function); //templates
    regex(/(\{Infobox )((?:*)organization)(\s+)/gi, protect_function);
    regex(/(\|\s*)(cleanup|color|coordinates\w*)(*=)/gi, protect_function);  //parameters within infoboxes
    regex(/(\|(?:*))(cleanup|encyclopa?edia|enroll?ment|honors|lockup\w{1,4}|organiation|catalog\snumber)(\s*=)/g, protect_function);
    regex(/(\|\s*)(encyclopedia|\w*colors)(\s?=)/gi, protect_function);
    regex(/(\|\s*)(localauthority)(\s?=)/gi, protect_function);
    regex(/(\|\s*)(hip(?:armou?r|honou?rs))(*?\=)/g, protect_function);
    regex(/(\|\s*title\s?=)(]*)(\|)/gi, protect_function);
 
    regex(/(.)(solid gray)(.)/gi, protect_function);
 
    //protect from hyphenation
    regex(/(.)(\breed(?:|s)|eegan)(.)/g, protect_function);  
 
    //protect from function re_zwords
    regex(/(.)((?:enterpri|promi|surpri|treati)(?:se?|ing))(.)/gi, protect_function);
    regex(/(.)((?: ant)(?:ic|idote|imon|ipath|iq))(.)/g, protect_function);  
    regex(/(.)((?:(?:mercury|nobel)pri|imagesi|picsi)(?:ze))(.)/g, protect_function);  
 
}
 
 
function ohc_unprotect_ENGVAR()
{
 
    //removes protection put in place by function ohc_protect_fmt (all cats, templates etc.)
    regex(//g, '');
    regex(/⍌(+)⍍/g, function(x, n) {
        var res = linkmap;
        res = res.replace(/⍌(+)⍍/g, function(x, n) {
            var res = linkmap;
            res = res.replace(/⍌(+)⍍/g, function(x, n) {
                var res = linkmap;
                res = res.replace(/⍌(+)⍍/g, function(x, n) {
                    return linkmap;
                });
                return res;
            });
            return res;
        });
        return res;
    });
}
/** ------------------------------------------------------------------------ **/
 
function Ohc_plain_english(){
 
//per https://www.gov.uk/designprinciples/styleguide
//redundancies
	regex(/B\.B\.C\./g, 'BBC');
	regex(/U\.S\.A\./g, 'USA');
	regex(/U\.S\.S\.R\./g, 'USSR');
	regex(/U\.(K|S)\./g, 'U$1');
	regex(/E\.U\./g, 'EU');
	regex(/(fill )out/gi, '$1in');
//	regex(/in order (to )/g, '$1'); // disabling per discussion on my talk (archive 35)
	regex(/In order t(o )/g, 'T$1');
 
//hyphenation
	regex(/(co)(o(?:per|rdin)at(e\b|ing|ion))/g, '$1-$2');
	regex(/\b(re)(e\w\w{4,})/gi, '$1-$2');
	regex(/\b(over|under)(r\w{4,})/gi, '$1-$2');
 	regex(/\b(vice) (president|chairman|chancellor|minister)/gi, "$1-$2");
 
//capitalisation
//rem geographical regions - too many false positives
	regex(/(local )authority/g, '$1council');
 
	regex(/w(estern European Union)/g, 'W$1');
	regex(/(New )s(outh Wales)/g, '$1S$2');
 
}
 
function Ohc_ENGVARSimple(){
 
	var table = {
		'aging':	'$1ageing',
		'aluminum':	'$1aluminium',
		'adrenalin(\\b)':	'$1adrenaline$2',
		'artifact':	'$1artefact',
		'(ana|breatha|cata|hydro|para)lyz(e|ing|is)':	'$1$2lys$3',
		'bestsell':	'$1best-sell',
		'diarrhea':	'$1diarrhoea',
		'(de|of)fense':	'$1$2fence',
		'(licen|practi)c(ing|ed)':	'$1$2s$3',
		'furor(\\b)':	'$1furore$2',
		'(light-|dark-|\\b)gray':	'$1$2grey',
		'guerilla':	'$1guerilla',
		'jewelry':	'$1jewellery',
		'maneuver(ab|ed|ing)':	'$1manoeuvr$2',
		'maneuver':	'$1manoeuvre',
		'louve(red|ring)':	'$1louv$2',
		'louver':	'$1louvre',
		'ped(iatric|ophil)':	'$1paed$2',
		'encyclopedi(a|c)':	'$1encyclopaedi$2',
		'skeptic':	'$1sceptic',
		'mollusk':	'$1mollusc',
		'vapor(s?\\b)':	'$1vapour$2',
		'licorice':	'$1liquorice',
 
		//composite words
		'(break|drop|clean|line|lock|pick)(out|up)':	'$1$2-$3',
 
		//oe/ae words
		'gyneco':	'$1gynaeco',
		'hemo(globin|ly|phil|rr)':	'$1haemo$2',
		'orthopedic':	'$1orthopaedic',
		'archeo':	'$1archaeo',
		'paleonto':	'$1palaeonto',
		'enology':	'$1oenology',
		'esophag':	'$1oesophag',
		'estrogen':	'$1oestrogen',
		'(an|)esthe(sia|tic|tist)':	'$1$2aesthe$3',
		'anesthesiologist':	'$1anaesthetist',
		'homeopath':	'$1homoeopath',
//		'medieval(\\b)':	'$1mediaeval$2',
		'omelet(\\b)':	'$1omelette$2',
		'rigor(\\b)':	'$1rigour$2',
		'(an|leuk|septic|tox)emi(a|c)':	'$1$2aemi$3',
 
		//'f' words
		'sulfur':	'$1sulphur',
 
		'anymore':	'$1any more',
		'specialty':	'$1speciality',
 
		// non-redundant e
		'(lik|liv|rat|sal|siz|shak)(able)':	'$1$2e$3',
 
		//'~our' words
		'(arm|clam|glam|harb|neighb|rum|savi?)or(ed|ful|ing|less|ly|s|\\b)':	'$1$2our$3',
		'(arm|sav)or(ies|y|s|\\b)':	'$1$2our$3',
		'(cand|od)or((?:ful|less)(?:ly|)|\\b)':	'$1$2our$3',
		'neighborhood':	'$1neighbourhood',
		'behavior(al|s|\\b)':	'$1behaviour$2',
		'favor(abl|ed|i*|s|\\b)':	'$1favour$2',
		'honor(abl|ed|ing|s|\\b)':	'$1honour$2',
		'(endeav|lab)or(e|ing|s|\\W)':	'$1$2our$3',
		'mol(d|t)(ed|ing|s|\\W)':	'$1moul$2$3',
 
		//'~re~' words
		'(calib|fib|goit|lust|mit|nit|och|reconnoit|sab|saltpet|spect|theat|tit)er(s?\\W)':	'$1$2re$3',
		'(centi|kilo|micro|milli|nano|-|\\d\\s)meter':	'$1$2metre',
		'(centi|milli|deci|pico|hecto|\\b)liter(s?\\b)':	'$1$2litre$3',
		'(dema|peda|mono|syna)gog(s?\\W)':	'$1$2gogue$3',
//		'(\\W{3,12})iz(e?|ation(s|al|)|ing)':	'$1$2is$3',
 
		//'~l' words where the 'l' doubles as past and present participle
		'((?:\\w{3,9}|)(?:fu|pan))el(e|ist|ing)':	'$1$2ell$3', 
		'(bev|jew|lev|mod|rev|trav)el(e|ing)':	'$1$2ell$3', 
		'({2,8})el(e|est|ing)(\\b)':	'$1$2ell$3$4', //added 'z' to avoid changing of "embezzled"
		'(app|di|enthr|equ|initi|journ|riv|sign|tot)al(e|ing)':	'$1$2all$3'
	};
 
	for (var word in table) {
		var txt="";
		try {
			var re = new RegExp('()' + word, 'g');
			regex(re, table);
		}
		catch(err) {
			txt="There was an error on function Ohc_ENGVARSimple(), when changing '"+ word + "' => '"+ table +"'.\n\n";
			txt+="Error: " + err.message + "\n\n";
			txt+="Click OK to continue.\n\n";
			alert(txt);
		}
	}
 
	var table = {
		//'~our' words
		'()(col|flav|hum)or(ed|ful|fully|ings?|less|lessly|s\\W)':	'$1$2our$3',
		'( *\\-)(col|flav|hum)ored':	'$1$2oured',
		'()(col)or(\\W)':	'$1$2our$3',

		//'~re~' words
		'()(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)er(ed|ing)':	'$1$2r$3',
		'()(cent|epicent|recent)er(ed|ing)':	'$1$2r$3',
		'()(cent|epicent|recent)er(s?\\b)':	'$1$2re$3',
		'()(ana|cata|dia|epi|homo|mono|pro)log(ed|ing)':	'$1$2logu$3',
		'()(ana|cata|dia|epi|homo|mono|pro)log(s?\\b)':	'$1$2logue$3',
 
		//'~l' words where the 'l' doubles as past and present participle
		'()(counc)l(e|ing|ors?)(\\b)':	'$1$2ll$3$4',
		'\\b(*)ll(ful|ment)':	'$1l$2',
		'(movie theat(er|re))':	'cinema',
 
		'()airplane':	'$1aeroplane',
		'()\\bom(my|)\\b':	'$1mother'
	};
 
	for (var word in table) {
		var txt="";
		try {
			var re = new RegExp(word, 'g');
			regex(re, table);			
		}
		catch(err) {
			txt="There was an error on function Ohc_ENGVARSimple(), when changing '"+ word + "' => '"+ table +"'.\n\n";
			txt+="Error: " + err.message + "\n\n";
			txt+="Click OK to continue.\n\n";
			alert(txt);
		}
	}
 
	//remove US spelling from {{convert}} template output
	regex(/(\{\{convert\|*)\|(?:sp|spell)*=*us/gi, '$1');
	regex(/(\{\{(?:in|ft|yd|?m)?+to+*)\|(?:sp|spell)*=*(?:American|us)/gi, '$1');
	regex(/(\{\{(?:pd|pop+density)+(?:km|mi)2*)\|(?:sp|spell)*=*(?:American|us)/gi, '$1');
 
	//remove ambiguous pound sign; rem incidental intervening space
	regex(/₤ ?(\d)/g, '£$1');
	regex(/rigour mortis/g, 'rigor mortis');
	//reconvert special cases
}
 
function Ohc_ENGVARCSimple(){
 
	var table = {
		'ageing':	'$1aging',
		'aluminium':	'$1aluminum',
		'adrenalin(\\b)':	'$1adrenaline$2',
		'(ana|breatha|cata|hydro|para)lyz(e|ing|is)':	'$1$2lys$3',
		'(de|of)fense':	'$1$2fence',
		'(licen|practi)c(ing|ed)':	'$1$2s$3',
		'furor(\\b)':	'$1furore$2',
		'(light-|dark-|\\b)gray':	'$1$2grey',
		'guerilla':	'$1guerilla',
		'maneuver(ab|ed|ing)':	'$1manoeuvr$2',
		'maneuver':	'$1manoeuvre',
		'louve(red|ring)':	'$1louv$2',
		'louver':	'$1louvre',
		'encyclopaedi(a|c)':	'$1encyclopedi$2',
		'skeptic':	'$1sceptic',
		'mollusk':	'$1mollusc',
		'vapor(s?\\b)':	'$1vapour$2',
		'liquorice':	'$1licorice',
 
		//composite words
//		'onstage':	'$1on-stage',
		'(break|drop|clean|line|lock|pick)(out|up)':	'$1$2-$3',
 
		//oe/ae words
		'anaesthesiologist':	'$1anesthetist',
		'(an|)aesthe(sia|tic|tist)':	'$1$2esthe$3',
		'archaeo':	'$1archeo',
		'diarrhoea':	'$1diarrhea',
		'foetus':	'$1fetus',
		'gyneco':	'$1gynaeco',
		'haemo(globin|ly|phil|rr)':	'$1hemo$2',
		'orthopaedic':	'$1orthopedic',
		'oenology':	'$1enology',
		'oesophag':	'$1esophag',
		'oestrogen':	'$1estrogen',
		'homoeopath':	'$1homeopath',
		'omelet(\\b)':	'$1omelette$2',
		'paed(iatric|ophil)':	'$1ped$2',
		'palaeonto':	'$1paleonto',
		'rigor(\\b)':	'$1rigour$2',
		'(an|leuk|septic|tox)aemi(a|c)':	'$1$2emi$3',
 
		//'f' words
		'sulfur':	'$1sulphur',
 
		'anymore':	'$1any more',
		'speciality':	'$1specialty',
 
		// non-redundant e
		'(lik|liv|rat|sal|siz|shak)(able)':	'$1$2e$3',
 
		//'~our' words
		'(arm|clam|glam|harb|neighb|rum|savi?)or(ed|ful|ing|less|ly|s|\\b)':	'$1$2our$3',
		'(arm|sav)or(ies|y|s|\\b)':	'$1$2our$3',
		'(cand|od)or((?:ful|less)(?:ly|)|\\b)':	'$1$2our$3',
		'neighborhood':	'$1neighbourhood',
		'behavior(al|s|\\b)':	'$1behaviour$2',
		'favor(abl|ed|i*|s|\\b)':	'$1favour$2',
		'honor(abl|ed|ing|s|\\b)':	'$1honour$2',
		'(endeav|lab)or(e|ing|s|\\W)':	'$1$2our$3',
		'mol(d|t)(ed|ing|s|\\W)':	'$1moul$2$3',
 
		//'~re~' words
		'(calib|fib|goit|lust|mit|nit|och|reconnoit|sab|saltpet|spect|theat|tit)er(s?\\W)':	'$1$2re$3',
		'(centi|kilo|micro|milli|nano|-|\\d\\s)meter':	'$1$2metre',
		'(centi|milli|deci|pico|hecto|\\b)liter(s?\\b)':	'$1$2litre$3',
		'(dema|peda|mono|syna)gog(s?\\W)':	'$1$2gogue$3',
 
		//'~l' words where the 'l' doubles as past and present participle
		'((?:\\w{3,9}|)(?:fu|pan))el(e|ist|ing)':	'$1$2ell$3', 
		'(bev|jew|lev|mod|rev|trav)el(e|ing)':	'$1$2ell$3', 
		'({2,8})el(e|est|ing)(\\b)':	'$1$2ell$3$4',
		'(app|di|enthr|equ|initi|journ|riv|sign|tot)al(e|ing)':	'$1$2all$3'
	};
 
	for (var word in table) {
		var txt="";
		try {
			var re = new RegExp('(\\b)' + word, 'g');
			regex(re, table);
		}
		catch(err) {
			txt="There was an error on function Ohc_ENGVAR-CSimple(), when changing '"+ word + "' => '"+ table +"'.\n\n";
			txt+="Error: " + err.message + "\n\n";
			txt+="Click OK to continue.\n\n";
			alert(txt);
		}
	}
 
	var table = {
		//'~our' words
		'()(col|flav|hum)or(ed|ful|fully|ings?|less|lessly|s\\W)':	'$1$2our$3',
		'( *\\-)(col|flav|hum)ored':	'$1$2oured',
		'()(col)or(\\W)':	'$1$2our$3',

		//'~re~' words
		'()(calib|fib|goit|lust|mit|nit|reconnoit|sab|saltpet|spect|theat|tit)er(ed|ing)':	'$1$2r$3',
		'()(cent|epicent|recent)er(ed|ing)':	'$1$2r$3',
		'()(cent|epicent|recent)er(s?\\b)':	'$1$2re$3',
		'()(ana|cata|dia|epi|homo|mono|pro)log(ed|ing)':	'$1$2logu$3',
		'()(ana|cata|dia|epi|homo|mono|pro)log(s?\\b)':	'$1$2logue$3',
 
		//'~l' words where the 'l' doubles as past and present participle
		'\\b(counc)l(e|ing|ors?)\\b':	'$1ll$2',
//		'(movie theat(er|re))':	'cinema',
		'\\b(*)ll(ful|ment)':	'$1l$2'
 
	};
 
	for (var word in table) {
		var txt="";
		try {
			var re = new RegExp(word, 'g');
			regex(re, table);			
		}
		catch(err) {
			txt="There was an error on function Ohc_ENGVAR-CSimple(), when changing '"+ word + "' => '"+ table +"'.\n\n";
			txt+="Error: " + err.message + "\n\n";
			txt+="Click OK to continue.\n\n";
			alert(txt);
		}
	}
 
	//remove US spelling from {{convert}} template output
	regex(/(\{\{convert\|*)\|(?:sp|spell)*=*us/gi, '$1');
	regex(/(\{\{(?:in|ft|yd|?m)?+to+*)\|(?:sp|spell)*=*(?:American|us)/gi, '$1');
	regex(/(\{\{(?:pd|pop+density)+(?:km|mi)2*)\|(?:sp|spell)*=*(?:American|us)/gi, '$1');
 
	regex(/rigour mortis/g, 'rigor mortis');
}
 
function SetEnglish(v) {
	switch (v) {
		case 'Ox':
			ohc_protect_ENGVAR();
			Ohc_ENGVARSimple();
			re_zwords();
 
			Ohc_ENGVARXedit_summary();
			break;
		case 'I':
			ohc_protect_ENGVAR();
			Ohc_ENGVARSimple();
			zwords();
 
			Ohc_ENGVARIedit_summary();
			break;
		case 'C':
			ohc_protect_ENGVAR();
			Ohc_ENGVARCSimple();
			re_zwords();
 
			Ohc_ENGVARCedit_summary();
			break;
		case 'P':
			alert('Feature not implemented');
			break;
	}
	Ohc_plain_english()
	ohc_unprotect_ENGVAR();	
	ohc_retask_pipes();
	insert_Engvar(v);
	doaction('diff');
//	Ohc_ENGVARedit_summary();
}
 
function Simpleplus() {
	Ohc_ENGVARSimple();
	zwords();
	ohc_unprotect_ENGVAR();
	insert_Engvar('B');
	Ohc_ENGVARedit_summary();
}
 
/** ------------------------------------------------------------------------ **/
 
function ohc_retask_pipes(){
	regex(/(\+? |)+?iation)\|((?:+? |){3,12}i(?:e?|ations?|abl|ing))/g, '$1$2');
//	regex(/(empha|synthe)siz(e|ing)/g, '$1sis$2'); 
}
 
function zwords(){
	regex(/({3,12})iz(e?|ations?|abl|ing)(\W)/g, '$1is$2$3');
	regex(/(empha)siz(e|ing)/g, '$1sis$2'); 
	regex(/(synthe)siz(e|ing)/g, '$1sis$2'); 
}
 
function re_zwords(){
	//converts 's-words' and 'ph-words' into Oxford 'z-words' and 'f-words'
 
	regex(/()(ar|de|improv|parad|(?:com|)pr|rev|surm|telev)is(e|ing)/g, '$1$2♫is$3'); 
	regex(/({5,12})is(ations?)(\W)/g, '$1iz$2$3');
	regex(/({0,12}(?:|ph|rd|thes))is(e?|ing)(\W)/g, '$1iz$2$3');
		//'f' words
	regex(/sulphur(\W)/g, 'sulfur$1');
 
}
function Ohc_flip_IMP(){
// measurements and perception
//	regex(/\\]/gi, '$1$2');
 
	//Template:{{convert}}
//	regex(/(\{\{convert)(\s*\|)/gi, '$1/flip$2'); //rem linking within convert template (area)	//needs resolving
	regex(/(\{\{convert\|+?\|(?:(?:sq|cu|)(?:?m)(?:2|3|))(?:\|(?:sq|cu|)(?:in|ft|yd|mi)(?:2|3|))?(\|\d)?(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //rem linking within convert template (area)
	regex(/(\{\{convert\|+?\|tonnes?(?:\|tons?)?(\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //rem linking within convert template
	regex(/(\{\{convert\|+?\|(?:(?:sq|)(?:k?m)(?:2|3|)|hectare))(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*?(?=\})/gi, '$1$2|disp=flip'); //putting metres and hectares behind
	regex(/(\{\{convert\|+?\|(?:hectares?|ha)(?:\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //flip hectares
	regex(/(\{\{convert\|+?\|(?:kmh|km\/h)(?:\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //flip kmh
	regex(/(\{\{convert\|+?\|(?:to|by|x)(?:\|+?\|(?:?m))(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //rem linking within convert template (input ranges only)
	regex(/(\{\{convert\|+?\|nmi)(2|)(\|mi\2 km\2|\|km\2 mi\2|)(?=)/gi, '$1$2|mi$2 km$2'); //putting miles first in nautical mile conversion
	regex(/(\{\{convert\|+?\|(?:kg|°?F))(\|(?:sp|adj|abbr|lk|sigfig|sortable)=+?)*(?=\})/gi, '$1$2|disp=flip');  //putting pounds and °C first
//	regex(/(\{\{(?:in|ft|mi|?m)?\sto\s(?:in|ft|mi|?m)?*?)\|wiki=(?:yes|no)/gi, '$1');

////manipulating "|disp=flip" parameter where already "flipped"
	regex(/(\{\{convert\|+?\|\w{1,4}(?:\|\w{1,4}|)?(?:\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(\|disp=flip)(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)+(?=\})/gi, '$1$3$2'); //reordering flipping parameter within convert template (last parameter)
	regex(/(\{\{convert\|+?\|(?:(?:sq|cu|)(?:in|ft|yd|mi|acre)(?:2|3|))(?:\|(?:sq|cu|)(?:?m|ha)(?:2|3|))?(\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)\|disp=flip(?=\})/gi, '$1$2'); //rem flipping within convert template (Imperial, sq and cubed)
	regex(/(\{\{convert\|+?\|(?:mi|miles?|mph)(?:\|kph|km\/h|)?(\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)\|disp=flip(?=\})/gi, '$1$2'); //rem flipping within convert template (Imperial, sq and cubed)
}

function Ohc_flip_SI(){
// measurements and perception
//	regex(/\\]/gi, '$1$2');
 
	//Template:{{convert}}
//	regex(/(\{\{convert)(\s*\|)/gi, '$1/flip$2'); //rem linking within convert template (area)	//needs resolving
	regex(/(\{\{convert\|+?\|(?:(?:sq|cu|)(?:in|ft|yd|mi)(?:2|3|))(?:\|(?:sq|cu|)(?:?m)(?:2|3|))?(\|\d)?(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //rem linking within convert template (area)
	regex(/(\{\{convert\|+?\|tonnes?(?:\|tons?)?(\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //rem linking within convert template
	regex(/(\{\{convert\|+?\|(?:(?:sq|)mi(?:2|3|)|acre))(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*?(?=\})/gi, '$1$2|disp=flip'); //putting metres and hectares behind
//	regex(/(\{\{convert\|+?\|(?:hectares?|ha)(?:\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //flip hectares
//	regex(/(\{\{convert\|+?\|mp(?:\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //flip kmh
	regex(/(\{\{convert\|+?\|(?:to|by|x)(?:\|+?\|(?:yd|f(?:oo|)t|in))(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(?=\})/gi, '$1|disp=flip'); //rem linking within convert template (input ranges only)
	regex(/(\{\{convert\|+?\|nmi)(2|)(\|mi\2 km\2|\|km\2 mi\2|)(?=)/gi, '$1$2|km$2 mi$2'); //putting miles first in nautical mile conversion
	regex(/(\{\{convert\|+?\|(?:lb|oz|°?F))(\|(?:sp|adj|abbr|lk|sigfig|sortable)=+?)*(?=\})/gi, '$1$2|disp=flip');  //putting pounds and °C first
//	regex(/(\{\{(?:in|ft|mi|?m)?\sto\s(?:in|ft|mi|?m)?*?)\|wiki=(?:yes|no)/gi, '$1');
 
////manipulating "|disp=flip" parameter where already "flipped"
	regex(/(\{\{convert\|+?\|\w{1,4}(?:\|\w{1,4}|)?(?:\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)(\|disp=flip)(\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)+(?=\})/gi, '$1$3$2'); //reordering flipping parameter within convert template (last parameter)
	regex(/(\{\{convert\|+?\|(?:(?:sq|cu|)(?:?m|ha)(?:2|3|))(?:\|(?:sq|cu|)(?:in|ft|yd|mi|acre)(?:2|3|))?(\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)\|disp=flip(?=\})/gi, '$1$2'); //rem flipping within convert template (Imperial, sq and cubed)
	regex(/(\{\{convert\|+?(?:\|kph|km\/h|)(?:\|mi|miles?|mph)?(\|\d)?(?:\|(?:sp|adj|abbr|lk|sigfig|sortable)=*)*)\|disp=flip(?=\})/gi, '$1$2'); //rem flipping within convert template (Imperial, sq and cubed)
}
 
function insert_Engvar(v){
	// Add a template to the article identifying English variant
	var box = document.editform.wpTextbox1;
	var txt = box.value;
 
        // Build a string with "Month YYYY"
        var dateobj=new Date();
        var month=new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
        var datestr= month + ' ' + dateobj.getFullYear();
 
       // Matches Use Australian English or EngvarA
       var reA = new RegExp('{{*(?:ngvar)*(?:|\\|*date*=*)*}}', 'gi');
        var reB = new RegExp('{{*(?:se+British+English|ngvarB)*(?:|\\|*date*=*)*}}', 'gi');
        var reI = new RegExp('{{*(?:se+Indian+English|ngvarI)*(?:|\\|*date*=*)*}}', 'gi');
        // Matches Use British (Oxford) English or EngvarOx
        var reOx = new RegExp('{{*(?:se+British+\\(Oxford\\)+English|ngvarOx)*(?:|\\|*date*=*)*}}', 'gi');
        // Matches Use Canadian English or EngvarC
        var reC = new RegExp('{{*(?:se+Canadian+English|ngvarC)*(?:|\\|*date*=*)*}}', 'gi');
       var reU = new RegExp('{{*(?:se+(Australian|British|Hong Kong|\\w+|New Zealand|Pakistani|South African)+English)*(?:|\\|*date*=*)*}}', 'gi');
 
        switch (v) {
        case 'I':
           // Replace with Indian
           txt = txt.replace( reA, '{{Use Indian English|date=' + datestr + '}}');
           txt = txt.replace( reB, '{{Use Indian English|date=' + datestr + '}}');
           txt = txt.replace( reOx, '{{Use Indian English|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{Use Indian English|date=' + datestr + '}}');
           txt = txt.replace( reU, '{{Use Indian English|date=' + datestr + '}}');
           // Prepend Indian template if not already tagged
           if( txt.search(reI) == -1 ) {
               txt = '{{Use Indian English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
        case 'A':
           txt = txt.replace( reB, '{{EngvarB|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{EngvarB|date=' + datestr + '}}');
           txt = txt.replace( reI, '{{EngvarB|date=' + datestr + '}}');
           txt = txt.replace( reOx, '{{EngvarB|date=' + datestr + '}}');
           txt = txt.replace( reU, '{{EngvarB|date=' + datestr + '}}');
           // Prepend Australian template if not already tagged
           if( txt.search(reA) == -1 ) {
               txt = '{{EngvarB|date=' + datestr + '}}\r\n' + txt;
           }
           break;
        case 'B':
           // Replace with British
           txt = txt.replace( reA, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reI, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reOx, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{Use British English|date=' + datestr + '}}');
           txt = txt.replace( reU, '{{Use British English|date=' + datestr + '}}');
           // Prepend British template if not already tagged
           if( txt.search(reB) == -1 ) {
               txt = '{{Use British English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
        case 'C':
           // Replace with Canadian
           txt = txt.replace( reA, '{{Use Canadian English|date=' + datestr + '}}');
           txt = txt.replace( reB, '{{Use Canadian English|date=' + datestr + '}}');
           txt = txt.replace( reI, '{{Use Canadian English|date=' + datestr + '}}');
           txt = txt.replace( reOx, '{{Use Canadian English|date=' + datestr + '}}');
           txt = txt.replace( reU, '{{Use Canadian English|date=' + datestr + '}}');
           // Prepend Canadian template if not already tagged
           if( txt.search(reC) == -1 ) {
               txt = '{{Use Canadian English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
        case 'Ox':
           // Replace with British (Oxford)
           txt = txt.replace( reA, '{{Use British (Oxford) English|date=' + datestr + '}}');
           txt = txt.replace( reB, '{{Use British (Oxford) English|date=' + datestr + '}}');
           txt = txt.replace( reI, '{{Use British (Oxford) English|date=' + datestr + '}}');
           txt = txt.replace( reC, '{{Use British (Oxford) English|date=' + datestr + '}}');
           txt = txt.replace( reU, '{{Use British (Oxford) English|date=' + datestr + '}}');
           // Prepend British (Oxford) template if not already tagged
           if( txt.search(reOx) == -1 ) {
               txt = '{{Use British (Oxford) English|date=' + datestr + '}}\r\n' + txt;
           }
           break;
       }
 
        box.value = txt;
}
function Ohc_ENGVARIedit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010
	setreason('spelling per ] by ]', 'append');
//	doaction('diff');
}
function Ohc_ENGVARAedit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010
	setreason('spelling per ] by ]', 'append');
//	doaction('diff');
}
function Ohc_ENGVARBedit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010
	setreason('] by ]', 'append');
//	doaction('diff');
}
function Ohc_ENGVARCedit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010
	setreason('] by ]', 'append');
//	doaction('diff');
}
function Ohc_ENGVARXedit_summary(){
	//Add a tag to the summary box
	setoptions(minor='true'); //removed ",watch='false'" in response to user notification 13 Nov. 2010
	setreason('all to ] by ]', 'append');
//	doaction('diff');
}
User:फ़िलप्रो/script/EN-IN.js Add topic