Karber:Mirzali/common.js

Wikiqısebend ra

Note: Qeydi ra dıme, gani viriya cıgeyrayoği pak bo ke vurnayışi bıvêniyê.

  • Gışta şıma ke niya ro gocega Firefox / Safari: Shift ser, bıtıknê ra newe ra bar kerên ya zi Ctrl-F5 ya zi Ctrl-R bıtıknê (seba Mac ra ⌘-R).
  • Google Chrome: Ctrl-Shift-R ro nê. (seba Mac ra ⌘-Shift-R)
  • Internet Explorer / Edge: Ctrl ke niyo ro cı, Newe ke bıtıknê ya zi Ctrl-F5 bıkerê.
  • Opera: Ctrl-F5 bıtıknê.
//[[en:User:Yair rand/newentrywiz.js]], translation section from [[:ca:Usuari:Aleator/novaentrada.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 */
// <nowiki>

var necdata = {
	pos: "name",
	pos2: "Name"
};
var necdefs = [
	['', [],
		[]
	]
];
var necpost = [];

for (var i = 1; i <= 11; ++i) {
	necpost[i] = [];
}

var necpostT = [];

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

var neccode = 'diq';
var necpostlangtext = [];

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

var necinfls = {
	diq: {
		'name': ['{{diq-name', '}}', ['Cınsiyet', '', [
				['nêzaniyeno', '|?'],
				['neri', '|n'],
				['mayki', '|m'],
				['notr', '|nt']
			]],
			['Zehfamar', '', [
				['çıniyo', '|'],
				['input', ' ', '|']
			]],
			['Zehfamarê halê çewti', '', [
				['çıniyo', ''],
				['input', ' ', '|']
			]]
		],
		'wextqıse': ['{{diq-wextqıse', '}}', ['Transitif?', '', [
				['nêzaniyeno', '|?'],
				['transitif', '|t'],
				['intransitif', '|i'],
				['transitif û intransitif', '|t-i']
			]],
			['Rıstımê wextê nıkayi', '', [
				['çıniyo', ''],
				['input', ' ', '|nıka=']
			]],
			['Rıstımê wextê nıkayi 2', '', [
				['çıniyo', ''],
				['input', ' ', '|nıka2=']
			]],
			['Rıstımê wextê veri', '', [
				['çıniyo', ''],
				['input', ' ', '|ravêrde=']
			]],
			['Rıstımê wextê veri 2', '', [
				['çıniyo', ''],
				['input', ' ', '|ravêrde2=']
			]],
			['Rıstımê subjontifi', '', [
				['çıniyo', ''],
				['input', ' ', '|subj=']
			]],
			['Rıstımê subjontifi', '', [
				['çıniyo', ''],
				['input', ' ', '|subj2=']
			]],
			['Kategoriye 2', '', [
				['çıniya', ''],
				['input', ' ', '|kat2=']
			]]
		],
		'sıfet': ['{{diq-sıfet', '}}', ['Cınsiyet', '', [
				['nêzaniyeno', '|?'],
				['neri', '|n'],
				['mayki', '|m'],
				['notr', '|nt']
			]],
			['Formo mayki', '', [
				['çıniyo', ''],
				['input', ' ', '|']
			]],
			['Tablo?', '', [
				['nê', ''],
				['eya', '|tablo=1'],
			]]
		],
	},
	de: {
		'name': ['{{ser|de|name', '}}', ['Cınsiyet', '', [
				['nêzaniyeno', ''],
				['neri', '|z=n'],
				['mayki', '|z=m'],
			]],
		],
	},

	en: {
		'name': ['{{ser|en|name', '}}', ['Zehfamar', '', [
				['çıniyo', ''],
				[title + 's', '|zehfamar|' +title +'s'],
				[title + 'es', '|zehfamar|' +title +'es'],
				['input', ' ', '|zehfamar|'],
			]]
		],
	},
	fa: {
		'name': ['{{ser|fa|name', '}}',
			['Transliterasyon', '', [
				['çıniyo', ''],
				['input', ' ', '|tr='],
			]],
	
			['Zehfamar', '', [
				['çıniyo', ''],
				['input', ' ', '|zehfamar|'],
			]],
		],
		'sıfet': ['{{ser|fa|sıfet', '}}',
			['Transliterasyon', '', [
				['çıniyo', ''],
				['input', ' ', '|tr='],
			]],
		],
		'wextqıse': ['{{ser|fa|wextqıse', '}}',
			['Transliterasyon', '', [
				['çıniyo', ''],
				['input', ' ', '|tr='],
			]],
		],
		'zerfe': ['{{ser|fa|zerfe', '}}',
			['Transliterasyon', '', [
				['çıniyo', ''],
				['input', ' ', '|tr='],
			]],
		],
	},

	fr: {
		'name': ['{{ser|fr|name', '}}', ['Cınsiyet', '', [
				['nêzaniyeno', '|c=?'],
				['neri', '|c=n'],
				['mayki', '|c=m'],
				['mayki û neri', '|mn'] //french doesn't have notr nouns. 
			]],
			['Zehfamar', '', [
				['çıniyo', ''],
				[title + 's', '|zehfamar|' +title +'s'],
				['input', ' ', '|zehfamar|'],
			]]
		],
	},
	kmr: {
		'name': ['{{ser|kmr|name', '}}', ['Cınsiyet', '', [
				['nêzaniyeno', '|c=?'],
				['neri', '|c=n'],
				['mayki', '|c=m'],
				['mayki û neri', '|mn'] //kurmancî doesn't have notr nouns. 
			]]
		],
		'sıfet': ['{{ser|kmr|sıfet', '}}', ['Komparatif?', '', [
				['nêzaniyeno', ''],
				[title + 'tir', '|komparatif|' + title + 'tir|superlatif|herî ' + title], //seba Zazaki ra 
			]]
		],
	},
	
};

/*

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

*/

/* 
'Antış', 
1 'Varyanti', 'Hemmena', 'Zıdmena', 3
4 'Cêrname', 'Corname', 'Eleqeyın', 'Eleqedar', 7
'Gurenayış', 8
'Etimolociye', 9
'Dunda', 10
'Çarnayışi' 11

*/
var necetym;
var necvaryanti;
var necpron;
var necheadingorder = ['Antış', 'Varyanti', 'Hemmena', 'Zıdmena', 'Cêrname', 'Corname', 'Eleqeyın', 'Eleqedar', 'Gurenayış', 'Etimolociye', 'Dunda', 'Çarnayışi'];
var necinputadvanced = "";
var necposlist = ['Name', 'Wextqıse', 'Sıfet', 'Zerfe', 'Akronim', 'Amar', 'Artikel', 'Balnişan', 'Bend', 'Bestoğ', 'Cumle', 'Çıftçekuye', 'Edat', 'Herfi', 'Kılmname', 'Miyanbend', 'Nameyê xısusiyi', 'Nameyo pêrabeste', 'Peybend', 'Qıse', 'Rıçık', 'Sembol', 'Vate', 'Vatenê verênan', 'Verbend', 'Wextqıseyo pêrabeste', 'Zemir'];
var nectemplate = ['Hemveng', 'IPA', 'Hece', 'Veng', 'Kategoriye', 'Wikipediya', 'Bıvêne', 'Dosya', 'Etimolociye'];


function necfunction2() {
	/* CREATE OPTIONS */
	var x = "Kodê zıwani: <input type=text value='diq' 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=='diq')?'':'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='Kodê zıwani bınuse, seba Zazaki ra diq, seba İngılızki ra en'></input><span id=neclangerror style=display:none;color:red> ERROR: INVALID LANGUAGE CODE</span><br>Tewrê grameri: ";

	for (i = 0; i < 4; ++i) {
		x += "<a id='necinputpos" + necposlist[i] + "' href=javascript: onclick=document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='';necdata.pos2='" + necposlist[i] + "';necdata.pos='" + necposlist[i].toLowerCase() + "';this.style.fontWeight='bold';necfunction4();necfunction()";

		if (!i) {
			x += " style='font-weight:bold'";
		}

		x += ">" + necposlist[i] + "</a>, ";
	}

	x += "<span id='necinputpos'>Ê bini: <input type=text onKeyUp=\"document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='';necdata.pos2=this.value;necdata.pos=this.value.toLowerCase().replace(/ /g,'');this.parentNode.setAttribute('ID','necinputpos'+this.value);document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='bold';necfunction();necfunction4()\" /><select onchange=\"document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='';necdata.pos2=this.value;necdata.pos=this.value.toLowerCase().replace(/ /g,'');this.parentNode.setAttribute('ID','necinputpos'+this.value);document.getElementById('necinputpos'+necdata.pos2).style.fontWeight='bold';necfunction();necfunction4()\"><option value=''>Weçine</option>";

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

	x += "</select></span><span id=necinfls></span><br>Qısımê bini:  <span id=nectransspan> <a href=javascript: id=necSynonymsbutton onclick=necpost[2][necpost[2].length]=['',''];necpostbox();necfunction();this.style.fontWeight='bold' title='Hemmeneyanê çekuye bınuse'>Hemmena</a>, <a href=javascript: id=necSynonymsbutton onclick=necpost[1][necpost[1].length]=['',''];necpostbox();necfunction();this.style.fontWeight='bold' title='Varyantê çekuye bınuse'>Varyanti</a>, <span id=nectransspan><a href=javascript: id=nectransbutton onclick=necpost[11][necpost[11].length]=['',''];necpostbox();necfunction();this.style.fontWeight='bold' title='Yew çarnayış cı ke'>Çarnayışi</a>, </span>Ê bini: <select onchange=necpostbox(this.value);this.selectedIndex=0;necfunction()><option select='selected'>Weçine</option>";

	for (i = 1; i < necheadingorder.length; ++i) {
		if (i != 1 && i != 2  && i != 9  && i != 11) {
			x += "<option value=" + i + ">" + necheadingorder[i] + "</option>";
		}
	}

	x += "</select><br><span id=necpostbox></span><span id='necdefs'>Definition: <input type=text id='necinput3' onKeyUp=necdefs[0][0]=this.value;necfunction() /><br></span>Melumato bin: <a href=javascript:necdefs.push(['',[],[]]);necdefupdate();necfunction() title='Menaya bine bınuse'>Menaya bine</a>,  <a href=javascript: id=necetymbutton onclick=document.getElementById('necetymspan').style.display='';necetym=document.getElementById('necetyminput').value;necfunction();this.style.fontWeight='bold' title='Etimolociye cı ke'>Etimolociye</a>, <a href=javascript: id=necpronbutton onclick=document.getElementById('necpronspan').style.display='';necpron=document.getElementById('necproninput').value;necfunction();this.style.fontWeight='bold' title='Wendış cı ke'>Wendış</a>, <a href=javascript: id=necvaryantibutton onclick=document.getElementById('necvaryantispan').style.display='';necvaryanti=document.getElementById('necvaryantiinput').value;necfunction();this.style.fontWeight='bold' title='Şablona varyanti cı ke'>Varyanti</a>. <span id='necetymspan' style='display:none'><br>Etimolociye: <a href=javascript: onclick=necetym=undefined;document.getElementById('necetymspan').style.display='none';necfunction();document.getElementById('necetymbutton').style.fontWeight='' title='Etimolociye wedare'>(Wedare)</a><br><textarea id=necetyminput onKeyUp=necetym=this.value;necfunction()></textarea></span><span id=necpronspan style='display:none'><br>Wendış: <a href=javascript: onclick=necpron=undefined;document.getElementById('necpronspan').style.display='none';necfunction();document.getElementById('necpronbutton').style.fontWeight='' title='Wendış wedare'>(Wedare)</a><br><textarea id=necproninput onKeyUp=necpron=this.value;necfunction()></textarea></span><span id=necvaryantispan style='display:none'><br>Varyanti: <a href=javascript: onclick=necvaryanti=undefined;document.getElementById('necvaryantispan').style.display='none';necfunction();document.getElementById('necvaryantibutton').style.fontWeight='' title='Şablona varyanti wedare'>(Wedare)</a><br><textarea id=necvaryantiinput onKeyUp=necvaryanti=this.value;necfunction()></textarea></span><div style='float:right;'><a href=/w/index.php?title=User_talk:Balyozxane/newentrywiz.js&action=edit&section=new title='Persan bımocne'>Pers?</a></div>";

	x += "</select><br><span id=necpostboxT></span>Şablon: <select onchange=necpostboxT(this.value);this.selectedIndex=0;necfunction()><option select='selected'>Weçine</option>";

	for (i = 0; i < nectemplate.length; ++i) {
			x += "<option value=" + i + ">" + nectemplate[i] + "</option>";
		}
	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 += "";
	} else {
		var neceditsummary = "([[Karber:Balyozxane/newentrywiz.js|NEC]]) +" + neccode + ":" + necdata.pos + ": "; //edit summary

		if (necvaryanti != undefined) {
			neceditsummary += "Varyantê " + necvaryanti;
		}
		
		for (i = 0; i < necdefs.length; ++i) {
			neceditsummary += ((i != 0) ? ', ' : '') + necdefs[i][0];
		}

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

	if (necpostT[6][0] != undefined) {
	    k += "{{bıvêne";
	    for (i = 0; i < necpostT[6].length; i++) {
	        k += "|" + necpostT[6][i];
	    }
	    k += "}}\n\n";
	}
		
	k += "== {{zıwan|" + document.getElementById('necinput').value + "}} ==";


	k += "\n";

	if (necpron != undefined || necpostT[0][0] != undefined || necpostT[3][0] != undefined  || necpostT[2][0] != undefined || necpostT[1][0] != undefined) {
		k += "\n=== Wendış ===\n";
		if (necpron != undefined) {
		    k += necpron + "\n";
		}
		for (i = 0; i < necpostT[1].length; ++i) {
			k += "* {{AŞF|" + neccode + "|" + necpostT[1][i] + "}}\n";
		}

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

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

	}

	k += "\n=== " + necdata.pos2 + " ===\n";

	if (necpostT[7][0] != undefined) {
		for (i = 0; i < necpostT[7].length; ++i) {
			k += "[[Dosya:" + necpostT[7][i][0] + "|thumb|" + necpostT[7][i][1] + "]]\n";
		}
	}
	
	if (necpostT[5][0] != undefined) {
		for (i = 0; i < necpostT[5].length; ++i) {
			k += "{{Wikipediya|zıwan=" + neccode + "|" + necpostT[5][i][0] + "|" + necpostT[5][i][1] + "}}\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 += '{{ser' + '|' + neccode + '|' + necdata.pos2.toLowerCase();

				k += '}}';
			}
		}
	}

	k += "";

	for (i = 0; i < necdefs.length; ++i) {

		if (necvaryanti != undefined) {
		    k += "\n# {{varyanti|" + neccode + "|" + necvaryanti + "}}";
		}else {
			k +="\n# " + necdefs[i][0];
		}
		
		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 != "diq" && necdefs[i][1][l][1] && (new LangMetadata()).guessScript(neccode) != 'Latn') {
				k += "\n#*: " + necdefs[i][1][l][1] + "";
			}

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

		for (l = 0; l < necdefs[i][2].length; ++l) {
			k += "\n#* ''";
			k += necdefs[i][2][l][5].replace(new RegExp("(" + title + "([^( |,|;|\?|\.|\!)]+)?)", "ig"), "'''$1'''");
			k += "'' {{çıme2|";
			if (necdefs[i][2][l][1]) {
				k += necdefs[i][2][l][1]; //nuştekar
			}
			if (necdefs[i][2][l][2]) {
				k += ", ''" + necdefs[i][2][l][2] + "''";//sername
			}
			if (necdefs[i][2][l][3]) {
				k += ", " + necdefs[i][2][l][3]; //weşanxane
			}
			if (necdefs[i][2][l][0]) {
				k += ", " + necdefs[i][2][l][0]; //sal
			}
			if (necdefs[i][2][l][4]) {
				k += ", p. " + necdefs[i][2][l][4] + "}}"; //p. seba "pele" rê 
			}
			else
				k += "}}";



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

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

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

		for (i = 0; i < necpost[o].length; ++i) {
			k += "\n* {{qualifier|" + necpost[o][i][0] + "}} ";

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

					k += "{{g|" + neccode + "|" + necpost[o][i][u] + "}}";
				}
			}
		}
	}
	
	for (o = 4; o <= 6; ++o) {
		if (necpost[o][0] != undefined) {
			k += "\n\n==== " + necheadingorder[o] + " ====";
		}

		for (i = 0; i < necpost[o].length; ++i) {
			k += "\n* {{g|" + neccode + "|" + necpost[o][i] + "}}";
		} 
	}

	if (necpost[7][0] != undefined) {
		k += "\n\n==== Eleqedar ====";
		k += "\n{{col2|" + neccode;
		for (i = 0; i < necpost[7].length; ++i) {
			k +="|" + necpost[7][i];
		}
		k += "}}"
	}
	var HH=0;//hi ha?

	if (necpost[8][0] != undefined) {
		k += "\n\n==== Gurenayış ====";
	}
		   HH = 0;
			for (i = 0; i < necpost[8].length; ++i) {
		        if (HH == 0) {
		            k += "\n{{hide-top|Vıraştışê çekuye}}";
		        }
//		        k += "\n''" + necpost[8][i][0] + "'':";
	        for (var uu in necpost[8][i]) {
		            if (uu != 0) { 
	                if (uu != 1) {
		                    k += "";
	                }
		                k += "\n* {{qualifier|" + necpost[8][i][0] + "}} {{g|" + neccode + "|" + necpost[8][i][uu] + "}}";
		            }
		        }
		        if (HH == 0) {
		            k += "\n{{hide-mid}}";
		            HH = 1;
		        }
		    }
		    if (HH == 1) {
		        k += "\n{{hide-bottom}}";
		    }

	
	if (necetym != undefined || necpostT[8][0] != undefined) {
		k += "\n\n==== Etimolociye ====\n";
	}
			for (i = 0; i < necpostT[8].length; ++i) {
				k += "> {{r|" + necpostT[8][i][0] + "|" + neccode;
				k += "|" + necpostT[8][i][1] + "}} ";
			}
	if (necetym != undefined) {
		k += necetym;
	}


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

		if (o == 10) { //Dunda
			for (i = 0; i < necpost[10].length; ++i) {
				k += "\n* {{Z|" + necpost[10][i][0] + "}}: {{g|" + necpost[10][i][0];
				k += "|" + necpost[10][i][1] + "}}";
			}
		}
		if (o == 11) { //Çarnayışi
		    HH = 0;
			for (i = 0; i < necpost[11].length; ++i) {
		        if (HH == 0) {
		            k += "\n{{ç-ser}}";
		        }
		        k += "\n* {z|" + necpost[11][i][0] + "}}: ";
	        for (var uu in necpost[11][i]) {
		            if (uu != 0) { //concatenar trads
	                if (uu != 1) {
		                    k += ", ";
	                }
		                k += "{{ç|" + necpost[11][i][0] + "|" + necpost[11][i][uu] + "}}";
		            }
		        }
		        if (HH == 0) {
		            k += "" + "";
		            HH = 1;
		        }
		    }
		    if (HH == 1) {
		        k += "\n{{ç-bın}}";
		    }
		}
	}

	if (necpostT[4][0] != undefined) { //kategoriye
		k += "\n";
	    for (i = 0; i < necpostT[4].length; i++) {
			k += "\n[[Kategoriye:" + necpostT[4][i] + "]]";
		}
	}


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


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

}


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 += "><br>Be kodê wikiyi ra bınuse: <input type=text value='" + necinputadvanced + "' onKeyUp=\"necinputadvanced=this.value;if (this.value){this.parentNode.style.fontWeight='bold'}else{this.parentNode.style.fontWeight=''};necfunction()\" /></span>";
		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 += "<br>" + a[r][0] + ": ";

		for (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() /></span>";
				if (i != a[r][2].length - 1) {
					q += ", ";
				}
			}
		}


		/* ADVANCED OPTIONS */
		if (r == 2) {
			q += "<span id='necinput" + qq + "Advanced' class=msgfornonnewbies><span style=font-weight:normal>, </span>Be kodê wikiyi ra bınuse: <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() /></span>";
		}
	}

	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 = "";
    for (i = 0; i < necdefs.length; i++) {
        def += "Mane: <input size=110 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='Mena wedare'> (–)</a>";
        }
        def += "<a href=javascript:necdefs[" + i + "][1].push(['','','']);uNec() title='Yew nımune cı ke'> (+nımune)</a><a href=javascript:necdefs[" + i + "][2].push(['','','','','','','']);uNec() title='Cıra-gırewtene cı ke'>(+cıra-gırewtene)</a>";
        for (l = 0; l < necdefs[i][1].length; l++) { //Exemple
            def += "<br><span style='padding-left:30px;'>Mînak: </span><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='Mînakê jê bibe'> (–)</a>";
            if (neccode != "diq") {
                def += "<br><span style='padding-left:60px;'>Wergera mînakê: </span><input type=text size=40 value='" + necdefs[i][1][l][2] + "' onKeyUp=necdefs[" + i + "][1][" + l + "][2]=this.value;necfunction() />";
            }
        }
        for (l = 0; l < necdefs[i][2].length; l++) { //Citacions
            var x = ['Serre', 'Nuştekar', 'Sername', 'Weşanxane', 'Pele'];
            var z = [4, 20, 20, 20, 5]; //mides
            def += "<br><span style='padding-left:30px;'>";
            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 += "</span><br><span style='padding-left:30px;'>Jêgirtin: <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='Cıra-gırewtene wedare'>(–)</a>";
            if (neccode != "diq") {
                def += "<br><span style='padding-left:60px;'>Çarnayışê cıra-gırewtene: </span><input type=text size=40 value='" + necdefs[i][2][l][6] + "' onKeyUp=necdefs[" + i + "][2][" + l + "][6]=this.value;necfunction() />";
            }
        }


		def += "<br>";
	}
	document.getElementById('necdefs').innerHTML = def;
}


function necpostbox(q) {
	if (q != undefined) {
		if ((q > 0 && q <= 3) || q == 10  || q == 8 || q == 11) {
			necpost[q][necpost[q].length] = ['', '']
		} else if ((q > 3 && q < 8)) {
			necpost[q][necpost[q].length] = '';
		} else {
			necpost[q] = '';
		}
	}
	var m = "";

	/* USAGE NOTES, INFLECTION TABLES */
	if (o == 0) {
		if (necpost[0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[0] + ": <a href=javascript:necpost[0]=undefined;";
			if (!o) {
				m += "document.getElementById('necquotbutton').style.fontWeight='';";
			}
			m += "necpostbox();necfunction() title='Nê qısımi wedare'>(wedare)</a></span><br><span style='padding-left:60px;'><textarea onKeyUp=necpost[0]=this.value;necfunction()>" + necpost[0] + "</textarea></span><br>";
		}
	}
	/* NYMS */
	for (o = 1; o < 4; o++) {
		if (necpost[o][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[o] + ": <a id=nec" + necheadingorder[o] + "button  href=javascript:necpost[" + o + "][necpost[" + o + "].length]=['',''];necpostbox();necfunction() title=' nê qısımi cı ke'>(cı ke)</a></span><br>";
		} else if (o == 2) {
			document.getElementById('necSynonymsbutton').style.fontWeight = '';
		}

		for (i = 0; i < necpost[o].length; ++i) {
			m += "<span style='padding-left:60px;'>Mena: <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='" + necheadingorder[o] + " lê zêde bike'> (+)</a>";
			if (necpost[o][i].length > 2) {
				m += "<a href=javascript:necpost[" + o + "][" + i + "].splice(" + (necpost[o][i].length - 1) + ",1);necpostbox();necfunction() title='" + necheadingorder[o] + " wedare'> (–)</a>";
			}
			m += "<a href=javascript:necpost[" + o + "].splice(" + i + ",1);necpostbox();necfunction() title='Nê qısımi wedare'> (wedare)</a><br>";
		}
	}

	/* DERIVED TERMS, RELATED TERMS, SEE ALSO, EXTERNAL LINKS */
	for (o = 4; o < 7; o++) {
		if (necpost[o][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[o] + ": <a href=javascript:necpost[" + o + "].push('');necpostbox();necfunction()>(nû)</a></span><br>";
		}

		for (i = 0; i < necpost[o].length; ++i) {
			m += "<span style='padding-left:60px;'><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='Wedare'>(–)</a><br>";
		}
	}

	/* Eleqedar */
	for (o = 7; o < 8; o++) {
		if (necpost[o][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[o] + ": <a href=javascript:necpost[" + o + "].push('');necpostbox();necfunction()>(nû)</a></span><br>";
		}

		for (i = 0; i < necpost[o].length; ++i) {
			m += "<span style='padding-left:60px;'><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='Jê bibe'>(–)</a><br>";
		}
	}
	
	/* Gurenayış */

	if (necpost[8][0] != undefined) {
	/*			m += "<span style='padding-left:30px;'>" + necheadingorder[8] + ": <a href=javascript:necpost[8].push('');necpostbox();necfunction()>(nû)</a></span><br>";*/
			m += "<span style='padding-left:30px;'>Gurenayış: <a id=nec" + necheadingorder[8] + "button  href=javascript:necpost[8][necpost[8].length]=['',''];necpostbox();necfunction() title='Tewro bin cı ke'>(tewro newe +)</a></span><br>";


		for (i = 0; i < necpost[8].length; ++i) {
			m += "<span style='padding-left:60px;'>Tewrê çekuye: <input type=text value='" + necpost[8][i][0] + "' onKeyUp=necpost[8][" + i + "][0]=this.value;necfunction() /> " + necheadingorder[8] + ": ";
			for (var u = 0; u < necpost[8][i].length; ++u) {
				if (u != 0) {
					if (u != 1) {
						m += ", ";
					}
					m += "<input type=text size=5 value='" + necpost[8][i][u] + "' onKeyUp=necpost[8][" + i + "][" + u + "]=this.value;necfunction() />";
				}
			}
			m += "<a href=javascript:necpost[8][" + i + "].push('');necpostbox();necfunction() title='Yew çekuya bine cı ke'> (+)</a>";
			if (necpost[8][i].length > 2) {
				m += "<a href=javascript:necpost[8][" + i + "].splice(" + (necpost[8][i].length - 1) + ",1);necpostbox();necfunction() title='Vê peyvê jê bibe'> (–)</a>";
			}
			m += "<a href=javascript:necpost[8].splice(" + i + ",1);necpostbox();necfunction() title='Vî cureyî jê bibe'> (jê bibe)</a><br>";
		}
	}
	
	/* DESCENDANTS Dunda*/

	if (necpost[10][0] != undefined) {
		m += "<span style='padding-left:30px;'>" + necheadingorder[10] + ": <a href=javascript:necpost[10].push(['','']);necpostbox();necfunction() title='Yew dundayo newe cı ke'>(newe)</a></span><br>";
	}

	for (i = 0; i < necpost[10].length; ++i) {
		m += "<span style='padding-left:60px;'>Kodê zıwani: <input type=text value='" + necpost[10][i][0] + "' onKeyUp=necpost[10][" + i + "][0]=this.value;necfunction() onblur=if (necCleanLangCode(this.value)){this.value=necCleanLangCode(this.value)};necpost[10][" + i + "][0]=this.value;necfunction() /> Çekuye: <input type=text value='" + necpost[10][i][1] + "' onKeyUp=necpost[10][" + i + "][1]=this.value;necfunction() /><a href=javascript:necpost[10].splice(" + i + ",1);necpostbox();necfunction() title='Wedare'>(–)</a><br>";
	}

	/* TRANSLATIONS */

	if (necpost[11][0] != undefined) {
			m += "<span style='padding-left:30px;'>" + necheadingorder[11] + ": <a id=nec" + necheadingorder[11] + "button  href=javascript:necpost[11][necpost[11].length]=['',''];necpostbox();necfunction() title='Yew zıwano bin cı ke'>(yew zıwano bin +)</a></span><br>";
		}

		for (i = 0; i < necpost[11].length; ++i) {
			m += "<span style='padding-left:60px;'>Kodê zıwani: <input type=text value='" + necpost[11][i][0] + "' onKeyUp=necpost[11][" + i + "][0]=this.value;necfunction() /> " + necheadingorder[11] + ": ";
			for (var u = 0; u < necpost[11][i].length; ++u) {
				if (u != 0) {
					if (u != 1) {
						m += ", ";
					}
					m += "<input type=text size=5 value='" + necpost[11][i][u] + "' onKeyUp=necpost[11][" + i + "][" + u + "]=this.value;necfunction() />";
				}
			}
			m += "<a href=javascript:necpost[11][" + i + "].push('');necpostbox();necfunction() title='Yew çarnayışo bin cı ke'> (+)</a>";
			if (necpost[11][i].length > 2) {
				m += "<a href=javascript:necpost[11][" + i + "].splice(" + (necpost[11][i].length - 1) + ",1);necpostbox();necfunction() title='Nê çarnayışi wedare'> (–)</a>";
			}
			m += "<a href=javascript:necpost[11].splice(" + i + ",1);necpostbox();necfunction() title='Nê zıwani wedare'> (wedare)</a><br>";
		}
	
	document.getElementById('necpostbox').innerHTML = m;
}


function necpostboxT(q) {
	if (q != undefined) {
		if (q == 3 || q == 5 || q == 7 || q == 8) {
			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 = "";

	/* Hemveng */
	
	if (necpostT[0][0] != undefined) {
		for (i = 0; i < necpostT[0].length; ++i) {
			n += "<span style='padding-left:30px;'>Hemveng: <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='Hemvengi wedare'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[0].push('');necpostboxT();necfunction() title='Hemvengê bini cı ke'> (+hemvengo newe)</a>";
			}
			n += "</span><br>";
		}
	}

	/* IPA */
	
	if (necpostT[1][0] != undefined) {
		for (i = 0; i < necpostT[1].length; ++i) {
			n += "<span style='padding-left:30px;'>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='IPAyi wedare'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[1].push('');necpostboxT();necfunction() title='IPAyo bin cı ke'> (+IPAyo newe)</a>";
			}
			n += "</span><br>";
		}
	}

	/* Hecenayene */
	
	if (necpostT[2][0] != undefined) {
		for (i = 0; i < necpostT[2].length; ++i) {
			n += "<span style='padding-left:30px;'>Hece: <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='Hecenayene wedare'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[2].push('');necpostboxT();necfunction() title=''> (+heceya bine) </a>";
			}
			n += "</span><br>";
		}
	}	

	/* Veng */
	
	if (necpostT[3][0] != undefined) {
		for (i = 0; i < necpostT[3].length; ++i) {
			n += "<span style='padding-left:30px;'>Navê dosyeyê: <input type=text value='" + necpostT[3][i][0] + "' onKeyUp=necpostT[3][" + i + "][0]=this.value;necfunction() />  Dorme: <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='Vengi wedare'> (–)</a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[3].push(['','']);necpostboxT();necfunction() title='Dengekî nû lê zêde bike'> (+dengê nû)</a>";
			}
			n += "</span><br>";
		}
	}

	/* Kategoriye */
	
	if (necpostT[4][0] != undefined) {
		for (i = 0; i < necpostT[4].length; ++i) {
			n += "<span style='padding-left:30px;'>Kategoriye: <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='Kategoriye wedare'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[4].push('');necpostboxT();necfunction() title='Yew kategoriya newiye cı ke'> (+kategoriya newiye) </a>";
			}
			n += "</span><br>";
		}
	}	

	/* Wikipediya */
	
	if (necpostT[5][0] != undefined) {
		for (i = 0; i < necpostT[5].length; ++i) {
			n += "<span style='padding-left:30px;'>Pela Wikipediya: <input type=text value='" + necpostT[5][i][0] + "' onKeyUp=necpostT[5][" + i + "][0]=this.value;necfunction() /> Pela Wikiqısebendi: <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='Şabloni wedare'> (–)</a>";

			n += "</span><br>";
		}
	}


	/* Sewbina bıvêne */
	
	if (necpostT[6][0] != undefined) {
		for (i = 0; i < necpostT[6].length; ++i) {
			n += "<span style='padding-left:30px;'>Bıvêne: <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='Çekuye wedare'> (–) </a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[6].push('');necpostboxT();necfunction() title='cı ke'> (+yewa bine) </a>";
			}
			n += "</span><br>";
		}
	}	

	/* Resım */
	
	if (necpostT[7][0] != undefined) {
		for (i = 0; i < necpostT[7].length; ++i) {
			n += "<span style='padding-left:30px;'>Nameyê dosya: <input type=text value='" + necpostT[7][i][0] + "' onKeyUp=necpostT[7][" + i + "][0]=this.value;necfunction() /> Caption-ê dosya: <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='Şabloni wedare'> (–)</a>";
			if (i == 0) {
					n += "<a href=javascript:necpostT[7].push(['','']);necpostboxT();necfunction() title='Yew resmo newe cı ke'> (+resmo newe)</a>";
				}

			n += "</span><br>";
		}
	}

	/* Etimolociye [[şablon:r]] */
	
	if (necpostT[8][0] != undefined) {
		for (i = 0; i < necpostT[8].length; ++i) {
			n += "<span style='padding-left:30px;'>Zimanê jêder: <input type=text value='" + necpostT[8][i][0] + "' onKeyUp=necpostT[8][" + i + "][0]=this.value;necfunction() /> Çekuye: <input type=text value='" + necpostT[8][i][1] + "' onKeyUp=necpostT[8][" + i + "][1]=this.value;necfunction() /><a href=javascript: necpostT[8].splice(" + i + ",1);necpostboxT();necfunction() title='Şabloni wedare'> (–)</a>";
			if (i == 0) {
				n += "<a href=javascript:necpostT[8].push(['','']);necpostboxT();necfunction() title='Cı ke'> (+)</a>";
			}

			n += "</span><br>";
		}
	}



	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();
}

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

// </nowiki>