Assembla home | Assembla project page
 

Changeset 61

Show
Ignore:
Timestamp:
06/12/07 16:54:59 (1 year ago)
Author:
digitalspaghetti
Message:

Including latest jQuery build + Latest Jamal (currently not compatible, trying to work with author to fix)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branch/config/core.php

    r55 r61  
    5555 * In development mode, you need to click the flash message to continue. 
    5656 */ 
    57         define('DEBUG', 2); 
     57        define('DEBUG', 0); 
    5858/** 
    5959 * Turn off or enable cache checking application-wide. 
  • branch/views/elements/js_include.ctp

    r58 r61  
    11<?php e($javascript->link('jquery'));?> 
     2<?php //e($javascript->link('jamal'));?> 
    23<?php e($javascript->link('wymeditor/jquery.wymeditor'));?> 
    34<?php e($javascript->link('wymeditor/plugins/tidy/jquery.wymeditor.tidy'));?> 
  • branch/webroot/js/jquery.js

    r57 r61  
    22if(typeof window.jQuery == "undefined") { 
    33/* 
    4  * jQuery 1.1.3a - New Wave Javascript 
     4 * jQuery @VERSION - New Wave Javascript 
    55 * 
    66 * Copyright (c) 2007 John Resig (jquery.com) 
     
    88 * and GPL (GPL-LICENSE.txt) licenses. 
    99 * 
    10  * $Date: 2007-05-21 00:49:26 +0000 (Mon, 21 May 2007) $ 
    11  * $Rev: 1938
     10 * $Date: 2007-05-23 13:48:15 +0100 (Wed, 23 May 2007) $ 
     11 * $Rev: 1961
    1212 */ 
    1313 
     
    179179                        // HANDLE: $(arraylike) 
    180180                        // Watch for when an array-like object is passed as the selector 
    181                         (a.jquery || a.length && a != window && (!a.nodeType || (jQuery.browser.msie && a.elements)) && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) || 
     181                        (a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) || 
    182182 
    183183                        // HANDLE: $(*) 
     
    194194         * @cat Core 
    195195         */ 
    196         jquery: "1.1.3a", 
     196        jquery: "@VERSION", 
    197197 
    198198        /** 
     
    14871487                                arg = arg.toString(); 
    14881488                         
    1489                         // Convert html string into DOM nodes 
     1489                        // Convert html string into DOM nodes 
    14901490                        if ( typeof arg == "string" ) { 
    14911491                                // Trim whitespace, otherwise indexOf won't work as expected 
     
    14931493 
    14941494                                var wrap = 
    1495                                         // option or optgroup 
     1495                                        // option or optgroup 
    14961496                                        !s.indexOf("<opt") && 
    14971497                                        [1, "<select>", "</select>"] || 
     
    16471647 
    16481648        /** 
    1649          * Merge two arrays together, removing all duplicates. 
    1650          * 
    1651          * The result is the altered first argument with 
    1652          * the unique elements from the second array added. 
     1649         * Merge two arrays together by concatenating them. 
    16531650         * 
    16541651         * @example $.merge( [0,1,2], [2,3,4] ) 
    1655          * @result [0,1,2,3,4] 
    1656          * @desc Merges two arrays, removing the duplicate 2 
    1657          * 
    1658          * @example var array = [3,2,1]; 
    1659          * $.merge( array, [4,3,2] ) 
    1660          * @result array == [3,2,1,4] 
    1661          * @desc Merges two arrays, removing the duplicates 3 and 2 
     1652         * @result [0,1,2,2,3,4] 
     1653         * @desc Merges two arrays. 
    16621654         * 
    16631655         * @name $.merge 
    16641656         * @type Array 
    1665          * @param Array first The first array to merge, the unique elements of second added. 
    1666          * @param Array second The second array to merge into the first, unaltered. 
     1657         * @param Array first The first array to merge, the elements of second are added. 
     1658         * @param Array second The second array to append to the first, unaltered. 
    16671659         * @cat JavaScript 
    16681660         */ 
     
    16751667        }, 
    16761668 
     1669        /** 
     1670         * Reduce an array (of jQuery objects only) to its unique elements. 
     1671         * 
     1672         * @example $.unique( [x1, x2, x3, x2, x3] ) 
     1673         * @result [x1, x2, x3] 
     1674         * @desc Reduces the arrays of jQuery objects to unique elements by removing the duplicates of x2 and x3 
     1675         * 
     1676         * @name $.unique 
     1677         * @type Array 
     1678         * @param Array array The array to reduce to its unique jQuery objects. 
     1679         * @cat JavaScript 
     1680         */ 
    16771681        unique: function(first) { 
    16781682                var r = [], num = jQuery.mergeNum++; 
     
    17691773                        fn = new Function("a","return " + fn); 
    17701774 
    1771                 var result = [], r = []
     1775                var result = []
    17721776 
    17731777                // Go through the array, translating each of the items to their 
     
    27792783                        element = window; 
    27802784                 
     2785                // Make sure that the function being executed has a unique ID 
     2786                if ( !handler.guid ) 
     2787                        handler.guid = this.guid++; 
     2788                         
    27812789                // if data is passed, bind to handler  
    27822790                if( data != undefined ) {  
     
    27952803                        // Set the guid of unique handler to the same of original handler, so it can be removed  
    27962804                        handler.guid = fn.guid; 
    2797                 } 
    2798  
    2799                 // Make sure that the function being executed has a unique ID 
    2800                 if ( !handler.guid ) { 
    2801                         handler.guid = this.guid++; 
    2802                         // Don't forget to set guid for the original handler function 
    2803                         if (fn) fn.guid = handler.guid; 
    28042805                } 
    28052806 
     
    28102811                if (!element.$handle) 
    28112812                        element.$handle = function() { 
    2812                                 jQuery.event.handle.apply(element, arguments); 
     2813                                // returned undefined or false 
     2814                                var val; 
     2815 
     2816                                // Handle the second event of a trigger and when 
     2817                                // an event is called after a page has unloaded 
     2818                                if ( typeof jQuery == "undefined" || jQuery.event.triggered ) 
     2819                                  return val; 
     2820                                 
     2821                                val = jQuery.event.handle.apply(element, arguments); 
     2822                                 
     2823                                return val; 
    28132824                        }; 
    28142825 
     
    28332844                if (!this.global[type]) 
    28342845                        this.global[type] = []; 
    2835                 this.global[type].push( element ); 
     2846                // Only add the element to the global list once 
     2847                if (jQuery.inArray(element, this.global[type]) == -1) 
     2848                        this.global[type].push( element ); 
    28362849        }, 
    28372850 
     
    28412854        // Detach an event or set of events from an element 
    28422855        remove: function(element, type, handler) { 
    2843                 var events = element.$events, ret
     2856                var events = element.$events, ret, index
    28442857 
    28452858                if ( events ) { 
     
    28732886                                        ret = null; 
    28742887                                        delete events[type]; 
     2888                                         
     2889                                        // Remove element from the global event type cache 
     2890                                        while ( this.global[type] && ( (index = jQuery.inArray(element, this.global[type])) >= 0 ) ) 
     2891                                                delete this.global[type][index]; 
    28752892                                } 
    28762893                        } 
     
    29012918 
    29022919                        // Trigger the event 
    2903                         if ( (val = this.handle.apply( element, data )) !== false ) 
     2920                        if ( (val = element.$handle.apply( element, data )) !== false ) 
    29042921                                this.triggered = true; 
    29052922 
     
    29142931                // returned undefined or false 
    29152932                var val; 
    2916                  
    2917                 // Handle the second event of a trigger and when 
    2918                 // an event is called after a page has unloaded 
    2919                 if ( typeof jQuery == "undefined" || jQuery.event.triggered ) 
    2920                   return val; 
    29212933 
    29222934                // Empty object is for triggered events with no data 
     
    29482960 
    29492961        fix: function(event) { 
     2962                // store a copy of the original event object  
     2963                // and clone to set read-only properties 
     2964                var originalEvent = event; 
     2965                event = jQuery.extend({}, originalEvent); 
     2966                 
     2967                // add preventDefault and stopPropagation since  
     2968                // they will not work on the clone 
     2969                event.preventDefault = function() { 
     2970                        // if preventDefault exists run it on the original event 
     2971                        if (originalEvent.preventDefault) 
     2972                                return originalEvent.preventDefault(); 
     2973                        // otherwise set the returnValue property of the original event to false (IE) 
     2974                        originalEvent.returnValue = false; 
     2975                }; 
     2976                event.stopPropagation = function() { 
     2977                        // if stopPropagation exists run it on the original event 
     2978                        if (originalEvent.stopPropagation) 
     2979                                return originalEvent.stopPropagation(); 
     2980                        // otherwise set the cancelBubble property of the original event to true (IE) 
     2981                        originalEvent.cancelBubble = true; 
     2982                }; 
     2983                 
    29502984                // Fix target property, if necessary 
    29512985                if ( !event.target && event.srcElement ) 
    29522986                        event.target = event.srcElement; 
     2987                                 
     2988                // check if target is a textnode (safari) 
     2989                if (jQuery.browser.safari && event.target.nodeType == 3) 
     2990                        event.target = originalEvent.target.parentNode; 
    29532991 
    29542992                // Add relatedTarget, if necessary 
    29552993                if ( !event.relatedTarget && event.fromElement ) 
    29562994                        event.relatedTarget = event.fromElement == event.target ? event.toElement : event.fromElement; 
    2957  
    2958                 // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) 
    2959                 if ( event.metaKey == null && event.ctrlKey != null ) 
    2960                         event.metaKey = event.ctrlKey; 
    2961  
    2962                 // Add which for click: 1 == left; 2 == middle; 3 == right 
    2963                 // Note: button is not normalized, so don't use it 
    2964                 if ( event.which == null && event.button != null ) 
    2965                         event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); 
    29662995 
    29672996                // Calculate pageX/Y if missing and clientX/Y available 
     
    29713000                        event.pageY = event.clientY + e.scrollTop; 
    29723001                } 
    2973  
    2974                 // Add which for keypresses: keyCode 
    2975                 if ( (event.which == null || event.type == "keypress") && event.keyCode != null ) 
    2976                         event.which = event.keyCode;     
    2977  
    2978                 // If it's a keypress event, add charCode to IE 
    2979                 if ( event.charCode == null && event.type == "keypress" ) 
    2980                         event.charCode = event.keyCode; 
    2981                                  
    2982                 // check if target is a textnode (safari) 
    2983                 if (jQuery.browser.safari && event.target.nodeType == 3) { 
    2984                         // store a copy of the original event object  
    2985                         // and clone because target is read only 
    2986                         var originalEvent = event; 
    2987                         event = jQuery.extend({}, originalEvent); 
    29883002                         
    2989                         // get parentnode from textnode 
    2990                         event.target = originalEvent.target.parentNode; 
    2991                          
    2992                         // add preventDefault and stopPropagation since  
    2993                         // they will not work on the clone 
    2994                         event.preventDefault = function() { 
    2995                                 return originalEvent.preventDefault(); 
    2996                         }; 
    2997                         event.stopPropagation = function() { 
    2998                                 return originalEvent.stopPropagation(); 
    2999                         }; 
    3000                 } 
     3003                // Add which for key events 
     3004                if ( !event.which && (event.charCode || event.keyCode) ) 
     3005                        event.which = event.charCode || event.keyCode; 
    30013006                 
    3002                 // fix preventDefault and stopPropagation 
    3003                 if (!event.preventDefault) 
    3004                         event.preventDefault = function() { 
    3005                                 this.returnValue = false; 
    3006                         }; 
    3007                          
    3008                 if (!event.stopPropagation) 
    3009                         event.stopPropagation = function() { 
    3010                                 this.cancelBubble = true; 
    3011                         }; 
     3007                // Add metaKey to non-Mac browsers (use ctrl for PC's and Meta for Macs) 
     3008                if ( !event.metaKey && event.ctrlKey ) 
     3009                        event.metaKey = event.ctrlKey; 
     3010 
     3011                // Add which for click: 1 == left; 2 == middle; 3 == right 
     3012                // Note: button is not normalized, so don't use it 
     3013                if ( !event.which && event.button ) 
     3014                        event.which = (event.button & 1 ? 1 : ( event.button & 2 ? 3 : ( event.button & 4 ? 2 : 0 ) )); 
    30123015                         
    30133016                return event; 
     
    30273030         * data as the second parameter (and the handler function as the third), see  
    30283031         * second example. 
     3032         * 
     3033         * Calling bind with an event type of "unload" will automatically 
     3034         * use the one method instead of bind to prevent memory leaks. 
    30293035         * 
    30303036         * @example $("p").bind("click", function(){ 
     
    30643070         */ 
    30653071        bind: function( type, data, fn ) { 
    3066                 return this.each(function(){ 
     3072                return type == "unload" ? this.one(type, data, fn) : this.each(function(){ 
    30673073                        jQuery.event.add( this, type, fn || data, fn && data ); 
    30683074                }); 
     
    30733079         * The handler is executed only once for each element. Otherwise, the same rules 
    30743080         * as described in bind() apply. 
    3075          The event handler is passed an event object that you can use to prevent 
     3081         * The event handler is passed an event object that you can use to prevent 
    30763082         * default behaviour. To stop both default action and event bubbling, your handler 
    30773083         * has to return false. 
     
    33363342                                jQuery.readyList = null; 
    33373343                        } 
    3338                         // Remove event lisenter to avoid memory leak 
     3344                        // Remove event listener to avoid memory leak 
    33393345                        if ( jQuery.browser.mozilla || jQuery.browser.opera ) 
    33403346                                document.removeEventListener( "DOMContentLoaded", jQuery.ready, false ); 
     
    37593765                } 
    37603766        }); 
     3767jQuery.fn.extend({ 
     3768 
     3769        /** 
     3770         * Displays each of the set of matched elements if they are hidden. 
     3771         * 
     3772         * @example $("p").show() 
     3773         * @before <p style="display: none">Hello</p> 
     3774         * @result [ <p style="display: block">Hello</p> ] 
     3775         * 
     3776         * @name show 
     3777         * @type jQuery 
     3778         * @cat Effects 
     3779         */ 
     3780         
     3781        /** 
     3782         * Show all matched elements using a graceful animation and firing an 
     3783         * optional callback after completion. 
     3784         * 
     3785         * The height, width, and opacity of each of the matched elements  
     3786         * are changed dynamically according to the specified speed. 
     3787         * 
     3788         * @example $("p").show("slow"); 
     3789         * 
     3790         * @example $("p").show("slow",function(){ 
     3791         *   alert("Animation Done."); 
     3792         * }); 
     3793         * 
     3794         * @name show 
     3795         * @type jQuery 
     3796         * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     3797         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     3798         * @cat Effects 
     3799         * @see hide(String|Number,Function) 
     3800         */ 
     3801        show: function(speed,callback){ 
     3802                return speed ? 
     3803                        this.animate({ 
     3804                                height: "show", width: "show", opacity: "show" 
     3805                        }, speed, callback) : 
     3806                         
     3807                        this.filter(":hidden").each(function(){ 
     3808                                this.style.display = this.oldblock ? this.oldblock : ""; 
     3809                                if ( jQuery.css(this,"display") == "none" ) 
     3810                                        this.style.display = "block"; 
     3811                        }).end(); 
     3812        }, 
     3813         
     3814        /** 
     3815         * Hides each of the set of matched elements if they are shown. 
     3816         * 
     3817         * @example $("p").hide() 
     3818         * @before <p>Hello</p> 
     3819         * @result [ <p style="display: none">Hello</p> ] 
     3820         * 
     3821         * @name hide 
     3822         * @type jQuery 
     3823         * @cat Effects 
     3824         */ 
     3825         
     3826        /** 
     3827         * Hide all matched elements using a graceful animation and firing an 
     3828         * optional callback after completion. 
     3829         * 
     3830         * The height, width, and opacity of each of the matched elements  
     3831         * are changed dynamically according to the specified speed. 
     3832         * 
     3833         * @example $("p").hide("slow"); 
     3834         * 
     3835         * @example $("p").hide("slow",function(){ 
     3836         *   alert("Animation Done."); 
     3837         * }); 
     3838         * 
     3839         * @name hide 
     3840         * @type jQuery 
     3841         * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     3842         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     3843         * @cat Effects 
     3844         * @see show(String|Number,Function) 
     3845         */ 
     3846        hide: function(speed,callback){ 
     3847                return speed ? 
     3848                        this.animate({ 
     3849                                height: "hide", width: "hide", opacity: "hide" 
     3850                        }, speed, callback) : 
     3851                         
     3852                        this.filter(":visible").each(function(){ 
     3853                                this.oldblock = this.oldblock || jQuery.css(this,"display"); 
     3854                                if ( this.oldblock == "none" ) 
     3855                                        this.oldblock = "block"; 
     3856                                this.style.display = "none"; 
     3857                        }).end(); 
     3858        }, 
     3859 
     3860        // Save the old toggle function 
     3861        _toggle: jQuery.fn.toggle, 
     3862         
     3863        /** 
     3864         * Toggles each of the set of matched elements. If they are shown, 
     3865         * toggle makes them hidden. If they are hidden, toggle 
     3866         * makes them shown. 
     3867         * 
     3868         * @example $("p").toggle() 
     3869         * @before <p>Hello</p><p style="display: none">Hello Again</p> 
     3870         * @result [ <p style="display: none">Hello</p>, <p style="display: block">Hello Again</p> ] 
     3871         * 
     3872         * @name toggle 
     3873         * @type jQuery 
     3874         * @cat Effects 
     3875         */ 
     3876        toggle: function( fn, fn2 ){ 
     3877                return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ? 
     3878                        this._toggle( fn, fn2 ) : 
     3879                        this.animate({ 
     3880                                height: "toggle", width: "toggle", opacity: "toggle" 
     3881                        }, fn, fn2); 
     3882        }, 
     3883         
     3884        /** 
     3885         * Reveal all matched elements by adjusting their height and firing an 
     3886         * optional callback after completion. 
     3887         * 
     3888         * Only the height is adjusted for this animation, causing all matched 
     3889         * elements to be revealed in a "sliding" manner. 
     3890         * 
     3891         * @example $("p").slideDown("slow"); 
     3892         * 
     3893         * @example $("p").slideDown("slow",function(){ 
     3894         *   alert("Animation Done."); 
     3895         * }); 
     3896         * 
     3897         * @name slideDown 
     3898         * @type jQuery 
     3899         * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     3900         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     3901         * @cat Effects 
     3902         * @see slideUp(String|Number,Function) 
     3903         * @see slideToggle(String|Number,Function) 
     3904         */ 
     3905        slideDown: function(speed,callback){ 
     3906                return this.animate({height: "show"}, speed, callback); 
     3907        }, 
     3908         
     3909        /** 
     3910         * Hide all matched elements by adjusting their height and firing an 
     3911         * optional callback after completion. 
     3912         * 
     3913         * Only the height is adjusted for this animation, causing all matched 
     3914         * elements to be hidden in a "sliding" manner. 
     3915         * 
     3916         * @example $("p").slideUp("slow"); 
     3917         * 
     3918         * @example $("p").slideUp("slow",function(){ 
     3919         *   alert("Animation Done."); 
     3920         * }); 
     3921         * 
     3922         * @name slideUp 
     3923         * @type jQuery 
     3924         * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     3925         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     3926         * @cat Effects 
     3927         * @see slideDown(String|Number,Function) 
     3928         * @see slideToggle(String|Number,Function) 
     3929         */ 
     3930        slideUp: function(speed,callback){ 
     3931                return this.animate({height: "hide"}, speed, callback); 
     3932        }, 
     3933 
     3934        /** 
     3935         * Toggle the visibility of all matched elements by adjusting their height and firing an 
     3936         * optional callback after completion. 
     3937         * 
     3938         * Only the height is adjusted for this animation, causing all matched 
     3939         * elements to be hidden in a "sliding" manner. 
     3940         * 
     3941         * @example $("p").slideToggle("slow"); 
     3942         * 
     3943         * @example $("p").slideToggle("slow",function(){ 
     3944         *   alert("Animation Done."); 
     3945         * }); 
     3946         * 
     3947         * @name slideToggle 
     3948         * @type jQuery 
     3949         * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     3950         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     3951         * @cat Effects 
     3952         * @see slideDown(String|Number,Function) 
     3953         * @see slideUp(String|Number,Function) 
     3954         */ 
     3955        slideToggle: function(speed, callback){ 
     3956                return this.animate({height: "toggle"}, speed, callback); 
     3957        }, 
     3958         
     3959        /** 
     3960         * Fade in all matched elements by adjusting their opacity and firing an 
     3961         * optional callback after completion. 
     3962         * 
     3963         * Only the opacity is adjusted for this animation, meaning that 
     3964         * all of the matched elements should already have some form of height 
     3965         * and width associated with them. 
     3966         * 
     3967         * @example $("p").fadeIn("slow"); 
     3968         * 
     3969         * @example $("p").fadeIn("slow",function(){ 
     3970         *   alert("Animation Done."); 
     3971         * }); 
     3972         * 
     3973         * @name fadeIn 
     3974         * @type jQuery 
     3975         * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     3976         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     3977         * @cat Effects 
     3978         * @see fadeOut(String|Number,Function) 
     3979         * @see fadeTo(String|Number,Number,Function) 
     3980         */ 
     3981        fadeIn: function(speed, callback){ 
     3982                return this.animate({opacity: "show"}, speed, callback); 
     3983        }, 
     3984         
     3985        /** 
     3986         * Fade out all matched elements by adjusting their opacity and firing an 
     3987         * optional callback after completion. 
     3988         * 
     3989         * Only the opacity is adjusted for this animation, meaning that 
     3990         * all of the matched elements should already have some form of height 
     3991         * and width associated with them. 
     3992         * 
     3993         * @example $("p").fadeOut("slow"); 
     3994         * 
     3995         * @example $("p").fadeOut("slow",function(){ 
     3996         *   alert("Animation Done."); 
     3997         * }); 
     3998         * 
     3999         * @name fadeOut 
     4000         * @type jQuery 
     4001         * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     4002         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     4003         * @cat Effects 
     4004         * @see fadeIn(String|Number,Function) 
     4005         * @see fadeTo(String|Number,Number,Function) 
     4006         */ 
     4007        fadeOut: function(speed, callback){ 
     4008                return this.animate({opacity: "hide"}, speed, callback); 
     4009        }, 
     4010         
     4011        /** 
     4012         * Fade the opacity of all matched elements to a specified opacity and firing an 
     4013         * optional callback after completion. 
     4014         * 
     4015         * Only the opacity is adjusted for this animation, meaning that 
     4016         * all of the matched elements should already have some form of height 
     4017         * and width associated with them. 
     4018         * 
     4019         * @example $("p").fadeTo("slow", 0.5); 
     4020         * 
     4021         * @example $("p").fadeTo("slow", 0.5, function(){ 
     4022         *   alert("Animation Done."); 
     4023         * }); 
     4024         * 
     4025         * @name fadeTo 
     4026         * @type jQuery 
     4027         * @param String|Number speed A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     4028         * @param Number opacity The opacity to fade to (a number from 0 to 1). 
     4029         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     4030         * @cat Effects 
     4031         * @see fadeIn(String|Number,Function) 
     4032         * @see fadeOut(String|Number,Function) 
     4033         */ 
     4034        fadeTo: function(speed,to,callback){ 
     4035                return this.animate({opacity: to}, speed, callback); 
     4036        }, 
     4037         
     4038        /** 
     4039         * A function for making your own, custom animations. The key aspect of 
     4040         * this function is the object of style properties that will be animated, 
     4041         * and to what end. Each key within the object represents a style property 
     4042         * that will also be animated (for example: "height", "top", or "opacity"). 
     4043         * 
     4044         * Note that properties should be specified using camel case 
     4045         * eg. marginLeft instead of margin-left. 
     4046         * 
     4047         * The value associated with the key represents to what end the property 
     4048         * will be animated. If a number is provided as the value, then the style 
     4049         * property will be transitioned from its current state to that new number. 
     4050         * Otherwise if the string "hide", "show", or "toggle" is provided, a default 
     4051         * animation will be constructed for that property. 
     4052         * 
     4053         * @example $("p").animate({ 
     4054         *   height: 'toggle', opacity: 'toggle' 
     4055         * }, "slow"); 
     4056         * 
     4057         * @example $("p").animate({ 
     4058         *   left: 50, opacity: 'show' 
     4059         * }, 500); 
     4060         * 
     4061         * @example $("p").animate({ 
     4062         *   opacity: 'show' 
     4063         * }, "slow", "easein"); 
     4064         * @desc An example of using an 'easing' function to provide a different style of animation. This will only work if you have a plugin that provides this easing function (Only "swing" and "linear" are provided by default, with jQuery). 
     4065         * 
     4066         * @name animate 
     4067         * @type jQuery 
     4068         * @param Hash params A set of style attributes that you wish to animate, and to what end. 
     4069         * @param String|Number speed (optional) A string representing one of the three predefined speeds ("slow", "normal", or "fast") or the number of milliseconds to run the animation (e.g. 1000). 
     4070         * @param String easing (optional) The name of the easing effect that you want to use (e.g. "swing" or "linear"). Defaults to "swing". 
     4071         * @param Function callback (optional) A function to be executed whenever the animation completes. 
     4072         * @cat Effects 
     4073         */ 
     4074        animate: function( prop, speed, easing, callback ) { 
     4075                return this.queue(function(){ 
     4076                        var hidden = jQuery(this).is(":hidden"); 
     4077                         
     4078                        for ( var p in prop ) 
     4079                                if ( prop[p] == "hide" && hidden || 
     4080                                        prop[p] == "show" && !hidden ) 
     4081                                                return; 
     4082                 
     4083                        this.curAnim = jQuery.extend({}, prop); 
     4084                        var opt = jQuery.speed(speed, easing, callback); 
     4085                        var self = this; 
     4086                         
     4087                        jQuery.each( prop, function(name, val){ 
     4088                                var e = new jQuery.fx( self, opt, name ); 
     4089                                if ( val.constructor == Number ) 
     4090                                        e.custom( e.cur(), val ); 
     4091                                else 
     4092                                        e[ val == "toggle" ? hidden ? "show" : "hide" : val ]( prop ); 
     4093                        }); 
     4094                }); 
     4095        }, 
     4096         
     4097        /** 
     4098         * 
     4099         * @private 
     4100         */ 
     4101        queue: function(type,fn){ 
     4102                if ( !fn ) { 
     4103                        fn = type; 
     4104                        type = "fx"; 
     4105                } 
     4106         
     4107                return this.each(function(){ 
     4108                        if ( !this.queue ) 
     4109                                this.queue = {}; 
     4110         
     4111                        if ( !this.queue[type] ) 
     4112                                this.queue[type] = []; 
     4113         
     4114                        this.queue[type].push( fn ); 
     4115                 
     4116                        if ( this.queue[type].length == 1 ) 
     4117                                fn.apply(this); 
     4118                }); 
     4119        } 
     4120 
     4121}); 
     4122 
     4123jQuery.extend({ 
     4124         
     4125        speed: function(speed, easing, fn) { 
     4126                var opt = speed && speed.constructor == Object ? speed : { 
     4127                        complete: fn || !fn && easing ||  
     4128                                jQuery.isFunction( speed ) && speed, 
     4129                        duration: speed, 
     4130                        easing: fn && easing || easing && easing.constructor != Function && easing || "swing" 
     4131                }; 
     4132 
     4133                opt.duration = (opt.duration && opt.duration.constructor == Number ?  
     4134                        opt.duration :  
     4135                        { slow: 600, fast: 200 }[opt.duration]) || 400; 
     4136         
     4137                // Queueing 
     4138                opt.old = opt.complete; 
     4139                opt.complete = function(){ 
     4140                        jQuery.dequeue(this, "fx"); 
     4141                        if ( jQuery.isFunction( opt.old ) ) 
     4142                                opt.old.apply( this ); 
     4143                }; 
     4144         
     4145                return opt; 
     4146        }, 
     4147         
     4148        easing: { 
     4149                linear: function( p, n, firstNum, diff ) { 
     4150                        return firstNum + diff * p; 
     4151                }, 
     4152                swing: function( p, n, firstNum, diff ) { 
     4153                        return ((-Math.cos(p*Math.PI)/2) + 0.5) * diff + firstNum; 
     4154                } 
     4155        }, 
     4156         
     4157        queue: {}, 
     4158         
     4159        dequeue: function(elem,type){ 
     4160                type = type || "fx"; 
     4161         
     4162                if ( elem.queue && elem.queue[type] ) { 
     4163                        // Remove self 
     4164                        elem.queue[type].shift(); 
     4165         
     4166                        // Get next function 
     4167                        var f = elem.queue[type][0]; 
     4168                 
     4169                        if ( f ) f.apply( elem ); 
     4170                } 
     4171        }, 
     4172 
     4173        timers: [], 
     4174 
     4175        /* 
     4176         * I originally wrote fx() as a clone of moo.fx and in the process 
     4177         * of making it small in size the code became illegible to sane 
     4178         * people. You've been warned. 
     4179         */ 
     4180         
     4181        fx: function( elem, options, prop ){ 
     4182 
     4183                var z = this; 
     4184 
     4185                // The styles 
     4186                var y = elem.style; 
     4187                 
     4188                if ( prop == "height" || prop == "width" ) { 
     4189                        // Store display property 
     4190                        var oldDisplay = jQuery.css(elem, "display"); 
     4191 
     4192                        // Make sure that nothing sneaks out 
     4193                        var oldOverflow = y.overflow; 
     4194                        y.overflow = "hidden"; 
     4195                } 
     4196 
     4197                // Simple function for setting a style value 
     4198                z.a = function(){ 
     4199                        if ( options.step ) 
     4200                                options.step.apply( elem, [ z.now ] ); 
     4201 
     4202                        if ( prop == "opacity" ) 
     4203                                jQuery.attr(y, "opacity", z.now); // Let attr handle opacity 
     4204                        else { 
     4205                                y[prop] = parseInt(z.now) + "px"; 
     4206                                y.display = "block"; // Set display property to block for animation 
     4207                        } 
     4208                }; 
     4209 
     4210                // Figure out the maximum number to run to 
     4211                z.max = function(){ 
     4212                        return parseFloat( jQuery.css(elem,prop) ); 
     4213                }; 
     4214 
     4215                // Get the current size 
     4216                z.cur = function(){ 
     4217                        var r = parseFloat( jQuery.curCSS(elem, prop) ); 
     4218                        return r && r > -10000 ? r : z.max(); 
     4219                }; 
     4220 
     4221                // Start an animation from one number to another 
     4222                z.custom = function(from,to){ 
     4223                        z.startTime = (new Date()).getTime(); 
     4224                        z.now = from; 
     4225                        z.a(); 
     4226 
     4227                        jQuery.timers.push(function(){ 
     4228&nb