User:Ultimate Dark Carnage/jQueryXT.js

(function($){   $.fn.toggleClick = function(callback1, callback2){        var toggleState = 0;        if (toggleState === 0){            $(this).click(function{ callback1.call(this); });           toggleState = 1;        }        else if (toggleState == 1){            $(this).click(function{ callback2.call(this); });           toggleState = 0;        }        return this;    };    $.fn.active = function(callback1, callback2){        $(this).mousedown(function{ callback1.call(this); });       $(this).mouseup(function{ callback2.call(this); });       return this;    };    $.math = {        log: function(n, base){            var l = Math.log(n) / Math.log(base);            return l;        },        abs: function(n){            if (n < 0){                n = n / -1;            }            return n;        },        factorial: (function{ var f = function(n){ if (n < 1) {return 1;} // no real error checking, could add type-check return (f[n] > 0) ? f[n] : f[n] = n * f(n -1); };           for (i = 0; i < 101; i++) {f(i);} // precalculate some values return f;       }),    };    $.date = {        hours: function{            var d = new Date;            var h = d.getHours;            return h;        },        minutes: function{            var d = new Date;            var m = d.getMinutes;            return m;        },        seconds: function{            var d = new Date;            var s = d.getSeconds;            return s;        }    }; })(jQuery);