Enter code here...<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript" src="raphael.js"></script>
<script type="text/javascript" src="util/common.js"></script>
<script type="text/javascript" src="util/vec2.js"></script>
<script type="text/javascript" src="util/set.js"></script>
<script type="text/javascript" src="util/map.js"></script>
<script type="text/javascript" src="util/pool.js"></script>
<script type="text/javascript" src="chem/element.js"></script>
<script type="text/javascript" src="chem/sgroup.js"></script>
<script type="text/javascript" src="chem/struct.js"></script>
<script type="text/javascript" src="chem/struct_valence.js"></script>
<script type="text/javascript" src="chem/molfile.js"></script>
<script type="text/javascript" src="prototype-min.js"></script>
<script type="text/javascript" src="chem/dfs.js"></script>
<script type="text/javascript" src="chem/smiles.js"></script>
<script type="text/javascript" src="rnd/events.js"></script>
<script type="text/javascript" src="rnd/visel.js"></script>
<script type="text/javascript" src="rnd/restruct.js"></script>
<script type="text/javascript" src="rnd/restruct_rendering.js"></script>
<script type="text/javascript" src="rnd/render.js"></script>
<script type="text/javascript" src="ketcher.js"></script>
<title>Ketcher: Example</title>
</head>
<body onload="rrr=ketcher.showMolfileOpts('client_area', $('mf3').innerHTML, 100, {'autoScale':true, 'ignoreMouseEvents':true});">
<div id="client_area" style="width:640px;height:480px"></div>
<p id="mf3" style="display:none">
Marvin 09211002102D
0 0 0 0 0 999 V3000
M V30 BEGIN CTAB
M V30 COUNTS 32 34 0 0 0
M V30 BEGIN ATOM
M V30 1 C -0.1086 -2.4987 0 0
M V30 2 N 1.2339 -4.8265 0 0 CHG=1
M V30 3 C -0.1086 -4.0426 0 0
M V30 4 C -1.4355 -1.7304 0 0
M V30 5 N 5.261 -4.0118 0 0 RAD=3
M V30 6 C -1.4355 -0.1941 0 0
M V30 7 N 2.5762 -2.483 0 0
M V30 8 C 1.2339 -1.7147 0 0
M V30 9 O 1.2339 -6.3629 0 0 CHG=-1
M V30 10 C 2.584 -4.0195 0 0
M V30 11 A 5.2455 -2.4675 0 0 CFG=3
M V30 12 C 3.9109 -4.7876 0 0
M V30 13 C 6.5878 -4.78 0 0
M V30 14 O -2.7701 0.5742 0 0 MASS=18
M V30 15 C 3.903 -1.7073 0 0
M V30 16 C -0.1086 0.5742 0 0 CFG=1
M V30 17 C -1.4355 -4.811 0 0
M V30 18 C -2.7701 -2.4987 0 0
M V30 19 C -2.7701 -4.0426 0 0 RAD=2
M V30 20 C 6.5878 -6.3241 0 0
M V30 21 C 7.9149 -4.0118 0 0
M V30 22 [C,N,O] 1.226 -0.1941 0 0
M V30 23 C 9.2495 -4.78 0 0
M V30 24 C 7.9149 -7.0922 0 0
M V30 25 C 9.2495 -6.3241 0 0
M V30 26 C 5.7594 -1.0158 0 0
M V30 27 C 6.7646 -2.7207 0 0
M V30 28 C -0.1107 2.1142 0 0 CHG=2
M V30 29 C 1.224 1.3459 0 0
M V30 30 C -4.1033 -1.7278 0 0 RAD=1
M V30 31 Fe -1.4334 -6.351 0 0 MASS=56
M V30 32 "NOT [Cl,Br,I]" 4.07 1.485 0 0
M V30 END ATOM
M V30 BEGIN BOND
M V30 1 1 2 3
M V30 2 2 3 1
M V30 3 1 4 1
M V30 4 1 5 12
M V30 5 1 6 4
M V30 6 1 7 8
M V30 7 1 8 1
M V30 8 1 9 2
M V30 9 2 10 2
M V30 10 1 11 15
M V30 11 1 12 10
M V30 12 1 13 5
M V30 13 4 6 14
M V30 14 1 10 7
M V30 15 1 15 7
M V30 16 1 16 6
M V30 17 1 17 3
M V30 18 2 18 4
M V30 19 1 19 18
M V30 20 4 20 13
M V30 21 4 21 13
M V30 22 1 22 16
M V30 23 4 23 21
M V30 24 4 24 20
M V30 25 4 25 24
M V30 26 2 17 19
M V30 27 1 11 5 CFG=1
M V30 28 4 25 23
M V30 29 1 11 26 CFG=3
M V30 30 1 11 27 CFG=2
M V30 31 8 16 28
M V30 32 1 16 29 CFG=1
M V30 33 1 18 30
M V30 34 1 17 31
M V30 END BOND
M V30 END CTAB
M END
</p>
</body>
</html>
Hi Marco,
As was mentioned above Javascript cannot read files from disk by its own. However you could do it from your C# application and pass the contents to the webcontrol. For example you could generate the html source dynamically replacing the content of the <p></p> area and then put the string to the webcontrol or you could pass some code to invoke it from javascript. It depends of your needs.
Hope it helps,
Kolya
chem.Molfile.partitionLine = function (/*string*/ str, /*array of int*/ parts, /*bool*/ withspace)
{
var res = [];
for (var i = 0, shift = 0; i < parts.length; ++i)
{
res.push(str.slice(shift, shift + parts[i]));
if (withspace)
shift++;
shift += parts[i];
}
return res;
};
Hi,
The Molfiles are very whitespace sensitive. You know, every extra whitespace or trimmed linebreak can destroy the layout completely. In other hand, according to HTML spec, the whitespaces around the "raw text elements" are stripped except some special cases. I cannot say it for sure as I don't see your code, but I guess the root of evil lies there. You could try to replace `<p>` tag with something like `<pre>` or `<textarea>` (refer the spec and hope that IE guys do its job well) or encode the Molfile directly in a script.
Cheers,
Kolya.
> >> <http://stackoverflow.com/a/3694080/1206628>. It depends of your needs.