Difference between revisions of "Compatibility"
(Created page with "== MathJax Compatibility == [http://www.mathjax.org MathJax] works by first loading a web page, then, after that is complete, editing the special mark-up on the page to turn tho...") |
(→Compatibility with MathJax and other packages) |
||
Line 1: | Line 1: | ||
+ | == Known Compatibilities == | ||
+ | |||
+ | JSmol is compatible with: | ||
+ | [http://www.jQuery.org jQuery 1.9+], | ||
+ | [https://developers.google.com/chart Google Charts] | ||
+ | |||
+ | == Known Incompatibilities == | ||
+ | |||
+ | JSmol will create the following global variables and will be incompatible with any package that does likewise: | ||
+ | |||
+ | our object: | ||
+ | Jmol | ||
+ | |||
+ | primary Java-derived package names: | ||
+ | |||
+ | J JM JMB JSV JU JV JW JZ java javajs | ||
+ | |||
+ | used by javajs for communication in relation to dialogs and menus: | ||
+ | |||
+ | SwingController | ||
+ | |||
+ | Java2Script globals: | ||
+ | |||
+ | Clazz ClassLoader ClassLoaderProgressMonitor JavaObject | ||
+ | $_A $_AB $_AC $_AD $_AF $_AI $_AL $_AS $_Ab $_B $_C $_D | ||
+ | $_E $_F $_G $_H $_I $_J $_K $_L $_M $_N $_O $_P $_Q | ||
+ | $_R $_S $_T $_U $_V $_W $_X $_Y $_Z $_k $_s | ||
+ | c$ $t$ | ||
+ | |||
+ | Note that [https://code.google.com/p/java2script/ Java2Script] had to be extensively augmented to work with Jmol. | ||
+ | Therefore JSmol will be incompatible with other Java2Script applications using the default implementations of Clazz. | ||
+ | |||
== MathJax Compatibility == | == MathJax Compatibility == | ||
− | [http://www.mathjax.org MathJax] works by first loading a web page, then, after that is complete, editing the special mark-up on the page to turn those marks into beautiful math expressions. The problem is that both Jmol and MathJax are competing for the | + | [http://www.mathjax.org MathJax] works by first loading a web page, then, after that is complete, editing the special mark-up on the page to turn those marks into beautiful math expressions. The problem is that both Jmol and MathJax are competing for the page processing after a page is loaded. Fortunately, MathJax was designed with this issue in mind, and there is a way of monitoring its progress. We need to start creating Jmol objects ''only after MathJax completes its job.'' |
For compatibility with MathJax, make sure you: | For compatibility with MathJax, make sure you: | ||
− | 1) are using dynamic loading of JSmol | + | 1) are using JSmol (JSmol.min.js, not the older Jmol.js) |
+ | |||
+ | 2) are using dynamic loading of JSmol | ||
-- use $(document).ready() to create all JSmol objects | -- use $(document).ready() to create all JSmol objects | ||
-- no <script> tags that use Jmol.getApplet() within the body | -- no <script> tags that use Jmol.getApplet() within the body | ||
− | + | 3) set the jQuery $(document).ready event to monitor MathJax loading and only start creating JSmol objects until that is done. For example: | |
− | |||
$(document).ready(function(){ | $(document).ready(function(){ | ||
loadJmol(); | loadJmol(); | ||
Line 44: | Line 77: | ||
... | ... | ||
<div id="appletplace"></div> | <div id="appletplace"></div> | ||
− | |||
− |
Revision as of 19:33, 7 March 2014
Known Compatibilities
JSmol is compatible with:
jQuery 1.9+, Google Charts
Known Incompatibilities
JSmol will create the following global variables and will be incompatible with any package that does likewise:
our object:
Jmol
primary Java-derived package names:
J JM JMB JSV JU JV JW JZ java javajs
used by javajs for communication in relation to dialogs and menus:
SwingController
Java2Script globals:
Clazz ClassLoader ClassLoaderProgressMonitor JavaObject $_A $_AB $_AC $_AD $_AF $_AI $_AL $_AS $_Ab $_B $_C $_D $_E $_F $_G $_H $_I $_J $_K $_L $_M $_N $_O $_P $_Q $_R $_S $_T $_U $_V $_W $_X $_Y $_Z $_k $_s c$ $t$
Note that Java2Script had to be extensively augmented to work with Jmol. Therefore JSmol will be incompatible with other Java2Script applications using the default implementations of Clazz.
MathJax Compatibility
MathJax works by first loading a web page, then, after that is complete, editing the special mark-up on the page to turn those marks into beautiful math expressions. The problem is that both Jmol and MathJax are competing for the page processing after a page is loaded. Fortunately, MathJax was designed with this issue in mind, and there is a way of monitoring its progress. We need to start creating Jmol objects only after MathJax completes its job.
For compatibility with MathJax, make sure you:
1) are using JSmol (JSmol.min.js, not the older Jmol.js)
2) are using dynamic loading of JSmol
-- use $(document).ready() to create all JSmol objects -- no <script> tags that use Jmol.getApplet() within the body
3) set the jQuery $(document).ready event to monitor MathJax loading and only start creating JSmol objects until that is done. For example:
$(document).ready(function(){ loadJmol(); });
loadJmol = function() { // we are checking evey 10 milliseconds if (!$("#MathJax_Message")[0] || $('#MathJax_Message:contains("Loading")')[0]) { setTimeout(loadJmol, 10); return; } var Info = { width: 300, height: 300, debug: false, color: "0xFFFFFF", addSelectionOptions: true, use: "HTML5", j2sPath: "./j2s", jarPath: "./java", jarFile: "JmolAppletSigned.jar", isSigned: true, script: "set antialiasDisplay;load $caffeine", serverURL: "http://chemapps.stolaf.edu/jmol/jsmol/php/jsmol.php", readyFunction: jmol_isReady, disableJ2SLoadMonitor: false, disableInitialConsole: true, allowJavaScript: true } $("#appletplace").html(Jmol.getAppletHtml("jmol", Info)); }
...
<div id="appletplace"></div>