diff --git a/dispatchers/Html.php b/dispatchers/Html.php index 6c82b4bfd..ca5fc4cbc 100644 --- a/dispatchers/Html.php +++ b/dispatchers/Html.php @@ -237,10 +237,10 @@ public function enqueue_assets() { // Only load if the wp-admin bar is visible. if ( is_admin_bar_showing() ) { wp_enqueue_script( - 'web-vitals', + 'qm-web-vitals', $this->qm->plugin_url( 'assets/web-vitals.js' ), array(), - QM_VERSION, + '3.3.2', true ); } diff --git a/output/html/web_vitals.php b/output/html/web_vitals.php index f3241a38b..674a3d7ef 100644 --- a/output/html/web_vitals.php +++ b/output/html/web_vitals.php @@ -34,6 +34,15 @@ public function name() { * @return void */ public function output() { + if ( ! wp_script_is( 'qm-web-vitals', 'enqueued' ) && ! wp_script_is( 'qm-web-vitals', 'done' ) ) { + $this->before_non_tabular_output(); + /* translators: %s: Script handle. */ + $notice = sprintf( __( 'Script %s is not available.', 'query-monitor' ), 'qm-web-vitals' ); + echo $this->build_notice( $notice ); + $this->after_non_tabular_output(); + return; + } + $this->before_tabular_output(); echo ''; @@ -47,19 +56,24 @@ public function output() { echo ''; echo ''; + echo ''; + echo ''; + echo '

Waiting for data...

'; + echo ''; + echo ''; echo ''; $this->after_tabular_output(); echo '