User:Mglovesfun/vector.js

// to prevent interpretation of template syntax

// THE FOLLOWING IS BASED ON User:Msh210/vector.js BUT HAS BEEN MODIFIED SINCE. THANKS MSH210! //importScript('Transwiki:Gadget-HotCat.js'); document.getElementById('firstHeading').setAttribute('style','color:green'); importScript('User:Lupin/autoedit.js', 'en.wikipedia.org','46637295');//needed for other things importScript('User:Conrad.Irwin/creation.js');//automates inflected-form creation; requires autoedit.js importScript('User:Conrad.Irwin/isblocked.js');//nice display if user's blocked document.cookie="WiktNearbyPagesLangHeadings=true";//restricts nearbypages to header not navbar importScript('User:Ruakh/WiktEtylAlwaysLink.js');//link etyl's langnames importScript('User:Yair rand/checktbotentries.js'); importScript('User:Yair rand/checktransremove.js'); importScript('User:Yair rand/FindTrans.js'); importScript('User:Yair rand/languagenametocode.js'); importScript('User:Yair rand/orangelinks2.js'); importScript('User:Kephir/gadgets/xte.js'); GPE = GPE || {}; GPE.deleteReasonIfBlank = "\[\[Wiktionary\:Sysop deleted\|\-\-explanation of deletion\-\-\]\]"; //start stuff copied from User:Connel_MacKenzie/clock.js and modified function makeTime { var timeGMT = new Date; var time = timeGMT.toUTCString; var li = document.createElement( 'li' ); li.id = 't-time'; li.appendChild( document.createTextNode( time ) ); var ul=document.getElementById('t-upload'); ul.parentNode.insertBefore(li,ul); } $( makeTime ); // end stuff from User:Connel_MacKenzie/clock.js /* begin stuff copied from User:Connel MacKenzie/reformat.js and amended */ function minorFormat {

//use Roman not Latin in translation tables (other than for the Latin language, of course) txt = txt.replace(/\*\: Latin\: (\[|\{)/gi, "\*\: Roman\: $1");

//Convert head/infl to language-specific template txt = txt.replace(/\{\{(head|infl)\|(de|es|fr|it)\|adverb\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|(de|en|es|fr|pt)\|proper noun\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|(de|fr|it)\|verb\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|en\|adjective\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|en\|adverb\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|en\|conjunction\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|en\|noun\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|(es|fi|fr|sv)\|noun\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|fr\|adjective form\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|fr\|preposition\}\}/gi, ""); txt = txt.replace(/\{\{(head|infl)\|(es|fr|pt)\|verb form\}\}/gi, ""); //Cyrillic script txt = txt.replace(/\{\{(head|infl)\|(ba|be|ce|bg|kk|ky|lez|mk|ru|uk)\|noun(\}\}|\|tr=|\|g=)/gi, "{{$2-noun$3"); txt = txt.replace(/\{\{(head|infl)\|(bg|ru)\|proper noun(\}\}|\|tr=|\|g=)/gi, "{{$2-proper noun$3");

// Always use head= instead of inf, pos=, sg= or current= txt = txt.replace(/\{\{(en|fr)\-(adj|adv|noun|plural\-noun|pronoun|proper noun|verb|verb form)\|(current|inf|pos|sg)=/gi, "{{$1-$2|head=");

//Merge or update gender and number templates txt = txt.replace(/\{\{m\|p\}\}/gi, "{{g|m-p}}"); txt = txt.replace(/\{\{f\|p\}\}/gi, "{{g|g-p}}"); txt = txt.replace(/\{\{n\|p\}\}/gi, "{{g|n-p}}"); txt = txt.replace(/\{\{m\}\} \{\{s\}\}/gi, "{{g|m}}"); txt = txt.replace(/\{\{m\}\} \{\{p\}\}/gi, "{{g|m-p}}"); txt = txt.replace(/\{\{m\}\} \{\{f\}\}/gi, "{{g|m|f}}"); txt = txt.replace(/\{\{f\}\} \{\{s\}\}/gi, "{{g|f}}"); txt = txt.replace(/\{\{f\}\} \{\{p\}\}/gi, "{{g|f-p}}"); txt = txt.replace(/\{\{n\}\} \{\{p\}\}/gi, "{{g|n-p}}"); txt = txt.replace(/\{\{n\}\} \{\{s\}\}/gi, "{{g|n}}"); txt = txt.replace(/\{\{m\}\} \{\{f\|p\}\}/gi, "{{g|m-p|f-p}}"); txt = txt.replace(/\{\{m\|f\}\} \{\{p\}\}/gi, "{{g|m-p|f-p}}"); txt = txt.replace(/\{\{m\}\} \{\{inv\}\}/gi, "{{g|m}}"); txt = txt.replace(/\{\{f\}\} \{\{inv\}\}/gi, "{{g|f}}"); txt = txt.replace(/\{\{m\}\} \{\{f\|inv\}\}/gi, "{{g|m|f}}"); txt = txt.replace(/\{\{m\|f\}\} \{\{inv\}\}/gi, "{{g|m|f}}");

//Convert *: to * before {{a}} { {audio}}, { {homophones}}, { {IPA}} and { {rhymes}} txt = txt.replace(/\*\: \{\{(a|audio|homophones|IPA|rhymes)(\||\})/gi, "* {{$1$2");

//Replace obsolete IPA characters txt = txt.replace(/ʣ/gi, "dz"); txt = txt.replace(/ʤ/gi, "dʒ"); txt = txt.replace(/ʥ/gi, "dʑ"); txt = txt.replace(/ʧ/gi, "tʃ"); txt = txt.replace(/ʦ/gi, "ts"); txt = txt.replace(/ʨ/gi, "tɕ");

//Adding {{qualifier}}. In some cases, you'll want to switch qualifier to context or gloss txt=txt.replace(/\(([a-zA-Z\ \-\,\:\;][a-zA-Z\ \-\,\:\;]*)\)/g, "{{qualifier|$1}}");//converts (foo) to {{qualifier|foo}} txt=txt.replace(/\(([a-zA-Z\ \-\,\:\;][a-zA-Z\ \-\,\:\;]*)\)/g, "{{qualifier|$1}}");//converts (foo) to {{qualifier|foo}} txt=txt.replace(/\{\{qualifier\|([a-zA-Z\ \-\,\:\;][a-zA-Z\ \-\,\:\;]*)\}\}\:/g, "{{sense|$1}}");//converts {{qualifier|foo}}: to {{sense|foo}} txt = txt.replace(/British/gi, "{{qualifier|British}}"); txt = txt.replace(/UK/gi, "{{qualifier|UK}}"); txt = txt.replace(/US/gi, "{{qualifier|US}}");

//Remove wikilinks from some common form of templates, but not piped links txt = txt.replace(/\{\{([\ -9\;-\\\^-z\}-ퟻ\-]+) of\|\[\[([\ -9\;-\\\^-z\}-ퟻ]+)\]\](\||\}\})/gi, "{{$1 of|$2$3");

//Actual { {form of}} txt = txt.replace(/\{\{form of\|([\ -9\;-\\\^-z\}-ퟻ]+)\|\[\[([\ -9\;-\\\^-z\}-ퟻ]+)\]\](\||\})/gi, "{{form of|$1|$2$3");

//Add { {homophones}} txt=txt.replace(/([hH])omophones\: \[\[([\ -9\;-\\\^-z\}-ퟻ]+)\]\]/g, "{"+"{homophones|$2}}"); //If two txt=txt.replace(/\{\{homophones\|([\ -9\;-\\\^-z\}-ퟻ]+)\}\}, \[\[([\ -9\;-\\\^-z\}-ퟻ]+)\]\]/g, "{"+"{homophones|$1|$2}}");

//Add lang=en to several templates. Change by hand if required txt = txt.replace(/\{\{(defn|etystub|rfc|rfd|rfe|rfp|rfap|rfdef|rfv|rfv\-etymology|rfv\-pronunciation)\}\}/g, "{{$1|lang=en}}");

//Put {{wikipedia}} under ==English== header, not above it txt=txt.replace(/\{\{wikipedia\}\}\n==English==/g, "==English==\n{{wikipedia}}"); txt=txt.replace(/\{\{wikipedia\}\}\n=/g, "{{wikipedia}}\n\n=");

//Bullet point before certain templates, but only when they are the first item on a line:

txt = txt.replace(/\n\{\{(a|AHD|audio|enPR|IPA|homophones|l|pedia|pedialite|qualifier|rhymes|seeCites|sense|X\-SAMPA)(\||\}\})/g, "\n* {{$1$2");

//Remove needless complexity from WT:ACCEL generated entries txt=txt.replace(/\|\[\[([\ -9\;-\\\^-z\}-ퟻ\-]+) \#([\ -9\;-\\\^-z\}-ퟻ\-]+)\|([\ -9\;-\\\^-z\}-ퟻ\-]+)\]\]/g, "|$1");

//Add lang=en to term with only one parameter. Obviously, if the word is not English, change the lang parameter

txt=txt.replace(/\{\{term\|([\ -9\;-\\\^-z\}-ퟻ\-]+)\}\}/g, "{{term|$1|lang=en}}");

//Text replacement other than replacing headers and template redirects, which come later on txt = txt.replace(/\|skey\=/gi, "|sort="); txt = txt.replace(/\ \}\}/g, "}}"); txt = txt.replace(/\{\{ /g, "{{"); txt = txt.replace(/\ \|/g, "\|"); txt = txt.replace(/\|\ /g, "\|"); txt = txt.replace(/\ \n/g, "\n"); txt = txt.replace(/\=\= /g, "=="); txt = txt.replace(/ \=\=/g, "=="); txt = txt.replace(/\n\n\n/g, "\n\n"); txt = txt.replace(/==\n==/g, "==\n\n=="); txt = txt.replace(/\-\-\-\-\n=/g, "\n\n="); txt = txt.replace(/==\n\n([a-zA-Z\*|\[|\{'])/g, "==\n$1"); txt = txt.replace(/\n\=(\=*)([A-ȳ\ ]*)(\=*)\<\!/g, "\n=$1$2$3\n<!"); txt = txt.replace(/===\n\'\'\'(.*)\'\'\'\n#/gi, "===\n$1\n\n#"); txt = txt.replace(/===\n\{\{(.*)\}\}\n#/gi, "===\n{{$1}}\n\n#"); txt = txt.replace(/\{\{PAGENAME\}\}/gi, "{"+"{subst:PAGENAME}}"); txt = txt.replace(/ m/g, " {{g|m}}"); txt = txt.replace(/m /g, "{{g|m}} "); txt = txt.replace(/ f/g, " {{g|f}}"); txt = txt.replace(/f /g, "{{g|f}} "); txt = txt.replace(/ n/g, " {{g|n}}"); txt = txt.replace(/n /g, "{{g|n}} "); txt = txt.replace(/ c/g, " {{g|c}}"); txt = txt.replace(/c /g, "{{g|c}} "); txt = txt.replace(/ pl/g, " {{g|p}}"); txt = txt.replace(/pl /g, "{{g|p}} "); txt = txt.replace(/ s/g, " {{g|s}}"); txt = txt.replace(/s /g, "{{g|s}} "); txt = txt.replace(/m, f/g, "{{g|m|f}}"); txt = txt.replace(/\{\{mf\}\}/g, "{{g|m|f}}"); txt = txt.replace(/m pl/g, "{{g|m-p}}"); txt = txt.replace(/f pl/g, "{{g|f-p}}"); txt = txt.replace(/m plural/g, "{{g|m-p}}"); txt = txt.replace(/f plural/g, "{{g|f-p}}"); txt = txt.replace(/\*(\ *)([1-9][0-9][0-9]*)\:/g, "* $2,"); txt = txt.replace(/\*(\ *)([1-9][0-9][0-9]*)\:/g, "* $2,"); txt=txt.replace(/\ (\ *)/g, " "); txt=txt.replace(/\n([\*\#\:\;]+)(\ *)([\'\{\[a-zA-Z])/g, "\n$1 $3");//Thanks, Conrad.Irwin. txt=txt.replace(/\n\{\{template\:PL\:/g, "\n* {"+"{template:PL:");//as previous txt=txt.replace(/\n\{\{pedia([\}\|])/g, "\n* {{pedia$1"); txt=txt.replace(/\n\{\{versity([\}\|])/g, "\n* {{versity$1"); txt=txt.replace(/\{\{form\ of\|([a-zA-Z\ \-\,\'\[\]\(\)\"\/]*)\ of\|/g, "{"+"{form of|$1|"); txt=txt.replace(/\{\{onym([\}\|])/g, "{"+"{l$1");//straight swap  txt = txt.replace(/lang=Italian/gi, "lang=it");  txt = txt.replace(/(first|First|second|Second|third|Third) person (singular|plural)/gi, "$1-person $2");  txt = txt.replace(/Sinhala/gi, "Sinhalese");//Common misuse of secondary language name  txt = txt.replace(/\[\[(WS|WikiSaurus)\:/gi, "[[Wikisaurus:");  txt = txt.replace(/\#\:\*/gi, "#:");

//Redirect snaps for non-context labels. Only works when editing an entire page, not a section //Uses a fairly simple regex system, thus can occasionally cause problems. If so, do section editing only //Achieves not a lot, slows down editing, and has to be updated any time one of these templates is renamed txt=txt.replace(/\{\{alt spell\|/g, "{"+"{alternative spelling of|"); txt=txt.replace(/\{\{alternate form of\|/g, "{"+"{alternative form of|"); txt=txt.replace(/\{\{alternate spelling of\|/g, "{"+"{alternative spelling of|"); txt=txt.replace(/([\|\{])bottom2([\}\|])/g, "$1bottom$2"); txt=txt.replace(/([\|\{])(checktrans\-mid|reqtrans\-mid|ttbc\-mid)([\}\|])/g, "$1trans-mid$3"); txt=txt.replace(/([\|\{])(checktrans\-bottom|reqtrans\-bottom|ttbc\-bot|ttbc\-bottom)([\}\|])/g, "$1trans-bottom$3"); txt=txt.replace(/\{\{cmn\-def\|/g, "{"+"{pinyin reading of|"); txt=txt.replace(/\{\{cx\|/g, "{"+"{context|"); txt=txt.replace(/\{\{(en|fr)\-adjective([\}\|])/g, "{"+"{$1-adj$2"); txt=txt.replace(/\{\{(en|fr)\-adverb([\}\|])/g, "{"+"{$1-adv$2"); txt=txt.replace(/\{\{en\-conjunction([\}\|])/g, "{"+"{en-con$1"); txt=txt.replace(/\{\{en\-conj([\}\|])/g, "{"+"{en-con$1"); txt=txt.replace(/\{\{en\-interjection([\|\}])/g, "{"+"{en-interj$1"); txt=txt.replace(/\{\{en\-intj([\|\}])/g, "{"+"{en-interj$1"); txt=txt.replace(/\{\{en\-particle([\}\|])/g, "{"+"{en-part$1"); txt=txt.replace(/\{\{en\-preposition([\}\|])/g, "{"+"{en-prep$1"); txt=txt.replace(/\{\{en\-plural\-noun([\}\|])/g, "{"+"{en-plural noun$1"); txt=txt.replace(/\{\{en\-pronoun([\}\|])/g, "{"+"{en-pron$1"); txt=txt.replace(/\{\{en\-adj\-more([\}\|])/g, "{"+"{en-adj$1"); txt=txt.replace(/\{\{en\-proper\-noun([\}\|])/g, "{"+"{en-proper noun$1"); txt=txt.replace(/\{\{eye dialect([\|\}])/g, "{"+"{eye dialect of$1"); txt=txt.replace(/\{\{Flowbreak([\|\}])/g, "{"+"{flowbreak$1"); txt=txt.replace(/\{\{fr\-pp([\}\|])/g, "{"+"{fr-past participle$1"); txt=txt.replace(/\{\{fr\-verb form([\}\|])/g, "{"+"{fr-verb-form$1"); txt=txt.replace(/\{\{i([\}\|])/g, "{"+"{qualifier$1"); txt=txt.replace(/\{\{infl\|/g, "{"+"{head|"); txt=txt.replace(/\{\{italbrac([\|\}])/g, "{"+"{qualifier$1");//straight swap txt=txt.replace(/\{\{i-c([\|\}])/g, "{"+"{sense$1"); txt=txt.replace(/\{\{italbrac-colon([\|\}])/g, "{"+"{sense$1"); txt=txt.replace(/\{\{non gloss definition([\|\}])/g, "{"+"{non-gloss definition$1"); txt=txt.replace(/\{\{n\-g([\|\}])/g, "{"+"{non-gloss definition$1"); txt=txt.replace(/\{\{PL\:pedia([\}\|])/g, "{"+"{pedia$1"); txt=txt.replace(/\{\{pf\}\}/g, "{"+"{pf.}}"); txt=txt.replace(/([\|\{])R\:ANOLH([\}\|])/g, "$1R:Anglo-Norman On-Line Hub$2"); txt=txt.replace(/\{\{SAMPA\|/g, "{"+"{X\-SAMPA|"); txt=txt.replace(/\{\{see also\|/g, "{"+"{also|"); txt=txt.replace(/\{\{sic([\|\}])/g, "{"+"{SIC$1"); txt=txt.replace(/\{\{sic\.([\|\}])/g, "{"+"{SIC$1"); txt=txt.replace(/\{\{(webster|Webster|webster 1913|1913)([\|\}])/g, "{"+"{Webster 1913$2"); txt=txt.replace(/\{\{Wikipedia([\|\}])/g, "{"+"{wikipedia$1"); txt=txt.replace(/\{\{Wikipedia\-inline([\}\|])/g, "{"+"{pedia$1"); txt=txt.replace(/\{\{xalso\|/g, "{"+"{xsee|"); txt=txt.replace(/\{\{zh\-forms\|/g, "{"+"{Hani-forms|"); //the next two lines have to be after the "alt spell" snap above

txt=txt.replace(/\n\#\ \{\{obsolete\}\}\ \{\{alternative spelling of\|/g, "\n# {"+"{obsolete spelling of|"); txt=txt.replace(/\n\#\ \{\{archaic\}\}\ \{\{alternative spelling of\|/g, "\n# {"+"{archaic spelling of|");

//Snapping context redirects txt=txt.replace(/\{\{art\}\}/g, "{"+"{arts}}"); txt=txt.replace(/([\|\{])Bible([\}\|])/g, "$1biblical$2"); txt=txt.replace(/([\|\{])carbohydrates([\}\|])/g, "$1carbohydrate$2"); txt=txt.replace(/([\|\{])christianity([\}\|])/g, "$1Christianity$2"); txt=txt.replace(/([\|\{])Colloquial([\}\|])/g, "$1colloquial$2"); txt=txt.replace(/([\|\{])communications([\}\|])/g, "$1communication$2"); txt=txt.replace(/([\|\{])Communication([\}\|])/g, "$1communication$2"); txt=txt.replace(/([\|\{])([Cc])omptheory([\}\|])/g, "$1computing theory$3"); txt=txt.replace(/([\|\{])computer([\}\|])/g, "$1computing$2"); txt=txt.replace(/([\|\{])computer programming([\}\|])/g, "$1programming$2"); txt=txt.replace(/([\|\{])computers([\}\|])/g, "$1computing$2"); txt=txt.replace(/([\|\{])euphemism([\}\|])/g, "$1euphemistic$2"); txt=txt.replace(/([\|\{])greek mythology([\}\|])/g, "$1Greek mythology$2"); txt=txt.replace(/([\|\{])GUI([\}\|])/g, "$1graphical user interface$2"); txt=txt.replace(/([\|\{])([iI])diom([\}\|])/g, "$1idiomatic$3"); txt=txt.replace(/(\{\{head\|[a-z]{2,3}\|)idiomatic([\}\|])/g, "$1idiom$2");//converts { {head|foo|idiomatic}} back to { {head|foo|idiom}} txt=txt.replace(/([\|\{])indef([\}\|])/g, "$1indefinite$2"); txt=txt.replace(/([\|\{])in plural([\}\|])/g, "$1in the plural$2"); txt=txt.replace(/([\|\{])internet([\}\|])/g, "$1Internet$2"); txt=txt.replace(/([\|\{])jocular([\}\|])/g, "$1humorous$2"); txt=txt.replace(/([\|\{])Law([\}\|])/g, "$1legal$2"); txt=txt.replace(/([\|\{])([mM])ath([\}\|])/g, "$1mathematics$3"); txt=txt.replace(/([\|\{])maths([\}\|])/g, "$1mathematics$2"); txt=txt.replace(/([\|\{])medical([\}\|])/g, "$1medicine$2"); txt=txt.replace(/([\|\{])Military([\}\|])/g, "$1military$2"); txt=txt.replace(/([\|\{])musici([\}\|])/g, "$1musical instruments$2"); txt=txt.replace(/([\|\{])Nautical([\}\|])/g, "$1nautical$2"); txt=txt.replace(/([\|\{])Obsolete([\}\|])/g, "$1obsolete$2"); txt=txt.replace(/([\|\{])organic compound([\}\|])/g, "$1organic compounds$2"); txt=txt.replace(/([\|\{])planetary science([\}\|])/g, "$1planetology$2"); txt=txt.replace(/([\|\{])pluralia tantum([\}\|])/g, "$1plurale tantum$2"); txt=txt.replace(/([\|\{])police([\}\|])/g, "$1law enforcement$2"); txt=txt.replace(/([\|\{])([sS])cifi([\}\|])/g, "$1science fiction$3"); txt=txt.replace(/([\|\{])space([\}\|])/g, "$1space science$2"); txt=txt.replace(/([\|\{])sport([\}\|])/g, "$1sports$2"); txt=txt.replace(/([\|\{])Theology([\}\|])/g, "$1theology$2"); txt=txt.replace(/([\|\{])theatre([\}\|])/g, "$1theater$2"); //Redirect snaps based on dialects/regional vocabulary txt=txt.replace(/([\|\{])American([\}\|])/g, "$1US$2"); txt=txt.replace(/([\|\{])AU([\}\|])/g, "$1Australia$2"); txt=txt.replace(/([\|\{])Australian([\}\|])/g, "$1Australia$2"); txt=txt.replace(/([\|\{])Canadian([\}\|])/g, "$1Canada$2"); txt=txt.replace(/([\|\{])Canadian English([\}\|])/g, "$1Canada$2"); txt=txt.replace(/([\|\{])CockneyRS([\}\|])/g, "$1Cockney rhyming slang$2"); txt=txt.replace(/([\|\{])Indian([\}\|])/g, "$1India$2"); txt=txt.replace(/([\|\{])North American([\}\|])/g, "$1North America$2"); txt=txt.replace(/([\|\{])New Zealand English([\}\|])/g, "$1New Zealand$2"); txt=txt.replace(/([\|\{])NZ([\}\|])/g, "$1New Zealand$2"); txt=txt.replace(/([\|\{])Scottish([\}\|])/g, "$1Scotland$2"); txt=txt.replace(/([\|\{])Scottish English([\}\|])/g, "$1Scotland$2"); txt=txt.replace(/([\|\{])USA([\}\|])/g, "$1US$2"); //A few redirects to non-categorizing template redirects txt=txt.replace(/([\|\{])figurative([\}\|])/g, "$1figuratively$2"); txt=txt.replace(/([\|\{])literal([\}\|])/g, "$1literally$2"); txt=txt.replace(/([\|\{])metaphorical([\}\|])/g, "$1figuratively$2");

// EXPERIMENTAL. Add context in front of context labels that lack it. Has to come after redirect snaps txt = txt.replace(/# \{\{(Australia|British|cardinal|chiefly|colloquial|dated|figuratively|formal|idiomatic|India|informal|Internet|intransitive|Ireland|literally|mathematics|military|New Zealand|nautical|often|ordinal|reflexive|slang|South Africa|transitive|UK|US|usually)(\||\}\})/gi, "# {"+"{context|$1$2");

} // get all the {-header-} templates replaced function headLevel { txt = txt.replace(/==adjective form==/gi, "==Adjective=="); txt = txt.replace(/==(alternative spellings|alternative spellings|alternative spelling|alternate spelling|alternate form|alternative form|alternate forms)==/gi, "==Alternative forms=="); txt = txt.replace(/==cardinal number==/gi, "==Cardinal numeral=="); txt = txt.replace(/==citations==/gi, "==Quotations=="); txt = txt.replace(/==derivation==/gi, "==Etymology=="); txt = txt.replace(/==derivatives==/gi, "==Derived terms=="); txt = txt.replace(/==note==/gi, "==Usage notes=="); txt = txt.replace(/==notes==/gi, "==Usage notes=="); txt = txt.replace(/==NOun==/gi, "==Noun=="); txt = txt.replace(/==noun form==/gi, "==Noun=="); txt = txt.replace(/==Number==/gi, "==Numeral=="); txt = txt.replace(/==ordinal number==/gi, "==Ordinal numeral=="); txt = txt.replace(/==(pinyin|pinyin syllable)==/gi, "==Romanization=="); txt = txt.replace(/==proper Noun==/gi, "==Proper noun=="); txt = txt.replace(/==reference==/gi, "==References=="); txt = txt.replace(/==translation==/gi, "==Translations=="); txt = txt.replace(/==usage==/gi, "==Usage notes=="); txt = txt.replace(/==variants==/gi, "==Alternative forms=="); txt = txt.replace(/==verb form==/gi, "==Verb=="); txt = txt.replace(/==chinese==/gi, "==Mandarin==");//Chinese will usually refer to Mandarin. If the templates aren't cmn, change by hand //Fix User:2.125.74.117 stuff txt = txt.replace(/==see Also==/gi, "==See also=="); txt = txt.replace(/\n====Also See====\n/gi, "{"+"{subst:blank}}"); //Header levels, L3 to L4 txt=txt.replace(/\n===(Antonyms|Coordinate terms|Derived terms|Descendants|Related terms|Synonyms|Translations|Usage notes)===\n/gi, "\n====$1====\n"); //Header levels, L2 to L3 txt=txt.replace(/\n==(Etymology|References|See also)==\n/gi, "\n===$1===\n"); }

function langHdrs { txt=txt.replace(/\n==(=*)([a-z])/gi, "\n==$1$2".toUpperCase ); txt=txt.replace(/==\[\[([a-zA-ZÀ-ž\-\ ]+)\]\]==/g, "==$1=="); }

function langSubsts { txt=txt.replace(/([=\ \*\:])\{\{([a-z]{2,3})\}\}/g, "$1{{subst"+":#ifexist:{{subst:"+"$2}}|{{etyl|$2|-}}|{{"+"$2}}}}"); }

function wiktClickMyDiff { window.status = "[Show changes] has now been clicked."; document.editform.wpDiff.click; }

function superAutoFormat { // get page title pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue; //if (pagetitle.search(/Editing /) != 0) return; switch(wgAction){case 'submit': case 'edit': break; default: return}; // is this in the main namespace? If not, stop. if (wgNamespaceNumber) return;

// If editing a section, skip all of everything. pagetitle = $('#firstHeading').text;//Thanks, Ruakh! txt = " " + document.editform.wpTextbox1.value; txt = txt.substr (1, txt.length-1); oldtxt = txt; if (txt.length < 2) txt = " " + txt; //safety valves if (txt.search(/^#redirect \[/i) != -1) return; minorFormat; //minor format problems that must be dealt with first langHdrs;   //swap out {-en-} and such headLevel;  //correct known 3rd level heading level problems langHdrs;   //correct known language heading level problems langSubsts; //subst: all the language templates if (txt == " ") txt = ""; document.editform.wpTextbox1.value = txt;

if (txt != oldtxt) { window.status = "...clicking the [Show changes] button..."; setTimeout( "wiktClickMyDiff;", 2000 ); } } $( superAutoFormat ); /* end stuff copied from User:Connel MacKenzie/reformat.js */

//