diff --git a/tests/visual/dep_loader.html b/tests/visual/dep_loader.html new file mode 100644 index 000000000..891188e30 --- /dev/null +++ b/tests/visual/dep_loader.html @@ -0,0 +1,26 @@ + + + + + Dependency loading + + + + + + + + +
+ + + \ No newline at end of file diff --git a/ui/ui.core.js b/ui/ui.core.js index 877b0d023..41486529f 100644 --- a/ui/ui.core.js +++ b/ui/ui.core.js @@ -9,6 +9,31 @@ */ ;(function($) { + +/** Lazy loading stub functions **/ +var uiPath; +$("script").each(function() { + if((/ui/i).test(this.src)) { + var splitted = this.src.split('/'); splitted.pop(); + uiPath = splitted.join('/') + ( splitted.join('/') == '' ? '' : '/' ); + } +}); + +$.each( ("accordion,colorpicker,datepicker,dialog,draggable,droppable,magnifier,progressbar," + + "resizable,selectable,slider,sortable,spinner,tabs").split(","), function(i, name){ + + // Handle event binding + $.fn[name] = function(){ + + var selector = this, args = arguments; + $.getScript(uiPath+'ui.'+name+'.js', function() { + selector[name].apply(selector, args); + }); + + }; +}); + + /** jQuery core modifications and additions **/ var _remove = $.fn.remove;