DLSupportJS

JavaScript framework using Prototype (http://www.prototypejs.org), Scriptaculous (http://script.aculo.us), and JS.Class (http://jsclass.jcoglan.com).

Summary
DLSupportJSJavaScript framework using Prototype (http://www.prototypejs.org), Scriptaculous (http://script.aculo.us), and JS.Class (http://jsclass.jcoglan.com).
AuthorDuc Tri Le <cmsmadesimple---at---email.tiger-inc.com>
LicenseThis class is released under the GNU General Public License.
Variables
UploadFileOptions(object) An object containing a uploaded file options.
Functions
HideLoadingImageHide the loading image if it is currently visible.
HideOverlayHide the overlay div if it is currently visible.
PageLoadingShow the loading image when this method is called and hide it when the body “onload” event is triggered.
ShowLoadingImageShow the loading image.
ShowOverlayCreate and show the overlay div if it is currently hidden.
UploadCompleteThis method is called after an upload has been completed.
UploadFileSubmit the provided form whose sole purpose is to upload files.

Author

Duc Tri Le <cmsmadesimple---at---email.tiger-inc.com>

License

This class is released under the GNU General Public License.

Variables

UploadFileOptions

(object) An object containing a uploaded file options.  Mainly used to hide the loading image once the file has been uploaded.

Functions

HideLoadingImage

HideLoadingImage: function()

Hide the loading image if it is currently visible.

Parameters

options(object) An object containing various options used in the execution of this method.  Refer to the method HideOverlay for more information on some of these options.  Defaults to an empty object.

The structure of the options parameter, if given, should look like the following:

Object (
    finish: {
        (function) The function that should be run after the overlay
        is hidden. Defaults to an empty function.
    },
    keep_overlay: {
        (boolean) Whether or not the overlay div should be kept
        visible. Defaults to false.
    },
    remove: {
        (boolean) Whether or not the overlay div should be removed
        from the DOM structure as well. Defaults to false.
    },

    duration: {
        (int) Refer to the "duration" attribute of the parameter
        "options" from the method HideOverlay.
    },
    remove_overlay: {
        (boolean) Refer to the "remove" attribute of the parameter
        "options" from the method HideOverlay.
    }
)

Returns

(boolean) Returns true if successful, false, otherwise.

HideOverlay

HideOverlay: function()

Hide the overlay div if it is currently visible.

Parameters

options(object) An object containing various options used in the execution of this method.  Defaults to an empty object.

The structure of the options parameter, if given, should look like the following:

Object (
    duration: {
        (int) The time, in seconds, of how long the effect should
        last. Defaults to 1.
    },
    finish: {
        (function) The function that should be run after the overlay
        is hidden. Defaults to an empty function.
    },
    remove: {
        (boolean) Whether or not the overlay div should be removed
        from the DOM structure as well. Defaults to false.
    }
)

Returns

(boolean) Returns true if successful, false, otherwise.

PageLoading

PageLoading: function()

Show the loading image when this method is called and hide it when the body “onload” event is triggered.

Parameters

options(object) An object containing various options used in the execution of this method.  Refer to the methods HideLoadingImage, HideOverlay, ShowOverlay, and ShowLoadingImage for more information on some of these attributes.  Defaults to an empty object.

The structure of the options parameter, if given, should look like the following:

Object (
    wait_time: {
        (int) The time, in seconds, to wait before the loading image
        is hidden. Defaults to 0.
    },

    color: {
        (string) Refer to the "color" attribute of the parameter
        "options" from the method ShowLoadingImage.
    },
    loading_finish: {
        (function) Refer to the "finish" attribute of the parameter
        "options" from the method ShowLoadingImage.
    },
    opacity: {
        (int) Refer to the "opacity" attribute of the parameter
        "options" from the method ShowOverlay.
    },
    overlay_color: {
        (string) Refer to the "color" attribute of the parameter
        "options" from the method ShowOverlay.
    },

    duration: {
        (int) Refer to the "duration" attribute of the parameter
        "options" from the method HideOverlay.
    },
    hiding_finish: {
        (function) Refer to the "finish" attribute of the parameter
        "options" from the method HideLoadingImage.
    },
    remove: {
        (boolean) Refer to the "remove" attribute of the parameter
        "options" from the method HideLoadingImage.
    }
    remove_overlay: {
        (boolean) Refer to the "remove" attribute of the parameter
        "options" from the method HideOverlay.
    }
)

Returns

(boolean) This method will always return true.

ShowLoadingImage

ShowLoadingImage: function()

Show the loading image.

Parameters

options(object) An object containing various options used in the execution of this method.  Refer to the method ShowOverlay for more information on some of the attributes.  Defaults to an empty object.

The structure of the options parameter, if given, should look like the following:

Object (
    color: {
        (string) The color of the loading image. The following are
        the supported values: "black", "blue", "brown", "gold",
        "gray", "green", "navy", "orange", "purple", "red", "white",
        and "yellow". Defaults to "red".
    },
    finish: {
        (function) The function that should be run after the loading
        image is showned. Defaults to an empty function.
    },

    duration: {
        (int) Refer to the "duration" attribute of the parameter
        "options" from the method ShowOverlay.
    },
    opacity: {
        (int) Refer to the "opacity" attribute of the parameter
        "options" from the method ShowOverlay.
    },
    overlay_color: {
        (string) Refer to the "color" attribute of the parameter
        "options" from the method ShowOverlay.
    }
)

Returns

(boolean) The method always returns true.

ShowOverlay

ShowOverlay: function()

Create and show the overlay div if it is currently hidden.

Parameters

options(object) An object containing various options used in the execution of this method.  Defaults to an empty object.

The structure of the options parameter, if given, should look like the following:

Object (
    color: {
        (string) The background color of the overlay. Defaults to
        "#FFFFFF".
    },
    duration: {
        (int) The time, in seconds, of how long the effect should
        last. Defaults to 1.
    },
    finish: {
        (function) The function that should be run after the overlay
        is showned. Defaults to an empty function.
    },
    opacity: {
        (int) The opacity percentage for the overlay. This value
        should be between 0 & 100. Defaults to 75.
    }
)

Returns

(boolean) The method will always return true.

UploadComplete

UploadComplete: function(data)

This method is called after an upload has been completed.

Parameters

data(string) JSON data sent by server.

UploadFile

UploadFile: function(form)

Submit the provided form whose sole purpose is to upload files.

Parameters

form(mixed) Either the ID of the form or the DOM element for the form itself that will be uploading the file.
options(object) An object containing various options used by this method.  Refer to the method HideLoadingImage, HideOverlay, ShowLoadingImage, and ShowOverlay for more information on some of the attributes.  Defaults to an empty object.

The structure of the options parameter, if given, should look like the following:

Object (
    finish: {
        (function) The function to run once the upload is complete.
        Defaults to an empty function.
    },
    hide_loading_image: {
        (boolean) Whether or not the function HideLoadingImage
        should be called. Defaults to true.
    }

    keep_overlay: {
        (boolean) Refer to the "keep_overlay" attribute of the
        parameter "options" from the method HideLoadingImage.
    },
    remove: {
        (boolean) Refer to the "remove" attribute of the parameter
        "options" from the method HideLoadingImage.
    },

    hiding_duration: {
        (int) Refer to the "duration" attribute of the parameter
        "options" from the method HideOverlay.
    },
    remove_overlay: {
        (boolean) Refer to the "remove" attribute of the parameter
        "options" from the method HideOverlay.
    },

    color: {
        (string) Refer to the "color" attribute of the parameter
        "options" from the method ShowLoadingImage.
    },

    loading_duration: {
        (int) Refer to the "duration" attribute of the parameter
        "options" from the method ShowOverlay.
    },
    opacity: {
        (int) Refer to the "opacity" attribute of the parameter
        "options" from the method ShowOverlay.
    },
    overlay_color: {
        (string) Refer to the "color" attribute of the parameter
        "options" from the method ShowOverlay.
    },
)

Returns

(boolean) This method will always return true.

HideLoadingImage: function()
Hide the loading image if it is currently visible.
HideOverlay: function()
Hide the overlay div if it is currently visible.
PageLoading: function()
Show the loading image when this method is called and hide it when the body “onload” event is triggered.
ShowLoadingImage: function()
Show the loading image.
ShowOverlay: function()
Create and show the overlay div if it is currently hidden.
UploadComplete: function(data)
This method is called after an upload has been completed.
UploadFile: function(form)
Submit the provided form whose sole purpose is to upload files.