Really good to investigate this.
OK, there are two issues: jQuery and j2s. A list of needed global variables
is given in JSmolCore.js:
Jmol._clearVars = function() {
// only on page closing -- appears to improve garbage collection
delete jQuery;
delete $;
delete Jmol;
if (!java)return;
delete J;
delete JZ;
delete java;
delete Clazz;
delete JavaObject;
delete bhtest;
delete xxxbhparams;
delete xxxShowParams;
delete c$;
delete d$;
delete w$;
delete $_A;
delete $_AB;
delete $_AC;
delete $_AD;
delete $_AF;
delete $_AI;
delete $_AL;
delete $_AS;
delete $_Ab;
delete $_B;
delete $_C;
delete $_D;
delete $_E;
delete $_F;
delete $_G;
delete $_H;
delete $_I;
delete $_J;
delete $_K;
delete $_L;
delete $_M;
delete $_N;
delete $_O;
delete $_P;
delete $_Q;
delete $_R;
delete $_S;
delete $_T;
delete $_U;
delete $_V;
delete $_W;
delete $_X;
delete $_Y;
delete $_Z;
delete $_k;
delete $_s;
delete $t$;
}
Now, any one of those could be a conflict. The thing to do is to open a
page that does not utilize JSmol, open a developer console, and check for
defined variables. In Firefox Firebug what you do is to type a letter like
"$" or "J" and see what is defined. Then, you could do a full replacement
in all the files in JSmol of that variable for another name. If it's "J",
that could be a problem, of course.
And we could modify JSmol itself if there is a difficulty. Let's get this
working in these tools.
Bob
On Thu, Apr 4, 2013 at 9:20 AM, Geoffrey Rowland <rowland.ge...@gmail.com>wrote:
> Hi folks
>
> I'm attempting to update the Jmol filter for Moodle and Jmol plugin for
> Mahara to use JSmol. Things are *almost* working, but I'm getting some
> clashes with the built-in JavaScript libraries (YUI for Moodle, MochiKit
> and jQuery for Mahara) particularly when in page edit mode for either CMS.
> Presumably due to issues with the $ variable/function being used by more
> than one JavaScript library, similar to those between JSmol and Prototype
> already discussed in these forums
>
> http://www.mail-archive.com/jmol-users@lists.sourceforge.net/msg20021.html
>
> For Mahara, in edit mode, I have reasonable workarounds by either not
> loading JSmol.min.js at all (displaying a rectangular div in place of
> JSmol) or loading JSmol.min.nojq.js instead. The second option works well
> (can even drag-and-drop spinning molecules around the page!) though a right
> mouse click on JSmol does not display the menu. Instead, a TypeError:
> $(...) is null popup is displayed (on the first right click). My
> understanding is the the Mahara jQuery uses $j rather than $ which is used
> by the built-in MochiKit
>
> https://mahara.org/interaction/forum/topic.php?id=2515
> https://mahara.org/interaction/forum/topic.php?id=3500
>
> For Moodle (2.4.3), the problems are more substantial as adding the JSmol
> libraries (JSmol.min.js or JSmol.min.nojq.js) interferes with display mode
> (some Moodle YUI controls no longer work) as well as edit mode. I'm
> guessing YUI uses $ too. The next version of Moodle 2.5 should have jQuery
> libraries alongside YUI, though I have not yet tried this, and don't know
> if it will help or hinder.
>
> http://docs.moodle.org/dev/jQuery
>
> Any suggestions as to the best way forward with this? Suspect similar
> issues will be encountered trying to integrate JSmol with other systems.
> Will using an iframe to contain a JSmol instance work?, or are there
> alternatives? As you can guess, I'm pretty new to this JavaScript stuff!
>
> Thanks
>
> Geoff
>
>
>
>
> ------------------------------------------------------------------------------
> Minimize network downtime and maximize team effectiveness.
> Reduce network management and security costs.Learn how to hire
> the most talented Cisco Certified professionals. Visit the
> Employer Resources Portal
> http://www.cisco.com/web/learning/employer_resources/index.html
> _______________________________________________
> Jmol-developers mailing list
> Jmol-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
>
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Chemistry Department
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
------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire
the most talented Cisco Certified professionals. Visit the
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers