PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.3
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.3
4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 3.10.3 All 149 releases
← All changes | classes/Visualizer/Module/Frontend.php +26 -19 3.7.23.7.3 View file →
@@ -435,8 +435,9 @@
435 435 $actions_div .= $css;
436 436
437 437 $_charts = array();
438 438 $_charts_type = '';
439 + $count = 0;
439 440 foreach ( $this->_charts as $id => $array ) {
440 441 $_charts = $this->_charts;
441 442 $library = $array['library'];
442 443 $_charts_type = $library;
@@ -449,27 +450,29 @@
449 450 true
450 451 );
451 452 wp_enqueue_script( "visualizer-render-$library" );
452 453 }
454 +
455 + if ( wp_script_is( "visualizer-render-$_charts_type" ) && 0 === $count ) {
456 + wp_localize_script(
457 + "visualizer-render-$_charts_type",
458 + 'visualizer',
459 + array(
460 + 'charts' => $this->_charts,
461 + 'language' => $this->get_language(),
462 + 'map_api_key' => get_option( 'visualizer-map-api-key' ),
463 + 'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '',
464 + 'wp_nonce' => wp_create_nonce( 'wp_rest' ),
465 + 'i10n' => array(
466 + 'copied' => __( 'The data has been copied to your clipboard. Hit Ctrl-V/Cmd-V in your spreadsheet editor to paste the data.', 'visualizer' ),
467 + ),
468 + 'page_type' => 'frontend',
469 + 'is_front' => true,
470 + )
471 + );
472 + }
473 + $count++;
453 474 }
454 - if ( wp_script_is( "visualizer-render-$_charts_type" ) ) {
455 - wp_localize_script(
456 - "visualizer-render-$_charts_type",
457 - 'visualizer',
458 - array(
459 - 'charts' => $_charts,
460 - 'language' => $this->get_language(),
461 - 'map_api_key' => get_option( 'visualizer-map-api-key' ),
462 - 'rest_url' => version_compare( $wp_version, '4.7.0', '>=' ) ? rest_url( 'visualizer/v' . VISUALIZER_REST_VERSION . '/action/#id#/#type#/' ) : '',
463 - 'wp_nonce' => wp_create_nonce( 'wp_rest' ),
464 - 'i10n' => array(
465 - 'copied' => __( 'The data has been copied to your clipboard. Hit Ctrl-V/Cmd-V in your spreadsheet editor to paste the data.', 'visualizer' ),
466 - ),
467 - 'page_type' => 'frontend',
468 - 'is_front' => true,
469 - )
470 - );
471 - }
472 475
473 476 // return placeholder div
474 477 return '<div class="' . $container_class . '">' . $actions_div . '<div id="' . $id . '"' . $this->getHtmlAttributes( $attributes ) . '></div>' . $this->addSchema( $chart->ID ) . '</div>';
475 478 }
@@ -668,11 +671,15 @@
668 671 }
669 672
670 673 function visualizerLoadScripts() {
671 674 document.querySelectorAll("script[data-visualizer-script]").forEach(function(elem) {
672 - jQuery.getScript( elem.getAttribute("data-visualizer-script"), function() {
675 + jQuery.getScript( elem.getAttribute("data-visualizer-script") )
676 + .done( function( script, textStatus ) {
673 677 elem.setAttribute("src", elem.getAttribute("data-visualizer-script"));
674 678 elem.removeAttribute("data-visualizer-script");
679 + setTimeout( function() {
680 + jQuery( '.visualizer-front:not(.visualizer-chart-loaded)' ).resize();
681 + } );
675 682 } );
676 683 });
677 684 }
678 685 </script>