public/js/app.js
/* Chain conversions given the request and the original response
 * Also sets the responseXXX fields on the jqXHR instance
 */
Chain conversions given the request and the original response
Also sets the responseXXX fields on the jqXHR instance
Chain conversions given the request and the original response Also sets the responseXXX fields on the jqXHR instance
function ajaxConvert( s, response, jqXHR, isSuccess ) {
 	var conv2, current, conv, tmp, prev,
 	converters = {},
		dataTypes = s.dataTypes.slice();
	if ( dataTypes[ 1 ] ) {
		for ( conv in s.converters ) {
			converters[ conv.toLowerCase() ] = s.converters[ conv ];
		}
	}
	current = dataTypes.shift();
	while ( current ) {
		if ( s.responseFields[ current ] ) {
			jqXHR[ s.responseFields[ current ] ] = response;
		}
		if ( !prev && isSuccess && s.dataFilter ) {
			response = s.dataFilter( response, s.dataType );
		}
		prev = current;
		current = dataTypes.shift();
		if ( current ) {
			if ( current === "*" ) {
				current = prev;
		} else if ( prev !== "*" && prev !== current ) {
				conv = converters[ prev + " " + current ] || converters[ "* " + current ];
				if ( !conv ) {
					for ( conv2 in converters ) {
						tmp = conv2.split( " " );
						if ( tmp[ 1 ] === current ) {
							conv = converters[ prev + " " + tmp[ 0 ] ] ||
							converters[ "* " + tmp[ 0 ] ];
							if ( conv ) {
								if ( conv === true ) {
									conv = converters[ conv2 ];
							} else if ( converters[ conv2 ] !== true ) {
								current = tmp[ 0 ];
								dataTypes.unshift( tmp[ 1 ] );
							}
							break;
						}
					}
				}
			}
				if ( conv !== true ) {
					if ( conv && s.throws ) {
						response = conv( response );
					} else {
						try {
							response = conv( response );
						} catch ( e ) {
							return {
								state: "parsererror",
								error: conv ? e : "No conversion from " + prev + " to " + current
							};
						}
					}
				}
			}
		}
	}
	return { state: "success", data: response };
}
function ajaxConvert ( s , response , jqXHR , isSuccess ) { var conv2 , current , conv , tmp , prev , converters = { } , dataTypes = s . dataTypes . slice ( ) ; if ( dataTypes [ 1 ] ) { for ( conv in s . converters ) { converters [ conv . toLowerCase ( ) ] = s . converters [ conv ] ; } } current = dataTypes . shift ( ) ; while ( current ) { if ( s . responseFields [ current ] ) { jqXHR [ s . responseFields [ current ] ] = response ; } if ( ! prev && isSuccess && s . dataFilter ) { response = s . dataFilter ( response , s . dataType ) ; } prev = current ; current = dataTypes . shift ( ) ; if ( current ) { if ( current === "*" ) { current = prev ; } else if ( prev !== "*" && prev !== current ) { conv = converters [ prev + " " + current ] || converters [ "* " + current ] ; if ( ! conv ) { for ( conv2 in converters ) { tmp = conv2 . split ( " " ) ; if ( tmp [ 1 ] === current ) { conv = converters [ prev + " " + tmp [ 0 ] ] || converters [ "* " + tmp [ 0 ] ] ; if ( conv ) { if ( conv === true ) { conv = converters [ conv2 ] ; } else if ( converters [ conv2 ] !== true ) { current = tmp [ 0 ] ; dataTypes . unshift ( tmp [ 1 ] ) ; } break ; } } } } if ( conv !== true ) { if ( conv && s . throws ) { response = conv ( response ) ; } else { try { response = conv ( response ) ; } catch ( e ) { return { state : "parsererror" , error : conv ? e : "No conversion from " + prev + " to " + current } ; } } } } } } return { state : "success" , data : response } ; }
Chain conversions given the request and the original response
 Also sets the responseXXX fields on the jqXHR instance
Chain conversions given the request and the original response Also sets the responseXXX fields on the jqXHR instance
// Work with a copy of dataTypes in case we need to modify it for conversion // Create converters map with lowercased keys // Convert to each sequential dataType // Apply the dataFilter if provided // There's only work to do if current dataType is non-auto // Convert response if prev dataType is non-auto and differs from current // Seek a direct converter // If none found, seek a pair // If conv2 outputs current // If prev can be converted to accepted input // Condense equivalence converters // Otherwise, insert the intermediate dataType // Apply converter (if not an equivalence) // Unless errors are allowed to bubble, catch and return them