Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Misc bug-fixes

  • Loading branch information...
commit 8d4a8e46f5f40e9251e803a3fef3c7e42c3fab19 1 parent cca3da2
@christianwach christianwach authored
Showing with 12 additions and 3 deletions.
  1. +9 −0 cp-ajax-comments.dev.js
  2. +3 −3 cp-ajax-comments.php
View
9 cp-ajax-comments.dev.js
@@ -583,6 +583,10 @@ jQuery(document).ready(function($) {
*/
function cpac_nice_append( response, content, target, last ) {
+ // test for undefined, which may happen on replies to comments
+ // which have lost their original context
+ if ( response === undefined || response === null ) { return; }
+
response.find(content)
.hide()
.appendTo(target);
@@ -604,6 +608,10 @@ jQuery(document).ready(function($) {
*/
function cpac_nice_prepend( response, content, target, last ) {
+ // test for undefined, which may happen on replies to comments
+ // which have lost their original context
+ if ( response === undefined || response === null ) { return; }
+
response.find(content)
.hide()
.prependTo(target);
@@ -829,6 +837,7 @@ jQuery(document).ready(function($) {
// get our data as object
var response = jQuery(data);
+ //console.log( data );
// add comment
cpac_add_comment( response );
View
6 cp-ajax-comments.php
@@ -78,7 +78,7 @@ function cpac_enable_plugin() {
// kick out if...
// cp is not enabled
- if ( !is_object( $commentpress_obj ) ) { return; }
+ if ( is_null( $commentpress_obj ) OR !is_object( $commentpress_obj ) ) { return; }
// we're in the WP back end
if ( is_admin() ) { return; }
@@ -89,7 +89,7 @@ function cpac_enable_plugin() {
add_action('wp_head', 'cpac_localise');
// add our javascripts
- add_action('wp_print_scripts', 'cpac_add_javascripts', 20);
+ add_action('wp_enqueue_scripts', 'cpac_add_javascripts', 20);
}
@@ -319,7 +319,7 @@ function cpac_add_javascripts() {
$debug_state = '';
// target different scripts when debugging
- if ( defined( 'WP_DEBUG' ) AND WP_DEBUG === true ) {
+ if ( defined( 'SCRIPT_DEBUG' ) AND SCRIPT_DEBUG === true ) {
// use uncompressed scripts
$debug_state = '.dev';
Please sign in to comment.
Something went wrong with that request. Please try again.