Jasinski Technical Wiki

Navigation

Home Page
Index
All Pages

Quick Search
»
Advanced Search »

Contributor Links

Create a new Page
Administration
File Management
Login/Logout
Your Profile

Other Wiki Sections

Software

PoweredBy

Page History: Extensions - jQuery

Compare Page Revisions



« Older Revision - Back to Page History - Newer Revision »


Page Revision: Thu, Sep 22, 2011, 11:41 AM


/*===============================================================================================*/
(function ($) {
    /*-------------------------------------------------------------------------------------------*/
    $.fn.showExt = function (show, fade) {

        if (fade == undefined) fade = false;

        if (show) {
            if (fade) this.fadeIn(); else this.show();
        }
        else {
            if (fade) this.fadeOut(); else this.hide();
        }
        return this;
    }
    /*-------------------------------------------------------------------------------------------*/
    $.fn.enable = function (enabled) {

        if (enabled)
            this.removeAttr('disabled');
        else
            this.attr('disabled', 'disabled');

        return this;
    }
    /*-------------------------------------------------------------------------------------------*/
    $.fn.lockEdit = function (readOnly) {

        if (readOnly)
            this.removeAttr('readonly');
        else
            this.attr('readonly', 'readonly');

        return this;
    }
    /*-------------------------------------------------------------------------------------------*/
    $.fn.setChecked = function (checked) {

        if (checked)
            this.attr('checked', 'checked');
        else
            this.removeAttr('checked');

        return this;
    }
    /*-------------------------------------------------------------------------------------------*/
    $.fn.validateInt = function (errorClassName) {

        var input = $(this).val();
        if ((input - 0) == input && Math.ceil(input) == Math.floor(input)) {
            $(this).removeClass(errorClassName);
            return true;
        }
        else {
            $(this).addClass(errorClassName);
            return false;
        }
    }
    /*-------------------------------------------------------------------------------------------*/
})(jQuery);
/*===============================================================================================*/

ScrewTurn Wiki version 3.0.1.400. Some of the icons created by FamFamFam. Except where noted, all contents Copyright © 1999-2024, Patrick Jasinski.