Hi,

It's nice to see some response. :) But first things first.

> Jmol.js includes not just functions for building Jmol applets, but also
> buttons, checkboxes, etc. linked up to a Jmol applet on the page. Perhaps
> the plugin could implement these functions in some way, as in...
>
> $('#jmolButton').jmolButton();

This is also one of the things that I'm actually trying to avoid. Let
me show you an example. Let's say you have a HTML code that looks like
that:

<p>This is some description about what is going to happen when you
click <a href="/some_molecule.pdb" id="magic">here</a>.</p>

So you add to your javascript file somewere in jQuery's
$(document).ready() part a line:

$('#magic').click(function(e){
  e.preventDefault(); // disable default click action
  $('#my-jmol-viewer').jmol('load ' + $(this).attr('href')); // or any
other command
});

See what I've done here? First time you call my jmol plugin on some
placeholder <div>, it gets replaced with a Jmol applet object. Next
time you can send direct script messages to it. Also if there is no
JavaScript a client can download pdb file directly, and we don't
interrupt his user experience on the web.

Now even more magic:

$(document).ready(function(){
  // Initialize Jmol with jMol when document has loaded
  $('#my-jmol').jmol({
    // Some settings
    onLoad : function(url){
      // when the molecule has been loaded, we set the page on fire
      $('#magic').parent().html('Tadaaa!');
    }
  });
  $('#magic').click(function(e){
    e.preventDefault(); // disable default click action
    $('#my-jmol-viewer').jmol('load /some_molecule.pdb'); // or any
other command
  });
});

> I would also be interested in setting Jmol parameters thusly:
>
> $('#Jmolapplet').jmol({ parameter: 'bondmodeor', value: true });
>
> In my fork, I've added a parameters object to _defaults that contains all
> the Jmol parameters as of 12.2.10; you might find that a useful reference. I
> also added a simple bit of code to _proc that allows one to set Jmol
> parameters using the above syntax.
>
> https://github.com/mevans86/jMol

Oh, nice, this should be sorted out a bit, but it's nice to see. I'll
look more into that tomorrow.

-- 
Gusts Kaksis
Web Developer

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to