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
49 lines (35 loc) • 1.38 kB
HTML
<html>
<head>
<title>Structure modified and atom mark demo</title>
<link href="bootstrap.css" rel="stylesheet">
<script type="text/javascript" language="javascript" src="jsme/jsme.nocache.js"></script>
<style>
em {background-color:rgb(102,255,255);}
</style>
<script>
//this function will be called after the JavaScriptApplet code has been loaded.
function jsmeOnLoad() {
jsmeApplet = new JSApplet.JSME("jsme_container", "380px", "340px", {
"options" : "oldlook,star"
});
jsmeApplet.setAfterStructureModifiedCallback(showEvent);
document.getElementById("log").value = "";
}
var patt=/\[([A-Za-z][a-z]?)H?\d*:\d+\]/g; //regexp pattern for numbered atom
function showEvent(event) {
var log = document.getElementById("log");
log.value = event.action + " at: " + event.atom + " b: " + event.bond + " m: " + event.molecule + " " + event.src.smiles() + "\n" + log.value;
}
</script>
</head>
<body>
<H1>Structure modified and atom mark demo</H1>
<p>
Draw a structure, click on the star icon of the editor and click on one or more atoms
</p>
<div id="jsme_container"></div>
<button type="button" id="clear_but" onclick='document.getElementById("log").value=""'>Clear log</button>
<BR>
<textarea id = "log" rows="24" cols="50"> </textarea>
</body>
</html>