]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/js/custom-fields.js
Wordpress 3.2
[autoinstalls/wordpress.git] / wp-admin / js / custom-fields.js
index ad7a2db16640affd0c186f2c557853be13129d5a..dbe2f4816e0f8c60ac87a4b45876435c719fc661 100644 (file)
@@ -1,26 +1 @@
-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); };
-               }
-       }
-
-       $('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); };
-}
+jQuery(document).ready(function(d){var c,b,e,a;c=function(){var g=d('#newmeta [name="_ajax_nonce"]').val(),f=d("#post_ID").val();if(!g||!f){return false}return[g,f]};b=function(g){var f=c();if(!f){return false}g.data=g.data.replace(/_ajax_nonce=[a-f0-9]+/,"_ajax_nonce="+f[0])+"&post_id="+f[1];return g};e=function(j,i){var f=d("postid",j).text(),g;if(!f){return}d("#post_ID").attr("name","post_ID").val(f);g=d("#hiddenaction");if("post"==g.val()){g.val("postajaxpost")}};a=function(g){var f=c();if(!f){return false}g.data._ajax_nonce=f[0];g.data.post_id=f[1];return g};d("#the-list").wpList({addBefore:b,addAfter:e,delBefore:a}).find(".updatemeta, .deletemeta").attr("type","button")});
\ No newline at end of file