diff options
author | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-10 17:15:22 +0200 |
---|---|---|
committer | Alex AUVOLAT <alexis211@gmail.com> | 2013-08-10 17:15:22 +0200 |
commit | 5435a0a45fdfa1bcceeb36f8531826ddc2bb3508 (patch) | |
tree | 6254e6f19ca78e394693ef22ea5393dcefc5468d /js/reviewdesu.js | |
parent | 2a748125c27c7f7c41a32a1dba14484c66dc351f (diff) | |
download | Bits-5435a0a45fdfa1bcceeb36f8531826ddc2bb3508.tar.gz Bits-5435a0a45fdfa1bcceeb36f8531826ddc2bb3508.zip |
Added possibility to add notes to studied batch items.
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... + }, + }); +} + |