-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
notebook.html
116 lines (116 loc) · 3.92 KB
/
notebook.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<!DOCTYPE html>
<html>
<head>
<title>WillNotebook</title>
<link rel="icon" href="favicon.png">
<link href="css/menu.css" rel="stylesheet" type="text/css" />
<link href="css/style.css" rel="stylesheet" type="text/css" />
<script src="jquery-3.1.1.min.js"></script>
<script src="brython.js"></script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']] },
TeX: {equationNumbers: {autoNumber: "all"}},
CommonHTML: { linebreaks: { automatic: true,width: "650px" }},
"HTML-CSS": { linebreaks: { automatic: true,width: "650px" }},
SVG: { linebreaks: { automatic:true,width: "650px"}}
});
</script>
<script type="text/javascript">
math = {reNumber:function(){
MathJax.Hub.Queue(
["resetEquationNumbers",MathJax.InputJax.TeX],
["PreProcess",MathJax.Hub],
["Reprocess",MathJax.Hub]
);}}
</script>
<script type='text/javascript' asyn src='MathJax-master/MathJax.js?config=TeX-MML-AM_CHTML'></script>
<script>
var docID = "!@docID@!";
function uploadImg(docID,cell,file,label,source,caption,width){
var url = 'http://127.0.0.1:8080/image';
var xhr = new XMLHttpRequest();
var fd = new FormData();
xhr.open("POST", url, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
// Every thing ok, file uploaded
receiveImg(xhr.responseText); // handle response.
}
};
console.log('Attaching files...')
fd.append("docID", docID);
fd.append("cell", cell);
fd.append("img", file);
fd.append("label", label);
fd.append("source", source);
fd.append("caption", caption);
fd.append("width", width);
console.log('Done. Sending to the server...')
xhr.send(fd);
}
function uploadFile(docID,toOpen){
var url = 'http://127.0.0.1:8080/open';
var xhr = new XMLHttpRequest();
var fd = new FormData();
xhr.open("POST", url, true);
xhr.onreadystatechange = function() {
if (xhr.readyState == 4 && xhr.status == 200) {
// Every thing ok, file uploaded
renderFile(xhr.responseText); // handle response.
}
};
fd.append("docID", docID);
fd.append("toOpen", toOpen);
xhr.send(fd);
}
function previewImg(event,id){
document.getElementById(id).src = URL.createObjectURL(event.target.files[0]);
}
</script>
<style type="text/css" media="print">
.dontprint
{ display: none; }
</style>
</head>
<body onload="brython({debug:1})">
<script type="text/python" src="engine.py"></script>
<div class="dontprint menu">
<ul>
<li>
<form method='POST' action="saveFile">
<input name="filename" value="document">
<select name="extension">
<option value="will">will</option>
<option value="docx">docx</option>
<option value="tex">tex</option>
<option value="pdflatex">pdflatex</option>
<select>
<select name="model">
<option value="article">article</option>
<option value="report">report</option>
<option value="usp">USP</option>
<select>
<input type="hidden" name="docID" value="!@docID@!">
<button type="submit">Save</button>
</form>
</li>
<li>
<input type="file" id="toOpen">
<input type="hidden" name="docID" value="!@docID@!">
<button id="openButton">Open</button>
</li>
<li>
<form action="https://scholar.google.com/scholar" onsubmit="this.submit();this.reset();return false;" target="_blank" method="GET">
<input type="text" placeholder="Academic Google" name="q" id="q">
<button type="submit">Search</button>
</form>
</li>
</ul>
</div>
<div id="page">
</div>
<aside id="pannel">
<aside>
</body>
</html>