Widget:StatsGraph: Difference between revisions

m Correct module name
Create a script scope with IIFE shenanigans
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly><div class="stats-graph-container"><script>var targetContainer = document.currentScript.parentNode;
<includeonly><div class="stats-graph-container"><script>(() => {
RLQ.push(['ext.gadget.md5hasher', function () {
  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>