Lazy loading of scriptaculous

Hi *, both scriptaculous and prototype are quite big, and I don’t use
all the goodness inside there, including :defaults is a bit too much
for me.
Someone knows of a way to dynamically load what’s effectively used
inside a side ?
It would be a great feature …

ngw


Nicholas W.
[email protected]

Do you mean load dynamically on the client side?

If so, can’t say i’ve heard any tricks to achieving this, what you
could do is compress the files, this will help reduce the size. Also
I was under the impression that by default most browsers cache
javascript so I guess you could see it as just the one download. But i
could be wrong. Hope this helps

Also if you choose a different javascript library consider moo tools
which allows you to choose only options you want.

I came across this a while ago, I was already loading javascript details
and
then
added mapping code as well. I was using Virtual Earth maps as Google
Maps
are crap for
Ireland.

In order to only have one layout file but still only load the mapping
code
on the pages where
I need it, I added an <%= @mapcode -%> to the layout.

Then in my controller I can only set the @mapcode when I want it set.

@mapcode = get_mapcode

private

def get_mapcode

code = " <script src="
http://dev.virtualearth.net/mapcontrol/v4/mapcontrol.js\“></script>”

end

Not quite what you are looking for but it does the trick for me.

Keith