' );
if ( data.next ) {
const diff = Math.max( 0, data.next - Math.floor( Date.now() / 1000 ) );
const seconds = diff % 60;
const minutes = Math.floor( diff / 60 ) % 60;
const hours = Math.floor( diff / 3600 ) % 24;
const days = Math.floor( diff / 86400 );
// If we're preloading within the next minute, start loading faster.
if ( minutes + hours === 0 ) {
nextPreloadTime = ACTIVE_INTERVAL;
}
const p = jQuery( '
' );
p.append(
jQuery( '' ).html(
sprintf(
/* Translators: 1: Number of days, 2: Number of hours, 3: Number of minutes, 4: Number of seconds */
__(
'Next preload scheduled in %1$s days, %2$s hours, %3$s minutes and %4$s seconds.',
'wp-super-cache'
),
days,
hours,
minutes,
seconds
)
)
);
panel.append( p );
}
if ( data.previous ) {
const p = jQuery( '
' );
p.append( jQuery( '' ).text( __( 'Last preload finished: ', 'wp-super-cache' ) ) );
p.append( jQuery( '' ).text( new Date( data.previous * 1000 ).toLocaleString() ) );
panel.append( p );
}
preloadInfoPanel.append( panel );
}
schedule_preload_update( nextPreloadTime );
}
} );