Ah, ok. Now I've looked at JmolColorPicker.js. Yes, some changes need to be
made there for consistency:

1) All functions should start with "jmol" -- uncapitalized -- if they are
intended for user use and "_jmol" if not. That's important because they need
to not interfere with anything else that the user might be using on the
page. If we did this "right" we would have all these be functions that are
properties of the _jmol object, but we aren't quite there yet.

2) In Jmol.js, all functions that require an applet ID are preceded with
jmolSetTarget() when they are used within the page, and they always invoke
the target using _jmol.targetText. But I see you have a different way of
doing it, because you are not storing the scripts the way the other _jmol...
functions do. You are invoking jmolScript directly. That's fine, but I think
you still should be using jmolSetTarget(), just like all the other user
methods. So then you would do the following instead of having the appletID
as a parameter:

function jmolColorPickerBox(scriptStr, startColor, boxID){   // notice the
lower case there
    var appletID = _jmol.targetSuffix;
...
}

function jmol_animationmode(selected, n){


should be (in my opinion):

function _jmolAnimationMode(selected, targetSuffix){

if you intend this to be something the HTML widgets are calling.


For

function jmol_spin (state, n) {
    if(state == true){
        result = jmolScriptWait("spin on", n);
        }else {
        result = jmolScriptWait("spin off", n);
        }
    }


I would prefer:

function _jmolSpin (state, targetSuffix) {
   jmolScript("spin " + (state ? "on" : "off"), targetSuffix);
}

Was there a reason there for scriptWait? If so, then:

   jmolScriptWait("spin " + (state ? "on" : "off"), targetSuffix);

Bob


On Mon, Jul 5, 2010 at 9:42 AM, Jonathan Gutow <[email protected]> wrote:

> While working on jmolColorPicker and the widgets in WebExport, I've
> realized that the behavior of our javascript utility functions is
> inconsistent.  Some of them take and appletID and some of them need the
> appletID set before they are called using another function.  I would like to
> propose that we extend the functions that don't accept appletIDs to accept
> appletIDs if they are provided.
>
> I don't think there is a problem with this as the jmolColorPicker function
> does this and works a lot like jmolButton, etc...
>
> Anybody see a problem?  Anybody want to help me work on this?
>
> 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
>
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jmol-developers mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>



-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to