1/** 2 * Reinitialize VC Charts on usMaybeUpdateCharts event 3 */ 4! function( $ ) { 5 "use strict"; 6 7 $us.USVCCharts = function( container, options ) { 8 this.init( container, options ); 9 }; 10 11 $us.USVCCharts.prototype = { 12 init: function( container, options ) { 13 this.$container = $( container ); 14 15 this.charts = { 16 line: { 17 class: 'vc_line-chart', 18 }, 19 round: { 20 class: 'vc_round-chart', 21 } 22 }; 23 24 // Listener for the event to redraw the chart 25 $us.$canvas.on( 'contentChange', this.redraw.bind( this ) ); 26 }, 27 28 redraw: function( event, data = {} ) { 29 if ( !data || ! data.elm ) { 30 return; 31 } 32 33 for ( const chart in this.charts ) { 34 const $wrapper = $( data.elm ).hasClass( 'w-popup' ) ? '.w-popup-wrap' : $( data.elm ); 35 36 if ( this.$container.closest( $wrapper ).length ) { 37 if ( this.$container.hasClass( this.charts.line.class ) ) { 38 $.fn.vcLineChart && this.$container.vcLineChart( { reload: ! 1 } ); 39 } else if ( this.$container.hasClass( this.charts.round.class ) ) { 40 $.fn.vcRoundChart && this.$container.vcRoundChart( { reload: ! 1 } ); 41 } 42 } 43 } 44 }, 45 }; 46 47 $.fn.USVCCharts = function( options ) { 48 return this.each( function() { 49 $( this ).data( 'USVCCharts', new $us.USVCCharts( this, options ) ); 50 } ); 51 }; 52 53 $( function() { 54 $( '.vc_line-chart, .vc_round-chart' ).USVCCharts(); 55 } ); 56}( jQuery );
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.