File:  [LON-CAPA] / loncom / html / adm / jsMath / jsMath-controls.html
Revision 1.1: download - view: text, annotated - select for diffs
Mon Mar 27 19:32:07 2006 UTC (18 years, 3 months ago) by albertel
Branches: MAIN
CVS tags: HEAD
-jsMath 3.2

    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-2006 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: while (!window.jsMath && !showWarning) {
   32:   try {
   33:     window.jsMath = window.parent.jsMath;
   34:     if (!window.jsMath) {throw "no jsMath";}
   35:   } catch (err) {
   36:     showWarning = 1;
   37:     //
   38:     // MSIE on Mac can't change document.domain, and 'try' won't
   39:     //   catch the error (Grrr!) so don't even try for it
   40:     //
   41:     if (document.domain.match(/\..*\./) &&
   42:         (navigator.appName != 'Microsoft Internet Explorer' ||
   43:          navigator.platform != 'MacPPC' || !navigator.userProfile || !document.all)) {
   44:       try {
   45:         document.domain = document.domain.replace(/^[^.]*\./,'');
   46:         showWarning = 0;
   47:       } catch(err) {}
   48:     }
   49:   }
   50: }
   51: 
   52: function Warning () {
   53:   alert(
   54:     "jsMath can't open the control panel, since jsMath was not " +
   55:     "obtained from a server that is in the same domain as the " +
   56:     "page that loaded it."
   57:   );
   58: }
   59: 
   60: if (showWarning) {setTimeout("Warning()",1)} else {
   61: debug = window.parent.debug; show = window.parent.show;
   62: 
   63: jsMath.Add(jsMath.Controls,{
   64: 
   65:   loaded: 1,
   66: 
   67:   Close: function () {
   68:     this.panel.style.display = "none";
   69:     jsMath.Element("button").style.display = (this.cookie.button ? "block" : "none");
   70:     if (jsMath.document.location.protocol == 'file:') return;
   71:     for (var id in {scale:1, scaleImg:1, font:1, print:1, autofont:1, alpha:1, tex2math:1}) {
   72:       if (this.cookie[id] != this.oldCookie[id] && this.oldCookie[id] != null) {
   73:         this.loaded = 0;
   74:         jsMath.document.location.reload();
   75:         return;
   76:       }
   77:     }
   78:   },
   79: 
   80:   Main: function () {
   81:     this.oldCookie = {}; jsMath.Add(this.oldCookie,this.cookie);
   82:     this.panel.innerHTML = ""; // for MSIE on the Mac
   83:     if (jsMath.browser == 'Mozilla') {
   84:       this.panel.appendChild(document.getElementById("jsMath_panel").cloneNode(true));
   85:     } else {
   86:       this.panel.innerHTML = document.getElementById("jsMath_panel").innerHTML;
   87:     }
   88: 
   89:     jsMath.Element("_version").innerHTML = jsMath.version;
   90: 
   91:     jsMath.Element("_fontType").innerHTML =
   92:       ({tex:"TeX",
   93:         image:"Image",
   94:         symbol:"Image symbol",
   95:         unicode:"Unicode"})[this.cookie.font];
   96: 
   97:      jsMath.Element("_mailto").href =
   98:        "mailto:dpvc@union.edu?subject=Bug Report for jsMath "
   99:            + jsMath.version + " (using " + jsMath.browser
  100:            + " in " + this.cookie.font + " mode)";
  101: 
  102:     if (this.cookie.print ||
  103:        (this.cookie.font != 'image' && this.cookie.font != 'symbol'))
  104:          {jsMath.Element("_resolution").disabled = true}
  105: 
  106:     /*
  107:      *  Seems to be a bug in Safari that messes up the button names
  108:      *  when the page is reloaded after an option change
  109:      */
  110:     if (jsMath.browser == 'Safari') {
  111:       jsMath.Element("_resolution").value = "Hi-Res Fonts for Printing";
  112:       jsMath.Element("_opts").value = "Options";
  113:       jsMath.Element("_done").value = "Done";
  114:     }
  115: 
  116:     this.panel.style.display = "block";
  117:     this.openMain = 0;
  118:   },
  119: 
  120:   Options: function () {
  121:     this.panel.innerHTML = ""; // for MSIE on the Mac
  122:     if (jsMath.browser == 'Mozilla') {
  123:       this.panel.appendChild(document.getElementById("jsMath_options").cloneNode(true));
  124:     } else {
  125:       this.panel.innerHTML = document.getElementById("jsMath_options").innerHTML;
  126:     }
  127:     jsMath.Element("_scale").value = this.cookie.scale;
  128:     jsMath.Element("_keep").value = this.cookie.keep;
  129:     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1,
  130:                     progress:1, asynch:1, blank:1, tex2math:1}) {
  131:       if (this.cookie[id]) {jsMath.Element('_'+id).checked = true}
  132:     }
  133:     var font = jsMath.document.getElementsByName("jsMath__font");
  134:     for (var i = 0; i < font.length; i++) {
  135:       if ((font[i].value == 'tex' && jsMath.nofonts) ||
  136:           ((font[i].value == 'symbol' || font[i].value == 'image') &&
  137:              jsMath.noImgFonts)) {
  138:         jsMath.Element('_'+font[i].value+"Text").style.color = "#888888";
  139:         font[i].disabled = true;
  140:       }
  141:       else if (this.cookie.font == font[i].value) {font[i].checked = true}
  142:     }
  143:     if (jsMath.noImgFonts) {
  144:       jsMath.Element("_alphaText").style.color = "#888888";
  145:       jsMath.Element("_alpha").disabled = true;
  146:       jsMath.Element("_scaleImg").disabled = true;
  147:     } else if (jsMath.Browser.imgScale != 1) {
  148:       jsMath.Element("_alphaText").style.color = "#888888";
  149:       jsMath.Element("_alpha").disabled = true;
  150:     }
  151:     if (jsMath.tex2math.Convert) {
  152:       jsMath.Element("_tex2mathRow").style.display = '';
  153:     }
  154: 
  155:     /*
  156:      *  Seems to be a bug in Safari that messes up the button names
  157:      *  when the page is reloaded after an option change
  158:      */
  159:     if (jsMath.isSafari) {
  160:       jsMath.Element("_back").value = "Back";
  161:       jsMath.Element("_done").value = "Done";
  162:     }
  163: 
  164:     this.panel.style.display = "block";
  165:   },
  166: 
  167:   SaveOptions: function (close) {
  168:     this.cookie.scale = jsMath.Element("_scale").value;
  169:     var font = jsMath.document.getElementsByName("jsMath__font");
  170:     for (var i = 0; i < font.length; i++) 
  171:       {if (font[i].checked) {this.cookie.font = font[i].value}}
  172:     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1,
  173:                     progress:1, asynch:1, blank:1, tex2math:1}) {
  174:       if (this.cookie[id] != null) {
  175:         this.cookie[id] = jsMath.Element('_'+id).checked ? 1: 0;
  176:       }
  177:     }
  178:     this.cookie.keep = jsMath.Element("_keep").value;
  179:     this.SetCookie(1);
  180:     if (close) {this.Close()} else {this.Main()}
  181:   },
  182: 
  183:   PrintResolution: function () {
  184:     this.cookie.print = 1;
  185:     this.SetCookie(1);
  186:     this.Close();
  187:   },
  188: 
  189:   CheckVersion: function () {
  190:     jsMath.Script.delayedLoad('http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js');
  191:   },
  192: 
  193:   NoAuto: function () {jsMath.Element("_autofont").checked = false}
  194: 
  195: });
  196: 
  197: }
  198: </script>
  199: 
  200: <!------------------------------------------------------------>
  201: 
  202: <div id="jsMath_panel">
  203: <div style="text-align:center; margin:1em 2em">
  204: <b style="font-size:large">jsMath v<span ID="jsMath__version"></span></b><br/>
  205: <small>(<span id="jsMath__fontType">type</span> fonts)</small>
  206: <p>
  207: <table border="0" cellspacing="0" cellpadding="0" style="margin:0px">
  208: <tr><td align="center"><table border="0" cellspacing="0" cellpadding="0">
  209: <tr><td align="center" colspan="3">
  210: <table border="0" cellspacing="0" cellpadding="0">
  211: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/quickstart.html">Quick Start</a></td></tr>
  212: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/printing.html">Printing Issues</a></td></tr>
  213: <tr><td height="5"></td></tr>
  214: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath">Home Page</a></td></tr>
  215: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/">Documentation</a></td></tr>
  216: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">Download Fonts</a></td></tr>
  217: <tr><td height="5"></td></tr>
  218: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/bugs.html">Known Bugs</a></td></tr>
  219: <tr><td align="left">&#8226; <a id="jsMath__mailto" href="mailto:dpvc@union.edu?subject=jsMath Bug Report">Report a  Bug</a></td></tr>
  220: <tr><td height="5"></td></tr>
  221: <tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/jsMath/COPYING.txt">License</a></td></tr>
  222: </table>
  223: </td></tr>
  224: <tr><td style="height:1em"></td></tr>
  225: <tr><td align="center" colspan="3">
  226: <input type="button" id="jsMath__resolution" value="Hi-Res Fonts for Printing"
  227:        style="width:17em" onclick="jsMath.Controls.PrintResolution()" />
  228: </td></tr>
  229: <tr><td height="1"></td></tr>
  230: <tr><td align="center" colspan="3">
  231: <input type="button" value="Check for jsMath Updates"
  232:        style="width:17em" onclick="jsMath.Controls.CheckVersion()" />
  233: </td></tr>
  234: <tr><td height="5"></td></tr>
  235: <tr><td align="left">
  236: <input type="button" value="Options" id="jsMath__opts" style="width:8em" onclick="jsMath.Controls.Options()" />
  237: </td><td>
  238: &nbsp;
  239: </td><td align="right">
  240: <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.Close()" />
  241: </td></tr>
  242: </table></td></tr>
  243: <tr><td height="7"></td></tr>
  244: <tr><td align="center" colspan="3" style="width:20em; font-size:x-small">
  245: <i>Click on the jsMath floating button or <nobr>ALT-click</nobr> on a
  246: mathematical expression to get this dialog at any time.</i>
  247: </td></tr>
  248: </table></p>
  249: </div>
  250: </div>
  251: 
  252: <!------------------------------------------------------------>
  253: 
  254: <div id="jsMath_options">
  255: <div style="text-align:center; padding:.75em 1.4em;">
  256: <b style="font-size:large">jsMath Options</b> <small>[<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/help.html">help</a>]</small>
  257: <p>
  258: <form action="javascript:" style="margin:0px;">
  259: <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
  260: 
  261: <tr><td>Scale all mathematics to <input type="text" id="jsMath__scale" value="100" size="3" />%</td></tr>
  262: 
  263: <tr><td height="5"></td></tr>
  264: 
  265: <tr><td><input type="radio" name="jsMath__font" value="tex" onclick="jsMath.Controls.NoAuto()" />
  266: <span id="jsMath__texText">Use native TeX fonts</span>
  267: <small>(<a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">download</a>)</small>
  268: </td></tr>
  269: <tr><td><input type="radio" name="jsMath__font" value="image" onclick="jsMath.Controls.NoAuto()" />
  270: <span id="jsMath__imageText">Use image fonts
  271: (<input type="checkbox" id="jsMath__scaleImg" value="1" /> scalable)</span></td></tr>
  272: <tr><td><input type="radio" name="jsMath__font" value="symbol" onclick="jsMath.Controls.NoAuto()" />
  273: <span id="jsMath__symbolText">Use images for symbols only</span></td></tr>
  274: <tr><td height="2"></td></tr>
  275: <tr><td><input type="radio" name="jsMath__font" value="unicode" onclick="jsMath.Controls.NoAuto()" />
  276: Use native Unicode fonts</td></tr>
  277: 
  278: <tr><td height="8"></td></tr>
  279: 
  280: <tr><td><input type="checkbox" id="jsMath__autofont" value="1" /> Autoselect best font</td></tr>
  281: <tr><td><input type="checkbox" id="jsMath__alpha"    value="1" /> <span id="jsMath__alphaText">Use image alpha channels</span></td></tr>
  282: <tr><td><input type="checkbox" id="jsMath__warn"     value="1" /> Show font warnings</td></tr>
  283: 
  284: <tr><td height="8"></td></tr>
  285: 
  286: <tr><td><input type="checkbox" id="jsMath__progress" value="1" /> Show progress messages</td></tr>
  287: <tr><td><input type="checkbox" id="jsMath__asynch"   value="1" /> Force asynchronous processing</td></tr>
  288: <tr><td><input type="checkbox" id="jsMath__blank"    value="1" /> Don't show page until complete</td></tr>
  289: <tr><td><input type="checkbox" id="jsMath__button"   value="1" /> Show jsMath button</td></tr>
  290: 
  291: <tr><td height="8"></td></tr>
  292: 
  293: <tr id="jsMath__tex2mathRow" STYLE="display:none"><td><input type="checkbox" id="jsMath__tex2math" value="1" /> Enable <code>tex2math</code> plug-in</td></tr>
  294: 
  295: <tr><td height="8"></td></tr>
  296: 
  297: <tr><td>Save settings for
  298: 
  299: <select id="jsMath__keep">
  300: <option value="0D">this session only
  301: <option value="1D">1 day
  302: <option value="2D">2 days
  303: <option value="3D">3 days
  304: <option value="1W">1 week
  305: <option value="2W">2 weeks
  306: <option value="1M">1 month
  307: <option value="2M">2 months
  308: <option value="3M">3 months
  309: <option value="6M">6 months
  310: <option value="1Y">1 year
  311: <option value="5Y">5 years
  312: </select>
  313: 
  314: </td></tr>
  315: 
  316: <tr><td height="13"></td></tr>
  317: 
  318: <tr><td align="center">
  319: <table border="0" cellspacing="0" cellpadding="0" width="100%">
  320: <tr>
  321: <td align="left">
  322: <input type="button" value="Back" id="jsMath__back" style="width:8em" onclick="jsMath.Controls.SaveOptions(0)" />
  323: &nbsp;&nbsp;
  324: </td>
  325: <td align="right">
  326: <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.SaveOptions(1)" />
  327: </td>
  328: </tr>
  329: </table>
  330: </td></tr>
  331: 
  332: </table>
  333: </form>
  334: </div>
  335: </div>
  336: </p>
  337: 
  338: <!------------------------------------------------------------>
  339: 
  340: <script>
  341:   if (!showWarning) {jsMath.Controls.Main()}
  342: </script>
  343: <script>
  344:   if (window.jsMath) {
  345:     jsMath.Script.endLoad();
  346:     jsMath.Message.doClear();
  347:   }
  348: </script>
  349: </body>
  350: </html>

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>