1{%- include snippets/get-sources.html -%} 2{%- assign _sources = __return -%} 3<script> 4 window.Lazyload.js(['{{ _sources.jquery }}', '{{ _sources.chart }}'], function() { 5 var $canvas = null, $this = null, _ctx = null, _text = ''; 6 $('.language-chart').each(function(){ 7 $this = $(this); 8 $canvas = $('<canvas></canvas>'); 9 _text = $this.text(); 10 $this.text('').append($canvas); 11 _ctx = $canvas.get(0).getContext('2d'); 12 (_ctx && _text) && (new Chart(_ctx, JSON.parse(_text)) && $this.attr('data-processed', true)); 13 }); 14 }); 15</script>