-
Notifications
You must be signed in to change notification settings - Fork 0
/
SMARTS.html
74 lines (68 loc) · 3.23 KB
/
SMARTS.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<HTML>
<script src="jquery/jquery-3.4.1.min.js"></script>
<script type="text/javascript" language="javascript" src="jsme/jsme.nocache.js"></script>
<!-- bootstrap -->
<!--<link rel='stylesheet' href='http://cdn.jsdelivr.net/bootstrap/3.2.0/css/bootstrap.css'>-->
<!-- Font Awesome icons (Bootstrap, Foundation, and jQueryUI also supported) -->
<!--<link rel='stylesheet' href='http://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css'>-->
<!-- JSON editor -->
<!-- <script src="jsoneditor/jsoneditor-1.4.0-beta.0.min.js"></script> -->
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@1.3.5/dist/jsoneditor.min.js"></script>
<script src="schema/BigSMILES_DataForm_schema_production.json"></script>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function updateParent() {
//console.log(opener.document.getElementById("bb").innerHTML);
alert(window.opener.document.getElementById("bb").innerHTML);
opener.document.getElementById("bb").innerHTML = "234";
//opener.document.parentForm.pf2.value = document.childForm.cf2.value;
alert(123);
self.close();
return false;
}
</SCRIPT>
</HEAD><BODY>
<noscript>
<div style="width: 22em; position: absolute; left: 50%; margin-left: -11em; color: red; background-color: white; border: 1px solid red; padding: 4px; font-family: sans-serif">
Your web browser must have JavaScript enabled
in order for this application to display correctly.
</div>
</noscript>
<div style="width:600px;float:left;background:#ffffff;">
<div id="appletContainer"></div>
<div id="return" style="margin:auto;width:100px;margin-top:10px;margin-bottom:10px;">
<button class="getSMILES" style="font-size:16px;text-align: center;padding:5px;">Get SMARTS</button>
</div>
</div>
<script>
function jsmeOnLoad() {
// initialize JSME editor with styrene repeat unit
var startingStructure = "8 7 * 6.57 -6.12 C 7.38 -5.66 C 8.59 -6.36 C 9.80 -5.66 C 11.02 -6.36 * 12.23 -5.66 * 8.59 -7.76 * 11.02 -7.76 1 2 1 2 3 1 3 4 1 4 5 1 5 6 1 3 7 -1 5 8 -2";
jsmeApplet = new JSApplet.JSME("appletContainer", "600px", "440px", {
//optional parameters
"options" : "query,hydrogens,multipart,autoez,noxbutton,norbutton,noreaction",
"jme" : startingStructure
});
//One can mimic the JME Java applet access to simplify the adaptation of HTML and JavaScript code:
document.JME = jsmeApplet;
jsmeApplet.setMolecularAreaScale(1.5);
jsmeApplet.setMenuScale(1.5);
}
$("#return").on("click",".getSMILES",function(event){
smilesStr = document.JME.smiles();
//jmeStr = document.JME.jmeFile();
//alert(smilesStr);
let target = opener.document.getElementById("message_container").innerHTML;
//alert(target);
let queryTxt = "*[name='"+target+"']";
//alert(queryTxt);
//alert(JSON.stringify($(opener.document).find(queryTxt).first()));
$(opener.document).find(queryTxt).first().val(smilesStr);
//console.log($(opener.document).find(queryTxt));
//$(opener.document).("input[name='"+target+"']").val(smilesStr);
//opener.document.getElementById("bb").innerHTML = "234";
self.close();
return false;
});
</script>
</BODY></HTML>