UNPKG

jsme

Version:

JSME is a free molecule editor written in JavaScript. JSME is a direct successor of the JME Molecule Editor applet. JSME supports drawing and editing of molecules and reactions on desktop computer, as well as on handheld devices including iPhone, iPad and

144 lines (125 loc) 4.55 kB
<HTML> <HEAD> <TITLE>JME Example 1</TITLE> <script type="text/javascript" language="javascript" src="../jsme/jsme.nocache.js"></script> <SCRIPT LANGUAGE="JavaScript"> function getSmiles() { var drawing = document.JME.smiles(); document.form.smi.value = drawing; } function getJmeFile() { var jme = document.JME.jmeFile(); document.form.jme_output.value = jme; } function getMolFile() { var mol = document.JME.molFile(); document.form.mol_output.value = mol; } function processJme() { document.JME.readMolecule(document.form.jme_output.value); } function useMol() { document.JME.readMolFile(document.form.mol_output.value); } function readMolecule() { var jme = "16 17 C 7.37 -8.99 C 7.37 -7.59 C 6.16 -6.89 C 4.95 -7.59 C 4.95 -8.99 C 6.16 -9.69 N 8.58 -6.89 C 8.58 -5.49 C 7.37 -4.79 O 6.16 -5.49 C 9.80 -7.59 O 9.80 -8.99 C 11.01 -6.89 Cl 12.22 -7.59 Cl 11.01 -5.49 C 9.80 -4.79 1 2 1 2 3 2 3 4 1 4 5 2 5 6 1 6 1 2 7 8 1 8 9 1 9 10 1 3 10 1 2 7 1 7 11 1 11 12 2 11 13 1 13 14 1 13 15 1 8 16 1"; document.JME.readMolecule(jme); } function readMultipart() { var jme = "9 9 C 6.68 -7.15 C 5.47 -6.45 C 4.26 -7.15 C 4.26 -8.55 C 5.47 -9.25 C 6.68 -8.55 C 5.47 -5.05 O- 6.68 -4.35 O 4.26 -4.35 1 2 1 2 3 2 3 4 1 4 5 2 5 6 1 6 1 2 2 7 1 7 8 1 7 9 2|1 0 Na+ 12.21 -6.61"; document.JME.readMolecule(jme) } function readReaction() { var jme = "3 2 C:1 1.41 -7.12 O:2 1.41 -5.72 Cl 2.63 -7.82 1 2 2 1 3 1|3 2 N:3 5.72 -6.78 C:4 7.12 -6.78 H:5 5.02 -7.99 1 2 1 1 3 1 >> 5 4 C:1 13.51 -6.40 O:2 13.51 -5.00 N:3 14.72 -7.10 C:4 15.94 -6.40 H:5 14.71 -8.50 1 2 2 1 3 1 3 4 1 3 5 1"; document.JME.readMolecule(jme); } function openHelpWindow() { window.open("http://www.molinspiration.com/jme/help/jme2008hints.html","jmehelp","toolbar=no,menubar=no,scrollbars=yes,resizable=yes,width=510,height=675,left=400,top=20"); } </SCRIPT> </HEAD> <BODY BGCOLOR="#FFFFFF"> <center> <p> <H2>Example of Java - JavaScript communication and data export / import</H2> <P> <table border=0 width="100%"> <tr> <td align="center"> <table> <tr> <td> <div code="JME.class" name="JME" archive="JME.jar" width=360 height=315>You have to enable Java and JavaScritpt on your machine !</div> </td> </tr> <tr> <td align="right"><a href="javascript:openHelpWindow();">JME Help</a></td> </tr> </table> </td> <td align="center"> <FORM METHOD="POST" NAME="form" ONSUBMIT="return false;"> <p> <CENTER> <b>smiles</b><BR> <INPUT TYPE="text" NAME="smi" SIZE=48"><BR> <p> <b>jme string</b><BR> <TEXTAREA NAME="jme_output" ROWS=1 COLS=40></TEXTAREA> <p> <b>mol file</b><BR> <TEXTAREA NAME="mol_output" ROWS=5 COLS=40></TEXTAREA> <P> <INPUT TYPE="button" VALUE="Get SMILES" onClick="getSmiles()"> &nbsp; <INPUT TYPE="button" VALUE="Get JME string" onClick="getJmeFile()"> &nbsp; <INPUT TYPE="button" VALUE="Get mol file" onClick="getMolFile()"> &nbsp; <p> <INPUT TYPE="button" VALUE="Use JME" onClick="processJme()"> &nbsp; <INPUT TYPE="button" VALUE="Use mol file" onClick="useMol()"> <P> <INPUT TYPE="button" VALUE="Clear Editor" onClick="document.JME.reset()"> &nbsp; <INPUT TYPE="reset" VALUE="Clear Fields"> </CENTER> </FORM> </td> </tr> </table> <FORM METHOD="POST" NAME="for2m" ONSUBMIT="return false;"> <INPUT TYPE="button" VALUE="Read Molecule" onClick="readMolecule()"> &nbsp;&nbsp; <INPUT TYPE="button" VALUE="Read Multipart Structure" onClick="readMultipart()"> &nbsp;&nbsp; <INPUT TYPE="button" VALUE="Read Reaction with Mapping" onClick="readReaction()"> </form> <p> <TABLE BORDER=1> <CAPTION> <B>Keyboard shortcuts</B> </CAPTION> <TR> <TD><FONT SIZE=2>bonds -,=,#</FONT></TD> <TD><FONT SIZE=2>rings 3..8, Ph is 1, furyl 0</FONT></TD> <TD><FONT SIZE=2>atoms C,N,O,P,S,F,L,B,I,H</FONT></TD> <TD><FONT SIZE=2>groups t - tert.butyl, ft - CF3, y - nitro, a - COOH, z - SO3H</FONT></TD> </TR> <TR> <TD><FONT SIZE=2>d - delete</FONT></TD> <TD COLSPAN=3><FONT SIZE=2>Esc - return to the standard state (C, single bond)</FONT></TD> <TR> <TD COLSPAN=4><FONT SIZE=2>molecule may by moved by "dragging" free space and rotated by pressing concurrently also the shift key</FONT></TD> </TR> </TABLE> </center> <P> </BODY> </HTML>