Google Groups Home
Help | Sign in
Dynamic Software causing many script loads, how would one handle this?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
Lee O  
View profile
 More options May 11, 6:58 pm
From: "Lee O" <lee...@gmail.com>
Date: Sun, 11 May 2008 15:58:53 -0700
Local: Sun, May 11 2008 6:58 pm
Subject: Dynamic Software causing many script loads, how would one handle this?

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 to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ryura  
View profile
 More options May 11, 10:14 pm
From: Ryura <yoyobo...@gmail.com>
Date: Sun, 11 May 2008 19:14:05 -0700 (PDT)
Local: Sun, May 11 2008 10:14 pm
Subject: Re: Dynamic Software causing many script loads, how would one handle this?
You *could* have a PHP that you call with $.getScript that'll use the
GET variables to spit out specific javascript depending on the
plugins, but that's a pretty lame way of doing things.

On May 11, 6:58 pm, "Lee O" <lee...@gmail.com> wrote:


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carl Von Stetten  
View profile
 More options May 12, 7:32 pm
From: Carl Von Stetten <vonner.li...@vonner.net>
Date: Mon, 12 May 2008 16:32:29 -0700
Local: Mon, May 12 2008 7:32 pm
Subject: Re: [jQuery] Dynamic Software causing many script loads, how would one handle this?
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


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2008 Google