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

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