PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.14
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.14
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 | js/render-facade.js +29 -16 3.10.23.11.14 View file →
@@ -2,9 +2,9 @@
2 2 /* global visualizer */
3 3 /* global jQuery */
4 4 var vizClipboard1=null;
5 5 (function($, visualizer){
6 -
6 +
7 7 function initActionsButtons(v) {
8 8 if($('a.visualizer-chart-shortcode').length > 0 && vizClipboard1 === null) {
9 9 vizClipboard1 = new ClipboardJS('a.visualizer-chart-shortcode'); // jshint ignore:line
10 10 vizClipboard1.on('success', function(e) {
@@ -106,19 +106,12 @@
106 106 initActionsButtons(visualizer);
107 107 registerDefaultActions();
108 108 });
109 109
110 - // Refresh charts if chart not generated.
111 - function refreshEachCharts() {
112 - setTimeout( function() {
113 - displayChartsOnFrontEnd();
114 - }, 100 );
115 - }
116 -
117 110 function initChartDisplay() {
118 111 if(visualizer.is_front == true){ // jshint ignore:line
119 112 displayChartsOnFrontEnd();
120 - }else{
113 + } else {
121 114 showChart();
122 115 }
123 116 }
124 117
@@ -134,16 +127,36 @@
134 127 $('body').trigger('visualizer:render:chart:start', viz);
135 128 }
136 129
137 130 function displayChartsOnFrontEnd() {
138 - // display all charts that are NOT to be lazy-loaded.
139 - $( 'div.viz-facade-loaded:not(.visualizer-lazy):not(.visualizer-cw-error):empty' ).removeClass( 'viz-facade-loaded' );
140 - $('div.visualizer-front:not(.visualizer-lazy):not(.viz-facade-loaded)').each(function(index, element){
141 - if ( $(element).is(':visible') ) {
142 - var id = $(element).addClass('viz-facade-loaded').attr('id');
131 + $(window).on('scroll', function() {
132 + $('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error):empty').each(function(index, element){
133 + // Do not render charts that are intentionally hidden.
134 + const style = window.getComputedStyle(element);
135 + if (style.display === 'none' || style.visibility === 'hidden') {
136 + return;
137 + }
138 +
139 + const id = $(element).addClass('viz-facade-loaded').attr('id');
140 + setTimeout(function(){
141 + // Add a short delay between each chart to avoid overloading the browser event loop.
142 + showChart(id);
143 + }, ( index + 1 ) * 100);
144 + });
145 + });
146 +
147 + $('div.visualizer-front-container:not(.visualizer-lazy-render)').each(function(index, element){
148 + // Do not render charts that are intentionally hidden.
149 + const style = window.getComputedStyle($(element).find('.visualizer-front')[0]);
150 + if (style.display === 'none' || style.visibility === 'hidden') {
151 + return;
152 + }
153 +
154 + const id = $(element).find('.visualizer-front').addClass('viz-facade-loaded').attr('id');
155 + setTimeout(function(){
156 + // Add a short delay between each chart to avoid overloading the browser event loop.
143 157 showChart(id);
144 - }
145 - refreshEachCharts();
158 + }, ( index + 1 ) * 100);
146 159 });
147 160
148 161 // interate through all charts that are to be lazy-loaded and observe each one.
149 162 $('div.visualizer-front.visualizer-lazy').each(function(index, element){