Annotation of loncom/html/adm/jsMath/jsMath-controls.html, revision 1.2

1.1       albertel    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) {
1.2     ! albertel   36:     showWarning = 1; pageDomain = '';
        !            37:     try {pageDomain = document.domain} catch (err) {}
1.1       albertel   38:     //
                     39:     // MSIE on Mac can't change document.domain, and 'try' won't
1.2     ! albertel   40:     //   catch the error (Grrr!) so don't even attempt it.
1.1       albertel   41:     //
1.2     ! albertel   42:     if (pageDomain.match(/\..*\./) &&
1.1       albertel   43:         (navigator.appName != 'Microsoft Internet Explorer' ||
                     44:          navigator.platform != 'MacPPC' || !navigator.userProfile || !document.all)) {
                     45:       try {
1.2     ! albertel   46:         document.domain = pageDomain.replace(/^[^.]*\./,'');
1.1       albertel   47:         showWarning = 0;
                     48:       } catch(err) {}
                     49:     }
                     50:   }
                     51: }
                     52: 
                     53: function Warning () {
                     54:   alert(
                     55:     "jsMath can't open the control panel, since jsMath was not " +
                     56:     "obtained from a server that is in the same domain as the " +
                     57:     "page that loaded it."
                     58:   );
                     59: }
                     60: 
                     61: if (showWarning) {setTimeout("Warning()",1)} else {
1.2     ! albertel   62: var debug = window.parent.debug; var show = window.parent.show;
1.1       albertel   63: 
                     64: jsMath.Add(jsMath.Controls,{
                     65: 
                     66:   loaded: 1,
                     67: 
1.2     ! albertel   68:   mainLabels: {
        !            69:     print: 'Print',  reload: 'Reload', local: 'Go Local', global: 'Go Global',
        !            70:     ctrls: 'Controls', opts: 'Options', done: 'Done'
        !            71:   },
        !            72:   optionLabels: {back: 'Back', done: 'Done'},
        !            73: 
1.1       albertel   74:   Close: function () {
                     75:     this.panel.style.display = "none";
                     76:     jsMath.Element("button").style.display = (this.cookie.button ? "block" : "none");
1.2     ! albertel   77:     if (jsMath.document.location.protocol == 'file:' && jsMath.Global.islocal) return;
        !            78:     for (var id in {scale:1, scaleImg:1, font:1, print:1, printwarn:1,
        !            79:                     stayhires:1, autofont:1, alpha:1, tex2math:1, global:1}) {
        !            80:       if (this.cookie[id] && this.cookie[id] != this.oldCookie[id] &&
        !            81:           this.oldCookie[id] != null) {
        !            82:         this.Reload();
1.1       albertel   83:         return;
                     84:       }
                     85:     }
                     86:   },
                     87: 
                     88:   Main: function () {
                     89:     this.oldCookie = {}; jsMath.Add(this.oldCookie,this.cookie);
                     90:     this.panel.innerHTML = ""; // for MSIE on the Mac
                     91:     if (jsMath.browser == 'Mozilla') {
                     92:       this.panel.appendChild(document.getElementById("jsMath_panel").cloneNode(true));
                     93:     } else {
                     94:       this.panel.innerHTML = document.getElementById("jsMath_panel").innerHTML;
                     95:     }
                     96: 
                     97:     jsMath.Element("_version").innerHTML = jsMath.version;
                     98: 
                     99:     jsMath.Element("_fontType").innerHTML =
                    100:       ({tex:"TeX",
                    101:         image:"Image",
                    102:         symbol:"Image symbol",
                    103:         unicode:"Unicode"})[this.cookie.font];
                    104: 
                    105:      jsMath.Element("_mailto").href =
                    106:        "mailto:dpvc@union.edu?subject=Bug Report for jsMath "
                    107:            + jsMath.version + " (using " + jsMath.browser
                    108:            + " in " + this.cookie.font + " mode)";
                    109: 
                    110:     if (this.cookie.print ||
                    111:        (this.cookie.font != 'image' && this.cookie.font != 'symbol'))
                    112:          {jsMath.Element("_resolution").disabled = true}
                    113: 
1.2     ! albertel  114:     if (jsMath.Global.isLocal) {
        !           115:       jsMath.Element("_ctrls").disabled = true;
        !           116:     } else {
        !           117:       this.cookie.hiddenGlobal = jsMath.Global.isHidden;
        !           118:       jsMath.Element("_global").style.display = "none";
        !           119:       jsMath.Element("_local").style.display = "";
        !           120:       if (!jsMath.Global.isHidden || jsMath.noShowGlobal)
        !           121:         {jsMath.Element("_ctrls").disabled = true}
        !           122:     }
        !           123:     if (jsMath.noChangeGlobal) {
        !           124:       for (var id in {global:1, local:1, ctrls: 1})
        !           125:         {jsMath.Element('_'+id).disabled = true}
        !           126:     }
        !           127:     if (!window.print) {jsMath.Element("_print").disabled = true}
        !           128: 
        !           129:     if (jsMath.Browser.safariButtonBug) {
        !           130:       for (var id in this.mainLabels)
        !           131:         {jsMath.Element('_'+id).value = this.mainLabels[id]}
1.1       albertel  132:     }
                    133: 
                    134:     this.panel.style.display = "block";
                    135:     this.openMain = 0;
                    136:   },
                    137: 
                    138:   Options: function () {
                    139:     this.panel.innerHTML = ""; // for MSIE on the Mac
                    140:     if (jsMath.browser == 'Mozilla') {
                    141:       this.panel.appendChild(document.getElementById("jsMath_options").cloneNode(true));
                    142:     } else {
                    143:       this.panel.innerHTML = document.getElementById("jsMath_options").innerHTML;
                    144:     }
                    145:     jsMath.Element("_scale").value = this.cookie.scale;
                    146:     jsMath.Element("_keep").value = this.cookie.keep;
1.2     ! albertel  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}) {
1.1       albertel  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)) {
1.2     ! albertel  157:         jsMath.Element('_'+font[i].value+"Text").className = "disabled";
1.1       albertel  158:         font[i].disabled = true;
                    159:       }
                    160:       else if (this.cookie.font == font[i].value) {font[i].checked = true}
                    161:     }
                    162:     if (jsMath.noImgFonts) {
1.2     ! albertel  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:       }
1.1       albertel  168:     } else if (jsMath.Browser.imgScale != 1) {
1.2     ! albertel  169:       jsMath.Element("_alphaText").className = "disabled";
1.1       albertel  170:       jsMath.Element("_alpha").disabled = true;
                    171:     }
                    172:     if (jsMath.tex2math.Convert) {
1.2     ! albertel  173:       jsMath.Element("_separator").style.display = '';
1.1       albertel  174:       jsMath.Element("_tex2mathRow").style.display = '';
                    175:     }
1.2     ! albertel  176:     if (jsMath.noChangeGlobal) {
        !           177:       jsMath.Element("_globalText").className = "disabled";
        !           178:       jsMath.Element("_global").disabled = true;
        !           179:     }
1.1       albertel  180: 
1.2     ! albertel  181:     if (jsMath.Browser.safariButtonBug) {
        !           182:       for (var id in this.optionLabels)
        !           183:         {jsMath.Element('_'+id).value = this.optionLabels[id]}
1.1       albertel  184:     }
                    185: 
                    186:     this.panel.style.display = "block";
                    187:   },
                    188: 
                    189:   SaveOptions: function (close) {
                    190:     this.cookie.scale = jsMath.Element("_scale").value;
                    191:     var font = jsMath.document.getElementsByName("jsMath__font");
                    192:     for (var i = 0; i < font.length; i++) 
                    193:       {if (font[i].checked) {this.cookie.font = font[i].value}}
1.2     ! albertel  194:     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1,
        !           195:                     stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) {
1.1       albertel  196:       if (this.cookie[id] != null) {
                    197:         this.cookie[id] = jsMath.Element('_'+id).checked ? 1: 0;
                    198:       }
                    199:     }
                    200:     this.cookie.keep = jsMath.Element("_keep").value;
1.2     ! albertel  201:     this.cookie.global = jsMath.Element("_global").value;
        !           202:     this.cookie.print = this.cookie.stayhires;
1.1       albertel  203:     this.SetCookie(1);
                    204:     if (close) {this.Close()} else {this.Main()}
                    205:   },
                    206: 
                    207:   PrintResolution: function () {
                    208:     this.cookie.print = 1;
                    209:     this.SetCookie(1);
                    210:     this.Close();
                    211:   },
                    212: 
1.2     ! albertel  213:   Print: function () {
        !           214:     this.Close();
        !           215:     jsMath.window.print();
        !           216:   },
        !           217: 
        !           218:   GoGlobal: function () {
        !           219:     this.cookie.global = "always";
        !           220:     jsMath.Global.GoGlobal(this.SetCookie(2));
        !           221:   },
        !           222:   GoLocal: function () {jsMath.Global.GoLocal()},
        !           223: 
        !           224:   ShowControls: function () {
        !           225:     this.Close();
        !           226:     jsMath.Global.Show();
        !           227:   },
        !           228: 
1.1       albertel  229:   CheckVersion: function () {
                    230:     jsMath.Script.delayedLoad('http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js');
                    231:   },
                    232: 
                    233:   NoAuto: function () {jsMath.Element("_autofont").checked = false}
                    234: 
                    235: });
                    236: 
                    237: }
                    238: </script>
                    239: 
                    240: <!------------------------------------------------------------>
                    241: 
                    242: <div id="jsMath_panel">
1.2     ! albertel  243: <div style="text-align:center">
        !           244: <b style="font-size:133%">jsMath v<span ID="jsMath__version"></span></b>
        !           245: (<span id="jsMath__fontType">type</span> fonts)
        !           246: [<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/main.html">help</a>]
        !           247: <p style="margin-bottom:0px">
1.1       albertel  248: <table border="0" cellspacing="0" cellpadding="0" style="margin:0px">
1.2     ! albertel  249: <tr valign="middle"><td align="center">
1.1       albertel  250: <table border="0" cellspacing="0" cellpadding="0">
1.2     ! albertel  251: <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>
        !           252: <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>
1.1       albertel  253: <tr><td height="5"></td></tr>
1.2     ! albertel  254: <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath">Home Page</a></td></tr>
        !           255: <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/">Documentation</a></td></tr>
        !           256: <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">Download Fonts</a></td></tr>
1.1       albertel  257: <tr><td height="5"></td></tr>
1.2     ! albertel  258: <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>
        !           259: <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>
1.1       albertel  260: <tr><td height="5"></td></tr>
1.2     ! albertel  261: <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>
1.1       albertel  262: </table>
1.2     ! albertel  263: </td>
        !           264: 
        !           265: <td style="width:1em">&nbsp;</td>
        !           266: 
        !           267: <td align="center">
        !           268: <table border="0" cellspacing="0" cellpadding="0">
1.1       albertel  269: <tr><td align="center" colspan="3">
1.2     ! albertel  270: <input type="button" value="Check for jsMath Updates"
        !           271:        style="width:18em" onclick="jsMath.Controls.CheckVersion()" /><br />
1.1       albertel  272: <input type="button" id="jsMath__resolution" value="Hi-Res Fonts for Printing"
1.2     ! albertel  273:        style="width:18em" onclick="jsMath.Controls.PrintResolution()" />
1.1       albertel  274: </td></tr>
1.2     ! albertel  275: 
        !           276: <tr><td height="8"></td></tr>
        !           277: 
        !           278: <tr valign="bottom"><td align="left">
        !           279: <input type="button" value="Print" id="jsMath__print" style="width:8em" onclick="jsMath.Controls.Print()" /><br />
        !           280: <input type="button" value="Reload" id="jsMath__reload" style="width:8em" style="width:8em" onclick="jsMath.window.location.reload()" /><br />
        !           281: </td><td>
        !           282: &nbsp;
        !           283: </td><td align="right">
        !           284: <input type="button" value="Go Global" id="jsMath__global" style="width:8em" onclick="jsMath.Controls.GoGlobal()"a /><!--
        !           285: --><input type="button" value="Go Local" id="jsMath__local" style="width:8em;display:none" onclick="jsMath.Controls.GoLocal()" /><br />
        !           286: <input type="button" value="Controls" id="jsMath__ctrls" style="width:8em" onclick="jsMath.Controls.ShowControls()" /><br/>
1.1       albertel  287: </td></tr>
1.2     ! albertel  288: 
        !           289: <tr><td height="8"></td></tr>
        !           290: 
        !           291: <tr valign="bottom"><td align="left">
        !           292: <input type="button" value="Options" id="jsMath__opts" style="width:8em" onclick="jsMath.Controls.Options()" /><br/>
1.1       albertel  293: </td><td>
                    294: &nbsp;
                    295: </td><td align="right">
                    296: <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.Close()" />
                    297: </td></tr>
                    298: </table></td></tr>
1.2     ! albertel  299: 
        !           300: <tr><td height="10"></td></tr>
        !           301: 
        !           302: <tr>
        !           303: <td colspan="3" align="center" style="width:26em">
        !           304: <i style="font-size:75%">Click the jsMath button or <nobr>ALT-click</nobr>
        !           305: on mathematics to reopen this panel.</i>
1.1       albertel  306: </td></tr>
1.2     ! albertel  307: 
1.1       albertel  308: </table></p>
                    309: </div>
                    310: </div>
                    311: 
                    312: <!------------------------------------------------------------>
                    313: 
                    314: <div id="jsMath_options">
1.2     ! albertel  315: <div style="text-align:center">
        !           316: <b style="font-size:133%">jsMath Options</b>
        !           317: [<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/help.html">help</a>]
1.1       albertel  318: <p>
1.2     ! albertel  319: <form action="javascript:" style="margin:0px">
        !           320: <table border="0" cellspacing="0" cellpadding="0">
        !           321: <tr valign="top"><td>
        !           322: 
1.1       albertel  323: <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
                    324: 
1.2     ! albertel  325: <tr><td><input type="checkbox" id="jsMath__autofont"  value="1" /> Autoselect best font</td></tr>
        !           326: <tr><td><input type="checkbox" id="jsMath__warn"      value="1" /> Show font warnings</td></tr>
        !           327: <tr><td><input type="checkbox" id="jsMath__alpha"     value="1" /> Use image alpha channels</td></tr>
        !           328: <tr><td><input type="checkbox" id="jsMath__printwarn" value="1" /> Print image-font help</td></tr>
        !           329: <tr><td><input type="checkbox" id="jsMath__stayhires" value="1" /> Always use hi-res fonts</td></tr>
        !           330: 
        !           331: <tr><td style="height:.8em"></td></tr>
        !           332: 
        !           333: <tr><td><input type="checkbox" id="jsMath__progress" value="1" /> Show progress messages</td></tr>
        !           334: <tr><td><input type="checkbox" id="jsMath__asynch"   value="1" /> Force asynchronous processing</td></tr>
        !           335: <tr><td><input type="checkbox" id="jsMath__blank"    value="1" /> Don't show page until complete</td></tr>
        !           336: <tr><td><input type="checkbox" id="jsMath__button"   value="1" /> Show jsMath button</td></tr>
        !           337: 
        !           338: <tr id="jsMath__separator" style="display:none"><td style="height:.8em"></td></tr>
        !           339: 
        !           340: <tr id="jsMath__tex2mathRow" style="display:none"><td><input type="checkbox" id="jsMath__tex2math" value="1" /> Enable <code>tex2math</code> plug-in</td></tr>
        !           341: 
        !           342: </td></tr>
        !           343: </table>
        !           344: </td>
        !           345: <td style="width:2em"></td>
        !           346: <td>
        !           347: 
        !           348: <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
1.1       albertel  349: <tr><td>Scale all mathematics to <input type="text" id="jsMath__scale" value="100" size="3" />%</td></tr>
                    350: 
1.2     ! albertel  351: <tr><td style="height:.5em"></td></tr>
1.1       albertel  352: 
                    353: <tr><td><input type="radio" name="jsMath__font" value="tex" onclick="jsMath.Controls.NoAuto()" />
                    354: <span id="jsMath__texText">Use native TeX fonts</span>
                    355: <small>(<a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">download</a>)</small>
                    356: </td></tr>
                    357: <tr><td><input type="radio" name="jsMath__font" value="image" onclick="jsMath.Controls.NoAuto()" />
                    358: <span id="jsMath__imageText">Use image fonts
1.2     ! albertel  359: <span id="jsMath__scaleImgText">(<input type="checkbox" id="jsMath__scaleImg" value="1" /> scalable)</span></span></td></tr>
1.1       albertel  360: <tr><td><input type="radio" name="jsMath__font" value="symbol" onclick="jsMath.Controls.NoAuto()" />
                    361: <span id="jsMath__symbolText">Use images for symbols only</span></td></tr>
                    362: <tr><td height="2"></td></tr>
                    363: <tr><td><input type="radio" name="jsMath__font" value="unicode" onclick="jsMath.Controls.NoAuto()" />
                    364: Use native Unicode fonts</td></tr>
                    365: 
1.2     ! albertel  366: <tr><td style="height:1em"></td></tr>
1.1       albertel  367: 
1.2     ! albertel  368: <tr><td align="center"><span id="jsMath__globalText">Use Global mode</span>
        !           369: <select id="jsMath__global">
        !           370: <option value="auto">when requested
        !           371: <option value="always">always
        !           372: <option value="never">never
        !           373: </select>
        !           374: </td></tr>
        !           375: <tr><td height="3"></td></tr>
1.1       albertel  376: <tr><td>Save settings for
                    377: <select id="jsMath__keep">
                    378: <option value="0D">this session only
                    379: <option value="1D">1 day
                    380: <option value="2D">2 days
                    381: <option value="3D">3 days
                    382: <option value="1W">1 week
                    383: <option value="2W">2 weeks
                    384: <option value="1M">1 month
                    385: <option value="2M">2 months
                    386: <option value="3M">3 months
                    387: <option value="6M">6 months
                    388: <option value="1Y">1 year
                    389: <option value="5Y">5 years
                    390: </select>
1.2     ! albertel  391: </td></tr>
1.1       albertel  392: 
1.2     ! albertel  393: <tr><td style="height:1em"></td></tr>
1.1       albertel  394: 
1.2     ! albertel  395: </table>
1.1       albertel  396: 
                    397: <table border="0" cellspacing="0" cellpadding="0" width="100%">
                    398: <tr>
1.2     ! albertel  399: <td align="left">&nbsp;
1.1       albertel  400: <input type="button" value="Back" id="jsMath__back" style="width:8em" onclick="jsMath.Controls.SaveOptions(0)" />
                    401: &nbsp;&nbsp;
                    402: </td>
                    403: <td align="right">
                    404: <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.SaveOptions(1)" />
1.2     ! albertel  405: &nbsp;
1.1       albertel  406: </td>
                    407: </tr>
                    408: </table>
1.2     ! albertel  409: 
1.1       albertel  410: </td></tr>
                    411: 
                    412: </table>
                    413: </form>
                    414: </div>
                    415: </div>
                    416: </p>
                    417: 
                    418: <!------------------------------------------------------------>
                    419: 
                    420: <script>
                    421:   if (!showWarning) {jsMath.Controls.Main()}
                    422: </script>
                    423: <script>
                    424:   if (window.jsMath) {
                    425:     jsMath.Script.endLoad();
                    426:     jsMath.Message.doClear();
                    427:   }
                    428: </script>
                    429: </body>
                    430: </html>

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