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+ < script src ="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js "> </ script >
16+
17+ < title > Document</ title >
18+ </ head >
19+
20+ < body >
21+ < div id ="container ">
22+
23+ < div id ="div-1 " style ="width:100%;height:30%; ">
24+
25+ </ div >
26+ < button style ="color: black; " id ="run_div-1 " class ="run "> Run</ button >
27+ < div id =out_div-1 > </ div >
28+
29+
30+
31+
32+ </ div >
33+
34+
35+
36+ < script >
37+ const editor = CodeMirror ( document . getElementById ( 'div-1' ) , {
38+ lineNumbers : true ,
39+ tabSize : 2 ,
40+ mode : 'javascript' ,
41+ theme : 'monokai' ,
42+ value : ''
43+ } ) ;
44+
45+ /////PROTO///////////
46+
47+ let store_cope = {
48+ "div-1" : editor
49+ }
50+
51+ function exec_cell ( id , count ) {
52+
53+ $ ( `#out_${ id } ` ) . html ( ( "global" , eval ) ( store_cope [ id ] . getValue ( ) ) || "" ) ;
54+
55+ count = parseInt ( count ) + 1
56+ let div_count = `div-${ count } `
57+
58+ if ( ! ( div_count in store_cope ) ) {
59+ $ ( "#container" ) . append (
60+ `<div id=${ div_count } class=""></div><br />
61+ <button style="color: black;" id=run_${ div_count } class="run">Run</button>
62+ <div id=out_${ div_count } ></div><br />`
63+ )
64+
65+ let editor = CodeMirror ( document . getElementById ( `${ div_count } ` ) , {
66+ lineNumbers : true ,
67+ tabSize : 2 ,
68+ mode : 'javascript' ,
69+ theme : 'monokai' ,
70+ value : ''
71+ } ) ;
72+
73+
74+ store_cope [ div_count ] = editor ;
75+
76+ }
77+
78+ }
79+
80+ $ ( document ) . on ( "click" , "button.run" , function ( ) {
81+ let id = this . id . split ( "_" ) [ 1 ]
82+ let count = this . id . split ( "-" ) [ 1 ]
83+ exec_cell ( id , count ) ;
84+ } )
85+ </ script >
86+
87+
88+
89+
90+
91+ </ body >
92+
93+ </ html >
94+
95+
96+
97+
98+ <!-- async function load(){
99+ df = await dfd.read_csv("https://raw.githubusercontent.com/pandas-dev/pandas/master/doc/data/titanic.csv")
100+ return df
101+
102+ }
103+
104+ df = load().then((df)=>{return df}) -->
0 commit comments