User:Balyozxane/newentrywiz.js

//repurposing User:Yair rand/newentrywiz.js for kmr only // buttons and prefilling via GET is taken from User:So9q/new-entry-creator.js // todo: clean, jQuerize, use langmetadata, let users extend this /* jshint sub:true, shadow:true, undef:true, unused:true, strict:true, forin:true, latedef:true */ /* global jQuery */ // // Initialize variables // Support prefilling via GET

function capitalize(s) { if (typeof s !== 'string') return ''; return s.charAt(0).toUpperCase + s.slice(1); }

if (mw.util.getParamValue('ct') == 'true') { var necdata = { pos: mw.util.getParamValue('pos'), pos2: capitalize(mw.util.getParamValue('pos')), };	var def2 =  + mw.util.getParamValue('def') + ; var neccode = mw.util.getParamValue('lang'); var transc = mw.util.getParamValue('transc'); var gender = mw.util.getParamValue('gender'); } else { neccode = typeof window.NEC_default_lang == "undefined" ? 'kmr' : window.NEC_default_lang; var necdata = { pos: "noun", pos2: "Noun" };	}

var necdefs = [ ['', [],		[],		[],		[],		[]	] ]; var necpost = [];

for (var i = 4; i <= 19; ++i) { necpost[i] = []; }

var necpostT = []; //ji bo şablonan

for (var i = 0; i <= 9; ++i) { necpostT[i] = []; }

var necpostlangtext = [];

var title = mw.config.get('wgTitle');

var necinfls = { kmr: { noun: [, ['Gender', , [ ['Unknown', gender ? '|' + gender : ''], ['masculine', '|m'], ['feminine', '|f'], ['masc/fem', '|mf'], ['m-p', '|m-p'], ['f-p', '|f-p'], ]]		],		adjective: [, ['Comp?', , [ ['Unknown', ''], ['comp+', '|c=+'], ]]		],		verb: [, ['Third-person singular present tense', , [ ['input', 'Other: ', '|'] ]],			['Past tense', '', [ ['input', 'Other: ', '|'] ]],		],	},

};

/*

Notes: necfunction fills in the edit box necfunction2 creates the main menu stuff inside the span id'd necblah necfunction3 doesn't exist necfunction4 goes to necfunction5 (don't remember what this was for) necfunction5 creates the inflections options by filling in necinfls necfunction6 does some extra junk for the infl options input boxes necdefupdate makes the definitions/example sentence options necpostbox makes the extra junk ("More details") work (i think)

More recent note: I knew next to nothing about javascript when I originally wrote this, so the code is an utter mess. It's also probably never going to be fixed up because really, I'd rather work on making WT:EDIT stuff the primary easy-editing method instead of tools like this.

The necinfls object works like this: Each language is its own object, containing an object for each pos, which contains the information for that pos. The first part is the stuff that comes at the beginning of the template, the second is the stuff at the end, the third onward are the available parameters of the template and what stuff they produce. Each template parameter is an array, which contains the word that shows up at the beginning of the section, then a blank value, and then subarrays of each option. Each subarray contains the text that shows up in the editor, followed by the text that shows up in the textbox (the wikimarkup). Some onclick javascript can be added to an option as the third parameter in the array. If the option is an input box, the first parameter should be "input", followed by the editor text (DON'T leave this blank or the whole thing will blow up), followed by the pre-inputbox-value wikimarkup, followed by post-inputbox-value wikimarkup, followed by any extra js.

Does this make any sense to anyone? :)

Things to do: 1 Get quotations to work right 2 Fix up pronunciation section 3 Add little help thingies 4 Inflection tables 5 Get the example sentence auto-bolding to not stink 6 Build add-section stuff

There are little href=javascript: things littered all over the place because I don't know any other way to make things look like unvisited links without having to actually put anything in the href.

eh, sploot



var necetym; var necpron; var necguharto; var necheadingorder = ['Usage notes', 'Inflection', 'Conjugation', 'Declension', 'Alternative forms', 'Synonyms', 'Antonyms', 'Hypernyms', 'Hyponyms', 'Meronyms', 'Holonyms', 'Derived terms', 'Related terms', 'Coordinate terms', 'Descendants', 'Translations', 'See also', 'External links', 'Categories', 'Images']; var necinputadvanced = ""; var necposlist = ['Noun', 'Verb', 'Adjective', 'Adverb', 'Pronoun', 'Conjunction', 'Interjection', 'Preposition', 'Proper noun', 'Article', 'Prepositional phrase', 'Contraction', 'Prefix', 'Suffix', 'Symbol', 'Letter', 'Idiom', 'Phrase']; var nectemplate = ['homophones', 'IPA', 'hyphenation', 'Audio', 'Category', 'Wikipedia', 'Also', 'Image', 'Der', 'Affix'];

function necfunction2 { /* CREATE OPTIONS */ var x = "Language code: <input type=text value='" + neccode + "' id='necinput' onKeyUp='neccode=this.value;necfunction;necfunction4;necfunction' onblur=if (necCleanLangCode(this.value)){this.value=necCleanLangCode(this.value)};neccode=this.value;document.getElementById('nectransspan').style.display=((this.value=='" + neccode + "')?:'none');if (/^[a-z]{2,3}(-[a-z\-]{1,7})?$/.test(this.value)){document.getElementById('neclangerror').style.display='none'}else{document.getElementById('neclangerror').style.display=};necfunction;necfunction4;necfunction;necdefupdate title='The two or three letter ISO-639 language code'> ERROR: INVALID LANGUAGE CODE Part of speech: ";

for (var i = 0; i < 4; ++i) { x += "" + necposlist[i] + ", "; }

x += " Other: Select ";

for (var i = 0; i < necposlist.length; ++i) { if (i > 3) { x += " " + necposlist[i] + " "; }	}

x += "  More details: Usage notes, Synonyms, Translations, More: Select ";

for (var i = 0; i < necheadingorder.length; ++i) { if (i != 0 && i != 5 && i != 15) { x += "" + necheadingorder[i] + " "; }	}

x += " Definition:   Further information: Another definition</a>,  <a href=javascript: id=necetymbutton onclick=document.getElementById('necetymspan').style.display=;necetym=document.getElementById('necetyminput').value;necfunction;this.style.fontWeight='bold' title='Add etymology section'>Etymology</a>, <a href=javascript: id=necpronbutton onclick=document.getElementById('necpronspan').style.display=;necpron=document.getElementById('necproninput').value;necfunction;this.style.fontWeight='bold' title='Add pronunciation section'>Pronunciation</a>, <a href=javascript: id=necguhartobutton onclick=document.getElementById('necguhartospan').style.display=;necguharto=document.getElementById('necguhartoinput').value;necfunction;this.style.fontWeight='bold' title='Şablona guharto lê zêde bike'>Guharto</a>. Etymology: <a href=javascript: onclick=necetym=undefined;document.getElementById('necetymspan').style.display='none';necfunction;document.getElementById('necetymbutton').style.fontWeight= title='Delete etymology section'>(delete)</a> <textarea id=necetyminput onKeyUp=necetym=this.value;necfunction> Pronunciation: <a href=javascript: onclick=necpron=undefined;document.getElementById('necpronspan').style.display='none';necfunction;document.getElementById('necpronbutton').style.fontWeight= title='Delete pronunciation section'>(delete)</a> <textarea id=necproninput onKeyUp=necpron=this.value;necfunction>  Guharto: <a href=javascript: onclick=necguharto=undefined;document.getElementById('necguhartospan').style.display='none';necfunction;document.getElementById('necguhartobutton').style.fontWeight='' title='Şablona guhartoyê jê bibe'>(Jê bibe)</a> <textarea id=necguhartoinput onKeyUp=necguharto=this.value;necfunction> ";

x += " Template: <select onchange=necpostboxT(this.value);this.selectedIndex=0;necfunction><option select='selected'>Select ";

for (i = 0; i < nectemplate.length; ++i) { x += "<option value=" + i + ">" + nectemplate[i] + " "; }	x += " <a href=/w/index.php?title=User_talk:Yair_rand/newentrywiz.js&action=edit&section=new title='Give feedback'>Give feedback</a> "; document.getElementById("editform").insertBefore(document.getElementById("necblah"), document.getElementById("editform").firstChild); document.getElementById("necblah").innerHTML = x;

if (document.URL.match("&section=new")) { document.getElementById("wpSummaryLabel").parentNode.removeChild(document.getElementById("wpSummaryLabel")); document.getElementById("wpSummary").parentNode.removeChild(document.getElementById("wpSummary")); } }

// Fill in the edit box. function necfunction { var k = "";

if (document.URL.match("&section=new")) { k += "\n\n"; } else { var neceditsummary = "(NEC-b) +" + neccode + ":" + necdata['pos'] + ": "; //edit summary

if (necguharto != undefined) { neceditsummary += "Alternative from of " + necguharto + " "; }		if (def2 != undefined) { neceditsummary += "Translation with JS from " + def2 + ": "; if (transc != "") { neceditsummary += 'tr=' + transc; }			if (gender != "") { neceditsummary += "|g=" + gender + " "; }		}			for (var i = 0; i < necdefs.length; ++i) { neceditsummary += ((i != 0) ? ', ' : '') + necdefs[i][0]; }

document.getElementById("wpSummary").value = neceditsummary; }

if (necpostT[6][0] != undefined) { k += "\n"; }

k += "==getByCode==\n";

for (var i = 0; i < necpost[19].length; ++i) { k += "\n"; }

if (necetym != undefined || necpostT[8][0] != undefined|| necpostT[9][0] != undefined) { k += "\n===Etymology===\n"; }		if (necpostT[8][0] != undefined || necpostT[9][0] != undefined) { k += "From ";

for (i = 0; i < necpostT[8].length; ++i) { k += "";

if (necpostT[8].length > 1 ) { k += ", from "; }		}

if (necpostT[8][0] != undefined && necpostT[9][0] != undefined) { k += " equivalent to "; }else if (necpostT[8][0] == undefined || necpostT[9][0] == undefined) { k += ""; }		for (i = 0; i < necpostT[9].length; ++i) { k += ""; }		k += "\n"; }			if (necetym != undefined) { k += necetym + "\n"; }

if (necpost[4].length > 0) { k += "\n===Alternative forms==="; k += "\n* \n"; }

if (necpron != undefined || necpostT[0][0] != undefined || necpostT[3][0] != undefined || necpostT[2][0] != undefined || necpostT[1][0] != undefined) { k += "\n===Pronunciation===\n"; if (necpron != undefined) { k += necpron + "\n";; }

if (necpostT[1][0] != undefined) { for (i = 0; i < necpostT[1].length; ++i) { if (necpostT[1][i][0]) { k += "* {{IPA|" + neccode + "|" + necpostT[1][i]; }else{ k += "* {{" + neccode + "-IPA"; }				k += "}}\n"; }		}

if (necpostT[3][0] != undefined) { for (i = 0; i < necpostT[3].length; ++i) { k += "* \n"; }		}		if (necpostT[2][0] != undefined) { k += "* {" + "{hyphenation|" + neccode; for (i = 0; i < necpostT[2].length; i++) { k += "|" + necpostT[2][i]; }		   k += "}}\n"; }

if (necpostT[0][0] != undefined) { k += "* \n"; }

}

k += "\n===" + necdata['pos2'] + "===\n";

if (!neccode) { neccode = ''; }

if (neccode != '' && necinfls[neccode] && necinfls[neccode][necdata['pos']] && necinfls[neccode][necdata['pos']][2]) { if (necdata[neccode + "-" + necdata['pos'] + "2"] != "Advanced") { if (necinfls[neccode][necdata['pos']][0] != undefined) { k += necinfls[neccode][necdata['pos']][0]; }

var x = necinfls[neccode][necdata['pos']];

for (var z = 0; z < x.length; ++z) { if (z <= 1) { continue; }

var zz = neccode + "-" + necdata['pos'] + z;

for (var y = 0; y < x[z][2].length; ++y) // search for inflections {					if (x[z][2][y][0] != "input" && necdata[zz] == x[z][2][y][0]) // is selected option, not input box {						k += x[z][2][y][1]; break; }

if (x[z][2][y][0] == "input" && necfunction7(x[z][2], necdata[zz]) == false) { k += x[z][2][y][2] + necdata[zz]; }				}			}

if (necinfls[neccode][necdata['pos']][1] != undefined) { k += necinfls[neccode][necdata['pos']][1]; }		} else { k += necinputadvanced; }	} else { if (necinputadvanced) { k += necinputadvanced; } else { if (neccode != '' && necinfls[neccode] && necinfls[neccode][necdata['pos']]) { k += necinfls[neccode][necdata['pos']][0];

k += necinfls[neccode][necdata['pos']][1]; } else { k += ''; }		}	}

//definition with only an alt form if (necguharto != undefined) { for (i = 0; i < necdefs.length && i <1; ++i) { k += "\n# '			}		}	//start definition line with a translation from User:Balyozxane/CreateTranslation.js		if (def2 != undefined) {			for (i = 0; i < necdefs.length && i <1; ++i) {				k += '\n# ';			if (necdefs[i][4].length > 0) {				k += " ";			}			k +=def2;		    if (necdefs[i][0]) {		    	k += ' ';		    } // hevmane		if (necdefs[i][3].length > 0) {			k += "\n#:  ";		} // dijmane		if (necdefs[i][5].length > 0) {			k += "\n#:  ";		}

for (var l = 0; l < necdefs[i][1].length; ++l) { k += "\n#:" + necdefs[i][1][l][0].replace(new RegExp("(" + title + ")", "ig"), "$1") + "";

if (neccode != "en" && necdefs[i][1][l][1] && (new LangMetadata).guessScript(neccode) != 'Latn') { k += "\n#::" + necdefs[i][1][l][1] + ""; }

if (neccode != "en") { k += "\n#::" + necdefs[i][1][l][2] + ""; }		}

for (var l = 0; l < necdefs[i][2].length; ++l) { k += "\n#*" + necdefs[i][2][l][0] + ", " + necdefs[i][2][l][1] + ", " + necdefs[i][2][l][2] + "";

if (necdefs[i][2][l][3]) { k += ", " + necdefs[i][2][l][3]; }

if (necdefs[i][2][l][4]) { k += ", page";

if (necdefs[i][2][l][4].match(/(-|–)/)) { k += "s"; }

k += " " + necdefs[i][2][l][4]; }

k += "\n#*:"; k += necdefs[i][2][l][5].replace(new RegExp("(" + title + ")", "ig"), "$1");

if (neccode != "en") { k += "\n#*::" + necdefs[i][2][l][6]; }		}	}		}	//definition line without the trans above if (def2 != undefined || necguharto != undefined) { i = 1 }else { i = 0 }	for (i; i < necdefs.length; ++i) {

k += "\n# ";

// etîket if (necdefs[i][4].length > 0) { k += " "; }

k += necdefs[i][0]; // hevmane if (necdefs[i][3].length > 0) { k += "\n#: "; } // dijmane if (necdefs[i][5].length > 0) { k += "\n#: "; }

for (var l = 0; l < necdefs[i][1].length; ++l) { k += "\n#:" + necdefs[i][1][l][0].replace(new RegExp("(" + title + ")", "ig"), "$1") + "";

if (neccode != "en" && necdefs[i][1][l][1] && (new LangMetadata).guessScript(neccode) != 'Latn') { k += "\n#::" + necdefs[i][1][l][1] + ""; }

if (neccode != "en") { k += "\n#::" + necdefs[i][1][l][2] + ""; }		}

for (var l = 0; l < necdefs[i][2].length; ++l) { k += "\n#*" + necdefs[i][2][l][0] + ", " + necdefs[i][2][l][1] + ", " + necdefs[i][2][l][2] + "";

if (necdefs[i][2][l][3]) { k += ", " + necdefs[i][2][l][3]; }

if (necdefs[i][2][l][4]) { k += ", page";

if (necdefs[i][2][l][4].match(/(-|–)/)) { k += "s"; }

k += " " + necdefs[i][2][l][4]; }

k += "\n#*:"; k += necdefs[i][2][l][5].replace(new RegExp("(" + title + ")", "ig"), "$1");

if (neccode != "en") { k += "\n#*::" + necdefs[i][2][l][6]; }		}	}

/* SUBHEADERS */ for (var o = 0; o <= 3; ++o) { if (necpost[o] != undefined) { k += "\n\n====" + necheadingorder[o] + "====\n" + necpost[o]; }	}

for (var o = 5; o <= 17; ++o) { if (necpost[o][0] != undefined) { k += "\n\n====" + necheadingorder[o] + "====" }

if (o < 11 || o == 13) { for (var i = 0; i < necpost[o].length; ++i) { k += "\n* ";

for (var u = 0; u < necpost[o][i].length; ++u) { if (u != 0) { if (u != 1) { k += ", "; }

k += ""; }				}			}		} else if (o == 14) { for (var i = 0; i < necpost[o].length; ++i) { k += "\n* getByCode: "; }		} else if (o == 15) { for (var i = 0; i < necpost[15].length; ++i) { k += "\n\n\n"; }		} else if (o == 16 || o == 17) { for (var i = 0; i < necpost[o].length; ++i) { k += "\n* " + necpost[o][i]; }		} else { for (var i = 0; i < necpost[o].length; ++i) { k += "\n* "; }		}	}

if (necpostT[4][0] != undefined) { k += "\n"; }

$(document.editform.wpTextbox1).val(k); }

function necCleanLangCode(lang) // taken from wt:edit {	var key = lang.toLowerCase.replace(' ', '');

var dict = { aar: "aa", afar: "aa", abk: "ab", abkhazian: "ab", afr: "af", afrikaans: "af", aka: "ak", akan: "ak", amh: "am", amharic: "am", ara: "ar", arabic: "ar", arg: "an", aragonese: "an", asm: "as", assamese: "as", ava: "av", avaric: "av", ave: "ae", avestan: "ae", aym: "ay", aymara: "ay", aze: "az", azerbaijani: "az", bak: "ba", bashkir: "ba", bam: "bm", bambara: "bm", bel: "be", belarusian: "be", ben: "bn", bengali: "bn", bis: "bi", bislama: "bi", bod: "bo", tibetan: "bo", bos: "bs", bosnian: "bs", bre: "br", breton: "br", bul: "bg", bulgarian: "bg", cat: "ca", catalan: "ca", ces: "cs", czech: "cs", cha: "ch", chamorro: "ch", che: "ce", chechen: "ce", chu: "cu", churchslavic: "cu", chv: "cv", chuvash: "cv", cor: "kw", cornish: "kw", cos: "co", corsican: "co", cre: "cr", cree: "cr", cym: "cy", welsh: "cy", dan: "da", danish: "da", deu: "de", german: "de", div: "dv", dhivehi: "dv", dzo: "dz", dzongkha: "dz", ell: "el", greek: "el", eng: "en", english: "en", epo: "eo", esperanto: "eo", est: "et", estonian: "et", eus: "eu", basque: "eu", ewe: "ee", fao: "fo", faroese: "fo", fas: "fa", persian: "fa", fij: "fj", fijian: "fj", fin: "fi", finnish: "fi", fra: "fr", french: "fr", fry: "fy", westernfrisian: "fy", ful: "ff", fulah: "ff", gla: "gd", scottishgaelic: "gd", gle: "ga", irish: "ga", glg: "gl", galician: "gl", glv: "gv", manx: "gv", grn: "gn", guarani: "gn", guj: "gu", gujarati: "gu", hat: "ht", haitian: "ht", hau: "ha", hausa: "ha", heb: "he", hebrew: "he", her: "hz", herero: "hz", hin: "hi", hindi: "hi", hmo: "ho", hirimotu: "ho", hrv: "hr", croatian: "hr", hun: "hu", hungarian: "hu", hye: "hy", armenian: "hy", ibo: "ig", igbo: "ig", ido: "io", iii: "ii", sichuanyi: "ii", iku: "iu", inuktitut: "iu", ile: "ie", interlingue: "ie", ina: "ia", interlingua: "ia", ind: "id", indonesian: "id", ipk: "ik", inupiaq: "ik", isl: "is", icelandic: "is", ita: "it", italian: "it", jav: "jv", javanese: "jv", jpn: "ja", japanese: "ja", kal: "kl", kalaallisut: "kl", kan: "kn", kannada: "kn", kas: "ks", kashmiri: "ks", kat: "ka", georgian: "ka", kau: "kr", kanuri: "kr", kaz: "kk", kazakh: "kk", khm: "km", centralkhmer: "km", kik: "ki", kikuyu: "ki", kin: "rw", kinyarwanda: "rw", kir: "ky", kirghiz: "ky", kom: "kv", komi: "kv", kon: "kg", kongo: "kg", kor: "ko", korean: "ko", kua: "kj", kuanyama: "kj", kur: "ku", kurdish: "ku", lao: "lo", lat: "la", latin: "la", lav: "lv", latvian: "lv", lim: "li", limburgan: "li", lin: "ln", lingala: "ln", lit: "lt", lithuanian: "lt", ltz: "lb", luxembourgish: "lb", lub: "lu", lubakatanga: "lu", lug: "lg", ganda: "lg", mah: "mh", marshallese: "mh", mal: "ml", malayalam: "ml", mar: "mr", marathi: "mr", mkd: "mk", macedonian: "mk", mlg: "mg", malagasy: "mg", mlt: "mt", maltese: "mt", mon: "mn", mongolian: "mn", mri: "mi", maori: "mi", msa: "ms", malay: "ms", mya: "my", burmese: "my", nau: "na", nauru: "na", nav: "nv", navajo: "nv", nbl: "nr", southndebele: "nr", nde: "nd", northndebele: "nd", ndo: "ng", ndonga: "ng", nep: "ne", nepali: "ne", nld: "nl", dutch: "nl", nno: "nn", norwegiannynorsk: "nn", nob: "nb", norwegianbokmal: "nb", nor: "no", norwegian: "no", nya: "ny", nyanja: "ny", oci: "oc", occitan: "oc", oji: "oj", ojibwa: "oj", ori: "or", oriya: "or", orm: "om", oromo: "om", oss: "os", ossetian: "os", pan: "pa", panjabi: "pa", pli: "pi", pali: "pi", pol: "pl", polish: "pl", por: "pt", portuguese: "pt", pus: "ps", pushto: "ps", que: "qu", quechua: "qu", roh: "rm", romansh: "rm", ron: "ro", romanian: "ro", run: "rn", rundi: "rn", rus: "ru", russian: "ru", sag: "sg", sango: "sg", san: "sa", sanskrit: "sa", sin: "si", sinhala: "si", slk: "sk", slovak: "sk", slv: "sl", slovenian: "sl", sme: "se", northernsami: "se", smo: "sm", samoan: "sm", sna: "sn", shona: "sn", snd: "sd", sindhi: "sd", som: "so", somali: "so", sot: "st", southernsotho: "st", spa: "es", spanish: "es", sqi: "sq", albanian: "sq", srd: "sc", sardinian: "sc", srp: "sr", serbian: "sr", ssw: "ss", swati: "ss", sun: "su", sundanese: "su", swa: "sw", swahili: "sw", swe: "sv", swedish: "sv", tah: "ty", tahitian: "ty", tam: "ta", tamil: "ta", tat: "tt", tatar: "tt", tel: "te", telugu: "te", tgk: "tg", tajik: "tg", tgl: "tl", tagalog: "tl", tha: "th", thai: "th", tir: "ti", tigrinya: "ti", ton: "to", tonga: "to", tsn: "tn", tswana: "tn", tso: "ts", tsonga: "ts", tuk: "tk", turkmen: "tk", tur: "tr", turkish: "tr", twi: "tw", uig: "ug", uighur: "ug", ukr: "uk", ukrainian: "uk", urd: "ur", urdu: "ur", uzb: "uz", uzbek: "uz", ven: "ve", venda: "ve", vie: "vi", vietnamese: "vi", vol: "vo", volapuk: "vo", wln: "wa", walloon: "wa", wol: "wo", wolof: "wo", xho: "xh", xhosa: "xh", yid: "yi", yiddish: "yi", yor: "yo", yoruba: "yo", zha: "za", zhuang: "za", zho: "zh", chinese: "zh", zul: "zu", zulu: "zu" };

return dict[key]; }

function necfunction4 { if (!neccode) { neccode = ''; }

if (neccode && necinfls[neccode] && necinfls[neccode][necdata['pos']] != undefined && necinfls[neccode][necdata['pos']][2] != undefined) { necfunction5(necinfls[neccode][necdata['pos']]); } else { var qq = neccode + "-" + necdata['pos'] + '2'; var xx = "<span class=msgfornonnewbies ";

if (necinputadvanced) { xx += "style='font-weight:bold' "; }

xx += "> Wikicode: <input type=text value='" + necinputadvanced + "' onKeyUp=\"necinputadvanced=this.value;if (this.value){this.parentNode.style.fontWeight='bold'}else{this.parentNode.style.fontWeight=''};necfunction\" /> "; document.getElementById("necinfls").innerHTML = xx; necfunction; } }

function necfunction5(a) { /* INFLECTION OPTIONS */

var q = ""; for (var r = 0; r < a.length; ++r) { if (r <= 1) { continue; }		var qq = neccode + "-" + necdata['pos'] + r;		if (necdata[qq] == undefined) { if (a[r][2][0][0] == 'input') { necdata[qq] = '' } else { necdata[qq] = a[r][2][0][0] }		}		q += " " + a[r][0] + ": ";

for (var i = 0; i < a[r][2].length; ++i) { if (a[r][2][i][0] != 'input') { q += "<a href=javascript: id='necinput" + qq + a[r][2][i][0] + "' onclick=\"";				if (a[r][2][i][2]) {					q += a[r][2][i][2] + ";"				}				q += "necdata[\'" + qq + "\']=\'" + a[r][2][i][0] + "\';necfunction4;necfunction\">" + a[r][2][i][0] + "</a>"; if (i != a[r][2].length - 1) { q += ", " }			} else { q += "<span id='necinput" + qq; if (necdata[qq] != "Advanced" && necfunction7(a[r][2], necdata[qq]) == false) { q += necdata[qq] }				q += "'>" + a[r][2][i][1] + "<input type=text value='' id='"; q += neccode + "-" + necdata['pos'] + "-" + r + "-" + i;				q += "' onKeyUp="; if (a[r][2][i][4]) { q += a[r][2][i][4] + ";" }

q += "necfunction6('" + qq + "','" + neccode + "-" + necdata['pos'] + "-" + r + "-" + i + "');";

q += "necfunction /> "; if (i != a[r][2].length - 1) { q += ", " }			}		}

/* ADVANCED OPTIONS */ if (r == 2) { q += "<span id='necinput" + qq + "Advanced' class=msgfornonnewbies>, Wikicode: <input type=text value='" + necinputadvanced + "' onKeyUp=necinputadvanced=this.value;document.getElementById('necinput" + qq + "'+necdata['" + qq + "']).style.fontWeight='';necdata['" + qq + "']='Advanced';document.getElementById('necinput" + qq + "'+necdata['" + qq + "']).style.fontWeight='bold';necfunction /> "; }	}

document.getElementById("necinfls").innerHTML = q;

for (var r = 0; r < a.length; ++r) { if (r <= 1) { continue; }

var qq = neccode + "-" + necdata['pos'] + r;		document.getElementById('necinput' + qq + necdata[qq]).style.fontWeight = 'bold';

if (document.getElementById('necinput' + qq + necdata[qq]).childNodes[1] && necdata[qq] != 'Advanced' && necfunction7(a[r][2], necdata[qq]) == false) { document.getElementById('necinput' + qq + necdata[qq]).childNodes[1].value = necdata[qq]; }	} }

function necdefupdate { /* DEFINITIONS */ var def = "<input class='unselectable' type='button' name='PasteOver' value=' + ' onmousedown='wikilinkText; return false'><input class='unselectable' type='button' name='PasteOver' value='|' onmousedown='wikiPipe; return false'><input class='unselectable' type='button' name='PasteOver' value='' onmousedown='wikiText; return false'> "; for (var i = 0; i < necdefs.length; ++i) { def += "Definition: <input size=50 type=text value='" + necdefs[i][0] + "' onKeyUp=necdefs[" + i + "][0]=this.value;necfunction />"; if (i > 0) { def += "<a href=javascript:necdefs.splice(" + i + ",1);uNec title='Delete this definition'>(–)</a>"; }		def += " <a href=javascript:necdefs[" + i + "][1].push([,,]);uNec title='Add example sentence'>(+example sentence)</a><a href=javascript:necdefs[" + i + "][2].push([,,,,,,]);uNec title='Add quotation'>(+quotation)</a><a href=javascript:necdefs[" + i + "][3].push([]);uNec title='Hevmane lê zêde bike'> (+hevmane)</a><a href=javascript:necdefs[" + i + "][5].push([]);uNec title='Dijmane lê zêde bike'> (+dijmane)</a><a href=javascript:necdefs[" + i + "][4].push(['']);uNec title='Etîketek lê zêde bike'> (+etîket)</a>"; if (necdefs[i][3].length > 0){//hevmane def += " Hevmane: "; for (l = 0; l < necdefs[i][3].length; l++) { def += "<input type=text size=10 value='" + necdefs[i][3][l][0] + "' onKeyUp=necdefs[" + i + "][3][" + l + "][0]=this.value;necfunction />"; if (necdefs[i][3].length > 1){ def += ", "; }		       }			def += "<a href=javascript:necdefs[" + i + "][3].push(['']);uNec title='Hevmaneyekê lê zêde bike'> (+)</a>"; def += "<a href=javascript:necdefs[" + i + "][3].splice(" + (necdefs[i][3].length - 1) + ",1);uNec title='Hevmaneyê jê bibe'> (–)</a>" }		if (necdefs[i][5].length > 0){//dijmane def += " Dijmane: "; for (l = 0; l < necdefs[i][5].length; l++) { def += "<input type=text size=10 value='" + necdefs[i][5][l][0] + "' onKeyUp=necdefs[" + i + "][5][" + l + "][0]=this.value;necfunction />"; if (necdefs[i][5].length > 1){ def += ", "; }		       }			def += "<a href=javascript:necdefs[" + i + "][5].push(['']);uNec title='Dijmaneyekê lê zêde bike'> (+)</a>"; def += "<a href=javascript:necdefs[" + i + "][5].splice(" + (necdefs[i][5].length - 1) + ",1);uNec title='Dijmaneyê jê bibe'> (–)</a>" }

if (necdefs[i][4].length > 0){//etîket def += " Etîket: "; for (l = 0; l < necdefs[i][4].length; l++) { def += "<input type=text size=10 value='" + necdefs[i][4][l][0] + "' onKeyUp=necdefs[" + i + "][4][" + l + "][0]=this.value;necfunction />"; if (necdefs[i][4].length > 1){ def += ", "; }		       }			def += "<a href=javascript:necdefs[" + i + "][4].push(['']);uNec title='Etîketekê lê zêde bike'> (+)</a>"; def += "<a href=javascript:necdefs[" + i + "][4].splice(" + (necdefs[i][4].length - 1) + ",1);uNec title='Etîketê jê bibe'> (–)</a>" }

for (var l = 0; l < necdefs[i][1].length; ++l) // Example sentences {			def += " Example sentence: <input type=text size=40 value='" + necdefs[i][1][l][0] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][0]=this.value;necfunction /><a href=javascript:necdefs[" + i + "][1].splice(" + l + ",1);uNec title='Delete this example sentence'>(–)</a>"; if (neccode != "en") { if ((new LangMetadata).guessScript(neccode) != 'Latn') { def += " Transliteration: <input type=text size=40 value='" + necdefs[i][1][l][1] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][1]=this.value;necfunction />"; }				def += " Translation: <input type=text size=40 value='" + necdefs[i][1][l][2] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][2]=this.value;necfunction />"; }		}		for (var l = 0; l < necdefs[i][2].length; ++l) // Quotations {			var x = ['Year', 'Author', 'Source title', 'Publisher', 'Page(s)']; var z = [4, 20, 20, 20, 5]; //sizes def += " "; for (var y = 0; y < x.length; ++y) { def += x[y] + ": <input type=text size=" + z[y] + " value='" + necdefs[i][2][l][y] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][" + y + "]=this.value;necfunction /> " }			def += " Quotation: <input type=text size=40 value='" + necdefs[i][2][l][5] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][5]=this.value;necfunction /><a href=javascript:necdefs[" + i + "][2].splice(" + l + ",1);uNec title='Delete this quotation'>(–)</a>"; if (neccode != "en") { def += " Translation: <input type=text size=40 value='" + necdefs[i][2][l][6] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][6]=this.value;necfunction />" }		}		def += " "; }	document.getElementById('necdefs').innerHTML = def; }

function necpostbox(q) { if (q != undefined) { if ((q > 5 && q <= 10) || q == 13 || q == 14 || q == 19) { necpost[q][necpost[q].length] = [, ] } else if ((q > 10 && q < 13) || q > 15 || q == 4) { necpost[q][necpost[q].length] = '' } else { necpost[q] = '' }	}	var m = "";

/* ALTERNATIVE FORMS */ if (necpost[4][0] != undefined) { m += " Alternative forms: "; for (i = 0; i < necpost[4].length; ++i) { m += "<input type=text value='" + necpost[4][i] + "' onKeyUp=necpost[4][" + i + "]=this.value;necfunction /><a href=javascript:necpost[4].splice(" + i + ",1);necpostbox;necfunction title='Peyvê jê bibe'> (–) </a>"; }		m += "<a href=javascript:necpost[4].push('');necpostbox;necfunction title='lê zêde bike'> (+yekî din) </a> "; m += " "; }

/* USAGE NOTES, INFLECTION TABLES */ for (var o = 0; o < 4; o++) { if (necpost[o] != undefined) { m += " " + necheadingorder[o] + ": <a href=javascript:necpost[" + o + "]=undefined;";

m += "necpostbox;necfunction title='Delete section'>(delete)</a> <textarea onKeyUp=necpost[" + o + "]=this.value;necfunction>" + necpost[o] + "  "; }	}	/* NYMS */ for (o = 5; o < 14; o++) { if (necpost[o][0] != undefined) { m += " " + necheadingorder[o] + ": <a id=nec" + necheadingorder[o] + "button href=javascript:necpost[" + o + "][necpost[" + o + "].length]=[,];necpostbox;necfunction title='add section'>(add section)</a>  " } else if (o == 5) { document.getElementById('necSynonymsbutton').style.fontWeight = '' }

for (var i = 0; i < necpost[o].length; ++i) { m += " Gloss: <input type=text value='" + necpost[o][i][0] + "' onKeyUp=necpost[" + o + "][" + i + "][0]=this.value;necfunction /> " + necheadingorder[o] + ": "; for (var u = 0; u < necpost[o][i].length; ++u) { if (u != 0) { if (u != 1) { m += ", "; }					m += "<input type=text size=5 value='" + necpost[o][i][u] + "' onKeyUp=necpost[" + o + "][" + i + "][" + u + "]=this.value;necfunction />"; }			}			m += "<a href=javascript:necpost[" + o + "][" + i + "].push('');necpostbox;necfunction title='Add " + necheadingorder[o].substr(0, necheadingorder[o].length - 1).toLowerCase + "'>(+)</a>"; if (necpost[o][i].length > 2) { m += "<a href=javascript:necpost[" + o + "][" + i + "].splice(" + (necpost[o][i].length - 1) + ",1);necpostbox;necfunction title='Delete " + necheadingorder[o].substr(0, necheadingorder[o].length - 1).toLowerCase + "'>(–)</a>" }			m += "<a href=javascript:necpost[" + o + "].splice(" + i + ",1);necpostbox;necfunction title='Remove section'>(remove section)</a> "; }		if (o == 10) { o = 12 }	}

/* DERIVED TERMS, RELATED TERMS, SEE ALSO, EXTERNAL LINKS */ for (o = 11; o <= 17; o++) { if (necpost[o][0] != undefined) { m += " " + necheadingorder[o] + ": <a href=javascript:necpost[" + o + "].push('');necpostbox;necfunction>(new)</a> "; }

for (var i = 0; i < necpost[o].length; ++i) { m += " <input type=text value='" + necpost[o][i] + "' onKeyUp=necpost[" + o + "][" + i + "]=this.value;necfunction /><a href=javascript:necpost[" + o + "].splice(" + i + ",1);necpostbox;necfunction title='Delete'>(–)</a> " }		if (o == 12) { o = 15 }	}

/* DESCENDANTS */

if (necpost[14][0] != undefined) { m += " " + necheadingorder[14] + ": <a href=javascript:necpost[14].push([,]);necpostbox;necfunction title='Add new descendant'>(new)</a> "; }

for (var i = 0; i < necpost[14].length; ++i) { m += " Language: <input type=text value='" + necpost[14][i][0] + "' onKeyUp=necpost[14][" + i + "][0]=this.value;necfunction onblur=if (necCleanLangCode(this.value)){this.value=necCleanLangCode(this.value)};necpost[14][" + i + "][0]=this.value;necfunction /> Word: <input type=text value='" + necpost[14][i][1] + "' onKeyUp=necpost[14][" + i + "][1]=this.value;necfunction /><a href=javascript:necpost[14].splice(" + i + ",1);necpostbox;necfunction title='Delete'>(–)</a> " }

/* TRANSLATIONS */ if (necpost[15][0] != undefined) { m += " Translations section: <a href=javascript:necpost[15].push('');necpostbox;necfunction title='Add translations section'>(add section)</a> " } else { document.getElementById('nectransbutton').style.fontWeight = '' }	for (var i = 0; i < necpost[15].length; ++i) { m += " Gloss: <input type=text value='" + necpost[15][i] + "' onKeyUp=necpost[15][" + i + "]=this.value;necfunction /><a href=javascript:necpost[15].splice(" + i + ",1);necpostbox;necfunction title='Delete'>(–)</a> " }

if (necpost[18][0] != undefined) { for (var i = 0; i < necpost[18].length; ++i) { m += " Category:<input type=text value='" + necpost[18][i] + "' onKeyUp=necpost[18][" + i + "]=this.value;necfunction /><a href=javascript:necpost[18].splice(" + i + ",1);necpostbox;necfunction title='Remove category'>(–)</a>"; if (i == 0) { m += "<a href=javascript:necpost[18].push('');necpostbox;necfunction title='Add new category'>(+new category)</a>" }			m += " " }	}

if (necpost[19][0] != undefined) { for (var i = 0; i < necpost[19].length; ++i) { m += " File name:<input type=text value='" + necpost[19][i][0] + "' onKeyUp=necpost[19][" + i + "][0]=this.value;necfunction /> Caption:<input type=text value='" + necpost[19][i][1] + "' onKeyUp=necpost[19][" + i + "][1]=this.value;necfunction /><a href=javascript:necpost[19].splice(" + i + ",1);necpostbox;necfunction title='Remove image'>(–)</a>"; if (i == 0) { m += "<a href=javascript:necpost[19].push([,]);necpostbox;necfunction title='Add new image'>(+new image)</a>" }			m += " " }	}

document.getElementById('necpostbox').innerHTML = m; }

function necpostboxT(q) { if (q != undefined) { if (q == 5 || q == 3 || (q > 6 && q <= 8) || q == 9) { necpostT[q][necpostT[q].length] = [, ] } else if (q == 1 ||q == 0 ||q == 2 || q == 4 || q == 6) { necpostT[q][necpostT[q].length] = ''; } else { necpostT[q] = ''; }	}	var n = "";

/* Hevdeng */ if (necpostT[0][0] != undefined) { for (i = 0; i < necpostT[0].length; ++i) { n += " Hevdeng:<input type=text value='" + necpostT[0][i] + "' onKeyUp=necpostT[0][" + i + "]=this.value;necfunction /><a href=javascript:necpostT[0].splice(" + i + ",1);necpostboxT;necfunction title='Hevdengê jê bibe'> (–) </a>"; if (i == 0) { n += "<a href=javascript:necpostT[0].push('');necpostboxT;necfunction title='Hevdenga din lê zêde bike'> (+hevdeng nû)</a>"; }			n += " "; }	}

/* IPA */ if (necpostT[1][0] != undefined) { for (i = 0; i < necpostT[1].length; ++i) { n += " IPA:<input type=text value='" + necpostT[1][i] + "' onKeyUp=necpostT[1][" + i + "]=this.value;necfunction /><a href=javascript:necpostT[1].splice(" + i + ",1);necpostboxT;necfunction title='IPAyê jê bibe'> (–) </a>"; if (i == 0) { n += "<a href=javascript:necpostT[1].push('');necpostboxT;necfunction title='IPAya din lê zêde bike'> (+IPA nû)</a>"; }			n += " "; }	}

/* Kîtekirin */ if (necpostT[2][0] != undefined) { for (i = 0; i < necpostT[2].length; ++i) { n += " Kîte:<input type=text value='" + necpostT[2][i] + "' onKeyUp=necpostT[2][" + i + "]=this.value;necfunction /><a href=javascript:necpostT[2].splice(" + i + ",1);necpostboxT;necfunction title='Kîtekirinê jê bibe'> (–) </a>"; if (i == 0) { n += "<a href=javascript:necpostT[2].push('');necpostboxT;necfunction title='Kîteya din lê zêde bike'> (+kîteya din) </a>"; }			n += " "; }	}

/* Deng */ if (necpostT[3][0] != undefined) { for (i = 0; i < necpostT[3].length; ++i) { n += " Navê dosyeyê:<input type=text value='" + necpostT[3][i][0] + "' onKeyUp=necpostT[3][" + i + "][0]=this.value;necfunction /> Dever:<input type=text value='" + necpostT[3][i][1] + "' onKeyUp=necpostT[3][" + i + "][1]=this.value;necfunction /><a href=javascript:necpostT[3].splice(" + i + ",1);necpostboxT;necfunction title='Dengî jê bibe'> (–)</a>"; if (i == 0) { n += "<a href=javascript:necpostT[3].push([,]);necpostboxT;necfunction title='Dengekî nû lê zêde bike'> (+dengê nû)</a>"; }			n += " "; }	}

/* Kategorî */ if (necpostT[4][0] != undefined) { for (i = 0; i < necpostT[4].length; ++i) { n += " Kategorî:<input type=text value='" + necpostT[4][i] + "' onKeyUp=necpostT[4][" + i + "]=this.value;necfunction /><a href=javascript:necpostT[4].splice(" + i + ",1);necpostboxT;necfunction title='Kategoriyê jê bibe'> (–) </a>"; if (i == 0) { n += "<a href=javascript:necpostT[4].push('');necpostboxT;necfunction title='Kategoriyeke nû lê zêde bike'> (+kategoriya nû) </a>"; }			n += " "; }	}

/* Wîkîpediyayê */ if (necpostT[5][0] != undefined) { for (i = 0; i < necpostT[5].length; ++i) { n += " Rûpela Wîkîpediyayê:<input type=text value='" + necpostT[5][i][0] + "' onKeyUp=necpostT[5][" + i + "][0]=this.value;necfunction /> Rûpela Wîkîferhengê:<input type=text value='" + necpostT[5][i][1] + "' onKeyUp=necpostT[5][" + i + "][1]=this.value;necfunction /><a href=javascript:necpostT[5].splice(" + i + ",1);necpostboxT;necfunction title='Şablonê jê bibe'> (–)</a>"; /*		if (i == 0) { n += "<a href=javascript:necpostT[5].push([,]);necpostboxT;necfunction title='Wêneyekî nû lê zêde bike'> (+wêneyê nû)</a>"; }*/			n += " "; }	}

/* Binêre herwiha */ if (necpostT[6][0] != undefined) { for (i = 0; i < necpostT[6].length; ++i) { n += " Binêre:<input type=text value='" + necpostT[6][i] + "' onKeyUp=necpostT[6][" + i + "]=this.value;necfunction /><a href=javascript:necpostT[6].splice(" + i + ",1);necpostboxT;necfunction title='Peyvê jê bibe'> (–) </a>"; if (i == 0) { n += "<a href=javascript:necpostT[6].push('');necpostboxT;necfunction title='lê zêde bike'> (+yekî din) </a>"; }			n += " "; }	}

/* Wêne */ if (necpostT[7][0] != undefined) { for (i = 0; i < necpostT[7].length; ++i) { n += " Navê dosyeyê:<input type=text value='" + necpostT[7][i][0] + "' onKeyUp=necpostT[7][" + i + "][0]=this.value;necfunction /> Sernavê wêneyî:<input type=text value='" + necpostT[7][i][1] + "' onKeyUp=necpostT[7][" + i + "][1]=this.value;necfunction /><a href=javascript:necpostT[7].splice(" + i + ",1);necpostboxT;necfunction title='Wêneyî jê bibe'> (–)</a>"; if (i == 0) { n += "<a href=javascript:necpostT[7].push([,]);necpostboxT;necfunction title='Wêneyekî nû lê zêde bike'> (+wêneyê nû)</a>"; }			n += " "; }	}

/* Etîmolojî: şablon:ji */ if (necpostT[8][0] != undefined) { for (i = 0; i < necpostT[8].length; ++i) { n += " Şablon: <input type=text value='" + necpostT[8][i][0] + "' onKeyUp=necpostT[8][" + i + "][0]=this.value;necfunction /> Zimanê jêder: <input type=text value='" + necpostT[8][i][1] + "' onKeyUp=necpostT[8][" + i + "][1]=this.value;necfunction /> Peyv: <input type=text value='" + necpostT[8][i][2] + "' onKeyUp=necpostT[8][" + i + "][2]=this.value;necfunction /> Mane: <input type=text value='" + necpostT[8][i][3] + "' onKeyUp=necpostT[8][" + i + "][3]=this.value;necfunction /> Translîterasyon: <input type=text value='" + necpostT[8][i][4] + "' onKeyUp=necpostT[8][" + i + "][4]=this.value;necfunction /><a href=javascript:necpostT[8].splice(" + i + ",1);necpostboxT;necfunction title='Şablonê jê bibe'> (–)</a>"; if (i == 0) { n += "<a href=javascript:necpostT[8].push([,]);necpostboxT;necfunction title='Lê zêde bike'> (+)</a>"; }

n += " "; }	}

/* Etîmolojî: şablon:qertaf */ if (necpostT[9][0] != undefined) { for (i = 0; i < necpostT[9].length; ++i) { n += " Qertaf #1: <input type=text size=10 value='" + necpostT[9][i][0] + "' onKeyUp=necpostT[9][" + i + "][0]=this.value;necfunction /> Qertaf #2: <input type=text value='" + necpostT[9][i][1] + "' onKeyUp=necpostT[9][" + i + "][1]=this.value;necfunction /> Maneya #1: <input type=text size=10 value='" + necpostT[9][i][2] + "' onKeyUp=necpostT[9][" + i + "][2]=this.value;necfunction /> Maneya #2: <input type=text size=10 value='" + necpostT[9][i][3] + "' onKeyUp=necpostT[9][" + i + "][3]=this.value;necfunction />TR #1: <input type=text size=10 value='" + necpostT[9][i][4] + "' onKeyUp=necpostT[9][" + i + "][4]=this.value;necfunction /> TR #2: <input type=text size=10 value='" + necpostT[9][i][5] + "' onKeyUp=necpostT[9][" + i + "][5]=this.value;necfunction /><a href=javascript:necpostT[9].splice(" + i + ",1);necpostboxT;necfunction title='Şablonê jê bibe'> (–)</a>"; if (i == 0) { n += "<a href=javascript:necpostT[9].push([,]);necpostboxT;necfunction title='Lê zêde bike'> (+)</a>"; }

n += " "; }	} document.getElementById('necpostboxT').innerHTML = n; }

function necfunction6(cc, dd) { document.getElementById('necinput' + cc + necdata[cc]).style.fontWeight = ''; necdata[cc] = document.getElementById(dd).value; document.getElementById(dd).parentNode.setAttribute('ID', 'necinput' + cc + document.getElementById(dd).value); document.getElementById('necinput' + cc + necdata[cc]).style.fontWeight = 'bold'; }

function necfunction7(qw, er) { var qwe = false;

for (var ty in qw) { if (er == qw[ty][0]) { qwe = true; }	}

return qwe; } function uNec { necdefupdate; necfunction; } mw.util.addPortletLink( mw.config.get('skin') === 'vector' ? 'p-views' : 'p-cactions', '/w/index.php?title=' + mw.config.get('wgPageName') + '&action=edit&editintro=User:Yair rand/usenec', 'nec', 'id', 'use the New Entry Creator to create a new entry', 'm', 'nextnode');

function wikilinkText { var sel; if (window.getSelection) { sel = window.getSelection; var activeElement = document.activeElement; if (activeElement.nodeName == "TEXTAREA" ||          (activeElement.nodeName == "INPUT" && activeElement.type.toLowerCase == "text")) { var val = activeElement.value, start = activeElement.selectionStart, end = activeElement.selectionEnd; activeElement.value = val.slice(0, start) +  + sel +  + val.slice(end); }	} } function wikiText { var sel; if (window.getSelection) { sel = window.getSelection; var activeElement = document.activeElement; if (activeElement.nodeName == "TEXTAREA" ||          (activeElement.nodeName == "INPUT" && activeElement.type.toLowerCase == "text")) { var val = activeElement.value, start = activeElement.selectionStart, end = activeElement.selectionEnd; activeElement.value = val.slice(0, start) + '' + val.slice(end); }	} } function wikiPipe { var sel; if (window.getSelection) { sel = window.getSelection; var activeElement = document.activeElement; if (activeElement.nodeName == "TEXTAREA" ||          (activeElement.nodeName == "INPUT" && activeElement.type.toLowerCase == "text")) { var val = activeElement.value, start = activeElement.selectionStart, end = activeElement.selectionEnd; activeElement.value = val.slice(0, start) + '|' + val.slice(end); }	} }

jQuery(document).ready(function necload {	if (document.getElementById('necblah')) {		necfunction2;		necdefupdate;		necfunction;		necfunction4;		necfunction;	} });

//