Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Plugins & Atahualpa (http://forum.bytesforall.com/forumdisplay.php?f=16)
-   -   [Solved] Multiple mootools - not good! (http://forum.bytesforall.com/showthread.php?t=3007)

jack96161 Aug 17, 2009 02:40 AM

[Solved] Multiple mootools - not good!
 
In the Header configuration & styling section of this forum I described how to replace the default header image with a sliding door menu - http://forum.bytesforall.com/showthread.php?t=2837. That feature uses mootools, a nifty library with a host of useful features. There were problems with using mootools as well as jquery, which were solved by making sure that jquery is loaded prior to mootools, but with that taken care of, it all works.

Since then, I wanted to add a very elegant slide gallery, SuperSlider-Show (http://wordpress.org/extend/plugins/superslider-show/), which as it happens, also makes use of mootools. At first, the gallery refused to work no matter how I played with the options. After hours of cut and try, I noticed that mootools was being loaded by both my sliding door menu and SuperSlide-Show, so I removed the statement from the sliding door code, loaded the gallery page, and viola! Everything worked perfectly - the menu and the gallery. BUT, on every other page, the sliding door menu refused to slide. After more hours and gallons of coffee, I found a solution:

The SuperSlider-Show WP plugin has a configuration option to disable its loading mootools in case someone else has done so already - that got my sliding door menus working on all pages, but now the SuperSlider-Show gallery was broken again! What I did was go back to the Atahualpa Theme Options->Add HTML/CSS Inserts->HTML Inserts: Header, and replaced my old call to load mootools:
<script type="text/javascript" src="http://www.yourdomain.com/
wp-content/themes/atahualpa/imagemenu/mootools.js"></script>
with the code that the SuperSlider-Show plugin would have used had I not disabled it:
<script type='text/javascript' src='http://www.yourdomain.com/wp-content/plugins/superslider-show/js/mootools-1.2.3-core-yc.js?ver=1.2.3'></script>
<script type='text/javascript' src='http://www.yourdomain.com/wp-content/plugins/superslider-show/js/mootools-1.2.3.1-more.js?ver=1.2.3'></script>
Magic! It all works - sliding menus, gallery plugin, the works. Notice that newer and more complete mootools libraries are loaded this time, but the sliding menu doesn't seem to mind. I'll update my note on the sliding door menu feature to warn others of potential mootools conflicts.

I guess the lessons learned are: jquery has to load prior to mootools; two copies of mootools don't play well together; and some plugins using mootools need the complete set of libraries, not just the core.

Now, if we can just get the plugin authors to check for previously loaded tool libraries, see if they are usable for their code, and conditionally avoid multiple copies (and warn us if the previously loaded versions are insufficient), life would be much easier!

Jack
[If I ever get serious about writing a new plugin myself someday, those words may come back and bite me!]


All times are GMT -6. The time now is 04:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.