Widget:StatsGraph: Difference between revisions

m Moved scope of 'currentScript'
Create a script scope with IIFE shenanigans
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
<includeonly><div class="stats-graph-container"><script>
<includeonly><div class="stats-graph-container"><script>(() => {
RLQ.push(['ext.gadget.md5hasher', function () {
   var targetContainer = document.currentScript.parentNode;
   var targetContainer = document.currentScript.parentNode;
   $(document).ready(function() {
   RLQ.push(['ext.gadget.md5hasher', function () {
    var graphData = JSON.parse(`<!--{$data|escape:'html'}-->`.replace(/&quot;/gi, '"'));
    $(document).ready(function() {
    window.iopwidgets.StatsGraph.buildGraph(graphData, targetContainer);
      var graphData = JSON.parse(`<!--{$data|escape:'html'}-->`.replace(/&quot;/gi, '"'));
   });
      window.iopwidgets.StatsGraph.buildGraph(graphData, targetContainer);
}]);</script></div></includeonly><noinclude>{{Documentation}}</noinclude>
    });
   }]);
})();</script></div></includeonly><noinclude>{{Documentation}}</noinclude>