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

<html>
<head>
<!--
 | jsMath-controls.html
 |
 | Part of the jsMath package for mathematics on the web.
 | 
 | This file handles the details of the jsMath control panels
 | 
 | ---------------------------------------------------------------------
 | 
 | Copyright 2004-2006 by Davide P. Cervone
 |
 | Licensed under the Apache License, Version 2.0 (the "License");
 | you may not use this file except in compliance with the License.
 | You may obtain a copy of the License at
 |
 |     http://www.apache.org/licenses/LICENSE-2.0
 |
 | Unless required by applicable law or agreed to in writing, software
 | distributed under the License is distributed on an "AS IS" BASIS,
 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 | See the License for the specific language governing permissions and
 | limitations under the License.
-->
</head>
<body>

<script>
var showWarning = 0;
while (!window.jsMath && !showWarning) {
  try {
    window.jsMath = window.parent.jsMath;
    if (!window.jsMath) {throw "no jsMath";}
  } catch (err) {
    showWarning = 1;
    //
    // MSIE on Mac can't change document.domain, and 'try' won't
    //   catch the error (Grrr!) so don't even try for it
    //
    if (document.domain.match(/\..*\./) &&
        (navigator.appName != 'Microsoft Internet Explorer' ||
         navigator.platform != 'MacPPC' || !navigator.userProfile || !document.all)) {
      try {
        document.domain = document.domain.replace(/^[^.]*\./,'');
        showWarning = 0;
      } catch(err) {}
    }
  }
}

function Warning () {
  alert(
    "jsMath can't open the control panel, since jsMath was not " +
    "obtained from a server that is in the same domain as the " +
    "page that loaded it."
  );
}

if (showWarning) {setTimeout("Warning()",1)} else {
debug = window.parent.debug; show = window.parent.show;

jsMath.Add(jsMath.Controls,{

  loaded: 1,

  Close: function () {
    this.panel.style.display = "none";
    jsMath.Element("button").style.display = (this.cookie.button ? "block" : "none");
    if (jsMath.document.location.protocol == 'file:') return;
    for (var id in {scale:1, scaleImg:1, font:1, print:1, autofont:1, alpha:1, tex2math:1}) {
      if (this.cookie[id] != this.oldCookie[id] && this.oldCookie[id] != null) {
        this.loaded = 0;
        jsMath.document.location.reload();
        return;
      }
    }
  },

  Main: function () {
    this.oldCookie = {}; jsMath.Add(this.oldCookie,this.cookie);
    this.panel.innerHTML = ""; // for MSIE on the Mac
    if (jsMath.browser == 'Mozilla') {
      this.panel.appendChild(document.getElementById("jsMath_panel").cloneNode(true));
    } else {
      this.panel.innerHTML = document.getElementById("jsMath_panel").innerHTML;
    }

    jsMath.Element("_version").innerHTML = jsMath.version;

    jsMath.Element("_fontType").innerHTML =
      ({tex:"TeX",
        image:"Image",
        symbol:"Image symbol",
        unicode:"Unicode"})[this.cookie.font];

     jsMath.Element("_mailto").href =
       "mailto:dpvc@union.edu?subject=Bug Report for jsMath "
           + jsMath.version + " (using " + jsMath.browser
           + " in " + this.cookie.font + " mode)";

    if (this.cookie.print ||
       (this.cookie.font != 'image' && this.cookie.font != 'symbol'))
         {jsMath.Element("_resolution").disabled = true}

    /*
     *  Seems to be a bug in Safari that messes up the button names
     *  when the page is reloaded after an option change
     */
    if (jsMath.browser == 'Safari') {
      jsMath.Element("_resolution").value = "Hi-Res Fonts for Printing";
      jsMath.Element("_opts").value = "Options";
      jsMath.Element("_done").value = "Done";
    }

    this.panel.style.display = "block";
    this.openMain = 0;
  },

  Options: function () {
    this.panel.innerHTML = ""; // for MSIE on the Mac
    if (jsMath.browser == 'Mozilla') {
      this.panel.appendChild(document.getElementById("jsMath_options").cloneNode(true));
    } else {
      this.panel.innerHTML = document.getElementById("jsMath_options").innerHTML;
    }
    jsMath.Element("_scale").value = this.cookie.scale;
    jsMath.Element("_keep").value = this.cookie.keep;
    for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1,
                    progress:1, asynch:1, blank:1, tex2math:1}) {
      if (this.cookie[id]) {jsMath.Element('_'+id).checked = true}
    }
    var font = jsMath.document.getElementsByName("jsMath__font");
    for (var i = 0; i < font.length; i++) {
      if ((font[i].value == 'tex' && jsMath.nofonts) ||
          ((font[i].value == 'symbol' || font[i].value == 'image') &&
             jsMath.noImgFonts)) {
        jsMath.Element('_'+font[i].value+"Text").style.color = "#888888";
        font[i].disabled = true;
      }
      else if (this.cookie.font == font[i].value) {font[i].checked = true}
    }
    if (jsMath.noImgFonts) {
      jsMath.Element("_alphaText").style.color = "#888888";
      jsMath.Element("_alpha").disabled = true;
      jsMath.Element("_scaleImg").disabled = true;
    } else if (jsMath.Browser.imgScale != 1) {
      jsMath.Element("_alphaText").style.color = "#888888";
      jsMath.Element("_alpha").disabled = true;
    }
    if (jsMath.tex2math.Convert) {
      jsMath.Element("_tex2mathRow").style.display = '';
    }

    /*
     *  Seems to be a bug in Safari that messes up the button names
     *  when the page is reloaded after an option change
     */
    if (jsMath.isSafari) {
      jsMath.Element("_back").value = "Back";
      jsMath.Element("_done").value = "Done";
    }

    this.panel.style.display = "block";
  },

  SaveOptions: function (close) {
    this.cookie.scale = jsMath.Element("_scale").value;
    var font = jsMath.document.getElementsByName("jsMath__font");
    for (var i = 0; i < font.length; i++) 
      {if (font[i].checked) {this.cookie.font = font[i].value}}
    for (var id in {autofont:1, scaleImg:1, alpha:1, warn:1, button:1,
                    progress:1, asynch:1, blank:1, tex2math:1}) {
      if (this.cookie[id] != null) {
        this.cookie[id] = jsMath.Element('_'+id).checked ? 1: 0;
      }
    }
    this.cookie.keep = jsMath.Element("_keep").value;
    this.SetCookie(1);
    if (close) {this.Close()} else {this.Main()}
  },

  PrintResolution: function () {
    this.cookie.print = 1;
    this.SetCookie(1);
    this.Close();
  },

  CheckVersion: function () {
    jsMath.Script.delayedLoad('http://www.math.union.edu/locate/jsMath/jsMath/jsMath-version-check.js');
  },

  NoAuto: function () {jsMath.Element("_autofont").checked = false}

});

}
</script>

<!------------------------------------------------------------>

<div id="jsMath_panel">
<div style="text-align:center; margin:1em 2em">
<b style="font-size:large">jsMath v<span ID="jsMath__version"></span></b><br/>
<small>(<span id="jsMath__fontType">type</span> fonts)</small>
<p>
<table border="0" cellspacing="0" cellpadding="0" style="margin:0px">
<tr><td align="center"><table border="0" cellspacing="0" cellpadding="0">
<tr><td align="center" colspan="3">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/quickstart.html">Quick Start</a></td></tr>
<tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/printing.html">Printing Issues</a></td></tr>
<tr><td height="5"></td></tr>
<tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath">Home Page</a></td></tr>
<tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/users/">Documentation</a></td></tr>
<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>
<tr><td height="5"></td></tr>
<tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/bugs.html">Known Bugs</a></td></tr>
<tr><td align="left">&#8226; <a id="jsMath__mailto" href="mailto:dpvc@union.edu?subject=jsMath Bug Report">Report a  Bug</a></td></tr>
<tr><td height="5"></td></tr>
<tr><td align="left">&#8226; <a target="_blank" href="http://www.math.union.edu/locate/jsMath/jsMath/COPYING.txt">License</a></td></tr>
</table>
</td></tr>
<tr><td style="height:1em"></td></tr>
<tr><td align="center" colspan="3">
<input type="button" id="jsMath__resolution" value="Hi-Res Fonts for Printing"
       style="width:17em" onclick="jsMath.Controls.PrintResolution()" />
</td></tr>
<tr><td height="1"></td></tr>
<tr><td align="center" colspan="3">
<input type="button" value="Check for jsMath Updates"
       style="width:17em" onclick="jsMath.Controls.CheckVersion()" />
</td></tr>
<tr><td height="5"></td></tr>
<tr><td align="left">
<input type="button" value="Options" id="jsMath__opts" style="width:8em" onclick="jsMath.Controls.Options()" />
</td><td>
&nbsp;
</td><td align="right">
<input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.Close()" />
</td></tr>
</table></td></tr>
<tr><td height="7"></td></tr>
<tr><td align="center" colspan="3" style="width:20em; font-size:x-small">
<i>Click on the jsMath floating button or <nobr>ALT-click</nobr> on a
mathematical expression to get this dialog at any time.</i>
</td></tr>
</table></p>
</div>
</div>

<!------------------------------------------------------------>

<div id="jsMath_options">
<div style="text-align:center; padding:.75em 1.4em;">
<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>
<p>
<form action="javascript:" style="margin:0px;">
<table border="0" cellspacing="0" cellpadding="0" style="text-align:left">

<tr><td>Scale all mathematics to <input type="text" id="jsMath__scale" value="100" size="3" />%</td></tr>

<tr><td height="5"></td></tr>

<tr><td><input type="radio" name="jsMath__font" value="tex" onclick="jsMath.Controls.NoAuto()" />
<span id="jsMath__texText">Use native TeX fonts</span>
<small>(<a target="_blank" href="http://www.math.union.edu/locate/jsMath/download/jsMath-fonts.html">download</a>)</small>
</td></tr>
<tr><td><input type="radio" name="jsMath__font" value="image" onclick="jsMath.Controls.NoAuto()" />
<span id="jsMath__imageText">Use image fonts
(<input type="checkbox" id="jsMath__scaleImg" value="1" /> scalable)</span></td></tr>
<tr><td><input type="radio" name="jsMath__font" value="symbol" onclick="jsMath.Controls.NoAuto()" />
<span id="jsMath__symbolText">Use images for symbols only</span></td></tr>
<tr><td height="2"></td></tr>
<tr><td><input type="radio" name="jsMath__font" value="unicode" onclick="jsMath.Controls.NoAuto()" />
Use native Unicode fonts</td></tr>

<tr><td height="8"></td></tr>

<tr><td><input type="checkbox" id="jsMath__autofont" value="1" /> Autoselect best font</td></tr>
<tr><td><input type="checkbox" id="jsMath__alpha"    value="1" /> <span id="jsMath__alphaText">Use image alpha channels</span></td></tr>
<tr><td><input type="checkbox" id="jsMath__warn"     value="1" /> Show font warnings</td></tr>

<tr><td height="8"></td></tr>

<tr><td><input type="checkbox" id="jsMath__progress" value="1" /> Show progress messages</td></tr>
<tr><td><input type="checkbox" id="jsMath__asynch"   value="1" /> Force asynchronous processing</td></tr>
<tr><td><input type="checkbox" id="jsMath__blank"    value="1" /> Don't show page until complete</td></tr>
<tr><td><input type="checkbox" id="jsMath__button"   value="1" /> Show jsMath button</td></tr>

<tr><td height="8"></td></tr>

<tr id="jsMath__tex2mathRow" STYLE="display:none"><td><input type="checkbox" id="jsMath__tex2math" value="1" /> Enable <code>tex2math</code> plug-in</td></tr>

<tr><td height="8"></td></tr>

<tr><td>Save settings for

<select id="jsMath__keep">
<option value="0D">this session only
<option value="1D">1 day
<option value="2D">2 days
<option value="3D">3 days
<option value="1W">1 week
<option value="2W">2 weeks
<option value="1M">1 month
<option value="2M">2 months
<option value="3M">3 months
<option value="6M">6 months
<option value="1Y">1 year
<option value="5Y">5 years
</select>

</td></tr>

<tr><td height="13"></td></tr>

<tr><td align="center">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td align="left">
<input type="button" value="Back" id="jsMath__back" style="width:8em" onclick="jsMath.Controls.SaveOptions(0)" />
&nbsp;&nbsp;
</td>
<td align="right">
<input type="button" value="Done" id="jsMath__done" style="width:8em" onclick="jsMath.Controls.SaveOptions(1)" />
</td>
</tr>
</table>
</td></tr>

</table>
</form>
</div>
</div>
</p>

<!------------------------------------------------------------>

<script>
  if (!showWarning) {jsMath.Controls.Main()}
</script>
<script>
  if (window.jsMath) {
    jsMath.Script.endLoad();
    jsMath.Message.doClear();
  }
</script>
</body>
</html>

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