Jetpack Stats Conflict
-
I apologize if this topic exists. I searched on various terms and found nothing.
I have to disable Jetpack statistics to manage roles. If I don’t, the following js is output, which results in the common “Uncaught ReferenceError: _ is not defined” error (which pretty much kills functionality on the role editor page).
Do you know of a work-around for this (other than ditching Jetpack)?
Thanks!
jQuery(window).load( function() {
jQuery( function($) {
resizeChart();
jQuery(window).resize( _.debounce( function(){
resizeChart();
}, 100) );
} );function resizeChart() {
var dashStats = jQuery( ‘#dashboard_stats div.inside’ );if ( dashStats.find( ‘.dashboard-widget-control-form’ ).length ) {
return;
}if ( ! dashStats.length ) {
dashStats = jQuery( ‘#dashboard_stats div.dashboard-widget-content’ );
var h = parseInt( dashStats.parent().height() ) – parseInt( dashStats.prev().height() );
var args = ‘width=’ + dashStats.width() + ‘&height=’ + h.toString();
} else {
if ( jQuery(‘#dashboard_stats’ ).hasClass(‘postbox’) ) {
var args = ‘width=’ + ( dashStats.prev().width() * 2 ).toString();
} else {
var args = ‘width=’ + ( dashStats.width() * 2 ).toString();
}
}dashStats.not( ‘.dashboard-widget-control’ ).load( ‘admin.php?page=stats&noheader&dashboard&’ + args );
}
} );
- The topic ‘Jetpack Stats Conflict’ is closed to new replies.