PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.9
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.9
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 3.10.4 All 148 releases
← All changes | js/render-facade.js +20 -46 4.0.73.7.9 View file →
@@ -1,11 +1,10 @@
1 1 /* global console */
2 2 /* global visualizer */
3 3 /* global jQuery */
4 -window['vizClipboard1'] = window['vizClipboard1'] || null;
5 -window['vizClipboard2'] = window['vizClipboard2'] || null;
4 +var vizClipboard1=null;
6 5 (function($, visualizer){
7 -
6 +
8 7 function initActionsButtons(v) {
9 8 if($('a.visualizer-chart-shortcode').length > 0 && vizClipboard1 === null) {
10 9 vizClipboard1 = new ClipboardJS('a.visualizer-chart-shortcode'); // jshint ignore:line
11 10 vizClipboard1.on('success', function(e) {
@@ -13,14 +12,14 @@
13 12
14 13 });
15 14 }
16 15
17 - if($('a.visualizer-action[data-visualizer-type=copy]').length > 0 && vizClipboard2 === null) {
16 + if($('a.visualizer-action[data-visualizer-type=copy]').length > 0) {
18 17 $('a.visualizer-action[data-visualizer-type=copy]').on('click', function(e) {
19 18 e.preventDefault();
20 19 });
21 - vizClipboard2 = new ClipboardJS('a.visualizer-action[data-visualizer-type=copy]'); // jshint ignore:line
22 - vizClipboard2.on('success', function(e) {
20 + var clipboard = new ClipboardJS('a.visualizer-action[data-visualizer-type=copy]'); // jshint ignore:line
21 + clipboard.on('success', function(e) {
23 22 window.alert(v.i10n['copied']);
24 23 });
25 24 }
26 25 $('a.visualizer-action[data-visualizer-type!=copy]').off('click').on('click', function(e) {
@@ -107,12 +106,19 @@
107 106 initActionsButtons(visualizer);
108 107 registerDefaultActions();
109 108 });
110 109
110 + // Refresh charts if chart not generated.
111 + function refreshEachCharts() {
112 + setTimeout( function() {
113 + displayChartsOnFrontEnd();
114 + }, 100 );
115 + }
116 +
111 117 function initChartDisplay() {
112 118 if(visualizer.is_front == true){ // jshint ignore:line
113 119 displayChartsOnFrontEnd();
114 - } else {
120 + }else{
115 121 showChart();
116 122 }
117 123 }
118 124
@@ -128,48 +134,16 @@
128 134 $('body').trigger('visualizer:render:chart:start', viz);
129 135 }
130 136
131 137 function displayChartsOnFrontEnd() {
132 - function renderVisibleLazyCharts() {
133 - $('div.visualizer-front:not(.viz-facade-loaded):not(.visualizer-lazy):not(.visualizer-cw-error):empty').each(function(index, element){
134 - // Do not render charts that are intentionally hidden.
135 - const style = window.getComputedStyle(element);
136 - if (style.display === 'none' || style.visibility === 'hidden') {
137 - return;
138 - }
139 -
140 - // Only render charts that are currently within the viewport.
141 - const rect = element.getBoundingClientRect();
142 - const inViewport = rect.bottom >= 0 && rect.top <= (window.innerHeight || document.documentElement.clientHeight);
143 - if (!inViewport) {
144 - return;
145 - }
146 -
147 - const id = $(element).addClass('viz-facade-loaded').attr('id');
148 - setTimeout(function(){
149 - // Add a short delay between each chart to avoid overloading the browser event loop.
150 - showChart(id);
151 - }, ( index + 1 ) * 100);
152 - });
153 - }
154 -
155 - $(window).on('scroll', renderVisibleLazyCharts);
156 -
157 - // Run once on page load to render any lazy charts already in the viewport.
158 - renderVisibleLazyCharts();
159 -
160 - $('div.visualizer-front-container:not(.visualizer-lazy-render)').each(function(index, element){
161 - // Do not render charts that are intentionally hidden.
162 - const style = window.getComputedStyle($(element).find('.visualizer-front')[0]);
163 - if (style.display === 'none' || style.visibility === 'hidden') {
164 - return;
138 + // display all charts that are NOT to be lazy-loaded.
139 + $( 'div.viz-facade-loaded:not(.visualizer-lazy):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');
143 + showChart(id);
165 144 }
166 -
167 - const id = $(element).find('.visualizer-front').addClass('viz-facade-loaded').attr('id');
168 - setTimeout(function(){
169 - // Add a short delay between each chart to avoid overloading the browser event loop.
170 - showChart(id);
171 - }, ( index + 1 ) * 100);
145 + refreshEachCharts();
172 146 });
173 147
174 148 // interate through all charts that are to be lazy-loaded and observe each one.
175 149 $('div.visualizer-front.visualizer-lazy').each(function(index, element){