Angel,
thank you, I think I understand, and your suggested solution sounds logical.
I assume both functions in pop_Jmol.js should be modified?
function putJmolDiv(molNr, molName, molFileName)
{ var imageFileName =
molFileName.substring(0,molFileName.lastIndexOf(".")) + ".jpg"
var tx = '<div id="Jmol' + molNr + '" class="JmolDiv" style="width:' +
JmolSize + 'px; height:' + JmolSize + 'px;">'
tx += '<img src="' + imageFileName + '"><br>'
tx += 'You can get a 3-dimensional model of the Cholesterol molecule
that you can manipulate. '
tx += 'It uses the Jmol applet. This may take quite a time to download
if you do not '
tx += 'already have it in cache. If you want to see that model, click '
tx += '<a href="javascript:void(popInJmol(' + molNr + ', \'' + molName
+ '\', \'' + molFileName + '\'))">here</a></div>'
document.writeln(tx)
}
function popInJmol(n,molName,fileName)
{ jmolInitialize(JmolPath)
jmolSetDocument(false)
document.getElementById("Jmol"+n).innerHTML = jmolApplet(JmolSize,"load
"+fileName+";set echo top center;color echo yellow;echo "+molName,n)
}
sincerely,
steve
-----Original Message-----
From: Angel Herráez [mailto:[email protected]]
Sent: 17 November 2011 20:37
To: [email protected]
Subject: Re: [Jmol-users] putJmolDiv
OK Steve, that's clear now.
Wow! 2007! Time really flies.
Let's see. Your approach is reasonable, but all comes to what the putJmolDiv()
function is doing. It calls popInJmol(n,molName,fileName) which is designed to
use the "load" command
+ the filename.
I'm not confident what load does with a script file. The safe way is using the
"script"
command instead.
So easiest solution is to edit the pop_Jmol.js file and add a new alternative
function. But then you have to cope with calling one or the other depending on
if yu want to use a model filename or a script filename.
I could put a filter so that the file extension is used to decide, but that's
not too wise given that Jmol doesn't care about extensions, so other people
might use any extension.
How about a new version that uses
function putJmolDiv(molNr, molName, molFileName, scripFileName)
?
That would be made backwards compatible, if the last parameter is omiited.
For your case, you would call it omitting the model like in
putJmolDiv(0,'one2one','', '/sites/files/jmolfiles/one2one.spt')
What do you think?
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security threats,
fraudulent activity, and more. Splunk takes this data and makes sense of it. IT
sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users
________________________________________________________
This email is from The James Hutton Institute (JHI), however the views
expressed by the sender are not necessarily the views of JHI and its
subsidiaries. This email and any attachments are confidential and are intended
solely for the use of the recipient(s) to whom they are addressed. If you
are not the intended recipient, you should not read, copy, disclose or rely on
any information contained in this email, and we would ask you to contact the
sender immediately and delete the email from your system. Although JHI has
taken reasonable precautions to ensure no viruses are present in this email,
neither the Institute nor the sender accepts any responsibility for any
viruses, and it is your responsibility to scan the email and any attachments.
The James Hutton Institute is a Scottish charitable company limited by
guarantee.
Registered in Edinburgh No. SC374831
Registered Office: The James Hutton Institute, Invergowrie Dundee DD2 5DA.
Charity No. SC041796
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users