1+ <!DOCTYPE html>
2+ <html lang =" en" >
3+
4+ <head >
5+ <meta charset =" UTF-8" >
6+ <meta name =" viewport" content =" width=device-width, initial-scale=1.0" >
7+ <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.css" >
8+ </link >
9+ <script type =" text/javascript"
10+ src =" https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/codemirror.min.js" ></script >
11+ <script type =" text/javascript"
12+ src =" https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/mode/javascript/javascript.min.js" ></script >
13+ <link rel =" stylesheet" href =" https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.52.2/theme/monokai.min.css" >
14+ <script src =" https://cdn.jsdelivr.net/npm/danfojs@0.1.1/dist/index.min.js" ></script >
15+
16+ <title >Document</title >
17+ </head >
18+
19+ <body >
20+ <div >
21+
22+ <div id =" my-div" style =" height: 500px; width: 1000px;" >
23+
24+ </div >
25+ <button style =" color: black;" id =" run" onclick =" run_cell(1)" >Run</button >
26+ <div id =" out" style =" height: 500px; width: 1000px;" >
27+
28+ </div >
29+
30+ <hr >
31+ <div id =" my-div2" style =" height: 500px; width: 1000px;" >
32+
33+ </div >
34+ <button style =" color: black;" id =" run" onclick =" run_cell(2)" >Run</button >
35+ <div id =" out2" style =" height: 500px; width: 1000px;" >
36+
37+ </div >
38+ </div >
39+
40+
41+
42+ <script >
43+ var code_out, code_out2;
44+ var variable_space = {}
45+
46+ const editor = CodeMirror (document .getElementById (' my-div' ), {
47+ lineNumbers: true ,
48+ tabSize: 2 ,
49+ mode: ' javascript' ,
50+ theme: ' monokai' ,
51+ value: ' '
52+ });
53+
54+ const editor2 = CodeMirror (document .getElementById (' my-div2' ), {
55+ lineNumbers: true ,
56+ tabSize: 2 ,
57+ mode: ' javascript' ,
58+ theme: ' monokai' ,
59+ value: ' '
60+ });
61+
62+ editor .on (' changes' , () => {
63+ code_out = editor .getValue ();
64+ });
65+
66+ editor2 .on (' changes' , () => {
67+ code_out2 = editor2 .getValue ();
68+ });
69+
70+
71+ function run_cell (id ) {
72+ if (id == 1 ) {
73+ console .log (code_out);
74+ let a = (" global" , eval)(code_out)
75+ // a = eval(code_out) + "<br>"
76+ document .getElementById (" out" ).innerHTML = a
77+
78+ } else {
79+ // console.log(variable_space[code_out2]);
80+ // a = eval(code_out2) + "<br>"
81+ console .log (code_out);
82+ document .getElementById (" out2" ).innerHTML = (" global" , eval)(code_out2)
83+
84+ }
85+ // var a = eval(code_out) + "<br>"
86+ // document.getElementById("out").innerHTML = a
87+ }
88+ </script >
89+
90+
91+
92+
93+
94+ </body >
95+
96+ </html >
97+
98+
99+
100+
101+ <!-- async function load(){
102+ df = await dfd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/master/doc/data/titanic.csv")
103+ return df
104+
105+ }
106+
107+ df = load().then((df)=>{return df}) -->
0 commit comments