On Mon, Nov 25, 2013 at 9:13 AM, Rolf Huehne <[email protected]> wrote:

>        Hi all,
>
> I am currently working on the migration of the 'Jena3D Viewer'
> (http://jena3d.fli-leibniz.de) from Jmol 11.6 to Jmol/JSmol 13.3 and got
> stuck in adapting 'JSmol.min.js'.
>
>
super!

First, look in the jsmol/js directory for the unminified version of
JSmol.min.js (JSmol.full.js) and do your debugging with that instead.
test2.htm is a good example of bypassing JSmol.min.js for testing purposes,
and it then allows modifying the individual components of JSmol.full.js.

You can use

System.out.println(......)

to output messages directly  to the "Jmol JavaScript console" if you want,
made visible with jmolAppletWhatever._showInfo(true)


The corresponding method in JSmol is (in this case)

Jmol._Applet.prototype._script

which is in JSmolApplet.js:

   Jmol._Applet.prototype._script = function(script) {
        if (!this._ready)
        return this._addScript(script);
        Jmol._setConsoleDiv(this._console);
        this._applet.script(script);
    }

(this._applet is the "real thing", corresponding to the Java or
Java-derived object)

You could modify  that by simply adding your own extension. Something like:


   Jmol._Applet.prototype._script = function(script) {
          if(script.indexOf("!") != 0)
                 script = "set echo waitmessage 0% 100%; echo \"Please
wait...\"; refresh;\n" + script + auto_zoom_script + "\n set echo
waitmessage off;";
        if (!this._ready)
        return this._addScript(script);
        Jmol._setConsoleDiv(this._console);
        this._applet.script(script);
    }


I added the check for an immediate scripts, but you probably don't need
that.
If I were you, I would  implement some sort of option that only adds this
to certain scripts, not all scripts. Maybe just load and isosurface
commands?

Bob




> ----------------------------------------------------------------------
>
> These modifications are intended to serve two purposes:
> 1) Show a "Please wait..." message within the applet window each time
> the 'jmolScript' function is called and hide it after the script is
> finished. This will be even more necessary with the still much slower
> JSmol.
> 2) Enable a simple 'auto zoom/center' option. If the 'auto zoom/center'
> option is activated the 'auto_zoom_script' variable is changed
> 'auto_zoom_script="zoomto 0.7 (selected) 0;";' and if you browse for
> example through the different hetero components or sites within the
> structure the view is automatically centered around this hetero
> component or site and zoomed for full visibility at maximum size.
>
> Unfortunately I couldn't identify the corresponding code within
> 'JSmol.min.js' to adapt it similarly. Any hints would be appreciated
> very much.
>
> Maybe a more generalized 'custom pre-/post-processing script' option
> could be added generally if there is enough interest by other Jmol
> users. The pre-processing script added at the beginning of each script
> within a 'Jmol.script' call and the post-processing script added at the
> end should be reconfigurable at any time.
> What do you think about this?
>
> Regards,
> Rolf
> --
>
> Rolf Huehne
> Postdoc
>
> Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
> Beutenbergstrasse 11
> 07745 Jena, Germany
>
> Phone:   +49 3641 65 6205
> Fax:     +49 3641 65 6210
> E-Mail:  [email protected]
> Website: http://www.fli-leibniz.de
>
>            Scientific Director: Prof. Dr. K. Lenhard Rudolph
>         Head of Administration: Dr. Daniele Barthel
> Chairman of Board of Trustees: Dennys Klein
>
> VAT No: DE 153 925 464
> Register of Associations: No. 230296, Amtsgericht Jena
> Tax Number: 162/141/08228
>
>
>
> ------------------------------------------------------------------------------
> Shape the Mobile Experience: Free Subscription
> Software experts and developers: Be at the forefront of tech innovation.
> Intel(R) Software Adrenaline delivers strategic insight and game-changing
> conversations that shape the rapidly evolving mobile landscape. Sign up
> now.
> http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>



-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


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
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to