jQuery.LateLoader

Sample

Download

Download (Minified)

Copyright (c) 2009 Erik Zaadi
 

Late loading of javascripts and css files

Dual licensed under the MIT and GPL licenses: http://www.opensource.org/licenses/mit-license.php http://www.gnu.org/licenses/gpl.html

Usage


$.LateLoader = 
    {
        LoadScriptOrCSS: 
        /*
        Loads a javascript/css from the passed url if it wasn't previously loaded
         
        The parameter can either be a string with the wanted url( then the default
        params are used (See Defaults for more details)), or an option object 
        URL -> relative or absolute URL to your javascript/css 
        */
        IsScriptOrCSSLoaded:
        /*
        Returns true|false if a javascript/css is already loaded (via LoadScriptOrCSS)
        
        Parameters : 
        URL-> relative or absolute URL to your javascript/css 
        Type->'js' or 'css' (defaults to 'js')
        */
        GetLoadedScriptOrCSSs: 
        /*
        Returns an array of all loaded scripts (object with 2 arrays, css and js)
        */
        GetLoadedScriptOrCSSsByType:
        /*
        Returns an array of all loaded scripts/css according to the passed type
        
        Parameter : 
        Type->'js' or 'css' 
        */
        PluginDefaults:
        {
            ArrayDataKey: "LateLoaderDataKey", //Unique key used to identify the jQuery Data collection
            ElementToAttachDataTo: "body", //DOM object that hosts the jQuery Data collection
            RemoteTimeout: 1500 //MS of timeout to wait for a remote script..
        },
        Defaults:
            {
                URL: null, //Will be filled in by LoadScriptOrCSS's parameter
                Type: 'js', // 'js' or 'css' (defaults to 'js')
                LoadedCallBackFunction: null, // Called when the javascript/css is loaded (default is null)
                ErrorCallBackFunction: null // Called when an error occurs (default is null)
            }
    }
		
 
 
Change jQuery UI Theme
 
 
 
Blog
RSS
Twitter
 
Blog
RSS