source: trunk/plugins/Equation/popups/dialog.html @ 613

Last change on this file since 613 was 613, checked in by ray, 12 years ago

Equation: new version
Discussion: Ticket #877

File size: 13.9 KB
Line 
1<!DOCTYPE html
2     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
5<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
6<head>
7  <title>AsciiMath Formula Input</title>
8  <script type="text/javascript" src="../../../popups/popup.js"></script>
9  <script type="text/javascript" src="../ASCIIMathML.js"></script>
10  <link rel="stylesheet" type="text/css" href="../../../popups/popup.css" />
11
12  <style type="text/css">
13        #outputNode,#inputText {
14                padding:5px;
15                background-color:white;
16                width:230px;
17                height:200px;
18                font-size:1.3em;
19                border: 1px solid darkgrey;
20        }
21        #clickInput {
22                width:100%;
23                border-collapse:collapse;
24                background-color: white;
25                text-align:center;
26        }
27        #clickInput td {
28                border: thin solid gray;
29                cursor:pointer;
30                font-size:1.1em;
31               
32        }
33        h3 {
34                font-size:1.6em;
35        }
36  </style>
37  <script type="text/javascript">
38   window.resizeTo(500, 300);
39var showasciiformulaonhover = false;
40HTMLArea = window.opener.HTMLArea;
41
42function i18n(str) {
43  return (HTMLArea._lc(str, 'Equation'));
44}
45function set (string)
46{
47        var inputField = document.getElementById("inputText");
48        inputField.value += string;
49        preview();
50        inputField.focus();
51        return false;
52}
53function preview() {
54  if (document.getElementById("inputText") != '') {
55      var str = document.getElementById("inputText").value;
56      var outnode = document.getElementById("outputNode");
57      var newnode = AMcreateElementXHTML("div");
58      newnode.setAttribute("id","outputNode");
59      outnode.parentNode.replaceChild(newnode,outnode);
60      outnode = document.getElementById("outputNode");
61      var n = outnode.childNodes.length;
62      for (var i = 0; i < n; i++)
63        outnode.removeChild(outnode.firstChild);
64      outnode.appendChild(document.createComment("`"+str+"`"));
65      AMprocessNode(outnode,true);
66  }
67}
68function Init() {
69        __dlg_translate('Equation');
70        __dlg_init();
71        var param = window.dialogArguments;
72        var cfg = param["editor"].config;
73       
74        mathcolor = cfg.Equation.mathcolor;
75        mathfontfamily = cfg.Equation.mathfontfamily;
76       
77        var inputField = document.getElementById("inputText");
78        if (param["editedNode"] && param["editedNode"].tagName.toLowerCase() == 'math')
79        {
80                var formula = param["editedNode"].getAttribute("title");
81                inputField.value = formula;
82                preview();
83        }
84        else if (param["editedNode"] && param["editedNode"].tagName.toLowerCase() == 'span')
85        {
86                var formula = param["editedNode"].innerHTML.replace(/^`?(.*?)`?$/m,"$1");;
87                inputField.value = formula;
88        }
89        else inputField.value = '';
90        inputField.focus();
91}
92 
93function onOK() {
94       
95 var param = {
96        "editedNode":window.dialogArguments.editedNode,
97        "formula" : document.getElementById("inputText").value
98 };
99 
100 __dlg_close(param);
101  return false;
102}
103
104function onCancel() {
105  __dlg_close(null);
106  return false;
107}
108
109function translate() {
110  if (!AMtranslated) { // run this only once
111    AMtranslated = true;
112    AMinitSymbols();
113    AMprocessNode(document.getElementById("clickInput"),true);
114    preview();
115  }
116}
117window.onload = Init;
118</script>
119
120</head>
121
122<body class="dialog">
123<div class="title">AsciiMath Formula Input</div>
124<!--
125Table modified from CharacterMap for ASCIIMathML by Peter Jipsen
126HTMLSource based on HTMLArea XTD 1.5 (http://mosforge.net/projects/htmlarea3xtd/) modified by Holger Hees
127Original Author - Bernhard Pfeifer novocaine@gmx.net
128-->
129<table  id="clickInput">
130<tr>
131<td colspan="3" class="character" title="(x+1)/(x-1)" onclick="set('(x+1)/(x-1)')">`(x+1)/(x-1)`</td>
132<td colspan="2" class="character" title="x^(m+n)" onclick="set('x^(m+n)')">`x^(m+n)`</td>
133<td colspan="2" class="character" title="x_(mn)" onclick="set('x_(mn)')">`x_(mn)`</td>
134<td colspan="2" class="character" title="sqrt(x)" onclick="set('sqrt(x)')">`sqrt(x)`</td>
135<td colspan="3" class="character" title="root(n)(x)" onclick="set('root(n)(x)')">`root(n)(x)`</td>
136<td colspan="2" class="character" title="&quot;text&quot;" onclick="set('&quot;text&quot;')">`&quot;text&quot;`</td>
137<td colspan="2" class="character" style="cursor:default"></td>
138</tr><tr>
139<td colspan="2" class="character" title="dy/dx" onclick="set('dy/dx')">`dy/dx`</td>
140<td colspan="3" class="character" title="lim_(x-&gt;oo)" onclick="set('lim_(x-&gt;oo)')">`lim_(x-&gt;oo)`</td>
141<td colspan="3" class="character" title="sum_(n=1)^oo" onclick="set('sum_(n=1)^oo')">`sum_(n=1)^oo`</td>
142<td colspan="3" class="character" title="int_a^bf(x)dx" onclick="set('int_a^bf(x)dx')">`int_a^bf(x)dx`</td>
143<td colspan="3" class="character" title="[[a,b],[c,d]]" onclick="set('[[a,b],[c,d]]')">`[[a,b],[c,d]]`</td>
144<td colspan="2" class="character" title="((n),(k))" onclick="set('((n),(k))')">`((n),(k))`</td>
145</tr><tr>
146<td class="character" title="*" onclick="set('*')">`*`</td>
147<td class="character" title="**" onclick="set('**')">`**`</td>
148<td class="character" title="//" onclick="set('//')">`//`</td>
149<td class="character" title="\\" onclick="set('\\\\')">`\\`</td>
150<td class="character" title="xx" onclick="set('xx')">`xx`</td>
151<td class="character" title="-:" onclick="set('-:')">`-:`</td>
152<td class="character" title="@" onclick="set('@')">`@`</td>
153<td class="character" title="o+" onclick="set('o+')">`o+`</td>
154<td class="character" title="ox" onclick="set('ox')">`ox`</td>
155<td class="character" title="o." onclick="set('o.')">`o.`</td>
156<td class="character" title="sum" onclick="set('sum')">`sum`</td>
157<td class="character" title="prod" onclick="set('prod')">`prod`</td>
158<td class="character" title="^^" onclick="set('^^')">`^^`</td>
159<td class="character" title="^^^" onclick="set('^^^')"><font size="+1">`&and;`</font></td>
160<td class="character" title="vv" onclick="set('vv')">`vv`</td>
161<td class="character" title="vvv" onclick="set('vvv')"><font size="+1">`&or;`</font></td>
162</tr><tr>
163<td class="character" title="!=" onclick="set('!=')">`!=`</td>
164<td class="character" title="&lt;=" onclick="set('&lt;=')">`&lt;=`</td>
165<td class="character" title="&gt;=" onclick="set('&gt;=')">`&gt;=`</td>
166<td class="character" title="-&lt;" onclick="set('-&lt;')">`-&lt;`</td>
167<td class="character" title="&gt;-" onclick="set('&gt;-')">`&gt;-`</td>
168<td class="character" title="in" onclick="set('in')">`in`</td>
169<td class="character" title="!in" onclick="set('!in')">`!in`</td>
170<td class="character" title="sub" onclick="set('sub')">`sub`</td>
171<td class="character" title="sup" onclick="set('sup')">`sup`</td>
172<td class="character" title="sube" onclick="set('sube')">`sube`</td>
173<td class="character" title="supe" onclick="set('supe')">`supe`</td>
174<td class="character" title="O/" onclick="set('O/')">`O/`</td>
175<td class="character" title="nn" onclick="set('nn')">`nn`</td>
176<td class="character" title="nnn" onclick="set('nnn')"><font size="+1">`&cap;`</font></td>
177<td class="character" title="uu" onclick="set('uu')">`uu`</td>
178<td class="character" title="uuu" onclick="set('uuu')"><font size="+1">`&cup;`</font></td>
179</tr><tr>
180<td class="character" title="and" onclick="set('and')">`and`</td>
181<td class="character" title="or" onclick="set('or')">`or`</td>
182<td class="character" title="not" onclick="set('not')">`not`</td>
183<td class="character" title="=&gt;" onclick="set('==&gt;')">`=&gt;`</td>
184<td class="character" title="if" onclick="set('if')">`if`</td>
185<td class="character" title="&lt;=&gt;" onclick="set('&lt;=&gt;')">`&lt;=&gt;`</td>
186<td class="character" title="AA" onclick="set('AA')">`AA`</td>
187<td class="character" title="EE" onclick="set('EE')">`EE`</td>
188<td class="character" title="_|_" onclick="set('_|_')">`_|_`</td>
189<td class="character" title="TT" onclick="set('TT')">`TT`</td>
190<td class="character" title="|--" onclick="set('|--')">`|--`</td>
191<td class="character" title="|==" onclick="set('|==')">`|==`</td>
192<td class="character" title="-=" onclick="set('-=')">`-=`</td>
193<td class="character" title="~=" onclick="set('~=')">`~=`</td>
194<td class="character" title="~~" onclick="set('~~')">`~~`</td>
195<td class="character" title="prop" onclick="set('prop')">`prop`</td>
196</tr><tr>
197<td class="character" title="int" onclick="set('int')">`int`</td>
198<td class="character" title="oint" onclick="set('oint')">`oint`</td>
199<td class="character" title="del" onclick="set('del')">`del`</td>
200<td class="character" title="grad" onclick="set('grad')">`grad`</td>
201<td class="character" title="+-" onclick="set('+-')">`+-`</td>
202<td class="character" title="oo" onclick="set('oo')">`oo`</td>
203<td class="character" title="aleph" onclick="set('aleph')">`aleph`</td>
204<td class="character" title="quad" onclick="set('quad')">`quad`</td>
205<td class="character" title="diamond" onclick="set('diamond')">`diamond`</td>
206<td class="character" title="square" onclick="set('square')">`square`</td>
207<td class="character" title="|__" onclick="set('|__')">`|__`</td>
208<td class="character" title="__|" onclick="set('__|')">`__|`</td>
209<td class="character" title="|~" onclick="set('|~')">`|~`</td>
210<td class="character" title="~|" onclick="set('~|')">`~|`</td>
211<td class="character" title="&lt;x&gt;" onclick="set('&lt;x&gt;')">`&lt;x&gt;`</td>
212<td class="character" title="/_" onclick="set('/_')">`/_`</td>
213</tr><tr>
214<td class="character" title="uarr" onclick="set('uarr')">`uarr`</td>
215<td class="character" title="darr" onclick="set('darr')">`darr`</td>
216<td class="character" title="larr" onclick="set('larr')">`larr`</td>
217<td class="character" title="-&gt;" onclick="set('-&gt;')">`-&gt;`</td>
218<td class="character" title="|-&gt;" onclick="set('|-&gt;')">`|-&gt;`</td>
219<td class="character" title="harr" onclick="set('harr')">`harr`</td>
220<td class="character" title="lArr" onclick="set('lArr')">`lArr`</td>
221<td class="character" title="rArr" onclick="set('rArr')">`rArr`</td>
222<td class="character" title="hArr" onclick="set('hArr')">`hArr`</td>
223<td class="character" title="hata" onclick="set('hat')">`hata`</td>
224<td class="character" title="ula" onclick="set('ul')">`ula`</td>
225<td class="character" title="dota" onclick="set('dot')">`dota`</td>
226<td class="character" title="ddota" onclick="set('ddot')">`ddota`</td>
227<td class="character" title="veca" onclick="set('vec')">`veca`</td>
228<td class="character" title="bara" onclick="set('bar')">`bara`</td>
229<td class="character" title=":." onclick="set(':.')">`:.`</td>
230</tr><tr>
231<td class="character" title="NN" onclick="set('NN')">`NN`</td>
232<td class="character" title="ZZ" onclick="set('ZZ')">`ZZ`</td>
233<td class="character" title="QQ" onclick="set('QQ')">`QQ`</td>
234<td class="character" title="RR" onclick="set('RR')">`RR`</td>
235<td class="character" title="CC" onclick="set('CC')">`CC`</td>
236<td class="character" title="bba" onclick="set('bb')">`bba`</td>
237<td class="character" title="bbba" onclick="set('bbb')">`bbba`</td>
238<td class="character" title="cca" onclick="set('cc')">`cca`</td>
239<td class="character" title="fra" onclick="set('fr')">`fra`</td>
240<td class="character" title="sfa" onclick="set('sf')">`sfa`</td>
241<td class="character" title="tta" onclick="set('tt')">`tta`</td>
242<td colspan="4" class="character" title="stackrel(-&gt;)(+)" onclick="set('stackrel(-&gt;)(+)')">`stackrel(-&gt;)(+)`</td>
243<td class="character" title="upsilon" onclick="set('upsilon')">`upsilon`</td>
244</tr><tr>
245<td class="character" title="alpha" onclick="set('alpha')">`alpha`</td>
246<td class="character" title="beta" onclick="set('beta')">`beta`</td>
247<td class="character" title="gamma" onclick="set('gamma')">`gamma`</td>
248<td class="character" title="Gamma" onclick="set('Gamma')">`Gamma`</td>
249<td class="character" title="delta" onclick="set('delta')">`delta`</td>
250<td class="character" title="Delta" onclick="set('Delta')">`Delta`</td>
251<td class="character" title="epsi" onclick="set('epsi')">`epsi`</td>
252<td class="character" title="zeta" onclick="set('zeta')">`zeta`</td>
253<td class="character" title="eta" onclick="set('eta')">`eta`</td>
254<td class="character" title="theta" onclick="set('theta')">`theta`</td>
255<td class="character" title="Theta" onclick="set('Theta')">`Theta`</td>
256<td class="character" title="iota" onclick="set('iota')">`iota`</td>
257<td class="character" title="kappa" onclick="set('kappa')">`kappa`</td>
258<td class="character" title="lambda" onclick="set('lambda')">`lambda`</td>
259<td class="character" title="Lambda" onclick="set('Lambda')">`Lambda`</td>
260<td class="character" title="mu" onclick="set('mu')">`mu`</td>
261</tr><tr>
262<td class="character" title="nu" onclick="set('nu')">`nu`</td>
263<td class="character" title="pi" onclick="set('pi')">`pi`</td>
264<td class="character" title="Pi" onclick="set('Pi')">`Pi`</td>
265<td class="character" title="rho" onclick="set('rho')">`rho`</td>
266<td class="character" title="sigma" onclick="set('sigma')">`sigma`</td>
267<td class="character" title="Sigma" onclick="set('Sigma')">`Sigma`</td>
268<td class="character" title="tau" onclick="set('tau')">`tau`</td>
269<td class="character" title="xi" onclick="set('xi')">`xi`</td>
270<td class="character" title="Xi" onclick="set('Xi')">`Xi`</td>
271<td class="character" title="phi" onclick="set('phi')">`phi`</td>
272<td class="character" title="Phi" onclick="set('Phi')">`Phi`</td>
273<td class="character" title="chi" onclick="set('chi')">`chi`</td>
274<td class="character" title="psi" onclick="set('psi')">`psi`</td>
275<td class="character" title="Psi" onclick="set('Psi')">`Psi`</td>
276<td class="character" title="omega" onclick="set('omega')">`omega`</td>
277<td class="character" title="Omega" onclick="set('Omega')">`Omega`</td>
278</tr>
279</table>
280<form action="javascript:void(0);">
281<table style="width: 100%;border:none">
282  <tr>
283    <td>Input</td><td>Preview</td>
284  </tr>
285  <tr>
286    <td>
287    <textarea id="inputText" onkeyup="preview()"></textarea>
288    </td>
289    <td>
290    <div id="outputNode"></div>
291    </td>
292  </tr>
293  <tr><td colspan="2">
294  Based on ASCIIMathML by <a href="http://www.chapman.edu/~jipsen" target="new">Peter Jipsen</a>,
295<a href="http://www.chapman.edu" target="new">Chapman University</a><br />
296  For more information on AsciiMathML visit this page: <a href="http://www1.chapman.edu/~jipsen/mathml/asciimath.html" onclick="window.open(this.href,'_blank','');return false;">http://www1.chapman.edu/~jipsen/mathml/asciimath.html</a></td></tr>
297</table>
298
299<div id="buttons">
300  <button type="submit" name="ok" onclick="return onOK();">OK</button>
301  <button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
302</div>
303</form>
304</body>
305</html>
Note: See TracBrowser for help on using the repository browser.