| @@ -1,16 +1,15 @@ | ||
| 1 | 1 | /* global console */ |
| 2 | 2 | /* global visualizer */ |
| 3 | 3 | /* global jQuery */ |
| 4 | -var vizClipboard1=null; | |
| 4 | + | |
| 5 | 5 | (function($, visualizer){ |
| 6 | 6 | |
| 7 | 7 | function initActionsButtons(v) { |
| 8 | - if($('a.visualizer-chart-shortcode').length > 0 && vizClipboard1 === null) { | |
| 9 | - vizClipboard1 = new ClipboardJS('a.visualizer-chart-shortcode'); // jshint ignore:line | |
| 10 | - vizClipboard1.on('success', function(e) { | |
| 8 | + if($('a.visualizer-chart-shortcode').length > 0) { | |
| 9 | + var clipboard1 = new ClipboardJS('a.visualizer-chart-shortcode'); // jshint ignore:line | |
| 10 | + clipboard1.on('success', function(e) { | |
| 11 | 11 | window.alert(v.i10n['copied']); |
| 12 | - | |
| 13 | 12 | }); |
| 14 | 13 | } |
| 15 | 14 | |
| 16 | 15 | if($('a.visualizer-action[data-visualizer-type=copy]').length > 0) { |
| @@ -106,15 +105,8 @@ | ||
| 106 | 105 | initActionsButtons(visualizer); |
| 107 | 106 | registerDefaultActions(); |
| 108 | 107 | }); |
| 109 | 108 | |
| 110 | - // Refresh charts if chart not generated. | |
| 111 | - function refreshEachCharts() { | |
| 112 | - setTimeout( function() { | |
| 113 | - displayChartsOnFrontEnd(); | |
| 114 | - }, 100 ); | |
| 115 | - } | |
| 116 | - | |
| 117 | 109 | function initChartDisplay() { |
| 118 | 110 | if(visualizer.is_front == true){ // jshint ignore:line |
| 119 | 111 | displayChartsOnFrontEnd(); |
| 120 | 112 | }else{ |
| @@ -135,15 +127,12 @@ | ||
| 135 | 127 | } |
| 136 | 128 | |
| 137 | 129 | function displayChartsOnFrontEnd() { |
| 138 | 130 | // 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' ); | |
| 131 | + $( 'div.viz-facade-loaded:not(.visualizer-lazy):empty' ).removeClass( 'viz-facade-loaded' ); | |
| 140 | 132 | $('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); | |
| 144 | - } | |
| 145 | - refreshEachCharts(); | |
| 133 | + var id = $(element).addClass('viz-facade-loaded').attr('id'); | |
| 134 | + showChart(id); | |
| 146 | 135 | }); |
| 147 | 136 | |
| 148 | 137 | // interate through all charts that are to be lazy-loaded and observe each one. |
| 149 | 138 | $('div.visualizer-front.visualizer-lazy').each(function(index, element){ |