|
2 | 2 | <html lang="en"> |
3 | 3 | <head> |
4 | 4 | <meta charset="utf-8"> |
5 | | - |
6 | 5 | <title>Custom HTML page for THttpServer</title> |
7 | 6 |
|
8 | | - <script src="jsrootsys/scripts/JSRoot.core.js" type="text/javascript"></script> |
9 | | - |
10 | 7 | <style> |
11 | 8 | table, td { |
12 | 9 | border: 1px solid black; |
|
50 | 47 | </tbody> |
51 | 48 | </table> |
52 | 49 |
|
53 | | - <script type='text/javascript'> |
| 50 | +</body> |
54 | 51 |
|
55 | | - document.getElementById('btn_hpx').onclick = function() { |
56 | | - JSROOT.httpRequest("hpx/root.json", 'object') |
57 | | - .then(obj => JSROOT.redraw("draw_hpx", obj)); |
58 | | - } |
| 52 | +<script type='module'> |
59 | 53 |
|
60 | | - document.getElementById('btn_hpxpy').onclick = function() { |
61 | | - JSROOT.httpRequest("hpxpy/root.json", 'object') |
62 | | - .then(obj => JSROOT.redraw("draw_hpxpy", obj, "col")); |
63 | | - } |
| 54 | + import { httpRequest, redraw, cleanup } from './jsrootsys/modules/main.mjs'; |
64 | 55 |
|
65 | | - // here both objects requested with signle multi.json request |
66 | | - document.getElementById('btn_both').onclick = function() { |
67 | | - JSROOT.httpRequest("multi.json?number=2", "multi", "hpx/root.json\nhpxpy/root.json\n") |
68 | | - .then(arr => { |
69 | | - JSROOT.redraw("draw_hpx", arr[0]); |
70 | | - JSROOT.redraw("draw_hpxpy", arr[1], "col"); |
71 | | - }); |
72 | | - } |
| 56 | + document.getElementById('btn_hpx').onclick = function() { |
| 57 | + httpRequest("hpx/root.json", 'object') |
| 58 | + .then(obj => redraw("draw_hpx", obj)); |
| 59 | + } |
73 | 60 |
|
74 | | - document.getElementById('btn_clear').onclick = function() { |
75 | | - if (JSROOT.cleanup) { |
76 | | - JSROOT.cleanup("draw_hpx"); |
77 | | - JSROOT.cleanup("draw_hpxpy"); |
78 | | - } else { |
79 | | - console.log('No drawing was perfromed - JSROOT.cleanup function not yet defined'); |
80 | | - } |
81 | | - } |
| 61 | + document.getElementById('btn_hpxpy').onclick = function() { |
| 62 | + httpRequest("hpxpy/root.json", 'object') |
| 63 | + .then(obj => redraw("draw_hpxpy", obj, "col")); |
| 64 | + } |
82 | 65 |
|
83 | | - </script> |
| 66 | + // here both objects requested with signle multi.json request |
| 67 | + document.getElementById('btn_both').onclick = function() { |
| 68 | + httpRequest("multi.json?number=2", "multi", "hpx/root.json\nhpxpy/root.json\n") |
| 69 | + .then(arr => { |
| 70 | + redraw("draw_hpx", arr[0]); |
| 71 | + redraw("draw_hpxpy", arr[1], "col"); |
| 72 | + }); |
| 73 | + } |
84 | 74 |
|
85 | | -</body> |
| 75 | + document.getElementById('btn_clear').onclick = function() { |
| 76 | + cleanup("draw_hpx"); |
| 77 | + cleanup("draw_hpxpy"); |
| 78 | + } |
| 79 | + |
| 80 | +</script> |
86 | 81 |
|
87 | 82 | </html> |
0 commit comments