diff --git a/static/math.css b/static/math.css index d64b604..2037bda 100644 --- a/static/math.css +++ b/static/math.css @@ -1,21 +1,7 @@ .number { - font-size: 100px; - height: 80px; font-family: helvetica; } -.question { - padding-left: 30px; -} - -.answer { - padding-top: 30px; -} - -#content { - padding-top: 30px; -} - .wrong { background: red; } diff --git a/static/math.js b/static/math.js index 9d99d22..ad34141 100644 --- a/static/math.js +++ b/static/math.js @@ -18,19 +18,24 @@ function deal_with_answer(e) { "second": $("#second").text(), "answer": $("#answer").val(), }; - console.log(data); $.post("/api/v0/attempt/", data, function(d) { if(d["status"]) { - $("#content").removeClass("wrong"); + $("body").removeClass("wrong"); new_problem(); } else { - $("#content").addClass("wrong"); + $("body").addClass("wrong"); + $("#answer").val(""); } + $("#answer").focus(); }); } $(function() { new_problem(); - $("#check").click(deal_with_answer); + $("#answer").keypress(function(e) { + if( e.which == 13) { + deal_with_answer(e); + } + }); }); diff --git a/templates/index.html b/templates/index.html index 75bf2aa..f2bc75c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -7,14 +7,11 @@
-
- 0 - + - 0 -
-
-
- + 0 + + + 0 +
+