Matrix

by Joshua Dwire

JavaScript

var data = "\
0	 	0 	 	0 	 	1 	 	0 	 	0 	 	0 	 	0 	 	0 	 		0 	 	0 	 	0 	 	0 \n\
0 		0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	1 	 	0 	 		0 	 	0 	 	0 	 	30 \n\
0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	0 	 		0 	 	0 	 	1 	 	60 \n\
74.088 	17.64	4.2	 	1 	 	0 	 	0 	 	0 	 	0 	 	0 	 		0 	 	0 	 	0 	 	30 \n\
0 	 	0 	 	0 	 	0 	 	636.056	73.96	8.6	 	1 	 	0 	 		0 	 	0 	 	0 	 	60 \n\
0 		0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	1737.979	670.81 	25.9 	1 	 	90 \n\
52.92	8.4 	1 		0 	 	0 	 	0 	 	-1 	 	0 	 	0 	 		0 	 	0 	 	0 	 	0 \n\
0		0	 	0	 	0 	 	221.88 	17.2  	1 	 	0 	 	0 	 		0 	 	-1 	 	0 	 	0 \n\
25.2	2 		0 	 	0 	 	0		-2 		0	 	0 		0 	 		0 	 	0 	 	0 	 	0 \n\
0 	 	0 	 	0 	 	0 		51.6 	2 		0 	 	0 	 	0		 	-2	 	0	 	0 	 	0 \n\
0 	 	2 	 	0 	 	0 	 	0 	 	0 	 	0 	 	0 	 	0 	 		0 	 	0 	 	0 	 	0 \n\
0 	 	0 	 	0 	 	0	 	0 	 	0 	 	0 	 	0 	 	155.4		2 	 	0 	 	0 	 	0";

var rows = [];
jQuery.each(data.replace(/\s*[\r\n]+\s*/g,'\n').replace(/[ \t]+/g,',').split('\n'),function(i,row){
    rows.push(row.split(','));
});

console.log("Go to http://www.dougbabcock.com/matrix.php");
console.log("var jq = document.createElement('script');\njq.src = 'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js';\ndocument.getElementsByTagName('head')[0].appendChild(jq);setTimeout(function(){jQuery.noConflict();jQuery.each("+JSON.stringify(rows)+",function(i,row){jQuery.each(row,function(j,val){jQuery('table tr:nth-child('+(i+1)+') td:nth-child('+(j+1)+') input').val(val);});});},2500)");