streamlined the look

This commit is contained in:
Stephen McQuay 2013-04-23 23:06:24 -07:00
parent 6f3b856658
commit 37ae2cf663
3 changed files with 14 additions and 26 deletions

View File

@ -1,21 +1,7 @@
.number { .number {
font-size: 100px;
height: 80px;
font-family: helvetica; font-family: helvetica;
} }
.question {
padding-left: 30px;
}
.answer {
padding-top: 30px;
}
#content {
padding-top: 30px;
}
.wrong { .wrong {
background: red; background: red;
} }

View File

@ -18,19 +18,24 @@ function deal_with_answer(e) {
"second": $("#second").text(), "second": $("#second").text(),
"answer": $("#answer").val(), "answer": $("#answer").val(),
}; };
console.log(data);
$.post("/api/v0/attempt/", data, function(d) { $.post("/api/v0/attempt/", data, function(d) {
if(d["status"]) { if(d["status"]) {
$("#content").removeClass("wrong"); $("body").removeClass("wrong");
new_problem(); new_problem();
} }
else { else {
$("#content").addClass("wrong"); $("body").addClass("wrong");
$("#answer").val("");
} }
$("#answer").focus();
}); });
} }
$(function() { $(function() {
new_problem(); new_problem();
$("#check").click(deal_with_answer); $("#answer").keypress(function(e) {
if( e.which == 13) {
deal_with_answer(e);
}
});
}); });

View File

@ -7,14 +7,11 @@
</head> </head>
<body> <body>
<section id="content"> <section id="content">
<div class="number question"> <span class="number" id="first">0</span>
<span class="number" id="first">0</span> <span class="number" id="operation">+</span>
<span class="number" id="operation">+</span> <span class="number" id="second">0</span>
<span class="number" id="second">0</span> <div>
</div> <input id="answer" type="number" size="2" class="number" autofocus />
<div class="number answer">
<input id="answer" type="number" size="2" class="number"></div>
<input id="check" type="submit" name="check" value="check"/>
</div> </div>
</section> </section>
<script src="/static/jquery-2.0.0.min.js"></script> <script src="/static/jquery-2.0.0.min.js"></script>