Changes
From Polyphasic Sleep Wiki
361 bytes added
, 2 years ago
Line 1: |
Line 1: |
| <includeonly> | | <includeonly> |
− | <div style="width:300px;height:300px"> | + | <div style="padding:5px"> |
− | <canvas id="myNapchart" width:100%;height:100%"></canvas></div> | + | <div style="width:320px;height:320px;"> |
| + | <canvas id="nc-<!--{$url|escape:'html'}-->" width:100%;height:100%;"></canvas></div></div> |
| <script src="/napchart.min.js"></script> | | <script src="/napchart.min.js"></script> |
| + | <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> |
| <script> | | <script> |
− | var ctx = document.getElementById("myNapchart").getContext('2d') | + | eval("var ctx_" + "<!--{$url|escape:'html'}-->".split('/').pop() + " = document.getElementById(\"nc-<!--{$url|escape:'html'}-->\").getContext('2d')") |
− | var myNapchart = Napchart.init(ctx, { | + | $.getJSON('https://cache.polysleep.org/napcharts/' + "<!--{$url|escape:'html'}-->".split('/').pop() + ".json", function(data) { |
− | // data goes here
| + | eval("var myNapchart_" + "<!--{$url|escape:'html'}-->".slice(21) + " = Napchart.init(ctx_" + "<!--{$url|escape:'html'}-->".split('/').pop() + ", data['chartDocument']['chartData'])"); |
− | elements: [{
| + | console.log(data); |
− | "start":720,
| + | }); |
− | "end": 790,
| |
− | "text": "Cool text"
| |
− | },{
| |
− | "start":1420,
| |
− | "end":400
| |
− | }]
| |
− | }, {
| |
− | // options go here
| |
− | })
| |
| </script> | | </script> |
| </includeonly> | | </includeonly> |