aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYingtong Li <runassudo@yingtongli.me>2017-03-23 22:24:00 +1100
committerYingtong Li <runassudo@yingtongli.me>2017-03-23 22:24:00 +1100
commit286d37e8617b3e4b90406407da0de3909f02ba63 (patch)
tree3465c42a894f09b34a94c10865fd2d96a4276bfc
parent9dd85e026f1ea95ec0c785550fe8a913cdb224f6 (diff)
Submit type answer on input change, not on loss of focus
-rw-r--r--pblive/__init__.py2
-rw-r--r--pblive/templates/question_type.html2
2 files changed, 2 insertions, 2 deletions
diff --git a/pblive/__init__.py b/pblive/__init__.py
index 911cbf8..15e366f 100644
--- a/pblive/__init__.py
+++ b/pblive/__init__.py
@@ -129,7 +129,7 @@ def socket_answer(question_num, answer):
if question_num == user.session.question_num:
user.answers[question_num] = answer
- if not isinstance(user.session.questions[user.session.question_num], pblive.data.DrawQuestion):
+ if isinstance(user.session.questions[user.session.question_num], pblive.data.MCQQuestion):
flask_socketio.emit('update', render_question(user, user.session, user.session.question_num), room=user.sid)
# Relay change
diff --git a/pblive/templates/question_type.html b/pblive/templates/question_type.html
index 73b4ad9..1e4497d 100644
--- a/pblive/templates/question_type.html
+++ b/pblive/templates/question_type.html
@@ -28,7 +28,7 @@
function submitAnswer() {
socket.emit('answer', {{ question_num }}, $('#answer').val());
}
- $('#answer').change(function() {
+ $('#answer').on('input', function() {
window.clearTimeout(submitAnswerTimer);
submitAnswerTimer = window.setTimeout(submitAnswer, 500);
});
Contact (issues, pull requests, etc.) at git@yingtongli.me. Generated by cgit.