User:Bluefire2/importStats.js

function importStats( playerName ) { console.log( 'caek' ); getHSData( playerName, function( stats ) {		var data = [],			fields = [];		switch( wgPageName ) {			case 'Calculator:Agility':				console.log( 'got there' );				fields.append($("#FormResultagm"));				if( $("#FormResultagxp").val === 'Level' ) {					data.append( stats[ "Agility" ][ 0 ] );				} else {					data.append( stats[ "Agility" ][ 1 ] );				}				break;			default:				console.log( 'Not implemented for this page... yet.' );				break;		}		$.each(data, function( index ) { fields[ index ].val(data[ index ]); });	}); } Array.prototype.append = function( item ) { this[ this.length ] = item; // chainable! yay! return this; }