Hi, that's what scriptaculous.js does:

it makes sure that prototype.js >= 1.5.0 is present then loads builder.js, effects.js, dragdrop.js, controls.js, and slider.js (a total of probably 150Kb of uncompressed javascript code)

what I propose instead is to load only what's needed by a given widget and remove the scriptaculous.js script alltogether, since the functionality of loading resources is implemented in NXThemesJsf already, with the possibility to load all scripts at once (merged in one single file) and in a gzip-compressed format when supported by the client.

so if you need drag-and-drop, simply require dragdrop.js in the widget definition (interdependencies between the modules can be declared too to simplify registrations) if you need effects.js require effects.js, etc..

any comment on this?

= scriptaculous.js ==================
var Scriptaculous = {
 Version: '1.6.5',
 require: function(libraryName) {
   // inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
 },
 load: function() {
   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"); $A(document.getElementsByTagName("script")).findAll( function(s) {
     return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
   }).each( function(s) {
     var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
     var includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
      function(include) { Scriptaculous.require(path+include+'.js') });
   });
 }
}

Scriptaculous.load();
===================

_______________________________________________
ECM mailing list
[email protected]
http://lists.nuxeo.com/mailman/listinfo/ecm

Reply via email to