view jmoleditor/Jmoleditor/editor.htm @ 5:c2055dd1927b draft default tip

Uploaded
author bgruening
date Thu, 24 Apr 2014 13:19:33 -0400
parents 17a3f755d472
children
line wrap: on
line source

<!--
//////////////////////////////////////////////////////////////////////////////////
//
JSDraw
// Copyright Scilligence Corporation, 2009-2012
// http://www.scilligence.com/
//
//////////////////////////////////////////////////////////////////////////////////
-->

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
<head>
<title>JSDraw - A Javascript Chemical Structure Editor/Viewer</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js" type="text/javascript"></script>
<script type="text/javascript" src='Scilligence.JSDraw.js'></script>


</head>
<body>

<h2>Paint your structure and add it to Galaxy!</h2>

<table border=1><tr><td>
Editor:<br />
<div class='JSDraw' id="test" style="width: 760px; height: 300px;border:1px solid gray" ondatachange='molchange'
    dataformat='molfile' data=''></div>
</td></tr></table>
<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>
<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>

<form name="galaxyform" id="galaxyform" enctype="multipart/form-data" action="" method="post">
    <input name='galaxyData' id='galaxyData' type='hidden' value='' />
    <input name='data_type' id='data_type' type='hidden' value='mol' />
    <input name='tool_id' id='tool_id' type='hidden' value='' />
</form>

<br />
Mol. Weight: <label id='mw' style='width:120px;font-weight:bold'></label>
Formula: <label id='formula' style='width:300px;font-weight:bold'></label>

<script type="text/javascript">
    JSDraw.init();

    function molchange(jsdraw) {
    document.getElementById('formula').innerHTML = jsdraw.getFormula(true);
    document.getElementById('mw').innerHTML = jsdraw.getMolWeight();
    }

    function getParameterByName(name)
    {
      name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
      var regexS = "[\\?&]" + name + "=([^&#]*)";
      var regex = new RegExp(regexS);
      var results = regex.exec(window.location.search);
      if(results == null)
        return "";
      else
        return decodeURIComponent(results[1].replace(/\+/g, " "));
    }

    document.getElementById('tool_id').value = getParameterByName('tool_id') ;

    document.getElementById('galaxyform').action = getParameterByName('GALAXY_URL')+"?tool_id="+getParameterByName('tool_id')+"&URL="+getParameterByName('URL')+" " ;

</script>

</body>
</html>