Ajax plugin tweakage from mdawaffe. fixes #3334
git-svn-id: http://svn.automattic.com/wordpress/trunk@4458 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
92bacd1a91
commit
f83762e87d
|
@ -688,7 +688,7 @@ class WP_Ajax_Response {
|
|||
$action = $_POST['action'];
|
||||
|
||||
$x = '';
|
||||
$x .= "<response action='$action_$id'>"; // The action attribute in the xml output is formatted like a nonce action
|
||||
$x .= "<response action='{$action}_$id'>"; // The action attribute in the xml output is formatted like a nonce action
|
||||
$x .= "<$what id='$id'" . ( false !== $old_id ? "old_id='$old_id'>" : '>' );
|
||||
$x .= $response;
|
||||
$x .= $s;
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
<?php
|
||||
@require_once('../../wp-config.php');
|
||||
cache_javascript_headers();
|
||||
$handler = get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php';
|
||||
?>
|
||||
<?php @require_once('../../wp-config.php'); cache_javascript_headers(); ?>
|
||||
addLoadEvent(function(){theList=new listMan();});
|
||||
function deleteSomething(what,id,message,obj){if(!obj)obj=theList;if(!message)message="<?php printf(__('Are you sure you want to delete this %s?'),"'+what+'"); ?>";if(confirm(message))return obj.ajaxDelete(what,id);else return false;}
|
||||
function dimSomething(what,id,dimClass,obj){if(!obj)obj=theList;return obj.ajaxDimmer(what,id,dimClass);}
|
||||
|
@ -10,7 +6,7 @@ function dimSomething(what,id,dimClass,obj){if(!obj)obj=theList;return obj.ajaxD
|
|||
var listMan = Class.create();
|
||||
Object.extend(listMan.prototype, {
|
||||
ajaxRespEl: 'ajax-response',
|
||||
ajaxHandler: '<?php echo $handler; ?>',
|
||||
ajaxHandler: false,
|
||||
inputData: '',
|
||||
clearInputs: [],
|
||||
showLink: true,
|
||||
|
@ -51,15 +47,17 @@ Object.extend(listMan.prototype, {
|
|||
if ( tempObj.showLink )
|
||||
tempObj.showLink = id;
|
||||
});
|
||||
}
|
||||
ajaxAdd.myResponseElement.update(tempObj.showLink ? ( "<div id='jumplink' class='updated fade'><p><a href='#" + what + '-' + tempObj.showLink + "'><?php _e('Jump to new item'); ?></a></p></div>" ) : '');
|
||||
}
|
||||
if ( tempObj.addComplete && typeof tempObj.addComplete == 'function' )
|
||||
tempObj.addComplete( what, where, update, transport );
|
||||
tempObj.recolorList();
|
||||
ajaxAdd.restoreInputs = null;
|
||||
});
|
||||
if ( !update )
|
||||
ajaxAdd.addOnWPError( function(transport) { tempObj.restoreForm(ajaxAdd.restoreInputs); });
|
||||
ajaxAdd.request(ajaxAdd.url);
|
||||
if ( !update )
|
||||
this.clear();
|
||||
return false;
|
||||
},
|
||||
|
@ -262,7 +260,5 @@ function killSubmit ( code, e ) {
|
|||
}
|
||||
}
|
||||
}
|
||||
//Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax
|
||||
function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; }
|
||||
//Generic but lame JS closure
|
||||
function encloseFunc(f){var a=arguments[1];return function(){return f(a);}}
|
||||
|
|
|
@ -19,7 +19,7 @@ Object.extend(WPAjax.prototype, {
|
|||
tempObj.WPError(transport);
|
||||
}
|
||||
});
|
||||
this.url = url;
|
||||
this.url = url ? url : '<?php bloginfo( 'wpurl' ); ?>/wp-admin/admin-ajax.php';
|
||||
this.getResponseElement(responseEl);
|
||||
},
|
||||
addArg: function(key, value) {
|
||||
|
@ -91,3 +91,6 @@ Ajax.Responders.register( {
|
|||
window.onbeforeunload = wpBeforeUnload;
|
||||
}
|
||||
});
|
||||
|
||||
//Pretty func adapted from ALA http://www.alistapart.com/articles/gettingstartedwithajax
|
||||
function getNodeValue(tree,el){try { var r = tree.getElementsByTagName(el)[0].firstChild.nodeValue; } catch(err) { var r = null; } return r; }
|
||||
|
|
|
@ -19,8 +19,8 @@ class WP_Scripts {
|
|||
$this->add( 'wp_tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('tiny_mce'), '09212006' );
|
||||
$this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.0');
|
||||
$this->add( 'autosave', '/wp-includes/js/autosave.js.php', array('prototype', 'sack'), '4206');
|
||||
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '4187');
|
||||
$this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '4187');
|
||||
$this->add( 'wp-ajax', '/wp-includes/js/wp-ajax-js.php', array('prototype'), '####');
|
||||
$this->add( 'listman', '/wp-includes/js/list-manipulation-js.php', array('wp-ajax', 'fat'), '####');
|
||||
if ( is_admin() ) {
|
||||
$this->add( 'dbx-admin-key', '/wp-admin/dbx-admin-key-js.php', array('dbx'), '3651' );
|
||||
$this->add( 'ajaxcat', '/wp-admin/cat-js.php', array('listman'), '3684' );
|
||||
|
|
Loading…
Reference in New Issue