Difference between revisions of "Compatibility"

From Jmol
Jump to navigation Jump to search
(Known Incompatibilities)
(Privacy Badger incompatibility - reported by Vinushka Schalk in jmol-users list)
 
(6 intermediate revisions by one other user not shown)
Line 3: Line 3:
 
JSmol is compatible with:
 
JSmol is compatible with:
  
  [http://www.jQuery.org jQuery 1.9+]
+
  [http://www.jQuery.org jQuery 1.9+] But see below.
 
  [https://developers.google.com/chart Google Charts]
 
  [https://developers.google.com/chart Google Charts]
 
  [http://www.mathjax.org MathJax] (but see below)
 
  [http://www.mathjax.org MathJax] (but see below)
Line 9: Line 9:
 
  [http://jspecview.sourceforge.net/ JSpecView]
 
  [http://jspecview.sourceforge.net/ JSpecView]
  
== Known Incompatibilities ==
+
== Known jQuery Incompatibilities ==
 +
 
 +
A bug/design fault/design decision in jQuery 2.0 prevents MSIE to be used for local pages that access remote files. This issue will reportedly not be fixed. jQuery 1.10 also has this bug, but at least there is a simple fix for that. See [http://bugs.jquery.com/ticket/14876].
 +
 
 +
== Known Variable Scope Incompatibilities ==
  
 
JSmol will create the following global variables and will be incompatible with any package that does likewise:
 
JSmol will create the following global variables and will be incompatible with any package that does likewise:
Line 19: Line 23:
 
primary Java-derived package names:
 
primary Java-derived package names:
  
  java javajs  J  JM   JMB  JSV  JU  JV   JW  JZ
+
  java javajs  J  JM JS  JSV  JU  JV  
  
 
used by javajs for communication in relation to dialogs and menus:
 
used by javajs for communication in relation to dialogs and menus:
Line 27: Line 31:
 
Java2Script globals:
 
Java2Script globals:
  
  Clazz JavaObject j2s.clazzloaded j2s.doProfile j2s.lib j2s.object.native c$
+
  Clazz   c$  "j2s.clazzloaded"  "j2s.doProfile" "j2s.lib" "j2s.object.native"
  
 
standard JavaScript classes that have been extended by Java2Script to be compatible with java.lang classes of the same name:
 
standard JavaScript classes that have been extended by Java2Script to be compatible with java.lang classes of the same name:
Line 111: Line 115:
 
     -- 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:
+
3) set the jQuery $(document).ready event to add a hook to start JSmol loading upon the MathJax "End" signal:
 
 
$(document).ready(function(){
 
  checkMathJax(loadJmol);
 
});
 
  
checkMathJax = function(fReady) {
+
<pre>
  return (!$("#MathJax_Message")[0]
+
$(document).ready(function(){
    || $('#MathJax_Message:contains("Loading")')[0]
+
  MathJax.Hub.Register.StartupHook("End", loadJmol);
    ? setTimeout(function(){checkMathJax(fReady)},10)
+
});
    : fReady());
 
}
 
  
 
  loadJmol = function() {
 
  loadJmol = function() {
Line 150: Line 148:
 
  &lt;div id="appletplace">&lt;/div>
 
  &lt;div id="appletplace">&lt;/div>
 
...
 
...
 +
</pre>
 +
A demonstration page can be found at [http://chemapps.stolaf.edu/jmol/jsmol/mathjax.htm].(credit goes to David Guichard, Whitman College, for finding this solution)
 +
 +
 +
== Other Incompatibilities ==
 +
=== Privacy Badger ===
 +
The Firefox add-on "Privacy Badger" will cause an error with JSmol pages. The error looks like <code>TypeError: getStackTrace(...) is undefined</code>.
 +
This is exclusive to the Firefox version of Privacy Badger and does not occur on Chrome.
  
A demonstration page can be found at [http://chemapps.stolaf.edu/jmol/jsmol/mathjax.htm].
+
The add-on must be disabled completely for JSmol to work. Clicking "disable Privacy Badger on this site" will not help.

Latest revision as of 18:22, 15 December 2015

Known Compatibilities

JSmol is compatible with:

jQuery 1.9+ But see below.
Google Charts
MathJax (but see below)
JSME (JavaScript Molecular Editor
JSpecView

Known jQuery Incompatibilities

A bug/design fault/design decision in jQuery 2.0 prevents MSIE to be used for local pages that access remote files. This issue will reportedly not be fixed. jQuery 1.10 also has this bug, but at least there is a simple fix for that. See [1].

Known Variable Scope 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:

java javajs  J   JM  JS  JSV   JU   JV 

used by javajs for communication in relation to dialogs and menus:

SwingController

Java2Script globals:

Clazz   c$   "j2s.clazzloaded"  "j2s.doProfile" "j2s.lib" "j2s.object.native"

standard JavaScript classes that have been extended by Java2Script to be compatible with java.lang classes of the same name:

Array Boolean Character Date Error Number String

additional java.lang classes that are made global to be compatible with standard Java usage:

AbstractMethodError AbstractStringBuilder Appendable ArithmeticException ArrayIndexOutOfBoundsException ArrayStoreException AssertionError CharSequence ClassCastException ClassCircularityError ClassFormatError ClassNotFoundException CloneNotSupportedException Cloneable Comparable Enum Exception ExceptionInInitializerError IllegalAccessError IllegalAccessException IllegalArgumentException IllegalMonitorStateException IllegalStateException IllegalThreadStateException IncompatibleClassChangeError IndexOutOfBoundsException InstantiationError InstantiationException InternalError InterruptedException Iterable LinkageError NegativeArraySizeException NoClassDefFoundError NoSuchFieldError NoSuchFieldException NoSuchMethodError NoSuchMethodException NullPointerException NumberFormatException OutOfMemoryError Runnable RuntimeException SecurityException StackOverflowError StackTraceElement StringBuffer StringBuilder StringIndexOutOfBoundsException Thread ThreadDeath ThreadGroup Throwable UnknownError UnsatisfiedLinkError UnsupportedClassVersionError UnsupportedOperationException VerifyError VirtualMachineError Void

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 Issues

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 add a hook to start JSmol loading upon the MathJax "End" signal:

$(document).ready(function(){
  MathJax.Hub.Register.StartupHook("End", loadJmol);
});

 loadJmol = function() {
  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));
 }
...
 </head>
 <body>
 <div id="appletplace"></div>
...

A demonstration page can be found at [2].(credit goes to David Guichard, Whitman College, for finding this solution)


Other Incompatibilities

Privacy Badger

The Firefox add-on "Privacy Badger" will cause an error with JSmol pages. The error looks like TypeError: getStackTrace(...) is undefined. This is exclusive to the Firefox version of Privacy Badger and does not occur on Chrome.

The add-on must be disabled completely for JSmol to work. Clicking "disable Privacy Badger on this site" will not help.

Contributors

Hansonr, AngelHerraez