Peter,
I tried your solution ... and it doesn't work ...
I tried to modify it:
var Modules = {
require: function(libraryName) {
document.write('<script type="text/javascript"
src="'+libraryName+'"></script>');
},
reload: function() {
var scriptTags = document.getElementsByTagName("SCRIPT");
var scriptaculous, modules = false;
if((typeof Prototype=='undefined') ||
(typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') ||
parseFloat(Prototype.Version.split(".")[0] + "." +
Prototype.Version.split(".")[1]) < 1.5)
throw("script.aculo.us requires the Prototype JavaScript
framework >= 1.5.0");
for(var i=0;i<scriptTags.length;i++) {
if(scriptTags[i].src &&
(scriptTags[i].src.match(/modules\.js(\?.*)?$/)
||
scriptTags[i].src.match(/scriptaculous\.js(\?.*)?$/))) {
if
(scriptTags[i].src.match(/modules\.js(\?.*)?$/)) {
var path1 =
scriptTags[i].src.replace(/modules\.js(\?.*)?$/,'');
}
if
(scriptTags[i].src.match(/scriptaculous\.js(\?.*)?$/)) {
var path2 =
scriptTags[i].src.replace(/scriptaculous\.js(\?.*)?$/,'');
}
if (path1 && !modules) {
('clist,faq,permissions,persons,previews,services').split(',').each(
function(include) {
Modules.require(path1+include+'.js');
});
modules = !modules;
}
if (path2 && !scriptaculous) {
('builder,effects,dragdrop,controls,slider').split(',').each(
function(include) {
Modules.require(path2+include+'.js')
});
scriptaculous = !scriptaculous;
}
}
}
}
}
Modules.reload();
I commented the 'Scriptaculous.load();' in the scriptaculous.js file to
avoid a pre-loading of the scriptaculous libraries.
My code doesn't permitt to load independently custom libraries, you
have to write the appropriate code in the reload method ...
Thanks for your ideas.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---