scribble-mathjax/docs/html/api/message.html
2011-07-20 15:56:58 -04:00

285 lines
13 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The MathJax.Message Object &mdash; MathJax v1.1 documentation</title>
<link rel="stylesheet" href="../_static/mj.css" type="text/css" />
<link rel="stylesheet" href="../_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '../',
VERSION: '1.1',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="../_static/jquery.js"></script>
<script type="text/javascript" src="../_static/underscore.js"></script>
<script type="text/javascript" src="../_static/doctools.js"></script>
<!--<script type="text/javascript" src="../../../MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>-->
<link rel="top" title="MathJax v1.1 documentation" href="../index.html" />
<link rel="up" title="The MathJax API" href="index.html" />
<link rel="next" title="The MathJax.HTML Object" href="html.html" />
<link rel="prev" title="The MathJax.Ajax Object" href="ajax.html" />
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="html.html" title="The MathJax.HTML Object"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="ajax.html" title="The MathJax.Ajax Object"
accesskey="P">previous</a> |</li>
<li><a href="../index.html">MathJax v1.1 documentation</a> &raquo;</li>
<li><a href="index.html" accesskey="U">The MathJax API</a> &raquo;</li>
</ul>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="the-mathjax-message-object">
<span id="api-message"></span><h1>The MathJax.Message Object<a class="headerlink" href="#the-mathjax-message-object" title="Permalink to this headline"></a></h1>
<p>The <tt class="docutils literal"><span class="pre">MathJax.Message</span></tt> object contains the methods used to manage the
small message area that appears at the lower-left corner of the
window. MathJax uses this area to inform the user of time-consuming
actions, like loading files and fonts, or how far along in the
typesetting process it is.</p>
<p>The page author can customize the look of the message window by
setting styles for the <tt class="docutils literal"><span class="pre">#MathJax_Message</span></tt> selector (which can be
set via</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">styles</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">&quot;#MathJax_Message&quot;</span><span class="o">:</span> <span class="p">{</span>
<span class="p">...</span>
<span class="p">}</span>
<span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
<p>Because of a bug in Internet Explorer, in order to change the side of
the screen where the message occurs, you must also set the side
for <tt class="docutils literal"><span class="pre">#MathJax_MSIE_Frame</span></tt>, as in</p>
<div class="highlight-javascript"><div class="highlight"><pre><span class="nx">MathJax</span><span class="p">.</span><span class="nx">Hub</span><span class="p">.</span><span class="nx">Config</span><span class="p">({</span>
<span class="nx">styles</span><span class="o">:</span> <span class="p">{</span>
<span class="s2">&quot;#MathJax_Message&quot;</span><span class="o">:</span> <span class="p">{</span><span class="nx">left</span><span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="nx">right</span><span class="o">:</span> <span class="mi">0</span><span class="p">},</span>
<span class="s2">&quot;#MathJax_MSIE_Frame&quot;</span><span class="o">:</span> <span class="p">{</span><span class="nx">left</span><span class="o">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span> <span class="nx">right</span><span class="o">:</span> <span class="mi">0</span><span class="p">}</span>
<span class="p">}</span>
<span class="p">});</span>
</pre></div>
</div>
<p>It is possible that a message is already being displayed when another
message needs to be posted. For this reason, when a message is
displayed on screen, it gets an id number that is used when you want
to remove or change that message. That way, when a message is
removed, the previous message (if any) can be redisplayed if it hasn&#8217;t
been removed. This allows for intermittent messages (like file
loading messages) to obscure longer-term messages (like &#8220;Processing
Math&#8221; messages) temporarily.</p>
<div class="section" id="methods">
<h2>Methods<a class="headerlink" href="#methods" title="Permalink to this headline"></a></h2>
<dl class="method">
<dt id="Set">
<tt class="descname">Set</tt><big>(</big><em>message</em><span class="optional">[</span>, <em>n</em><span class="optional">[</span>, <em>delay</em><span class="optional">]</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#Set" title="Permalink to this definition"></a></dt>
<dd><p>This sets the message being displayed to the given <cite>message</cite>
string. If <cite>n</cite> is not <tt class="docutils literal"><span class="pre">null</span></tt>, it represents a message id
number and the text is set for that message id, otherwise a new id
number is created for this message. If <cite>delay</cite> is provided, it is
the time (in milliseconds) to display the message before it is
cleared. If <cite>delay</cite> is not provided, the message will not be
removed automatically; you must call the
<tt class="xref py py-meth docutils literal"><span class="pre">MathJax.Messsage.Clear()</span></tt> method by hand to remove it.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>message</strong> &#8212; the text to display in the message area</li>
<li><strong>n</strong> &#8212; the message id number</li>
<li><strong>delay</strong> &#8212; amout of time to display the message</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last">the message id number for this message.</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="Clear">
<tt class="descname">Clear</tt><big>(</big><em>n</em><span class="optional">[</span>, <em>delay</em><span class="optional">]</span><big>)</big><a class="headerlink" href="#Clear" title="Permalink to this definition"></a></dt>
<dd><p>This causes the message with id <cite>n</cite> to be removed after the given
<cite>delay</cite>, in milliseconds. The default delay is 600 milliseconds.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>n</strong> &#8212; the message id number</li>
<li><strong>delay</strong> &#8212; the delay before removing the message</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last"><tt class="docutils literal"><span class="pre">null</span></tt></p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="Remove">
<tt class="descname">Remove</tt><big>(</big><big>)</big><a class="headerlink" href="#Remove" title="Permalink to this definition"></a></dt>
<dd><p>This removes the message frame from the window (it will reappear when
future messages are set, however).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><tt class="docutils literal"><span class="pre">null</span></tt></td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="File">
<tt class="descname">File</tt><big>(</big><em>file</em><big>)</big><a class="headerlink" href="#File" title="Permalink to this definition"></a></dt>
<dd><p>This sets the message area to a &#8220;Loading <em>file</em>&#8221; message, where <em>file</em>
is the name of the file (with <tt class="docutils literal"><span class="pre">[MathJax]</span></tt> representing the root
directory).</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>file</strong> &#8212; the name of the file being loaded</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last">the message id number for the message created</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="filterText">
<tt class="descname">filterText</tt><big>(</big><em>text</em>, <em>n</em><big>)</big><a class="headerlink" href="#filterText" title="Permalink to this definition"></a></dt>
<dd><p>This method is called on each message before it is displayed. It can
be used to modify (e.g., shorten) the various messages before they are
displayed. The default action is to check if the <tt class="docutils literal"><span class="pre">messageStyle</span></tt>
configuration parameter is <tt class="docutils literal"><span class="pre">simple</span></tt>, and if so, convert loading and
processing messages to a simpler form. This method can be overridden
to perform other sanitization of the message strings.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Parameters :</th><td class="field-body"><ul class="first simple">
<li><strong>text</strong> &#8212; the text of the message to be posted</li>
<li><strong>n</strong> &#8212; the id number of the message to be posted</li>
</ul>
</td>
</tr>
<tr class="field"><th class="field-name">Returns :</th><td class="field-body"><p class="first last">the modified message text</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="Log">
<tt class="descname">Log</tt><big>(</big><big>)</big><a class="headerlink" href="#Log" title="Permalink to this definition"></a></dt>
<dd><p>Returns a string of all the messages issued so far, separated by
newlines. This is used in debugging MathJax operations.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field"><th class="field-name">Returns :</th><td class="field-body">string of all messages so far</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<h3><a href="../index.html">Table Of Contents</a></h3>
<ul>
<li><a class="reference internal" href="#">The MathJax.Message Object</a><ul>
<li><a class="reference internal" href="#methods">Methods</a></li>
</ul>
</li>
</ul>
<h4>Previous topic</h4>
<p class="topless"><a href="ajax.html"
title="previous chapter">The MathJax.Ajax Object</a></p>
<h4>Next topic</h4>
<p class="topless"><a href="html.html"
title="next chapter">The MathJax.HTML Object</a></p>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="../search.html" method="get">
<input type="text" name="q" size="18" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="../genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="html.html" title="The MathJax.HTML Object"
>next</a> |</li>
<li class="right" >
<a href="ajax.html" title="The MathJax.Ajax Object"
>previous</a> |</li>
<li><a href="../index.html">MathJax v1.1 documentation</a> &raquo;</li>
<li><a href="index.html" >The MathJax API</a> &raquo;</li>
</ul>
</div>
<div class="footer">
&copy; Copyright 2011 Design Science.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
</div>
</body>
</html>