Ah, here's a twist. Who can figure out what THIS does? (Answer below.)
function newAppletWindow() {
jmolSetDocument(0)
var script = ';script "javascript:getState()"'
var html = '<html><title>Jmol Popup Model</title><body>'
+'<head><script type="text/javascript">'
+'_jmol = new Array();'
+'function refreshModelX(){'
+' document.getElementById("jmolAppletX").script(getState())'
+'}'
+'function getState(){'
+' return opener.jmolGetPropertyAsString("stateInfo")+";zoomLarge =
false"'
+'}'
+'</script>'
+'<body><h3><a href="javascript:refreshModelX()">refresh model</a>'
+' <a href="javascript:alert(\'Click on "refresh model" at
any time to see the model in its current state in this window. You may
refresh the model as often as desired, and you may resize this model as
often as you like.\')">note</a></h3>'
+jmolApplet(["100%","90%"],script,"X").replace(/allback/g,"allbackDISABLED")
+'</body></html>'
dowritenew(html)
}
ANSWER: the opening script for the applet reads:
script "javascript:getState()"
This tells Jmol to RUN the JavaScript getState() method in order and get
the return from that as the script to run. That's the same function used
by the "refresh model" link.
Does it work? See for yourself at:
http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11/new.htm
Bob Hanson wrote:
> Nick Greeves wrote:
>
>> Hi Bob,
>> I see you are making progress with this new resizable window and
>> have introduced explanatory text in the applet window. (and the
>> debug code has gone;-) )
>> You may already be planning this, but it would be nice if the model
>> loaded up after showing this text without having to click refresh.
>>
> I'm just worried that this possibly VERY long JavaScript string would
> get mangled in the JS --> HTML --> JS. Single/double quotes for example.
>
> OH, oh, wait! I've got it.....
>
>
>> I'm pleased to see that an animation in progress is also transferred
>> in progress and keeps going. (I was using 14. 'file' command) Works
>> in Safari and Firefox.
>>
> Now THAT's interesting.
>
>> All the best
>> Nick
>
>
>
>
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users