diff options
Diffstat (limited to 'js/reviewdesu.js')
-rw-r--r-- | js/reviewdesu.js | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/js/reviewdesu.js b/js/reviewdesu.js index 829f07a..6750b4b 100644 --- a/js/reviewdesu.js +++ b/js/reviewdesu.js @@ -84,7 +84,7 @@ function next_question() { html = '<h3>Question ' + question_nb + ' of ' + total + '</h3>'; html += '<div class="review_item">'; - html += '<div>' + question.question + '</div>'; + html += '<div class="box">' + question.question + '</div>'; html += '<p><button id="flipbtn" onclick="show_answer();">answer</button></p>'; html += '</div>'; $("core").innerHTML = html; @@ -95,7 +95,8 @@ function next_question() { function show_answer() { html = '<h3>Question ' + question_nb + ' of ' + total + '</h3>'; html += '<div class="review_item">'; - html += '<div>' + question.answer + '</div>'; + html += '<div class="box2">' + question.answer + '</div>'; + html += '<div class="boxn" onclick="edit_note();" id="notebox">' + (notes[question.key] || '<em>click to add note...</em>') + '</div>'; html += '<p><button taborder="1" onclick="answer_question(-1);">fail</button>'; html += '<button taborder="2" id="dunnobtn" onclick="answer_question(0);">dunno</button>'; html += '<button taborder="3" id="winbtn" onclick="answer_question(1);">win</button></p>'; @@ -109,3 +110,22 @@ function answer_question(a) { score += a; next_question(); } + +function edit_note() { + var idd = question.key; + var note = prompt("Add note for item:", notes[idd] || ''); + if (note != null) notes[idd] = note; + if (notes[idd] == '') delete notes[idd]; + $("notebox").innerHTML = (notes[idd] || '<em>click to add note...</em>'); + + new Ajax.Request('index.php?p=brresults-study-' + batchid, { + method: 'post', + parameters: { + notes: Object.toJSON(notes), + }, + onSuccess: function(transport) { + // nothing... + }, + }); +} + |