comparison jmoleditor/Jmoleditor/editor.htm @ 1:17a3f755d472 draft

Uploaded
author bgruening
date Wed, 21 Aug 2013 03:07:12 -0400
parents
children
comparison
equal deleted inserted replaced
0:f653fd06f055 1:17a3f755d472
1 <!--
2 //////////////////////////////////////////////////////////////////////////////////
3 //
4 JSDraw
5 // Copyright Scilligence Corporation, 2009-2012
6 // http://www.scilligence.com/
7 //
8 //////////////////////////////////////////////////////////////////////////////////
9 -->
10
11 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
12 <head>
13 <title>JSDraw - A Javascript Chemical Structure Editor/Viewer</title>
14 <meta http-equiv="X-UA-Compatible" content="IE=edge" >
15 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
16
17 <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" type="text/javascript"></script>
18 <script type="text/javascript" src='Scilligence.JSDraw.js'></script>
19
20
21 </head>
22 <body>
23
24 <h2>Paint your structure and add it to Galaxy!</h2>
25
26 <table border=1><tr><td>
27 Editor:<br />
28 <div class='JSDraw' id="test" style="width: 760px; height: 300px;border:1px solid gray" ondatachange='molchange'
29 dataformat='molfile' data=''></div>
30 </td></tr></table>
31 <button onclick='document.getElementById("data_type").value ="mol";document.getElementById("galaxyData").value = JSDraw.get("test").getMolfile();document.getElementById("galaxyform").submit();'>Export Molfile to Galaxy</button>
32 <button onclick='document.getElementById("data_type").value ="smi";document.getElementById("galaxyData").value = JSDraw.get("test").getSmiles();document.getElementById("galaxyform").submit();'>Export Smiles to Galaxy</button>
33
34 <form name="galaxyform" id="galaxyform" enctype="multipart/form-data" action="" method="post">
35 <input name='galaxyData' id='galaxyData' type='hidden' value='' />
36 <input name='data_type' id='data_type' type='hidden' value='mol' />
37 <input name='tool_id' id='tool_id' type='hidden' value='' />
38 </form>
39
40 <br />
41 Mol. Weight: <label id='mw' style='width:120px;font-weight:bold'></label>
42 Formula: <label id='formula' style='width:300px;font-weight:bold'></label>
43
44 <script type="text/javascript">
45 JSDraw.init();
46
47 function molchange(jsdraw) {
48 document.getElementById('formula').innerHTML = jsdraw.getFormula(true);
49 document.getElementById('mw').innerHTML = jsdraw.getMolWeight();
50 }
51
52 function getParameterByName(name)
53 {
54 name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
55 var regexS = "[\\?&]" + name + "=([^&#]*)";
56 var regex = new RegExp(regexS);
57 var results = regex.exec(window.location.search);
58 if(results == null)
59 return "";
60 else
61 return decodeURIComponent(results[1].replace(/\+/g, " "));
62 }
63
64 document.getElementById('tool_id').value = getParameterByName('tool_id') ;
65
66 document.getElementById('galaxyform').action = getParameterByName('GALAXY_URL')+"?tool_id="+getParameterByName('tool_id')+"&URL="+getParameterByName('URL')+" " ;
67
68 </script>
69
70 </body>
71 </html>