]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/js/custom-fields.js
Wordpress 2.3.2-scripts
[autoinstalls/wordpress.git] / wp-admin / js / custom-fields.js
1 function customFieldsOnComplete( what, where, update, transport ) {
2         var pidEl = $('post_ID');
3         pidEl.name = 'post_ID';
4         pidEl.value = getNodeValue(transport.responseXML, 'postid');
5         var aEl = $('hiddenaction')
6         if ( aEl.value == 'post' ) aEl.value = 'postajaxpost';
7 }
8 addLoadEvent(customFieldsAddIn);
9 function customFieldsAddIn() {
10         theList.showLink=0;
11         theList.addComplete = customFieldsOnComplete;
12         if (!theList.theList) return false;
13         inputs = theList.theList.getElementsByTagName('input');
14         for ( var i=0; i < inputs.length; i++ ) {
15                 if ('text' == inputs[i].type) {
16                         inputs[i].setAttribute('autocomplete', 'off');
17                         inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
18                 }
19                 if ('updatemeta' == inputs[i].className) {
20                         inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
21                 }
22         }
23
24         $('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
25         $('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); };
26 }