added LaTeXMathML files
[lambda.git] / jsMath / jsMath-controls.html
1 <html>
2 <head>
3 <!--
4  | jsMath-controls.html
5  |
6  | Part of the jsMath package for mathematics on the web.
7  | 
8  | This file handles the details of the jsMath control panels
9  | 
10  | ---------------------------------------------------------------------
11  | 
12  | Copyright 2004-2007 by Davide P. Cervone
13  |
14  | Licensed under the Apache License, Version 2.0 (the "License");
15  | you may not use this file except in compliance with the License.
16  | You may obtain a copy of the License at
17  |
18  |     http://www.apache.org/licenses/LICENSE-2.0
19  |
20  | Unless required by applicable law or agreed to in writing, software
21  | distributed under the License is distributed on an "AS IS" BASIS,
22  | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23  | See the License for the specific language governing permissions and
24  | limitations under the License.
25 -->
26 </head>
27 <body>
28
29 <script>
30 var showWarning = 0;
31 var domain = document.domain || "";
32 var mustPost = ((domain == "" || domain == "localhost") && window.postMessage);
33 while (!window.jsMath && !showWarning) {
34   try {
35     window.jsMath = window.parent.jsMath;
36     if (!window.jsMath) {throw "no jsMath";}
37   } catch (err) {
38     showWarning = 1; pageDomain = '';
39     try {pageDomain = document.domain} catch (err) {}
40     //
41     // MSIE on Mac can't change document.domain, and 'try' won't
42     //   catch the error (Grrr!) so don't even attempt it.
43     //
44     if (pageDomain.match(/\..*\./) &&
45         (navigator.appName != 'Microsoft Internet Explorer' ||
46          !navigator.platform.match(/Mac/) || !navigator.userProfile || !document.all)) {
47       try {
48         document.domain = pageDomain.replace(/^[^.]*\./,'');
49         showWarning = 0;
50       } catch(err) {}
51     }
52   }
53 }
54
55 function Warning () {
56   alert(
57     "jsMath can't open the control panel, since jsMath was not " +
58     "obtained from a server that is in the same domain as the " +
59     "page that loaded it."
60   );
61 }
62
63 if (showWarning) {
64   if (!mustPost) setTimeout("Warning()",1);
65 } else {
66   var debug = window.parent.debug;
67   var show = window.parent.show;
68 }
69 </SCRIPT>
70
71 <SCRIPT ID="jsMath_script">
72 if (window.jsMath) {
73
74 jsMath.Add(jsMath.Controls,{
75
76   loaded: 1,
77
78   mainLabels: {
79     print: 'Print',  reload: 'Reload', local: 'Go Local', global: 'Go Global',
80     ctrls: 'Controls', opts: 'Options', done: 'Done'
81   },
82   optionLabels: {back: 'Back', done: 'Done'},
83
84   Close: function () {
85     this.panel.style.display = "none";
86     jsMath.Element("button").style.display = (this.cookie.button ? "block" : "none");
87     if (jsMath.document.location.protocol == 'file:' && jsMath.Global.islocal) return;
88     for (var id in {scale:1, scaleImg:1, font:1, print:1, printwarn:1,
89                     stayhires:1, autofont:1, alpha:1, tex2math:1, global:1}) {
90       if (this.cookie[id] && this.cookie[id] != this.oldCookie[id] &&
91           this.oldCookie[id] != null) {
92         this.Reload();
93         return;
94       }
95     }
96   },
97
98   Main: function () {
99     this.oldCookie = {}; jsMath.Add(this.oldCookie,this.cookie);
100     this.GetPanel("main");
101
102     jsMath.Element("_version").innerHTML = jsMath.version;
103
104     jsMath.Element("_fontType").innerHTML =
105       ({tex:"TeX",
106         image:"Image",
107         symbol:"Image symbol",
108         unicode:"Unicode"})[this.cookie.font];
109
110      jsMath.Element("_mailto").href =
111        "mailto:dpvc@union.edu?subject=Bug Report for jsMath "
112            + jsMath.version + " (using " + jsMath.browser
113            + " in " + this.cookie.font + " mode)";
114
115     if (this.cookie.print ||
116        (this.cookie.font != 'image' && this.cookie.font != 'symbol'))
117          {jsMath.Element("_resolution").disabled = true}
118
119     if (jsMath.Global.isLocal) {
120       jsMath.Element("_ctrls").disabled = true;
121     } else {
122       this.cookie.hiddenGlobal = jsMath.Global.isHidden;
123       jsMath.Element("_global").style.display = "none";
124       jsMath.Element("_local").style.display = "";
125       if (!jsMath.Global.isHidden || jsMath.noShowGlobal)
126         {jsMath.Element("_ctrls").disabled = true}
127     }
128     if (jsMath.noChangeGlobal) {
129       for (var id in {global:1, local:1, ctrls: 1})
130         {jsMath.Element('_'+id).disabled = true}
131     }
132     if (!window.print) {jsMath.Element("_print").disabled = true}
133
134     if (jsMath.Browser.safariButtonBug) {
135       for (var id in this.mainLabels)
136         {jsMath.Element('_'+id).value = this.mainLabels[id]}
137     }
138
139     this.panel.style.display = "block";
140     this.openMain = 0;
141   },
142
143   Options: function () {
144     this.GetPanel("options");
145     jsMath.Element("_scale").value = this.cookie.scale;
146     jsMath.Element("_keep").value = this.cookie.keep;
147     jsMath.Element("_global").value = this.cookie.global;
148     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1,
149                     stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) {
150       if (this.cookie[id]) {jsMath.Element('_'+id).checked = true}
151     }
152     var font = jsMath.document.getElementsByName("jsMath__font");
153     for (var i = 0; i < font.length; i++) {
154       if ((font[i].value == 'tex' && jsMath.nofonts) ||
155           ((font[i].value == 'symbol' || font[i].value == 'image') &&
156              jsMath.noImgFonts)) {
157         jsMath.Element('_'+font[i].value+"Text").className = "disabled";
158         font[i].disabled = true;
159       }
160       else if (this.cookie.font == font[i].value) {font[i].checked = true}
161     }
162     if (jsMath.noImgFonts) {
163       for (var id in {alpha:1, printwarn:1, stayhires:1}) {
164         var obj = jsMath.Element("_"+id);
165         obj.disabled = true;
166         obj.parentNode.className = "disabled";
167       }
168     } else if (jsMath.Browser.imgScale != 1) {
169       jsMath.Element("_alphaText").className = "disabled";
170       jsMath.Element("_alpha").disabled = true;
171     }
172     if (jsMath.tex2math.Convert) {
173       jsMath.Element("_separator").style.display = '';
174       jsMath.Element("_tex2mathRow").style.display = '';
175     }
176     if (jsMath.noChangeGlobal) {
177       jsMath.Element("_globalText").className = "disabled";
178       jsMath.Element("_global").disabled = true;
179     }
180     if (jsMath.isCHMmode) {
181       jsMath.Element("_asynchText").className  = "disabled";
182       jsMath.Element("_asynch").disabled = true;
183     }
184
185     if (jsMath.Browser.safariButtonBug) {
186       for (var id in this.optionLabels)
187         {jsMath.Element('_'+id).value = this.optionLabels[id]}
188     }
189
190     this.panel.style.display = "block";
191
192     if (jsMath.Browser.msieMoveButtonHack) {
193       this.panel.style.left = "0px";
194       this.panel.style.top = "0px";
195       jsMath.Controls.MoveButton();
196     }
197   },
198
199   HTML: {},  // storage for panels for Firefox3 in local mode
200
201   GetPanel: function (name) {
202     this.panel.innerHTML = ""; // for MSIE on the Mac
203     var html = this.HTML[name];
204     if (html == null) {html = document.getElementById("jsMath_"+name).innerHTML}
205     this.panel.innerHTML = html;
206   },
207
208   SaveOptions: function (close) {
209     this.cookie.scale = jsMath.Element("_scale").value;
210     var font = jsMath.document.getElementsByName("jsMath__font");
211     for (var i = 0; i < font.length; i++) 
212       {if (font[i].checked) {this.cookie.font = font[i].value}}
213     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1,
214                     stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) {
215       if (this.cookie[id] != null) {
216         this.cookie[id] = jsMath.Element('_'+id).checked ? 1: 0;
217       }
218     }
219     this.cookie.keep = jsMath.Element("_keep").value;
220     this.cookie.global = jsMath.Element("_global").value;
221     this.cookie.print = this.cookie.stayhires;
222     this.SetCookie(1);
223     if (close) {this.Close()} else {this.Main()}
224   },
225
226   PrintResolution: function () {
227     this.cookie.print = 1;
228     this.SetCookie(1);
229     this.Close();
230   },
231
232   Print: function () {
233     this.Close();
234     jsMath.window.print();
235   },
236
237   GoGlobal: function () {
238     this.cookie.global = "always";
239     jsMath.Global.GoGlobal(this.SetCookie(2));
240   },
241   GoLocal: function () {jsMath.Global.GoLocal()},
242
243   ShowControls: function () {
244     this.Close();
245     jsMath.Global.Show();
246   },
247
248   NoAuto: function () {jsMath.Element("_autofont").checked = false}
249
250 });
251
252 jsMath.Add(jsMath.Post.Commands,{
253   PAN: function (message) {jsMath.Controls.HTML.main = message},
254   OPT: function (message) {jsMath.Controls.HTML.options = message},
255
256   PST: function (message) {
257     jsMath.Controls.Main();
258     jsMath.Script.endLoad();
259     jsMath.Message.doClear();
260   }
261 });
262
263 }
264 </script>
265
266 <!------------------------------------------------------------>
267
268 <div id="jsMath_main">
269 <div style="text-align:center">
270 <b style="font-size:133%">jsMath v<span ID="jsMath__version"></span></b>
271 (<span id="jsMath__fontType">type</span> fonts)
272 [<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/main.html">help</a>]
273 <p style="margin-bottom:0px">
274 <table border="0" cellspacing="0" cellpadding="0" style="margin:0px">
275 <tr valign="middle"><td align="center">
276 <table border="0" cellspacing="0" cellpadding="0">
277 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/quickstart.html">Quick Start</a></td></tr>
278 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/fonts.html">Missing Fonts</a></td></tr>
279 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/printing.html">Printing Issues</a></td></tr>
280 <tr><td height="5"></td></tr>
281 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath">Home Page</a></td></tr>
282 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/">Documentation</a></td></tr>
283 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="https://sourceforge.net/forum/?group_id=172663">User Community</a></td></tr>
284 <tr><td height="5"></td></tr>
285 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/bugs.html">Known Bugs</a></td></tr>
286 <tr><td class="infoLink" align="left">&#8226; <a id="jsMath__mailto" href="mailto:dpvc@union.edu?subject=jsMath Bug Report">Report a Bug</a></td></tr>
287 <tr><td height="5"></td></tr>
288 <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/jsMath/COPYING.txt">License</a></td></tr>
289 </table>
290 </td>
291
292 <td style="width:1em">&nbsp;</td>
293
294 <td align="center">
295 <table border="0" cellspacing="0" cellpadding="0">
296 <tr><td align="center" colspan="3">
297 <input type="button" id="jsMath__resolution" value="Hi-Res Fonts for Printing"
298        style="width:18em" onclick="jsMath.Controls.PrintResolution()" />
299 </td></tr>
300
301 <tr><td height="8"></td></tr>
302
303 <tr valign="bottom"><td align="left">
304 <input type="button" value="Print" id="jsMath__print" style="width:8em" onclick="jsMath.Controls.Print()" /><br />
305 <input type="button" value="Reload" id="jsMath__reload" style="width:8em" style="width:8em" onclick="jsMath.window.location.reload()" /><br />
306 </td><td>
307 &nbsp;
308 </td><td align="right">
309 <input type="button" value="Go Global" id="jsMath__global" style="width:8em" onclick="jsMath.Controls.GoGlobal()"a /><!--
310 --><input type="button" value="Go Local" id="jsMath__local" style="width:8em;display:none" onclick="jsMath.Controls.GoLocal()" /><br />
311 <input type="button" value="Controls" id="jsMath__ctrls" style="width:8em" onclick="jsMath.Controls.ShowControls()" /><br/>
312 </td></tr>
313
314 <tr><td height="8"></td></tr>
315
316 <tr valign="bottom"><td align="left">
317 <input type="button" value="Options" id="jsMath__opts" style="width:8em" onclick="jsMath.Controls.Options()" /><br/>
318 </td><td>
319 &nbsp;
320 </td><td align="right">
321 <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.Close()" />
322 </td></tr>
323 </table></td></tr>
324
325 <tr><td height="10"></td></tr>
326
327 <tr>
328 <td colspan="3" align="center" style="width:26em">
329 <i style="font-size:75%">Click the jsMath button or <nobr>ALT-click</nobr>
330 on mathematics to reopen this panel.</i>
331 </td></tr>
332
333 </table></p>
334 </div>
335 </div>
336
337 <!------------------------------------------------------------>
338
339 <div id="jsMath_options">
340 <div style="text-align:center">
341 <b style="font-size:133%">jsMath Options</b>
342 [<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/help.html">help</a>]
343 <p>
344 <form action="javascript:" style="margin:0px">
345 <table border="0" cellspacing="0" cellpadding="0">
346 <tr valign="top"><td>
347
348 <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
349
350 <tr><td><input type="checkbox" id="jsMath__autofont"  value="1" /> Autoselect best font</td></tr>
351 <tr><td><input type="checkbox" id="jsMath__warn"      value="1" /> Show font warnings</td></tr>
352 <tr><td><input type="checkbox" id="jsMath__alpha"     value="1" /> Use image alpha channels</td></tr>
353 <tr><td><input type="checkbox" id="jsMath__printwarn" value="1" /> Print image-font help</td></tr>
354 <tr><td><input type="checkbox" id="jsMath__stayhires" value="1" /> Always use hi-res fonts</td></tr>
355
356 <tr><td style="height:.8em"></td></tr>
357
358 <tr><td><input type="checkbox" id="jsMath__progress" value="1" /> Show progress messages</td></tr>
359 <tr><td><input type="checkbox" id="jsMath__asynch"   value="1" /> <span id="jsMath__asynchText">Force asynchronous processing</span></td></tr>
360 <tr><td><input type="checkbox" id="jsMath__blank"    value="1" /> Don't show page until complete</td></tr>
361 <tr><td><input type="checkbox" id="jsMath__button"   value="1" /> Show jsMath button</td></tr>
362
363 <tr id="jsMath__separator" style="display:none"><td style="height:.8em"></td></tr>
364
365 <tr id="jsMath__tex2mathRow" style="display:none"><td><input type="checkbox" id="jsMath__tex2math" value="1" /> Enable <code>tex2math</code> plug-in</td></tr>
366
367 </td></tr>
368 </table>
369 </td>
370 <td style="width:2em"></td>
371 <td>
372
373 <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
374 <tr><td>Scale all mathematics to <input type="text" id="jsMath__scale" value="100" size="3" />%</td></tr>
375
376 <tr><td style="height:.5em"></td></tr>
377
378 <tr><td><input type="radio" name="jsMath__font" value="tex" onclick="jsMath.Controls.NoAuto()" />
379 <span id="jsMath__texText">Use native TeX fonts</span>
380 <small>(<a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">download</a>)</small>
381 </td></tr>
382 <tr><td><input type="radio" name="jsMath__font" value="image" onclick="jsMath.Controls.NoAuto()" />
383 <span id="jsMath__imageText">Use image fonts
384 <span id="jsMath__scaleImgText">(<input type="checkbox" id="jsMath__scaleImg" value="1" /> scalable)</span></span></td></tr>
385 <tr><td><input type="radio" name="jsMath__font" value="symbol" onclick="jsMath.Controls.NoAuto()" />
386 <span id="jsMath__symbolText">Use images for symbols only</span></td></tr>
387 <tr><td height="2"></td></tr>
388 <tr><td><input type="radio" name="jsMath__font" value="unicode" onclick="jsMath.Controls.NoAuto()" />
389 Use native Unicode fonts</td></tr>
390
391 <tr><td style="height:1em"></td></tr>
392
393 <tr><td align="center"><span id="jsMath__globalText">Use Global mode</span>
394 <select id="jsMath__global">
395 <option value="auto">when requested
396 <option value="always">always
397 <option value="never">never
398 </select>
399 </td></tr>
400 <tr><td height="3"></td></tr>
401 <tr><td>Save settings for
402 <select id="jsMath__keep">
403 <option value="0D">this session only
404 <option value="1D">1 day
405 <option value="2D">2 days
406 <option value="3D">3 days
407 <option value="1W">1 week
408 <option value="2W">2 weeks
409 <option value="1M">1 month
410 <option value="2M">2 months
411 <option value="3M">3 months
412 <option value="6M">6 months
413 <option value="1Y">1 year
414 <option value="5Y">5 years
415 </select>
416 </td></tr>
417
418 <tr><td style="height:1em"></td></tr>
419
420 </table>
421
422 <table border="0" cellspacing="0" cellpadding="0" width="100%">
423 <tr>
424 <td align="left">&nbsp;
425 <input type="button" value="Back" id="jsMath__back" style="width:8em" onclick="jsMath.Controls.SaveOptions(0)" />
426 &nbsp;&nbsp;
427 </td>
428 <td align="right">
429 <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.SaveOptions(1)" />
430 &nbsp;
431 </td>
432 </tr>
433 </table>
434
435 </td></tr>
436
437 </table>
438 </form>
439 </div>
440 </div>
441 </p>
442
443 <!------------------------------------------------------------>
444
445 <script>
446   if (showWarning) {
447     if (mustPost) {
448       var scr = document.getElementById("jsMath_script");
449       window.parent.postMessage("jsMCP:SCR:"+scr.innerHTML,"*");
450       var main = document.getElementById("jsMath_main");
451       window.parent.postMessage("jsMCP:PAN:"+main.innerHTML,"*");
452       var options = document.getElementById("jsMath_options");
453       window.parent.postMessage("jsMCP:OPT:"+options.innerHTML,"*");
454       window.parent.postMessage("jsMCP:PST:","*");
455     }
456   } else {
457     jsMath.Controls.Main()
458   }
459 </script>
460 <script>
461   if (window.jsMath) {
462     jsMath.Script.endLoad();
463     jsMath.Message.doClear();
464   }
465 </script>
466 </body>
467 </html>