Skip to content

Commit

Permalink
Change figure_jsroot
Browse files Browse the repository at this point in the history
Use modules, import and async functions
  • Loading branch information
linev committed Oct 23, 2024
1 parent b2c81c8 commit 9dd2b8d
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions _includes/figure_jsroot
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,12 @@
<a name="f{{sect}}{{fig}}"></a>
{% endif %}

{% if {{included_JSRootCore}} != 1 %}
<script src="https://root.cern/js/dev/scripts/JSRoot.core.min.js" type="text/javascript"></script>
{% assign included_JSRootCore = 1 %}
{% endif %}
<script type='text/javascript'>
JSROOT.settings.HandleKeys = false;
JSROOT.openFile("{{f}}").then(file => file.readObject("{{o}}")).then(obj => JSROOT.draw("{{id}}", obj, ""));
<script type='module'>
import { settings, openFile, draw } from 'https://root.cern/js/latest/modules/main.mjs';
settings.HandleKeys = false;
const file = await openFile("{{f}}");
const obj = await file.readObject("{{o}}");
draw("{{id}}", obj, "");
</script>

{% capture caption_size %}{{ caption | size }}{% endcapture %}
Expand Down

0 comments on commit 9dd2b8d

Please sign in to comment.