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>(() => { | ||
var targetContainer = document.currentScript.parentNode; | var targetContainer = document.currentScript.parentNode; | ||
$(document).ready(function() { | RLQ.push(['ext.gadget.md5hasher', function () { | ||
$(document).ready(function() { | |||
var graphData = JSON.parse(`<!--{$data|escape:'html'}-->`.replace(/"/gi, '"')); | |||
}); | window.iopwidgets.StatsGraph.buildGraph(graphData, targetContainer); | ||
} | }); | ||
}]); | |||
})();</script></div></includeonly><noinclude>{{Documentation}}</noinclude> | |||
