I've found part of the answer.  It appears that the jmolApplet(size,  
script, n) treats n=0 as a special case.  If n = 0 it assigns its own  
number.  This is not consistent with the documentation.  It appears  
that in _jmolApplet(size, inlineModel, script, nameSuffix), the

if (! nameSuffix)
       nameSuffix = appletCount;
considers nameSuffix = 0 as True.  The following change appears to  
make it work properly:
if (nameSuffix == null)
       nameSuffix = appletCount;

Is there is something I'm overlooking?  If not, I suggest we change  
all tests for empty variables to this form in Jmol.js.

Jonathan

On Nov 13, 2009, at 5:09 PM, Jonathan Gutow wrote:

> I'm looking for some ideas here.
>
> I have been working on some additional javascript code that
> automatically limits the number of live jmol applets on a page to
> avoid memory problems.  Here's my problem:
>
> 1) In a simple page that loads once, repeated javascript calls that
> replace an applet with a picture and then put the applet back using
> jmolApplet(size, script, n) work fine.  The applet is repeatedly
> replaced with the appletID = 'jmolApplet'+n.
>
> 2) I'm trying to make this work for the SAGEmath people.  In that
> case, I get the odd behavior that each time I try to reload the applet
> with the jmolApplet(size, script, n) call the n seems to be ignored
> and the automatic numbering in Jmol.js takes over.  The pages are
> dynamic, but the Jmol div is defined by me through javascript.
>
> I could make a special version of Jmol.js, but I would like to have
> SAGEmath use as standard Jmol protocols as possible.  Any ideas, what
> could be causing the problem? Is it an odd javascript parsing
> problem?  The n does not seem to be ignored for the first placement of
> the applet.
>
> Thanks for your input.
>
> Jonathan
>                          Dr. Jonathan H. Gutow
> Chemistry Department                                 [email protected]
> UW-Oshkosh                                           Office: 
> 920-424-1326
> 800 Algoma Boulevard                                 FAX:920-424-2042
> Oshkosh, WI 54901
>                  http://www.uwosh.edu/facstaff/gutow
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008  
> 30-Day
> trial. Simplify your report design, integration and deployment - and  
> focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Jmol-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-developers

                          Dr. Jonathan H. Gutow
Chemistry Department                                 [email protected]
UW-Oshkosh                                           Office:920-424-1326
800 Algoma Boulevard                                 FAX:920-424-2042
Oshkosh, WI 54901
                  http://www.uwosh.edu/facstaff/gutow






------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to