/// Binds a handler to one or more events for each matched element. Can also bind custom events.
/// </summary>
/// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
/// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param>
/// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
/// Binds a handler to one or more events to be executed exactly once for each matched element.
/// </summary>
/// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
/// <param name="data" optional="true" type="Object">Additional data passed to the event handler as event.data</param>
/// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
/// Unbinds a handler from one or more events for each matched element.
/// </summary>
/// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
/// <param name="fn" type="Function">A function to bind to the event on each of the set of matched elements. function callback(eventObject) such that this corresponds to the dom element.</param>
// Handle object literals
if ( typeof type === "object" && !type.preventDefault ) {
for ( var key in type ) {
this.unbind(key, type[key]);
}
return this;
}
return this.each(function() {
jQuery.event.remove( this, type, fn );
});
},
trigger: function( type, data ) {
/// <summary>
/// Triggers a type of event on every matched element.
/// </summary>
/// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
/// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param>
/// <param name="fn" type="Function">This parameter is undocumented.</param>
return this.each(function() {
jQuery.event.trigger( type, data, this );
});
},
triggerHandler: function( type, data ) {
/// <summary>
/// Triggers all bound event handlers on an element for a specific event type without executing the browser's default actions.
/// </summary>
/// <param name="type" type="String">One or more event types separated by a space. Built-in event type values are: blur, focus, load, resize, scroll, unload, click, dblclick, mousedown, mouseup, mousemove, mouseover, mouseout, mouseenter, mouseleave, change, select, submit, keydown, keypress, keyup, error .</param>
/// <param name="data" optional="true" type="Array">Additional data passed to the event handler as additional arguments.</param>
/// <param name="fn" type="Function">This parameter is undocumented.</param>
if ( this[0] ) {
var event = jQuery.Event( type );
event.preventDefault();
event.stopPropagation();
jQuery.event.trigger( event, data, this[0] );
return event.result;
}
},
toggle: function( fn ) {
/// <summary>
/// Toggles among two or more function calls every other click.
/// </summary>
/// <param name="fn" type="Function">The functions among which to toggle execution</param>
// Save reference to arguments for access in closure
var args = arguments, i = 1;
// link all the functions, so any of them can unbind this click handler
/// Loads HTML from a remote file and injects it into the DOM. By default performs a GET request, but if parameters are included
/// then a POST will be performed.
/// </summary>
/// <param name="url" type="String">The URL of the HTML page to load.</param>
/// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
/// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus, XMLHttpRequest) such that this maps the injected DOM element.</param>
/// <returns type="jQuery" />
if ( typeof url !== "string" ) {
return this._load( url );
// Don't do a request if no elements are being requested
// Attach a bunch of functions for handling common AJAX events
// jQuery.each( "ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function( i, o ) {
// jQuery.fn[o] = function( f ) {
// return this.bind(o, f);
// };
// });
jQuery.fn["ajaxStart"] = function( f ) {
/// <summary>
/// Attach a function to be executed whenever an AJAX request begins and there is none already active. This is an Ajax Event.
/// </summary>
/// <param name="f" type="Function">The function to execute.</param>
/// <returns type="jQuery" />
return this.bind("ajaxStart", f);
};
jQuery.fn["ajaxStop"] = function( f ) {
/// <summary>
/// Attach a function to be executed whenever all AJAX requests have ended. This is an Ajax Event.
/// </summary>
/// <param name="f" type="Function">The function to execute.</param>
/// <returns type="jQuery" />
return this.bind("ajaxStop", f);
};
jQuery.fn["ajaxComplete"] = function( f ) {
/// <summary>
/// Attach a function to be executed whenever an AJAX request completes. This is an Ajax Event.
/// </summary>
/// <param name="f" type="Function">The function to execute.</param>
/// <returns type="jQuery" />
return this.bind("ajaxComplete", f);
};
jQuery.fn["ajaxError"] = function( f ) {
/// <summary>
/// Attach a function to be executed whenever an AJAX request fails. This is an Ajax Event.
/// </summary>
/// <param name="f" type="Function">The function to execute.</param>
/// <returns type="jQuery" />
return this.bind("ajaxError", f);
};
jQuery.fn["ajaxSuccess"] = function( f ) {
/// <summary>
/// Attach a function to be executed whenever an AJAX request completes successfully. This is an Ajax Event.
/// </summary>
/// <param name="f" type="Function">The function to execute.</param>
/// <returns type="jQuery" />
return this.bind("ajaxSuccess", f);
};
jQuery.fn["ajaxSend"] = function( f ) {
/// <summary>
/// Attach a function to be executed before an AJAX request is sent. This is an Ajax Event.
/// </summary>
/// <param name="f" type="Function">The function to execute.</param>
/// <returns type="jQuery" />
return this.bind("ajaxSend", f);
};
jQuery.extend({
get: function( url, data, callback, type ) {
/// <summary>
/// Loads a remote page using an HTTP GET request.
/// </summary>
/// <param name="url" type="String">The URL of the HTML page to load.</param>
/// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
/// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param>
/// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param>
/// <returns type="XMLHttpRequest" />
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = null;
}
return jQuery.ajax({
type: "GET",
url: url,
data: data,
success: callback,
dataType: type
});
},
getScript: function( url, callback ) {
/// <summary>
/// Loads and executes a local JavaScript file using an HTTP GET request.
/// </summary>
/// <param name="url" type="String">The URL of the script to load.</param>
/// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(data, textStatus) such that this maps the options for the AJAX request.</param>
/// <returns type="XMLHttpRequest" />
return jQuery.get(url, null, callback, "script");
},
getJSON: function( url, data, callback ) {
/// <summary>
/// Loads JSON data using an HTTP GET request.
/// </summary>
/// <param name="url" type="String">The URL of the JSON data to load.</param>
/// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
/// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete if the data is loaded successfully. It should map function(data, textStatus) such that this maps the options for this AJAX request.</param>
/// <returns type="XMLHttpRequest" />
return jQuery.get(url, data, callback, "json");
},
post: function( url, data, callback, type ) {
/// <summary>
/// Loads a remote page using an HTTP POST request.
/// </summary>
/// <param name="url" type="String">The URL of the HTML page to load.</param>
/// <param name="data" optional="true" type="Map">Key/value pairs that will be sent to the server.</param>
/// <param name="callback" optional="true" type="Function">The function called when the AJAX request is complete. It should map function(responseText, textStatus) such that this maps the options for this AJAX request.</param>
/// <param name="type" optional="true" type="String">Type of data to be returned to callback function. Valid valiues are xml, html, script, json, text, _default.</param>
/// <returns type="XMLHttpRequest" />
// shift arguments if data argument was omited
if ( jQuery.isFunction( data ) ) {
type = type || callback;
callback = data;
data = {};
}
return jQuery.ajax({
type: "POST",
url: url,
data: data,
success: callback,
dataType: type
});
},
ajaxSetup: function( settings ) {
/// <summary>
/// Sets up global settings for AJAX requests.
/// </summary>
/// <param name="settings" type="Options">A set of key/value pairs that configure the default Ajax request.</param>
jQuery.extend( jQuery.ajaxSettings, settings );
},
ajaxSettings: {
url: location.href,
global: true,
type: "GET",
contentType: "application/x-www-form-urlencoded",
processData: true,
async: true,
/*
timeout: 0,
data: null,
username: null,
password: null,
traditional: false,
*/
// Create the request object; Microsoft failed to properly
// implement the XMLHttpRequest in IE7 (can't request local files),
// so we use the ActiveXObject when it is available
// This function can be overriden by calling jQuery.ajaxSetup
/// Show all matched elements using a graceful animation and firing an optional callback after completion.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// Hides all matched elements using a graceful animation and firing an optional callback after completion.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
// Set the display of the elements in a second loop
// to avoid the constant reflow
for ( var j = 0, k = this.length; j < k; j++ ) {
this[j].style.display = "none";
}
return this;
}
},
// Save the old toggle function
_toggle: jQuery.fn.toggle,
toggle: function( fn, fn2 ) {
/// <summary>
/// Toggles displaying each of the set of matched elements.
/// </summary>
/// <returns type="jQuery" />
var bool = typeof fn === "boolean";
if ( jQuery.isFunction(fn) && jQuery.isFunction(fn2) ) {
this._toggle.apply( this, arguments );
} else if ( fn == null || bool ) {
this.each(function() {
var state = bool ? fn : jQuery(this).is(":hidden");
jQuery(this)[ state ? "show" : "hide" ]();
});
} else {
this.animate(genFx("toggle", 3), fn, fn2);
}
return this;
},
fadeTo: function( speed, to, callback ) {
/// <summary>
/// Fades the opacity of all matched elements to a specified opacity.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// <param name="prop" type="Options">A set of style attributes that you wish to animate and to what end.</param>
/// <param name="speed" optional="true" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="easing" optional="true" type="String">The name of the easing effect that you want to use. There are two built-in values, 'linear' and 'swing'.</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// <returns type="jQuery" />
var optall = jQuery.speed(speed, easing, callback);
/// Reveal all matched elements by adjusting their height.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// Hiding all matched elements by adjusting their height.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// Toggles the visibility of all matched elements by adjusting their height.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// Fades in all matched elements by adjusting their opacity.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>
/// Fades the opacity of all matched elements to a specified opacity.
/// </summary>
/// <param name="speed" type="String">A string representing one of three predefined speeds ('slow', 'normal', or 'fast'), or
/// the number of milliseconds to run the animation</param>
/// <param name="callback" optional="true" type="Function">A function to be executed whenever the animation completes, once for each animated element. It should map function callback() such that this is the DOM element being animated.</param>