User:MGSpiller/monobook.js

/*

function considerChangingExpiryFocus { return true; }

//todo function fixCreationLinks { //fix the links created in the table for preload templates, to allow multi-word terms // get page title var pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue; if (pagetitle.search(/Search/) != -1) { pagetitle = document.getElementById('contentSub').firstChild.nodeValue; pagetitle = pagetitle.replace(/For query /g, ""); pagetitle = pagetitle.replace(/\"/g, ""); }  if (pagetitle.search(/^Search results/) != -1) {    // find the spot to add our new tab    var edittabli = document.getElementById('preload-table');    //http://en.wiktionary.org/w/wiki.phtml?title=$1&action=edit&preload=Template:new_en_verb_past /* //so now, determine what the page name *should* be, and find the broken part in these links, and replace. javascript:(function{var i,c,x,h,t; for(i=0;x=document.links[i];++i) { h=x.getAttribute(%22href%22);   t=x.text;   if (t.search(/&action=edit&preload=Template:new/) != -1) {     h = h + t ;     t = t.replace(t, "basic");     x.text = t ;     x.href = h ;   //todo: make this work   }   //x.title += %22 %22 + x.innerHTML;    //x.appendChild(document.createTextNode(h));  } })  } }

// add "favorites" to navigation box thing on left column function addToNav { var lastnav = document.getElementById('n-sitesupport'); var newnav; var newa;

// get page title var pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue; if (pagetitle.search(/Search/) != -1) { pagetitle = document.getElementById('contentSub').firstChild.nodeValue; pagetitle = pagetitle.replace(/For query /g, ""); pagetitle = pagetitle.replace(/\"/g, ""); }  pagetitle = pagetitle.replace(/Editing /g, "");  var pageexternal = pagetitle.replace(/\ /g, "_");  var pageext =      pagetitle.replace(/\ /g, "+");

newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/Wiktionary:Beer parlour'; newa.appendChild(document.createTextNode('Beer Parlor')); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav); ta['Beer Parlor'] = new Array('','The rowdy place where policies are discussed in a chaotic manner');

//w:pagetitle newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='/wiki/w:' + pageexternal; newa.appendChild(document.createTextNode('w: ' + pagetitle)); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav); ta['w: ' + pagetitle] = new Array('','Wikipedia quicklink for this same title');

if (pagetitle == 'User:Connel MacKenzie') return;

//ARTFL: newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='http://machaut.uchicago.edu/?action=search&word=' + pageext + '&resource=Webster\'s&quicksearch=on' ; newa.appendChild(document.createTextNode('ARTFL:' + pagetitle)); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav); ta['ARTFL:' + pagetitle] = new Array('','Check for this title in Websters 1913 Dictionary');

//Google: newnav = document.createElement('li'); newa = document.createElement('a'); newa.href='http://print.google.com/print?q=' + pageext + '&btnG=Google+Search'; newa.appendChild(document.createTextNode('Google:' + pagetitle)); newnav.appendChild(newa); lastnav.parentNode.appendChild(newnav); ta['Google:' + pagetitle] = new Array('','Check for this title using Google');

//www.diclogos.org /* newnav = document.createElement('li') ; newf = document.createElement('form') ; newm = newf.createElement('method') ; newm.value = 'post' ; newf.appendChild(newm) ; newm = newf.createElement('action') ; newm.value = 'http://www.dicologos.org/pls/dictionary/new_dictionary.dic.main' ; newf.appendChild(newm) ; newIname = newf.form.createElement('input'); newm = newIname.createElement('type') ; newm.value = 'text' ; newIname.appendChild(newm) ; newm = newIname.createElement('name') ; newm.value = 'word' ; newIname.appendChild(newm) ; newm = newIname.createElement('size') ; newm.value = 12 ; newIname.appendChild(newm) ; newf.appendChild(newIname) ; newIname = newf.form.createElement('input') ; newm = newIname.createElement('type') ; newm.value = 'submit' ; newIname.appendChild(newm) ; newm = newIname.createElement('value') ; newm.value = 'Search' ; newIname.appendChild(newm) ; newf.appendChild(newIname) ; newnav.appendChild(newf) ; lastnav.parentNode.appendChild(newnav);

//http://www.cogsci.princeton.edu/cgi-bin/webwn2.0?stage=1&word= WordNet:

//http://foldoc.doc.ic.ac.uk/foldoc/foldoc.cgi?query=&action=Search FOLDOC:

//http://www.altavista.com/web/results?itag=wrx&q=&kgs=0&kls=0 Altavista:

//Probably good to have these links, to prove that our defs are generally different? //www.m-w.com + www.dictionary.com + collins + about.com + wordreference.com etc. //perhaps also to search for copyvios quickly. Hmmm. }

/* The variables "oldtxt" and "oldtext" determine which summary comments are added, AND whether or not to click the "Show changes" button. "oldtxt" is for clicking, while "oldtext" is used section-by-section. */

function minorFormat { var oldtext = txt; //note the regexp ?(onething|notherthing|otherthing) syntax that doesn't work as I thought txt = txt.replace(/\/gi, ""); //italics is  in wiki syntax txt = txt.replace(/\<\/i\>/gi, ""); //italics is  in wiki syntax txt = txt.replace(/\/gi, ""); //bold is  in wiki syntax txt = txt.replace(/\<\/b\>/gi, ""); //bold is  in wiki syntax // txt = txt.replace(/\/gi, "\n\n"); //break is  in wiki syntax // txt = txt.replace(/\<\/br\>/gi, "\n\n"); //break is  in wiki syntax txt = txt.replace(/\=\= /g, "=="); txt = txt.replace(/ \=\=/g, "=="); txt = txt.replace(/\{\{-en-\}\}/g, "==English=="); txt = txt.replace(/==\{\{en\}\}==/g, "==English=="); txt = txt.replace(/Morobashi/gi, "Morohashi"); txt = txt.replace(/\[\[comparative\]\]/gi, ""); txt = txt.replace(/\[\[superlative\]\]/gi, ""); txt = txt.replace(/\'\'comparative\'\'/gi, ""); txt = txt.replace(/\'\'superlative\'\'/gi, ""); txt = txt.replace(/\{\{top\}\}\</gi, "\n<"); txt = txt.replace(/\{\{mid\}\}\\n\n\<\!-- Change Part-Of-Speech on next line \(inside the======\'s\) to be correct.--\>\n/gi, "");    txt = txt.replace(/\<\!--\{\{wikipedia\}\} uncomment if you know there is a Wikipedia article--\>\n/gi, "");  if (txt != oldtext) {    if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", ";    document.editform.wpSummary.value += "format";  } }

function genderFmt { var oldtext = txt; //txt = txt.replace(/plural/gi, "plural"); // NOTE: this only "/gi" case insensitive search in this section - all others must be just "/g". txt = txt.replace(/ m/g, " "); // test this m txt = txt.replace(/m /g, " "); // test this m txt = txt.replace(/ f/g, " "); txt = txt.replace(/f /g, " "); txt = txt.replace(/ n/g, " "); txt = txt.replace(/n /g, " "); txt = txt.replace(/ c/g, " "); txt = txt.replace(/c /g, " "); txt = txt.replace(/ pl/g, " "); txt = txt.replace(/pl /g, " "); txt = txt.replace(/ s/g, " "); txt = txt.replace(/s /g, " "); txt = txt.replace(/m, f/g, ", "); txt = txt.replace(/m pl/g, " "); txt = txt.replace(/f pl/g, " "); txt = txt.replace(/m plural/g, " "); txt = txt.replace(/f plural/g, " "); txt = txt.replace(/\(plural \[/gi, "(plural: ["); txt = txt.replace(/\(plural /gi, "(plural: "); txt = txt.replace(/, plural '/gi, " (plural: '"); //note: this requires human help  if (txt != oldtext) {    if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", ";    document.editform.wpSummary.value += "";  } }

// get all the templates replaced function headLevel { // improper heading levels txt = txt.replace(/===English===\n/gi, "==English==\n"); //Insert a blank line after "==English==" txt = txt.replace(/==English==\n=/gi, "==English==\n\n="); txt = txt.replace(/==English==\n\{/gi, "==English==\n\n\{");

var oldtext = txt;

//depricated templates txt = txt.replace(/\{\{-noun-\}\}/g, "===Noun==="); txt = txt.replace(/\{\{-verb-\}\}/g, "===Verb==="); txt = txt.replace(/\{\{-etym-\}\}/g, "===Etymology==="); txt = txt.replace(/\{\{-adj-\}\}/g, "===Adjective==="); txt = txt.replace(/\{\{-syn-\}\}/g, "===Synonyms===");

txt = txt.replace(/\{\{trans\}\}/g, "Translations");

//really far-off entries txt = txt.replace(/\nadjective\n/gi, "\n===Adjective===\n"); txt = txt.replace(/\nadverb\n/gi, "\n===Adverb===\n"); txt = txt.replace(/\nnoun\n/gi, "\n===Noun===\n"); txt = txt.replace(/\nverb\n/gi, "\n===Verb===\n"); txt = txt.replace(/\ntranslation\n/gi, "\n===Translations===\n"); txt = txt.replace(/\ntranslations\n/gi, "\n===Translations===\n");

//first, correct case txt = txt.replace(/==adjective==/gi, "==Adjective=="); txt = txt.replace(/==\[\[adjective\]\]==/gi, "==Adjective=="); txt = txt.replace(/==adverb==/gi, "==Adverb=="); txt = txt.replace(/==\[\[adverb\]\]==/gi, "==Adverb=="); txt = txt.replace(/==antonyms==/gi, "==Antonyms=="); txt = txt.replace(/==\[\[antonyms\]\]==/gi, "==Antonyms=="); txt = txt.replace(/==cardinal number==/gi, "==Cardinal number=="); txt = txt.replace(/==number==/gi, "==Cardinal number=="); txt = txt.replace(/==derived expresson==/gi, "==Derived terms=="); txt = txt.replace(/==derived expression==/gi, "==Derived terms=="); txt = txt.replace(/==\[\[derived expression\]\]==/gi, "==Derived terms=="); txt = txt.replace(/==derived expressions==/gi, "==Derived terms=="); txt = txt.replace(/==\[\[derived expressions\]\]==/gi, "==Derived terms=="); txt = txt.replace(/==derived term==/gi, "==Derived terms=="); txt = txt.replace(/==\[\[derived term\]\]==/gi, "==Derived terms=="); txt = txt.replace(/==derived terms==/gi, "==Derived terms=="); txt = txt.replace(/==\[\[derived terms\]\]==/gi, "==Derived terms=="); txt = txt.replace(/==derived word==/gi, "==Derived terms=="); txt = txt.replace(/==\[\[derived word\]\]==/gi, "==Derived terms=="); txt = txt.replace(/==derived words==/gi, "==Derived terms=="); txt = txt.replace(/==\[\[derived words\]\]==/gi, "==Derived terms=="); txt = txt.replace(/==etymology==/gi, "==Etymology=="); txt = txt.replace(/==\[\[etymology\]\]==/gi, "==Etymology=="); txt = txt.replace(/==noun==/gi, "==Noun=="); txt = txt.replace(/==\[\[noun\]\]==/gi, "==Noun=="); txt = txt.replace(/==noun phrase==/gi, "==Noun=="); txt = txt.replace(/==\[\[noun phrase\]\]==/gi, "==Noun=="); txt = txt.replace(/==verbal phrase==/gi, "==Phrase=="); txt = txt.replace(/==\[\[verbal phrase\]\]==/gi, "==Phrase=="); txt = txt.replace(/==pronunciation==/gi, "==Pronunciation=="); txt = txt.replace(/==\[\[pronunciation\]\]==/gi, "==Pronunciation=="); txt = txt.replace(/==proper name==/gi, "==Proper noun=="); txt = txt.replace(/==\[\[proper name\]\]==/gi, "==Proper noun=="); txt = txt.replace(/==proper noun==/gi, "==Proper noun=="); txt = txt.replace(/==\[\[proper noun\]\]==/gi, "==Proper noun=="); txt = txt.replace(/==related words==/gi, "==Related terms=="); txt = txt.replace(/==\[\[related words\]\]==/gi, "==Related terms=="); txt = txt.replace(/==see also==/gi, "==See also=="); txt = txt.replace(/==\[\[see also\]\]==/gi, "==See also=="); txt = txt.replace(/==symbol==/gi, "==Symbol=="); txt = txt.replace(/==\[\[symbol\]\]==/gi, "==Symbol=="); txt = txt.replace(/==symbols==/gi, "==Symbol=="); txt = txt.replace(/==\[\[symbols\]\]==/gi, "==Symbol=="); txt = txt.replace(/==synonyms==/gi, "==Synonyms=="); txt = txt.replace(/==\[\[synonyms\]\]==/gi, "==Synonyms=="); txt = txt.replace(/==translation==/gi, "==Translations=="); txt = txt.replace(/==\[\[translation\]\]==/gi, "==Translations=="); txt = txt.replace(/==translations==/gi, "==Translations=="); txt = txt.replace(/==\[\[translations\]\]==/gi, "==Translations=="); txt = txt.replace(/==note==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[note\]\]==/gi, "==Usage notes=="); txt = txt.replace(/==notes==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[notes\]\]==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[usage note\]\]==/gi, "==Usage notes=="); txt = txt.replace(/==usage==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[usage\]\]==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[usage notes\]\]==/gi, "==Usage notes=="); txt = txt.replace(/==usages==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[usages\]\]==/gi, "==Usage notes=="); txt = txt.replace(/==usage note==/gi, "==Usage notes=="); txt = txt.replace(/==\[\[intransitive verb\]\]==/gi, "==Verb=="); txt = txt.replace(/==verb==/gi, "==Verb=="); txt = txt.replace(/==\[\[verb\]\]==/gi, "==Verb=="); //Ironically, all these spelling variations have been spotted in Wiktionary... txt = txt.replace(/==Variant form==/gi, "==Alternative forms=="); txt = txt.replace(/==Variant forms==/gi, "==Alternative forms=="); txt = txt.replace(/==Alternate form==/gi, "==Alternative forms=="); txt = txt.replace(/==Alternate forms==/gi, "==Alternative forms=="); txt = txt.replace(/==Alternative form==/gi, "==Alternative forms=="); txt = txt.replace(/==Alternative forms==/gi, "==Alternative forms=="); //Ironically, all these spelling variations have been spotted in Wiktionary... txt = txt.replace(/==Alternate spelling==/gi, "==Alternative spellings=="); txt = txt.replace(/==Alternate spellings==/gi, "==Alternative spellings=="); txt = txt.replace(/==Alternative spelling==/gi, "==Alternative spellings=="); txt = txt.replace(/==Other spellings==/gi, "==Alternative spellings=="); txt = txt.replace(/==Spelling variant==/gi, "==Alternative spellings=="); txt = txt.replace(/==Spelling variants==/gi, "==Alternative spellings=="); txt = txt.replace(/==Spelling variation==/gi, "==Alternative spellings=="); txt = txt.replace(/==Spelling variations==/gi, "==Alternative spellings=="); txt = txt.replace(/==spellings==/gi, "==Alternative spellings=="); txt = txt.replace(/==variant==/gi, "==Alternative spellings=="); txt = txt.replace(/==\[\[variant\]\]==/gi, "==Alternative spellings=="); txt = txt.replace(/==variant spelling==/gi, "==Alternative spellings=="); txt = txt.replace(/==variant spellings==/gi, "==Alternative spellings=="); txt = txt.replace(/==variants==/gi, "==Alternative spellings=="); txt = txt.replace(/==variation==/gi, "==Alternative spellings=="); txt = txt.replace(/==variations==/gi, "==Alternative spellings=="); txt = txt.replace(/==varieties==/gi, "==Alternative spellings=="); txt = txt.replace(/==Typographic variants==/gi, "==Alternative spellings=="); txt = txt.replace(/==Variant spelling==/gi, "==Alternative spellings=="); txt = txt.replace(/==Variant spellings==/gi, "==Alternative spellings=="); //then correct levels txt = txt.replace(/==Adjective==\n/gi, "===Adjective===\n"); txt = txt.replace(/==Adverb==\n/gi, "===Adverb===\n"); txt = txt.replace(/==Derived terms==\n/gi, "===Derived terms===\n"); txt = txt.replace(/==Etymology==\n/gi, "===Etymology===\n"); txt = txt.replace(/==Noun==\n/gi, "===Noun===\n"); txt = txt.replace(/==Pronunciation==\n/gi, "===Pronunciation===\n"); txt = txt.replace(/==See also==\n/gi, "===See also===\n"); txt = txt.replace(/==Related terms==\n/gi, "===Related terms===\n"); txt = txt.replace(/==Symbol==\n/gi, "===Symbol===\n"); txt = txt.replace(/==Symbols==\n/gi, "===Symbol===\n"); txt = txt.replace(/==Synonyms==\n/gi, "===Synonyms===\n"); txt = txt.replace(/==Translation==\n/gi, "====Translations====\n"); txt = txt.replace(/==Translations==\n/gi, "====Translations====\n"); txt = txt.replace(/==Usage note==\n/gi, "===Usage note===\n"); txt = txt.replace(/==Verb==\n/gi, "===Verb===\n"); txt = txt.replace(/\#\*\ \[\[Synonym\]\]s\n/gi, "===Synonyms===\n"); txt = txt.replace(/\#\*\ Synonyms\n/gi, "===Synonyms===\n"); //next line is controvercial? txt = txt.replace(/====Alternative spellings====\n/g, "===Alternative spellings===\n"); txt = txt.replace(/==Alternative spellings==\n/g, "===Alternative spellings===\n"); txt = txt.replace(/===Alternative spellings===\n\[/g, "===Alternative spellings===\n* ["); txt = txt.replace(/====Alternative forms====\n/g, "===Alternative forms===\n"); txt = txt.replace(/==Alternative forms==\n/g, "===Alternative forms===\n"); txt = txt.replace(/===Alternative forms===\n\[/g, "===Alternative forms===\n* ["); //todo: Ensure all headers are in Sentence case, not in Title Case. <-- BAH! Go after valid headers only. Leave all others on exception "todo2" list. if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "===Hdr==="; } }

function langHdrs { var oldtext = txt; txt = txt.replace(/===icelandic===\n/gi, "==Icelandic==\n"); txt = txt.replace(/===german===\n/gi, "==German==\n"); txt = txt.replace(/===french===\n/gi, "==French==\n"); txt = txt.replace(/===indonesian===\n/gi, "==Indonesian==\n"); txt = txt.replace(/===interlingua===\n/gi, "==Interlingua==\n"); txt = txt.replace(/===\[\[interlingua\]\]===\n/gi, "==Interlingua==\n"); txt = txt.replace(/===italian===\n/gi, "==Italian==\n"); txt = txt.replace(/===latin===\n/gi, "==Latin==\n"); txt = txt.replace(/===portuguese===\n/gi, "==Portuguese==\n"); txt = txt.replace(/===novial===\n/gi, "==Novial==\n"); txt = txt.replace(/===romanica===\n/gi, "==Romanica==\n"); txt = txt.replace(/===\[\[romanica\]\]===\n/gi, "==Romanica==\n"); txt = txt.replace(/===spanish===\n/gi, "==Spanish==\n"); txt = txt.replace(/===slovak===\n/gi, "==Slovak==\n"); txt = txt.replace(/==volapuk==/gi, "==Volapük=="); txt = txt.replace(/==\[\[volapuk\]\]==/gi, "==Volapük=="); txt = txt.replace(/==volapük==/gi, "==Volapük=="); txt = txt.replace(/==\[\[volapük\]\]==/gi, "==Volapük=="); txt = txt.replace(/==volapük word==/gi, "==Volapük=="); txt = txt.replace(/==\[\[volapük\]\] word==/gi, "==Volapük=="); txt = txt.replace(/===\[\[volapük\]\]===\n/gi, "==Volapük==\n"); txt = txt.replace(/===welsh===\n/gi, "==Welsh==\n"); txt = txt.replace(/===\[\[Chickasaw\]\]===\n/gi, "==Chickasaw==\n"); txt = txt.replace(/===Meanings===\n/gi, ""); if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "==Lang=="; } }

// do not do generic code here! Only sway two letter templates that *are* language names for translations // TODO: A smarter person would have list="af,am,an,ar,az,be..." function langSubsts { var oldtext = txt; txt = txt.replace(/\{\{en\}\}/g, ""); txt = txt.replace(/\{\{af\}\}/g, ""); txt = txt.replace(/\{\{am\}\}/g, ""); txt = txt.replace(/\{\{an\}\}/g, ""); txt = txt.replace(/\{\{ar\}\}/g, ""); txt = txt.replace(/\{\{az\}\}/g, ""); txt = txt.replace(/\{\{be\}\}/g, ""); txt = txt.replace(/\{\{bg\}\}/g, ""); txt = txt.replace(/\{\{bh\}\}/g, ""); txt = txt.replace(/\{\{br\}\}/g, ""); txt = txt.replace(/\{\{bs\}\}/g, ""); txt = txt.replace(/\{\{ca\}\}/g, ""); txt = txt.replace(/\{\{ch\}\}/g, ""); txt = txt.replace(/\{\{cr\}\}/g, ""); txt = txt.replace(/\{\{cs\}\}/g, ""); txt = txt.replace(/\{\{cy\}\}/g, ""); txt = txt.replace(/\{\{da\}\}/g, ""); txt = txt.replace(/\{\{de\}\}/g, ""); txt = txt.replace(/\{\{el\}\}/g, ""); txt = txt.replace(/\{\{eo\}\}/g, ""); txt = txt.replace(/\{\{es\}\}/g, ""); txt = txt.replace(/\{\{et\}\}/g, ""); txt = txt.replace(/\{\{eu\}\}/g, ""); txt = txt.replace(/\{\{fa\}\}/g, ""); txt = txt.replace(/\{\{fi\}\}/g, ""); txt = txt.replace(/\{\{fj\}\}/g, ""); txt = txt.replace(/\{\{fo\}\}/g, ""); txt = txt.replace(/\{\{fr\}\}/g, ""); txt = txt.replace(/\{\{fy\}\}/g, ""); txt = txt.replace(/\{\{ga\}\}/g, ""); txt = txt.replace(/\{\{gl\}\}/g, ""); txt = txt.replace(/\{\{gn\}\}/g, ""); txt = txt.replace(/\{\{gu\}\}/g, ""); txt = txt.replace(/\{\{gv\}\}/g, ""); txt = txt.replace(/\{\{he\}\}/g, ""); txt = txt.replace(/\{\{hi\}\}/g, ""); txt = txt.replace(/\{\{hr\}\}/g, ""); txt = txt.replace(/\{\{hu\}\}/g, ""); txt = txt.replace(/\{\{hy\}\}/g, ""); txt = txt.replace(/\{\{ia\}\}/g, ""); txt = txt.replace(/\{\{id\}\}/g, ""); txt = txt.replace(/\{\{io\}\}/g, ""); txt = txt.replace(/\{\{is\}\}/g, ""); txt = txt.replace(/\{\{it\}\}/g, ""); txt = txt.replace(/\{\{ja\}\}/g, ""); txt = txt.replace(/\{\{jp\}\}/g, ""); txt = txt.replace(/\{\{jv\}\}/g, ""); txt = txt.replace(/\{\{ka\}\}/g, ""); txt = txt.replace(/\{\{kk\}\}/g, ""); txt = txt.replace(/\{\{km\}\}/g, ""); txt = txt.replace(/\{\{kn\}\}/g, ""); txt = txt.replace(/\{\{ko\}\}/g, ""); txt = txt.replace(/\{\{kr\}\}/g, ""); txt = txt.replace(/\{\{ku\}\}/g, ""); txt = txt.replace(/\{\{kw\}\}/g, ""); txt = txt.replace(/\{\{la\}\}/g, ""); txt = txt.replace(/\{\{lb\}\}/g, ""); txt = txt.replace(/\{\{li\}\}/g, ""); txt = txt.replace(/\{\{lo\}\}/g, ""); txt = txt.replace(/\{\{lt\}\}/g, ""); txt = txt.replace(/\{\{lv\}\}/g, ""); txt = txt.replace(/\{\{ma\}\}/g, ""); txt = txt.replace(/\{\{mh\}\}/g, ""); txt = txt.replace(/\{\{mi\}\}/g, ""); txt = txt.replace(/\{\{mk\}\}/g, ""); txt = txt.replace(/\{\{ml\}\}/g, ""); txt = txt.replace(/\{\{mn\}\}/g, ""); txt = txt.replace(/\{\{mr\}\}/g, ""); txt = txt.replace(/\{\{ms\}\}/g, ""); txt = txt.replace(/\{\{mt\}\}/g, ""); txt = txt.replace(/\{\{my\}\}/g, ""); txt = txt.replace(/\{\{ne\}\}/g, ""); txt = txt.replace(/\{\{nl\}\}/g, ""); txt = txt.replace(/\{\{nn\}\}/g, ""); txt = txt.replace(/\{\{no\}\}/g, ""); txt = txt.replace(/\{\{oc\}\}/g, ""); txt = txt.replace(/\{\{pl\}\}/g, ""); txt = txt.replace(/\{\{pt\}\}/g, ""); txt = txt.replace(/\{\{ro\}\}/g, ""); txt = txt.replace(/\{\{ru\}\}/g, ""); txt = txt.replace(/\{\{sa\}\}/g, ""); txt = txt.replace(/\{\{si\}\}/g, ""); txt = txt.replace(/\{\{sk\}\}/g, ""); txt = txt.replace(/\{\{sl\}\}/g, ""); txt = txt.replace(/\{\{sm\}\}/g, ""); txt = txt.replace(/\{\{sq\}\}/g, ""); txt = txt.replace(/\{\{sr\}\}/g, ""); txt = txt.replace(/\{\{su\}\}/g, ""); txt = txt.replace(/\{\{sv\}\}/g, ""); txt = txt.replace(/\{\{Sv\}\}/g, ""); txt = txt.replace(/\{\{sw\}\}/g, ""); txt = txt.replace(/\{\{ta\}\}/g, ""); txt = txt.replace(/\{\{te\}\}/g, ""); txt = txt.replace(/\{\{th\}\}/g, ""); txt = txt.replace(/\{\{tl\}\}/g, ""); txt = txt.replace(/\{\{tm\}\}/g, ""); txt = txt.replace(/\{\{tr\}\}/g, ""); txt = txt.replace(/\{\{tt\}\}/g, ""); txt = txt.replace(/\{\{ua\}\}/g, ""); txt = txt.replace(/\{\{uk\}\}/g, ""); txt = txt.replace(/\{\{ur\}\}/g, ""); txt = txt.replace(/\{\{uz\}\}/g, ""); txt = txt.replace(/\{\{vi\}\}/g, ""); txt = txt.replace(/\{\{vo\}\}/g, ""); txt = txt.replace(/\{\{wa\}\}/g, ""); txt = txt.replace(/\{\{xh\}\}/g, ""); txt = txt.replace(/\{\{yi\}\}/g, ""); txt = txt.replace(/\{\{yo\}\}/g, ""); txt = txt.replace(/\{\{zh\}\}/g, ""); txt = txt.replace(/\{\{zu\}\}/g, ""); txt = txt.replace(/\{\{alb\}\}/g, ""); txt = txt.replace(/\{\{ang\}\}/g, ""); txt = txt.replace(/\{\{arm\}\}/g, ""); txt = txt.replace(/\{\{arn\}\}/g, ""); txt = txt.replace(/\{\{ast\}\}/g, ""); txt = txt.replace(/\{\{bns\}\}/g, ""); txt = txt.replace(/\{\{bos\}\}/g, ""); txt = txt.replace(/\{\{chr\}\}/g, ""); txt = txt.replace(/\{\{cic\}\}/g, ""); txt = txt.replace(/\{\{fur\}\}/g, ""); txt = txt.replace(/\{\{gmh\}\}/g, ""); txt = txt.replace(/\{\{goh\}\}/g, ""); txt = txt.replace(/\{\{got\}\}/g, ""); txt = txt.replace(/\{\{grc\}\}/g, ""); txt = txt.replace(/\{\{haw\}\}/g, ""); txt = txt.replace(/\{\{kky\}\}/g, ""); txt = txt.replace(/\{\{kld\}\}/g, ""); txt = txt.replace(/\{\{mdf\}\}/g, ""); txt = txt.replace(/\{\{nap\}\}/g, ""); txt = txt.replace(/\{\{non\}\}/g, ""); txt = txt.replace(/\{\{pap\}\}/g, ""); txt = txt.replace(/\{\{pms\}\}/g, ""); txt = txt.replace(/\{\{rap\}\}/g, ""); txt = txt.replace(/\{\{scn\}\}/g, ""); txt = txt.replace(/\{\{sco\}\}/g, ""); txt = txt.replace(/\{\{tlh\}\}/g, ""); txt = txt.replace(/\{\{tyv\}\}/g, ""); txt = txt.replace(/\{\{vec\}\}/g, ""); txt = txt.replace(/\{\{wen\}\}/g, ""); // to me, these next few need to be reviewed quite closely! Obviously, not ISO 639-3. txt = txt.replace(/\{\{it-bo\}\}/g, ""); txt = txt.replace(/\{\{it-br\}\}/g, ""); txt = txt.replace(/\{\{it-ge\}\}/g, ""); txt = txt.replace(/\{\{it-mn\}\}/g, ""); txt = txt.replace(/\{\{it-mo\}\}/g, ""); txt = txt.replace(/\{\{it-pr\}\}/g, ""); txt = txt.replace(/\{\{el-it\}\}/g, ""); txt = txt.replace(/\{\{pt-br\}\}/g, ""); txt = txt.replace(/\{\{pt-pt\}\}/g, ""); txt = txt.replace(/\{\{zh-tc\}\}/g, ""); txt = txt.replace(/\{\{nl-vla\}\}/g, ""); txt = txt.replace(/\{\{nap-cal\}\}/g, ""); txt = txt.replace(/\{\{eml-rom\}\}/g, ""); txt = txt.replace(/\{\{gstr/g, "{{subst"+":gstr"); if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "{{subst:lang}}"; } }

// Get all the wikified common languages French, Dutch, German etc. de-wikified. //From a list of langs, search for translation style and heading style and correct both //italian,french,german,spanish,japanese,serbian,latin,swedish,dutch,finnish,russian,norwegian,bosnian, //esperanto,chinese,portuguese,irish,polish,slovak,czech,danish,greek,hebrew,turkish,welsh, //hungarian,korean,arabic,romanian,indonesian,croatian,vietnamese,bulgarian,hindi, //filipino,icelandic,albanian,sanskrit,slovene,thai,yiddish,  **TOP40** //,tamil,urdu,balinese,afrikaans,kurdish,hawaiian,swahili,scots,fijian,zulu,cantonese, function deWikify { var oldtext = txt; txt = txt.replace(/\*\[\[Italian\]\]:/gi, "*Italian:"); txt = txt.replace(/\*\[\[French\]\]:/gi, "*French:"); txt = txt.replace(/\*\[\[German\]\]:/gi, "*German:"); txt = txt.replace(/\*\[\[Spanish\]\]:/gi, "*Spanish:"); txt = txt.replace(/\*\[\[Japanese\]\]:/gi, "*Japanese:"); txt = txt.replace(/\*\[\[Serbian\]\]:/gi, "*Serbian:"); txt = txt.replace(/\*\[\[Latin\]\]:/gi, "*Latin:"); txt = txt.replace(/\*\[\[Swedish\]\]:/gi, "*Swedish:"); txt = txt.replace(/\*\[\[Dutch\]\]:/gi, "*Dutch:"); txt = txt.replace(/\*\[\[Finnish\]\]:/gi, "*Finnish:"); txt = txt.replace(/\*\[\[Russian\]\]:/gi, "*Russian:"); txt = txt.replace(/\*\[\[Norwegian\]\]:/gi, "*Norwegian:"); txt = txt.replace(/\*\[\[Bosnian\]\]:/gi, "*Bosnian:"); // txt = txt.replace(/\*\[\[Esperanto\]\]:/gi, "*Esperanto:"); txt = txt.replace(/\*\[\[Chinese\]\]:/gi, "*Chinese:"); txt = txt.replace(/\*\[\[Portuguese\]\]:/gi, "*Portuguese:"); // txt = txt.replace(/\*\[\[Irish\]\]:/gi, "*Irish:"); txt = txt.replace(/\*\[\[Polish\]\]:/gi, "*Polish:"); txt = txt.replace(/\*\[\[Slovak\]\]:/gi, "*Slovak:"); txt = txt.replace(/\*\[\[Czech\]\]:/gi, "*Czech:"); txt = txt.replace(/\*\[\[Danish\]\]:/gi, "*Danish:"); txt = txt.replace(/\*\[\[Greek\]\]:/gi, "*Greek:"); txt = txt.replace(/\*\[\[Hebrew\]\]:/gi, "*Hebrew:"); txt = txt.replace(/\*\[\[Turkish\]\]:/gi, "*Turkish:"); txt = txt.replace(/\*\[\[Welsh\]\]:/gi, "*Welsh:"); txt = txt.replace(/\*\[\[Hungarian\]\]:/gi, "*Hungarian:"); txt = txt.replace(/\*\[\[Korean\]\]:/gi, "*Korean:"); txt = txt.replace(/\*\[\[Arabic\]\]:/gi, "*Arabic:"); txt = txt.replace(/\*\[\[Romanian\]\]:/gi, "*Romanian:"); txt = txt.replace(/\*\[\[Indonesian\]\]:/gi, "*Indonesian:"); txt = txt.replace(/\*\[\[Croatian\]\]:/gi, "*Croatian:"); txt = txt.replace(/\*\[\[Vietnamese\]\]:/gi, "*Vietnamese:"); txt = txt.replace(/\*\[\[Bulgarian\]\]:/gi, "*Bulgarian:"); txt = txt.replace(/\*\[\[Hindi\]\]:/gi, "*Hindi:"); txt = txt.replace(/\*\[\[Filipino\]\]:/gi, "*Filipino:"); txt = txt.replace(/\*\[\[Icelandic\]\]:/gi, "*Icelandic:"); txt = txt.replace(/\*\[\[Albanian\]\]:/gi, "*Albanian:"); txt = txt.replace(/\*\[\[Sanskrit\]\]:/gi, "*Sanskrit:"); txt = txt.replace(/\*\[\[Slovene\]\]:/gi, "*Slovene:"); txt = txt.replace(/\*\[\[Thai\]\]:/gi, "*Thai:"); // txt = txt.replace(/\*\[\[Yiddish\]\]:/gi, "*Yiddish:"); //txt = txt.replace(/\*\[\[Tamil\]\]:/gi, "*Tamil:"); //txt = txt.replace(/\*\[\[Urdu\]\]:/gi, "*Urdu:"); //txt = txt.replace(/\*\[\[Balinese\]\]:/gi, "*Balinese:"); //txt = txt.replace(/\*\[\[Afrikaans\]\]:/gi, "*Afrikaans:"); //txt = txt.replace(/\*\[\[Kurdish\]\]:/gi, "*Kurdish:"); //txt = txt.replace(/\*\[\[Hawaiian\]\]:/gi, "*Hawaiian:"); //txt = txt.replace(/\*\[\[Swahili\]\]:/gi, "*Swahili:"); //txt = txt.replace(/\*\[\[Scots\]\]:/gi, "*Scots:"); //txt = txt.replace(/\*\[\[Fijian\]\]:/gi, "*Fijian:"); //txt = txt.replace(/\*\[\[Zulu\]\]:/gi, "*Zulu:"); //txt = txt.replace(/\*\[\[Cantonese\]\]:/gi, "*Cantonese:"); txt = txt.replace(/==\[\[Italian\]\]==/gi, "==Italian=="); txt = txt.replace(/==\[\[French\]\]==/gi, "==French=="); txt = txt.replace(/==\[\[German\]\]==/gi, "==German=="); txt = txt.replace(/==\[\[Spanish\]\]==/gi, "==Spanish=="); txt = txt.replace(/==\[\[Japanese\]\]==/gi, "==Japanese=="); txt = txt.replace(/==\[\[Serbian\]\]==/gi, "==Serbian=="); txt = txt.replace(/==\[\[Latin\]\]==/gi, "==Latin=="); txt = txt.replace(/==\[\[Swedish\]\]==/gi, "==Swedish=="); txt = txt.replace(/==\[\[Dutch\]\]==/gi, "==Dutch=="); txt = txt.replace(/==\[\[Finnish\]\]==/gi, "==Finnish=="); txt = txt.replace(/==\[\[Russian\]\]==/gi, "==Russian=="); txt = txt.replace(/==\[\[Norwegian\]\]==/gi, "==Norwegian=="); txt = txt.replace(/==\[\[Bosnian\]\]==/gi, "==Bosnian=="); // txt = txt.replace(/==\[\[Esperanto\]\]==/gi, "==Esperanto=="); txt = txt.replace(/==\[\[Chinese\]\]==/gi, "==Chinese=="); txt = txt.replace(/==\[\[Portuguese\]\]==/gi, "==Portuguese=="); // txt = txt.replace(/==\[\[Irish\]\]==/gi, "==Irish=="); txt = txt.replace(/==\[\[Polish\]\]==/gi, "==Polish=="); txt = txt.replace(/==\[\[Slovak\]\]==/gi, "==Slovak=="); txt = txt.replace(/==\[\[Czech\]\]==/gi, "==Czech=="); txt = txt.replace(/==\[\[Danish\]\]==/gi, "==Danish=="); txt = txt.replace(/==\[\[Greek\]\]==/gi, "==Greek=="); txt = txt.replace(/==\[\[Hebrew\]\]==/gi, "==Hebrew=="); txt = txt.replace(/==\[\[Turkish\]\]==/gi, "==Turkish=="); // txt = txt.replace(/==\[\[Welsh\]\]==/gi, "==Welsh=="); txt = txt.replace(/==\[\[Hungarian\]\]==/gi, "==Hungarian=="); txt = txt.replace(/==\[\[Korean\]\]==/gi, "==Korean=="); txt = txt.replace(/==\[\[Arabic\]\]==/gi, "==Arabic=="); txt = txt.replace(/==\[\[Romanian\]\]==/gi, "==Romanian=="); txt = txt.replace(/==\[\[Indonesian\]\]==/gi, "==Indonesian=="); txt = txt.replace(/==\[\[Croatian\]\]==/gi, "==Croatian=="); txt = txt.replace(/==\[\[Vietnamese\]\]==/gi, "==Vietnamese=="); txt = txt.replace(/==\[\[Bulgarian\]\]==/gi, "==Bulgarian=="); txt = txt.replace(/==\[\[Hindi\]\]==/gi, "==Hindi=="); txt = txt.replace(/==\[\[Filipino\]\]==/gi, "==Filipino=="); txt = txt.replace(/==\[\[Icelandic\]\]==/gi, "==Icelandic=="); txt = txt.replace(/==\[\[Albanian\]\]==/gi, "==Albanian=="); txt = txt.replace(/==\[\[Sanskrit\]\]==/gi, "==Sanskrit=="); txt = txt.replace(/==\[\[Slovene\]\]==/gi, "==Slovene=="); txt = txt.replace(/==\[\[Thai\]\]==/gi, "==Thai=="); // txt = txt.replace(/==\[\[Yiddish\]\]==/gi, "==Yiddish=="); //txt = txt.replace(/==\[\[Tamil\]\]==/gi, "==Tamil=="); //txt = txt.replace(/==\[\[Urdu\]\]==/gi, "==Urdu=="); //txt = txt.replace(/==\[\[Balinese\]\]==/gi, "==Balinese=="); //txt = txt.replace(/==\[\[Afrikaans\]\]==/gi, "==Afrikaans=="); //txt = txt.replace(/==\[\[Kurdish\]\]==/gi, "==Kurdish=="); //txt = txt.replace(/==\[\[Hawaiian\]\]==/gi, "==Hawaiian=="); //txt = txt.replace(/==\[\[Swahili\]\]==/gi, "==Swahili=="); //txt = txt.replace(/==\[\[Scots\]\]==/gi, "==Scots=="); //txt = txt.replace(/==\[\[Fijian\]\]==/gi, "==Fijian=="); //txt = txt.replace(/==\[\[Zulu\]\]==/gi, "==Zulu=="); //txt = txt.replace(/==\[\[Cantonese\]\]==/gi, "==Cantonese=="); txt = txt.replace(/==\[\[w\:Koine Greek\|Koine Greek\]\]==/gi, "==Ancient Greek=="); txt = txt.replace(/==\[\[w:Koine Greek\|Koine Greek\]\]==/gi, "==Ancient Greek=="); txt = txt.replace(/==\[\[w\:Koine Greek|Koine Greek\]\]==/gi, "==Ancient Greek=="); txt = txt.replace(/==\[\[w:Koine Greek|Koine Greek\]\]==/gi, "==Ancient Greek=="); if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "dewikify common langs"; } }

function notEnglishInflection { var oldtext = txt;

//On lines following heading lines (===Noun===) that start with "#", ensure stem plus [c] // or [u] or plural form are present, wikified properly. If not, add "s" to end of //stem-word, pop up a warning saying that this may be pluralizing it wrong, and go.

//for now, quick and dirty replacement if missing entirely. (Should the 'often' incorrect plural just be skipped?) txt = txt.replace(/===Noun===\n\#/g, "===Noun===\n\n\n\#"); txt = txt.replace(/===Proper noun===\n\#/g, "===Proper noun===\n\n\n\#");

//On lines following "===Adjective===" that start with a "#", ensure and  are there (even if they say "none".)  <--bogus. txt = txt.replace(/===Adjective===\n\#/g, "===Adjective===\n\n\n\#");

//On lines following "===Adverb===" that start with a "#", ensure and  are there (even if they say "none".) <-- bogus txt = txt.replace(/===Adverb===\n\#/g, "===Adverb===\n\n\n\#");

//todo: rework this section once Polyglot has the template politics sorted out //on lines following "===Verb===" that start with "'", ensure that past, participle and third person forms are mentioned, otherwise add a {{en-infl... template txt = txt.replace(/===Verb===\n\#/g, "===Verb===\n\n\n\#");

if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "{{infl}}"; } }

function englishInflection { var oldtext = txt;

//On lines following heading lines (===Noun===) that start with "#", ensure stem plus [c] // or [u] or plural form are present, wikified properly. If not, add "s" to end of //stem-word, pop up a warning saying that this may be pluralizing it wrong, and go.

//for now, quick and dirty replacement if missing entirely. (Should the 'often' incorrect plural just be skipped?) txt = txt.replace(/===Noun===\n\#/g, "===Noun===\n\n\n\n\n\n\#"); txt = txt.replace(/===Proper noun===\n\#/g, "===Proper noun===\n\n\n\#");

//On lines following "===Adjective===" that start with a "#", ensure and  are there (even if they say "none".)  <--bogus. // txt = txt.replace(/===Adjective===\n\#/g, "===Adjective===\n\<\!--Pick one or more of the following:-->\n'\n'  (no  or )\n'  (: more , : most )\n'\n\n\#"); txt = txt.replace(/===Adjective===\n\#/g, "===Adjective===\n\<\!--Pick one or more of the following:-->\n'\n' (no  or )\n'  (: more , : most )\n'  (: er, : est)\n\n\#");

//On lines following "===Adverb===" that start with a "#", ensure and  are there (even if they say "none".) <-- bogus txt = txt.replace(/===Adverb===\n\#/g, "===Adverb===\n\n\n\#"); // txt = txt.replace(/===Adverb===\n\#/g, "===Adverb===\n  (: er, : est)\n\n\#");

//todo: rework this section once Polyglot has the template politics sorted out //on lines following "===Verb===" that start with "'", ensure that past, participle and third person forms are mentioned, otherwise add a {{en-infl... template txt = txt.replace(/Verb===\n\#/gi, "Verb===\n{{en-infl-reg-consonant-y|||}}\n{{en-infl-reg-consonant|||}}\n{{en-infl-reg-sibilant|||}}\n{{en-infl-reg-other-e||e}}\n{{en-infl-reg-ie||e}}\n{{en-infl-reg-vowel-e||e}}\n\n\#");

if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "{{infl}} (en)"; } }

//Inflection lines: TODO separate code for entries that have ==English==. //this gets about 80% right. Perfectly acceptable to have many languages, but for //horribly formatted entries, there is usually only one language. Entries with //multiple languages tend to be pretty clean, comparatively. This code needs to be //rewritten when I figure out the Russian technique of selecting text-sections. (Or //rather, how to implement that here.) function inflLine {

//momentarily remove extra blank lines txt = txt.replace(/verb===\n\n/gi, "Verb===\n"); txt = txt.replace(/===noun===\n\n/gi, "===Noun===\n"); txt = txt.replace(/===proper noun===\n\n/gi, "===Proper noun===\n"); txt = txt.replace(/===adjective===\n\n/gi, "===Adjective===\n"); txt = txt.replace(/===adverb===\n\n/gi, "===Adverb===\n");

if (txt.search(/==English==\n/) == -1) { notEnglishInflection; } else { englishInflection; } //todo then do the ones that are common to both...Proper noun...Phrase...etc. }

//Next, on lines that start with "#" (therefore definitions) skip the, (qualifiers) and // punctuation: then capitalize first letter of first sentence, pipe-syntax-wikified if needed. Ensure // period is at end of line (except quotes and parens, of course.)

//todo: make sure templates that are not in all upper-case start with a lower case character

//todo: flag or just replace "===Transitive verb===" with "===Verb===" <-- WS:BP first

//todo: count heading level. If heading level is four, and last heading level was 2, warn or fix or something. (Note: if level is 2, and last level was 2, 3, 4, or 5, it is still ok)

//todo: If English not first heading, and there is no 2nd level header, add "==English=="

//todo: If English appears elsewhere, and another language is in front, swap sections (Separate w/ "".)

//todo: Remove "" except once between English and all other language.

//todo: move all category links to bottom

//todo: move all interwiki links even more bottomer.

//todo: "subst:" all etymology Webster templates ending in a period. Discuss on WS:BP first.

//todo: Alphabetize Part Of Speech sections

//prep tables for balancing... function transTable { var oldtext = txt; txt = txt.replace(/\<\!--left column--\>\n/gi, ""); txt = txt.replace(/\<\!--right column--\>\n/gi, ""); txt = txt.replace(/\<\!--languages from A to I go here--\>\n/gi, ""); txt = txt.replace(/\<\!--Put translations for languages from A to I here--\>\n/gi, ""); txt = txt.replace(/\<\!--languages from A to M go here--\>\n/gi, ""); txt = txt.replace(/\<\!--languages from N to Z go here--\>\n/gi, ""); txt = txt.replace(/\<\!--languages from J to Z go here--\>\n/gi, ""); txt = txt.replace(/\<\!--Put translations for languages from J to Z here--\>\n/gi, ""); txt = txt.replace(/\{\| border=0 width=100\%\n\|-\n\|bgcolor=\"\#FFFFE0\" valign=top width=48\%\|\n\{\|/gi, ""); txt = txt.replace(/\{\| border=0 width=100\%\n\|-\n\|bgcolor=\"\#FFFFE0\" valign=top width=48\%\|\n\{\|/gi, ""); txt = txt.replace(/\|\}\n\| width=1\% \|\n\|bgcolor=\"\#FFFFE0\" valign=top width=48\%\|\n\{\|/gi, ""); txt = txt.replace(/\|\}\n\|\}/gi, "");

//rewrite the tables auto-balancing code here... //Note that it will need the Russian's area-selection logic applied to it /* pg	;balance columns for a "Names" page (all in 4 columns) w !,"Paste text of entire page with sections to be balanced:",! k x,y r y(1) f k=2:1 r !,y(k):5 q:'$t w #,!!!,y(1) f m=2:1:k d	.i y(m)'?1"==".e w !,y(m) q	.w !,y(m) s x(1)=y(m) .f l=2:0 q:'$d(y(m+1)) q:y(m+1)?1"==".e  q:y(m+1)?1"{{".e1"index-".e  d	..s m=m+1 ..s x(l)=y(m) ..s l=l+1 .s i=l-1 d mid4 w ! q top4	;balance columns w !,"Paste text of section to be balanced:",! r x(1) f i=2:1 r !,x(i):5 q:'$t w #,!!!,x(1) mid4	s cnt=0,i=i-1,c=0 f j=2:1:i i x(j)?1"{".e k x(j) f j=2:1:i i $g(x(j))?1"|".e k x(j) f j=2:1:i i $tr($g(x(j))," ","")="" k x(j) f j=2:1:i i $g(x(j))?1"''Section".e w !,x(j) k x(j) f j=2:1:i i $d(x(j)) s cnt=cnt+1 i x(1)["Translation" d q	.w !,"" .f j=2:1:i i $d(x(j)) s c=c+1 w:c=cnt\2 !,"" w !,x(j) .w !,"" q:cnt<1 w !,"{{top4}}" s tcnt=cnt,cnt=$s(cnt#4:1,1:0)+(cnt\4),md=0 f j=2:1:i i $d(x(j)) s c=c+1 d:c>cnt w !,x(j) .w !,"{{mid4}}" s c=1 s md=md+1 .i j=4,tcnt=5 s cnt=cnt-1 .i j=4,tcnt=6 s cnt=cnt-1 .i j=7,tcnt=9 s cnt=cnt-1 i md<3 w:md<1 !,"{{mid4}}" w:md<2 !,"{{mid4}}" w !,"{{mid4}}" w !,"{{bottom}}" q if (txt != oldtext) { if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; document.editform.wpSummary.value += "{{top/mid/bot}}"; } }

function superAutoFormat { // get page title pagetitle = document.getElementById('content').getElementsByTagName('h1').item(0).firstChild.nodeValue; if (pagetitle.search(/Editing /) == -1) return; pagetitle = pagetitle.replace(/Editing /g, ""); pageexternal = pagetitle.replace(/\ /g, "_");

// is this in the main namespace? If not, stop. if (pagetitle.search(/\:/) != -1) return;

txt = " " + document.editform.wpTextbox1.value; txt = txt.substr (1, txt.length-1); var oldtxt = txt; if (txt.length < 2) txt = " " + txt;

// change me, if not exiting properly / {{PAGENAMEE}}

txt = txt.replace(/\{\{PAGENAMEE\}\}/g, pageexternal); txt = txt.replace(/\{\{PAGENAME\}\}/g, pagetitle); txt = txt.replace(/\{\{subst:PAGENAME\}\}/g, pagetitle);

minorFormat; //minor format problems that must be dealt with first // genderFmt;   //format gender from italics to template langHdrs;   //spap 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 deWikify;   //de-wikify all "common" languages //todo: limit formatting of inflections and such to ==English== section only? inflLine;   //add an "inflection" line if missing transTable; //reformat translations tables, balance columns (todo)

txt = txt.replace(/\{\{PAGENAMEE\}\}/g, pageexternal); txt = txt.replace(/\{\{PAGENAME\}\}/g, pagetitle); txt = txt.replace(/\{\{subst:PAGENAME\}\}/g, pagetitle);

if (txt == " ") txt = "";

document.editform.wpTextbox1.value = txt;

//document.editform.wpSummary.value = document.forms.length;

if (txt != oldtxt) { //comments now added for specific sections only. if (document.editform.wpSummary.value == "") document.editform.wpSummary.value = "fmt"; //if (document.editform.wpSummary.value != "") document.editform.wpSummary.value += ", "; //document.editform.wpSummary.value += "+format"; document.editform.wpDiff.click; } }

function punishWikiServers { /* No, this is not a crazy mass attack. OK, I should rename the function, but you get the idea...every 5 seconds load a new window in edit mode, and let the other portions of this javascript do the dirtywork to the given page. So, when I load one of my three special cleanup pages...my generated "todo" list, this section of code will start opening new windows like a porn site gone mad. The auto-formatting of those pages is not perfect (especially considering that these are "cleanup" lists) so I'll have to come back and ALT-S them each after the show changes, anyway.

I actually think this will be nicer to the servers. They seem to choke when I try to manually open 20 pages. At least this way, there'll be *some* delay between each new page open. */ var i,x,h,url,z document.editform.wpSummary.value = ""; for (i=0; i<160; i++) { h = document.links[i] ; //.getAttribute(%22href%22); url = h.toString; if (url.search(/action=edit/) != -1) { z = window.open(url); //sleep(5000); //milliseconds, right? } }  }

function reformatMyPage { addToNav ; //fixCreationLinks ; superAutoFormat ; //if (pagetitle.search("MacKenzie\/todo") != -1) { //punishWikiServers; //}

//Let this happen on MediaWiki:Nogomatch instead. //nogomatchHideInputBoxen; }

var hack = 'failed'; var hack_pagetitle =''; if (window.addEventListener) window.addEventListener("load",reformatMyPage,false); else if (window.attachEvent) window.attachEvent("onload",reformatMyPage);

//Remember to start by opening Tools, Web Development, JavaScript Console...

/*

//Remember to start by opening Tools, Web Development, JavaScript Console...

// User:Lupin/popups.js

mw.loader.load(            'https://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'             + '&action=raw&ctype=text/javascript&dontcountme=s');