-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
206 lines (176 loc) · 7.14 KB
/
index.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<!DOCTYPE html>
<html>
<head>
<title>Latex2MathML</title>
<!-- Copyright (c) 2012-2015 The MathJax Consortium -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<!-- Jquery CDN -->
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<!-- FontAwesome css -->
<link href="font-awesome-4.7.0/css/font-awesome.min.css" rel="stylesheet">
<!-- Latex2Equation Tool -->
<script src="latex2equation.js"></script>
<!-- BootStrap css -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css"
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- BootStrap Js -->
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<!-- cnpm get-google-font file -->
<link href='fonts/fonts.css' rel='stylesheet'>
<!-- Custom css file of index page -->
<link href='indexPage.css' rel='stylesheet'>
<!-- copy to clipBoard Tool -->
<script src="clipboard.min.js"></script>
<!-- x-MathJax Config File -->
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
showProcessingMessages: false,
tex2jax: { inlineMath: [['$','$'],['\\(','\\)']],
extensions: ["toMathML.js"]
}
});
</script>
<!-- x-MathJax Config File Done /-->
<!-- MathJax Js File-->
<script type="text/javascript" src="Mathjax/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<!-- ToolTip Tool -->
<script>$(function () { $("[data-toggle='tooltip']").tooltip(); });</script>
<script>
function getMathML(jax, callback) {
var mml;
try {
mml = jax.root.toMathML("");
} catch (err) {
if (!err.restart) {
throw err
} // an actual error
return MathJax.Callback.After([getMathML, jax, callback], err.restart);
}
MathJax.Callback(callback)(mml);
}
</script>
<script>
var Preview = {
delay: 150, // delay after keystroke before updating
preview: null, // filled in by Init below
buffer: null, // filled in by Init below
timeout: null, // store setTimout id
mjRunning: false, // true when MathJax is processing
oldText: null, // used to check if an update is needed
Init: function () {
this.preview = document.getElementById("MathPreview");
this.buffer = document.getElementById("MathBuffer");
},
SwapBuffers: function () {
var buffer = this.preview, preview = this.buffer;
this.buffer = buffer;
this.preview = preview;
buffer.style.visibility = "hidden";
buffer.style.position = "absolute";
preview.style.position = "";
preview.style.visibility = "";
},
Update: function () {
if (this.timeout) {
clearTimeout(this.timeout)
}
this.timeout = setTimeout(this.callback, this.delay);
},
CreatePreview: function () {
Preview.timeout = null;
if (this.mjRunning) return;
var text = document.getElementById("MathInput").value;
if (text === this.oldtext) return;
this.buffer.innerHTML = this.oldtext = text;
this.mjRunning = true;
MathJax.Hub.Queue(
["Typeset", MathJax.Hub, this.buffer],
["PreviewDone", this],
);
},
PreviewDone: function () {
this.mjRunning = false;
this.SwapBuffers();
},
};
Preview.callback = MathJax.Callback(["CreatePreview", Preview]);
Preview.callback.autoReset = true; // make sure it can run more than once
</script>
<!-- Clean All -->
<script>
var cleanAll = function () {
const text_input = '';
document.getElementById("MathInput").value = text_input
}
</script>
</head>
<body>
<div id="head-title">
<!-- head title left -->
<i class="fa fa-codepen head-title-left" aria-hidden="true">
<span style="margin-left: 4px">Latex2MathML</span>
</i>
<!-- head title right -->
<button class="fa fa-minus head-title-right" aria-hidden="true"></button>
<button class="fa fa-thumb-tack head-title-right" aria-hidden="true"></button>
</div>
<div class="container-fluid">
<div class="row-fluid">
<div class="span12">
<div id="editEquation">
Edit Equation:<br/>
</div>
<!-- input area -->
<div id="inputArea">
<textarea id="MathInput" cols="60" rows="10" onkeyup="Preview.Update()"></textarea>
</div>
<!-- MathPreview -->
<div id="MathPreview" style="
background-color: #CCCCCC;
padding: 20px;
width: 100%;
height: 80px;
text-align: center;
font-size: 20px;"></div>
<!-- MathBuffer -->
<div id="MathBuffer" style="
visibility: hidden;
background-color: #CCCCCC;
padding: 20px;
width: 100%;
font-size: 20px;
text-align: center;
position: absolute;
top: 287px;
left: 0;
height: 80px;"></div>
<!-- bottom part -->
<div>
<!-- need bootstrap tooltip -->
<button class="fa fa-question-circle" id="bottom-button-help" aria-hidden="true" data-toggle="tooltip"
data-placement="right" title="Help"></button>
<!-- Bottom Right Button -->
<button type="button" onclick="clickHandler('MathInput')" class="btn-sm btn btn-default bottom-button"
style="margin: 20px 0 50px 0;">Word Equation
</button>
<button type="button" onclick="cleanAll()" class="btn-sm btn btn-default bottom-button" style="margin: 20px 10px 50px 0;">
Clean All
</button>
</div>
</div>
</div>
</div>
<!-- footer -->
<footer class="navbar-fixed-bottom">
<div class="container" style="text-align: center">
<p class="fa fa-github-alt" aria-hidden="true" style="color: #c3c3c3; font-size: 13px"><span style="margin-left: 5px; font-size: 13px;">Reagan1947</span></p>
</div>
</footer>
<script>
Preview.Init();
</script>
</body>
</html>