summaryrefslogtreecommitdiffstats
path: root/wp-inst/wp-admin/custom-fields.js
blob: e86c87ebd620cfcbc2fae1b86878752861a3d61b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
function customFieldsOnComplete() {
	var pidEl = document.getElementById('post_ID');
	pidEl.name = 'post_ID';
	pidEl.value = getNodeValue(theList.ajaxAdd.responseXML, 'postid');
	var aEl = document.getElementById('hiddenaction')
	if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
}
addLoadEvent(customFieldsAddIn);
function customFieldsAddIn() {
	theList.showLink=0;
	theList.addComplete = customFieldsOnComplete;
	if (!theList.theList) return false;
	inputs = theList.theList.getElementsByTagName('input');
	for ( var i=0; i < inputs.length; i++ ) {
		if ('text' == inputs[i].type) {
			inputs[i].setAttribute('autocomplete', 'off');
		        inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
		}
		if ('updatemeta' == inputs[i].className) {
		        inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
		}
	}

	document.getElementById('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
	document.getElementById('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+document.getElementById("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
}