Lee,

Do the various plugins at least use the same jQuery version?  If so, can 
you modify the plugin-specific JS file to load the required jQuery 
scripts only if they haven't already been loaded?  You will at least 
need to make sure that the jQuery.js (or jQuery.min.js or 
jQuery.pack.js) is loaded by the CMS main page.  Then you might try 
something like this (this example specifically checks to see if jqModal 
and tablesorter are loaded):

$.ajaxSetup({async:false}); // temporarily make ajax synchronous so your 
script
                            // doesn't start executing code before 
required scripts
                            // are loaded.
if(!$.jqm){ // test to see if the jqModal jqm()
            // function doesn't exist yet
    $.getScript("relative path/jqModal.min.js");
}
if(!$.tablesorter){ // test to see if the tablesorter()
                    // function doesn't exist yet
    $.getScript("relative path/jquery.tablesorter.min.js");
}
$.ajaxSetup({async:true)};  // restore ajax to asynchrounous mode



Lee O wrote:
> I have an application that has many plugins, all of which have jquery 
> scripts. Now, i imagine there are ways to program an javascript 
> aggregator of some sort, but i imagine this is a very common problem 
> with plugin based web-apps, so i was curious if jquery had any ways to 
> handle this.
>
> To reiterate with an example: If you have a CMS that is plugin based, 
> with 20 plugins, and each plugin has its own js file to run its own, 
> plugin specific, jquery code from. You cannot(/and should not have 
> to/) manually combine them together (ignoring the aggregator aspect 
> for now), so are there any other options? Having 20+ <script> calls on 
> one page is a bit overkill heh..
>
> Any thoughts on this subject?
>
> Thanks,
> -- 
> Lee Olayvar
> http://www.leeolayvar.com 

Reply via email to