JQuery Minesweeper

Not my code. I stumbled across it on gist and wanted to see it in running condition: https://gist.github.com/einfallstoll/4528997

by Brian Layman

HTML

<script src="https://code.jquery.com/jquery-latest.min.js"></script>

JavaScript

$(document).ready(function() {
			var body = $("body");
			
			{ //BODY
				{ //HTML
					body.append(
						"<style>" +
							"table#minefield td {" +
								"text-align: center;" +
								"font-weight: bold;" +
							"}" +
							".flag {" +
								"background-color: grey;" +
							"}" +
							".mine {" +
								"background-color: red;" +
							"}" +
							".gomine {" +
								"background-color: orange;" +
							"}" +
							".class0, .class1, .class2, .class3, .class4, .class5, .class6, .class7, .class8 {" +
								"background-color: #EEE;" +
							"}" +
							".class1 {" +
								"color: blue;" +
							"}" +
							".class2 {" +
								"color: green;" +
							"}" +
							".class3 {" +
								"color: red;" +
							"}" +
							".class4 {" +
								"color: purple;" +
							"}" +
							".class5 {" +
								"color: maroon;" +
							"}" +
							".class6 {" +
								"color: deepskyblue;" +
							"}" +
							".class7 {" +
								"color: black;" +
							"}" +
							".class8 {" +
								"color: gray;" +
							"}" +
						"</style>"
						);
					body.append("<h1>jMineSweeper</h1>");
					body.append(
						"<form>" +
							"<table>" + 
								"<tr>" +
									"<th>Size:</th>" +
									"<td><input type=\"text\" id=\"size\" value=\"16x16\"></input></td>" +
								"</tr>" +
								"<tr>" +
									"<th>Mines:</th>" +
									"<td><input type=\"text\" id=\"mines\" value=\"40\"></input></td>" +
								"</tr>" +
								"<tr>" +
									"<th>Hints:</th>" +
									"<td><input type=\"text\" id=\"hints\" value=\"2\"></input></td>" +
								"</tr>" +
								"<tr>" +
									"<td colspan=\"2\"><center><input type=\"submit\"></input></center></td>" +
								"</tr>" +
							"</table>" +
						"</form>" +
						"<br>"
						);
				}
				{ //STYLE
					body.css("font-family","sans-serif");
				}
			}
			
			{ //ACTIONS
				$("form").submit(function(e) {
					e.preventDefault();
					{ //TEST INPUTS
						var size =...