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

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:  | 
1.3     ! albertel   12:  | Copyright 2004-2007 by Davide P. Cervone
1.1       albertel   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' ||
1.3     ! albertel   44:          !navigator.platform.match(/Mac/) || !navigator.userProfile || !document.all)) {
1.1       albertel   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);
1.3     ! albertel   90:     this.GetPanel("panel");
1.1       albertel   91: 
                     92:     jsMath.Element("_version").innerHTML = jsMath.version;
                     93: 
                     94:     jsMath.Element("_fontType").innerHTML =
                     95:       ({tex:"TeX",
                     96:         image:"Image",
                     97:         symbol:"Image symbol",
                     98:         unicode:"Unicode"})[this.cookie.font];
                     99: 
                    100:      jsMath.Element("_mailto").href =
                    101:        "mailto:dpvc@union.edu?subject=Bug Report for jsMath "
                    102:            + jsMath.version + " (using " + jsMath.browser
                    103:            + " in " + this.cookie.font + " mode)";
                    104: 
                    105:     if (this.cookie.print ||
                    106:        (this.cookie.font != 'image' && this.cookie.font != 'symbol'))
                    107:          {jsMath.Element("_resolution").disabled = true}
                    108: 
1.2       albertel  109:     if (jsMath.Global.isLocal) {
                    110:       jsMath.Element("_ctrls").disabled = true;
                    111:     } else {
                    112:       this.cookie.hiddenGlobal = jsMath.Global.isHidden;
                    113:       jsMath.Element("_global").style.display = "none";
                    114:       jsMath.Element("_local").style.display = "";
                    115:       if (!jsMath.Global.isHidden || jsMath.noShowGlobal)
                    116:         {jsMath.Element("_ctrls").disabled = true}
                    117:     }
                    118:     if (jsMath.noChangeGlobal) {
                    119:       for (var id in {global:1, local:1, ctrls: 1})
                    120:         {jsMath.Element('_'+id).disabled = true}
                    121:     }
                    122:     if (!window.print) {jsMath.Element("_print").disabled = true}
                    123: 
                    124:     if (jsMath.Browser.safariButtonBug) {
                    125:       for (var id in this.mainLabels)
                    126:         {jsMath.Element('_'+id).value = this.mainLabels[id]}
1.1       albertel  127:     }
                    128: 
                    129:     this.panel.style.display = "block";
                    130:     this.openMain = 0;
1.3     ! albertel  131: 
        !           132:     if (jsMath.Browser.msieMoveButtonHack) {
        !           133:       this.panel.style.left = "0px";
        !           134:       this.panel.style.top = "0px";
        !           135:       jsMath.Controls.MoveButton();
        !           136:     }
1.1       albertel  137:   },
                    138: 
                    139:   Options: function () {
1.3     ! albertel  140:     this.GetPanel("options");
1.1       albertel  141:     jsMath.Element("_scale").value = this.cookie.scale;
                    142:     jsMath.Element("_keep").value = this.cookie.keep;
1.2       albertel  143:     jsMath.Element("_global").value = this.cookie.global;
                    144:     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1,
                    145:                     stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) {
1.1       albertel  146:       if (this.cookie[id]) {jsMath.Element('_'+id).checked = true}
                    147:     }
                    148:     var font = jsMath.document.getElementsByName("jsMath__font");
                    149:     for (var i = 0; i < font.length; i++) {
                    150:       if ((font[i].value == 'tex' && jsMath.nofonts) ||
                    151:           ((font[i].value == 'symbol' || font[i].value == 'image') &&
                    152:              jsMath.noImgFonts)) {
1.2       albertel  153:         jsMath.Element('_'+font[i].value+"Text").className = "disabled";
1.1       albertel  154:         font[i].disabled = true;
                    155:       }
                    156:       else if (this.cookie.font == font[i].value) {font[i].checked = true}
                    157:     }
                    158:     if (jsMath.noImgFonts) {
1.2       albertel  159:       for (var id in {alpha:1, printwarn:1, stayhires:1}) {
                    160:         var obj = jsMath.Element("_"+id);
                    161:         obj.disabled = true;
                    162:         obj.parentNode.className = "disabled";
                    163:       }
1.1       albertel  164:     } else if (jsMath.Browser.imgScale != 1) {
1.2       albertel  165:       jsMath.Element("_alphaText").className = "disabled";
1.1       albertel  166:       jsMath.Element("_alpha").disabled = true;
                    167:     }
                    168:     if (jsMath.tex2math.Convert) {
1.2       albertel  169:       jsMath.Element("_separator").style.display = '';
1.1       albertel  170:       jsMath.Element("_tex2mathRow").style.display = '';
                    171:     }
1.2       albertel  172:     if (jsMath.noChangeGlobal) {
                    173:       jsMath.Element("_globalText").className = "disabled";
                    174:       jsMath.Element("_global").disabled = true;
                    175:     }
1.3     ! albertel  176:     if (jsMath.isCHMmode) {
        !           177:       jsMath.Element("_asynchText").className  = "disabled";
        !           178:       jsMath.Element("_asynch").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";
1.3     ! albertel  187: 
        !           188:     if (jsMath.Browser.msieMoveButtonHack) {
        !           189:       this.panel.style.left = "0px";
        !           190:       this.panel.style.top = "0px";
        !           191:       jsMath.Controls.MoveButton();
        !           192:     }
        !           193:   },
        !           194: 
        !           195:   GetPanel: function (name) {
        !           196:     this.panel.innerHTML = ""; // for MSIE on the Mac
        !           197:     if (jsMath.browser == 'Mozilla') {
        !           198:       this.panel.appendChild(document.getElementById("jsMath_"+name).cloneNode(true));
        !           199:     } else {
        !           200:       this.panel.innerHTML = document.getElementById("jsMath_"+name).innerHTML;
        !           201:     }
1.1       albertel  202:   },
                    203: 
                    204:   SaveOptions: function (close) {
                    205:     this.cookie.scale = jsMath.Element("_scale").value;
                    206:     var font = jsMath.document.getElementsByName("jsMath__font");
                    207:     for (var i = 0; i < font.length; i++) 
                    208:       {if (font[i].checked) {this.cookie.font = font[i].value}}
1.2       albertel  209:     for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, printwarn: 1,
                    210:                     stayhires: 1, button:1, progress:1, asynch:1, blank:1, tex2math:1}) {
1.1       albertel  211:       if (this.cookie[id] != null) {
                    212:         this.cookie[id] = jsMath.Element('_'+id).checked ? 1: 0;
                    213:       }
                    214:     }
                    215:     this.cookie.keep = jsMath.Element("_keep").value;
1.2       albertel  216:     this.cookie.global = jsMath.Element("_global").value;
                    217:     this.cookie.print = this.cookie.stayhires;
1.1       albertel  218:     this.SetCookie(1);
                    219:     if (close) {this.Close()} else {this.Main()}
                    220:   },
                    221: 
                    222:   PrintResolution: function () {
                    223:     this.cookie.print = 1;
                    224:     this.SetCookie(1);
                    225:     this.Close();
                    226:   },
                    227: 
1.2       albertel  228:   Print: function () {
                    229:     this.Close();
                    230:     jsMath.window.print();
                    231:   },
                    232: 
                    233:   GoGlobal: function () {
                    234:     this.cookie.global = "always";
                    235:     jsMath.Global.GoGlobal(this.SetCookie(2));
                    236:   },
                    237:   GoLocal: function () {jsMath.Global.GoLocal()},
                    238: 
                    239:   ShowControls: function () {
                    240:     this.Close();
                    241:     jsMath.Global.Show();
                    242:   },
                    243: 
1.1       albertel  244:   CheckVersion: function () {
                    245:     jsMath.Script.delayedLoad('http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js');
                    246:   },
                    247: 
                    248:   NoAuto: function () {jsMath.Element("_autofont").checked = false}
                    249: 
                    250: });
                    251: 
                    252: }
                    253: </script>
                    254: 
                    255: <!------------------------------------------------------------>
                    256: 
                    257: <div id="jsMath_panel">
1.2       albertel  258: <div style="text-align:center">
                    259: <b style="font-size:133%">jsMath v<span ID="jsMath__version"></span></b>
                    260: (<span id="jsMath__fontType">type</span> fonts)
                    261: [<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/main.html">help</a>]
                    262: <p style="margin-bottom:0px">
1.1       albertel  263: <table border="0" cellspacing="0" cellpadding="0" style="margin:0px">
1.2       albertel  264: <tr valign="middle"><td align="center">
1.1       albertel  265: <table border="0" cellspacing="0" cellpadding="0">
1.2       albertel  266: <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>
1.3     ! albertel  267: <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>
1.2       albertel  268: <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  269: <tr><td height="5"></td></tr>
1.2       albertel  270: <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath">Home Page</a></td></tr>
                    271: <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/">Documentation</a></td></tr>
1.3     ! albertel  272: <tr><td class="infoLink" align="left">&#8226; <a target="_blank" href="https://sourceforge.net/forum/?group_id=172663">User Community</a></td></tr>
1.1       albertel  273: <tr><td height="5"></td></tr>
1.2       albertel  274: <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>
1.3     ! albertel  275: <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  276: <tr><td height="5"></td></tr>
1.2       albertel  277: <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  278: </table>
1.2       albertel  279: </td>
                    280: 
                    281: <td style="width:1em">&nbsp;</td>
                    282: 
                    283: <td align="center">
                    284: <table border="0" cellspacing="0" cellpadding="0">
1.1       albertel  285: <tr><td align="center" colspan="3">
1.2       albertel  286: <input type="button" value="Check for jsMath Updates"
                    287:        style="width:18em" onclick="jsMath.Controls.CheckVersion()" /><br />
1.1       albertel  288: <input type="button" id="jsMath__resolution" value="Hi-Res Fonts for Printing"
1.2       albertel  289:        style="width:18em" onclick="jsMath.Controls.PrintResolution()" />
1.1       albertel  290: </td></tr>
1.2       albertel  291: 
                    292: <tr><td height="8"></td></tr>
                    293: 
                    294: <tr valign="bottom"><td align="left">
                    295: <input type="button" value="Print" id="jsMath__print" style="width:8em" onclick="jsMath.Controls.Print()" /><br />
                    296: <input type="button" value="Reload" id="jsMath__reload" style="width:8em" style="width:8em" onclick="jsMath.window.location.reload()" /><br />
                    297: </td><td>
                    298: &nbsp;
                    299: </td><td align="right">
                    300: <input type="button" value="Go Global" id="jsMath__global" style="width:8em" onclick="jsMath.Controls.GoGlobal()"a /><!--
                    301: --><input type="button" value="Go Local" id="jsMath__local" style="width:8em;display:none" onclick="jsMath.Controls.GoLocal()" /><br />
                    302: <input type="button" value="Controls" id="jsMath__ctrls" style="width:8em" onclick="jsMath.Controls.ShowControls()" /><br/>
1.1       albertel  303: </td></tr>
1.2       albertel  304: 
                    305: <tr><td height="8"></td></tr>
                    306: 
                    307: <tr valign="bottom"><td align="left">
                    308: <input type="button" value="Options" id="jsMath__opts" style="width:8em" onclick="jsMath.Controls.Options()" /><br/>
1.1       albertel  309: </td><td>
                    310: &nbsp;
                    311: </td><td align="right">
                    312: <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.Close()" />
                    313: </td></tr>
                    314: </table></td></tr>
1.2       albertel  315: 
                    316: <tr><td height="10"></td></tr>
                    317: 
                    318: <tr>
                    319: <td colspan="3" align="center" style="width:26em">
                    320: <i style="font-size:75%">Click the jsMath button or <nobr>ALT-click</nobr>
                    321: on mathematics to reopen this panel.</i>
1.1       albertel  322: </td></tr>
1.2       albertel  323: 
1.1       albertel  324: </table></p>
                    325: </div>
                    326: </div>
                    327: 
                    328: <!------------------------------------------------------------>
                    329: 
                    330: <div id="jsMath_options">
1.2       albertel  331: <div style="text-align:center">
                    332: <b style="font-size:133%">jsMath Options</b>
                    333: [<a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/help.html">help</a>]
1.1       albertel  334: <p>
1.2       albertel  335: <form action="javascript:" style="margin:0px">
                    336: <table border="0" cellspacing="0" cellpadding="0">
                    337: <tr valign="top"><td>
                    338: 
1.1       albertel  339: <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
                    340: 
1.2       albertel  341: <tr><td><input type="checkbox" id="jsMath__autofont"  value="1" /> Autoselect best font</td></tr>
                    342: <tr><td><input type="checkbox" id="jsMath__warn"      value="1" /> Show font warnings</td></tr>
                    343: <tr><td><input type="checkbox" id="jsMath__alpha"     value="1" /> Use image alpha channels</td></tr>
                    344: <tr><td><input type="checkbox" id="jsMath__printwarn" value="1" /> Print image-font help</td></tr>
                    345: <tr><td><input type="checkbox" id="jsMath__stayhires" value="1" /> Always use hi-res fonts</td></tr>
                    346: 
                    347: <tr><td style="height:.8em"></td></tr>
                    348: 
                    349: <tr><td><input type="checkbox" id="jsMath__progress" value="1" /> Show progress messages</td></tr>
1.3     ! albertel  350: <tr><td><input type="checkbox" id="jsMath__asynch"   value="1" /> <span id="jsMath__asynchText">Force asynchronous processing</span></td></tr>
1.2       albertel  351: <tr><td><input type="checkbox" id="jsMath__blank"    value="1" /> Don't show page until complete</td></tr>
                    352: <tr><td><input type="checkbox" id="jsMath__button"   value="1" /> Show jsMath button</td></tr>
                    353: 
                    354: <tr id="jsMath__separator" style="display:none"><td style="height:.8em"></td></tr>
                    355: 
                    356: <tr id="jsMath__tex2mathRow" style="display:none"><td><input type="checkbox" id="jsMath__tex2math" value="1" /> Enable <code>tex2math</code> plug-in</td></tr>
                    357: 
                    358: </td></tr>
                    359: </table>
                    360: </td>
                    361: <td style="width:2em"></td>
                    362: <td>
                    363: 
                    364: <table border="0" cellspacing="0" cellpadding="0" style="text-align:left">
1.1       albertel  365: <tr><td>Scale all mathematics to <input type="text" id="jsMath__scale" value="100" size="3" />%</td></tr>
                    366: 
1.2       albertel  367: <tr><td style="height:.5em"></td></tr>
1.1       albertel  368: 
                    369: <tr><td><input type="radio" name="jsMath__font" value="tex" onclick="jsMath.Controls.NoAuto()" />
                    370: <span id="jsMath__texText">Use native TeX fonts</span>
                    371: <small>(<a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">download</a>)</small>
                    372: </td></tr>
                    373: <tr><td><input type="radio" name="jsMath__font" value="image" onclick="jsMath.Controls.NoAuto()" />
                    374: <span id="jsMath__imageText">Use image fonts
1.2       albertel  375: <span id="jsMath__scaleImgText">(<input type="checkbox" id="jsMath__scaleImg" value="1" /> scalable)</span></span></td></tr>
1.1       albertel  376: <tr><td><input type="radio" name="jsMath__font" value="symbol" onclick="jsMath.Controls.NoAuto()" />
                    377: <span id="jsMath__symbolText">Use images for symbols only</span></td></tr>
                    378: <tr><td height="2"></td></tr>
                    379: <tr><td><input type="radio" name="jsMath__font" value="unicode" onclick="jsMath.Controls.NoAuto()" />
                    380: Use native Unicode fonts</td></tr>
                    381: 
1.2       albertel  382: <tr><td style="height:1em"></td></tr>
1.1       albertel  383: 
1.2       albertel  384: <tr><td align="center"><span id="jsMath__globalText">Use Global mode</span>
                    385: <select id="jsMath__global">
                    386: <option value="auto">when requested
                    387: <option value="always">always
                    388: <option value="never">never
                    389: </select>
                    390: </td></tr>
                    391: <tr><td height="3"></td></tr>
1.1       albertel  392: <tr><td>Save settings for
                    393: <select id="jsMath__keep">
                    394: <option value="0D">this session only
                    395: <option value="1D">1 day
                    396: <option value="2D">2 days
                    397: <option value="3D">3 days
                    398: <option value="1W">1 week
                    399: <option value="2W">2 weeks
                    400: <option value="1M">1 month
                    401: <option value="2M">2 months
                    402: <option value="3M">3 months
                    403: <option value="6M">6 months
                    404: <option value="1Y">1 year
                    405: <option value="5Y">5 years
                    406: </select>
1.2       albertel  407: </td></tr>
1.1       albertel  408: 
1.2       albertel  409: <tr><td style="height:1em"></td></tr>
1.1       albertel  410: 
1.2       albertel  411: </table>
1.1       albertel  412: 
                    413: <table border="0" cellspacing="0" cellpadding="0" width="100%">
                    414: <tr>
1.2       albertel  415: <td align="left">&nbsp;
1.1       albertel  416: <input type="button" value="Back" id="jsMath__back" style="width:8em" onclick="jsMath.Controls.SaveOptions(0)" />
                    417: &nbsp;&nbsp;
                    418: </td>
                    419: <td align="right">
                    420: <input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.SaveOptions(1)" />
1.2       albertel  421: &nbsp;
1.1       albertel  422: </td>
                    423: </tr>
                    424: </table>
1.2       albertel  425: 
1.1       albertel  426: </td></tr>
                    427: 
                    428: </table>
                    429: </form>
                    430: </div>
                    431: </div>
                    432: </p>
                    433: 
                    434: <!------------------------------------------------------------>
                    435: 
                    436: <script>
                    437:   if (!showWarning) {jsMath.Controls.Main()}
                    438: </script>
                    439: <script>
                    440:   if (window.jsMath) {
                    441:     jsMath.Script.endLoad();
                    442:     jsMath.Message.doClear();
                    443:   }
                    444: </script>
                    445: </body>
                    446: </html>

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