Difference between revisions of "Jmol JavaScript Object"

From Jmol
Jump to navigation Jump to search
(first tips - which files are needed)
(Installation)
Line 3: Line 3:
 
==Installation==
 
==Installation==
  
These files must be accesible to the html page (note that [[Troubleshooting/Applet#Java_security_errors|Java scurity policy]] imposes limitations on the folder location of files):
+
These files must be accessible to the html page. Note that [[Troubleshooting/Applet#Java_security_errors|Java scurity policy]] imposes limitations on the folder location of files. The JavaScript files should be in the following order:
  
* {{file|JmolApplet0*.jar}} or {{file|JmolAppletSigned0*.jar}}
+
* {{file|JmolApplet.jar}} or {{file|JmolAppletSigned.jar}} or {{file|JmolApplet0*.jar}} or {{file|JmolAppletSigned0*.jar}}
 
: (That is a set of files, where the * stands for several suffixes. You may need to read about [[Jmol_Applet#Unsigned_vs._Signed_Applet_.26_Data_Access|signed vs. unsigned applet]].)
 
: (That is a set of files, where the * stands for several suffixes. You may need to read about [[Jmol_Applet#Unsigned_vs._Signed_Applet_.26_Data_Access|signed vs. unsigned applet]].)
* {{file|JmolCore.js}}
+
* {{file|JmolCore.js}} (required)
* {{file|JmolApplet.js}}
+
* {{file|JmolApplet.js}} (required)
* {{file|JmolApi.js}}
+
* {{file|JmolControls.js}} (optional -- required if any buttons or links or other input methods will be used)
* {{file|JmolControls.js}}
+
* {{file|JmolApi.js}} (required)
 
 
  
 
==Initialization==
 
==Initialization==

Revision as of 21:25, 12 August 2012

Jmol Javascript Object is a set of javascript functions and utilities refactored and reorganized into a single javascript object. It supersedes the former Jmol.js javascript library as it allows for a cleaner, more efficient way to interact with the applet from javascript, and abstracts the view of a molecular model so that the applet could be seamlessly replaced by an image, or a third party visualization method depending on client's browser resources.

Installation

These files must be accessible to the html page. Note that Java scurity policy imposes limitations on the folder location of files. The JavaScript files should be in the following order:

  • File icon.gifJmolApplet.jar or File icon.gifJmolAppletSigned.jar or File icon.gifJmolApplet0*.jar or File icon.gifJmolAppletSigned0*.jar
(That is a set of files, where the * stands for several suffixes. You may need to read about signed vs. unsigned applet.)
  • File icon.gifJmolCore.js (required)
  • File icon.gifJmolApplet.js (required)
  • File icon.gifJmolControls.js (optional -- required if any buttons or links or other input methods will be used)
  • File icon.gifJmolApi.js (required)

Initialization

Basic

The html page must reference (usually with a script tag in the head section) the javascript libraries:

  • File icon.gifJmolCore.js essential
  • File icon.gifJmolApplet.js essential, must go after JmolCore
  • File icon.gifJmolApi.js essential, must go after JmolCore
  • File icon.gifJmolControls.js optional, must go after JmolCore; only needed if you will insert user interface controls like buttons, links, menus, etc.

Using the ChemDoodle alternative

The html page must reference these additional javascript libraries:

Using the GLmol alternative

The html page must reference these additional javascript libraries:

  • File icon.gifjQuery.min.js required; unrelated to Jmol and not included in Jmol distribution. The jQuery JavaScript Library.
  • File icon.gifThree49custom.js required; not included in Jmol distribution; available with GLmol, below.
  • File icon.gifGLmol.js required; from GLmol - Molecular Viewer on WebGL/Javascript; must go after the above two.
  • File icon.gifJmolGlmol.js required; must go after JmolApplet and all those above.

Initialization parameters

API