diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-30 16:49:38 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-10-30 16:49:38 +0000 |
commit | d85d717aedbc7690e2a450e40dab8fcebd94b38c (patch) | |
tree | a7340a14bb1192e977fca4f26beef29869e17579 /wp-admin/js/custom-fields.js | |
parent | 9817ff2d282c68faaa09232845829b96f207e72b (diff) | |
download | wordpress-mu-d85d717aedbc7690e2a450e40dab8fcebd94b38c.tar.gz wordpress-mu-d85d717aedbc7690e2a450e40dab8fcebd94b38c.tar.xz wordpress-mu-d85d717aedbc7690e2a450e40dab8fcebd94b38c.zip |
Merge with WordPress 2.3.1
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@1139 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin/js/custom-fields.js')
-rw-r--r-- | wp-admin/js/custom-fields.js | 55 |
1 files changed, 24 insertions, 31 deletions
diff --git a/wp-admin/js/custom-fields.js b/wp-admin/js/custom-fields.js index 8f2b1a5..ad7a2db 100644 --- a/wp-admin/js/custom-fields.js +++ b/wp-admin/js/custom-fields.js @@ -1,33 +1,26 @@ -jQuery( function($) { - var before = function() { - var nonce = $('#newmeta [@name=_ajax_nonce]').val(); - var postId = $('#post_ID').val(); - if ( !nonce || !postId ) { return false; } - return [nonce,postId]; +function customFieldsOnComplete( what, where, update, transport ) { + var pidEl = $('post_ID'); + pidEl.name = 'post_ID'; + pidEl.value = getNodeValue(transport.responseXML, 'postid'); + var aEl = $('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); }; + } } - var addBefore = function( s ) { - var b = before(); - if ( !b ) { return false; } - s.data = s.data.replace(/_ajax_nonce=[a-f0-9]+/, '_ajax_nonce=' + b[0]) + '&post_id=' + b[1]; - return s; - }; - - var addAfter = function( r, s ) { - var postId = $('postid', r).text(); - if ( !postId ) { return; } - $('#post_ID').attr( 'name', 'post_ID' ).val( postId ); - var h = $('#hiddenaction'); - if ( 'post' == h.val() ) { h.val( 'postajaxpost' ); } - }; - - var delBefore = function( s ) { - var b = before(); if ( !b ) return false; - s.data._ajax_nonce = b[0]; s.data.post_id = b[1]; - return s; - } - - $('#the-list') - .wpList( { addBefore: addBefore, addAfter: addAfter, delBefore: delBefore } ) - .find('.updatemeta, .deletemeta').attr( 'type', 'button' ); -} ); + $('metakeyinput').onkeypress = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); }; + $('updatemetasub').onclick = function(e) {return killSubmit('theList.inputData+="&id="+$("post_ID").value;theList.ajaxAdder("meta", "newmeta");', e); }; +} |