summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--design/style.css1
-rw-r--r--js/liststudy.js55
-rw-r--r--js/reviewdesu.js2
-rw-r--r--lib/list/list_models.php13
4 files changed, 53 insertions, 18 deletions
diff --git a/design/style.css b/design/style.css
index af90223..4959921 100644
--- a/design/style.css
+++ b/design/style.css
@@ -7,6 +7,7 @@ body {
margin: 0px;
width: 400px;
font-size: 0.9em;
+ font-family: "Liberation Serif", "IPAPGothic";
}
.menu {
diff --git a/js/liststudy.js b/js/liststudy.js
index d4a74c8..820e35d 100644
--- a/js/liststudy.js
+++ b/js/liststudy.js
@@ -7,6 +7,7 @@ var items = [];
var max_score = 0;
var med_score = 0;
+var avg_score = 0;
function show_batch_table() {
process_items();
@@ -15,38 +16,57 @@ function show_batch_table() {
}
function process_items() {
+ var item_idx = {};
+
for (var i = 0; i < batch_data.items.length; i++) {
+ var d = batch_data.items[i];
+ item_idx[d[0]] = items.length;
items.push(
- {"info": batch_data.items[i],
- "win": 0, "fail": 0, "score": 0}
+ {"info": d,
+ "win": 0, "fail": 0, "score": 0, "marker": ""}
);
}
+
+ // Calculate total wins and losses
for (var i = 0; i < reviews_data.length; i++) {
for (var j = 0; j < reviews_data[i].results.length; j++) {
var n = reviews_data[i].results[j][0];
var s = reviews_data[i].results[j][1];
- for (var k = 0; k < items.length; k++) {
- if (items[k].info[0] == n) {
- if (s == 1) {
- items[k].win++;
- items[k].score++;
- } else if (s == -1) {
- items[k].fail++;
- items[k].score--;
- }
- }
+ var k = item_idx[n];
+ if (s == 1) {
+ items[k].win++;
+ items[k].score++;
+ } else if (s == -1) {
+ items[k].fail++;
+ items[k].score--;
}
}
}
+
+ // Make marker indication : -1 (fail) -> red, 0 (dunno) -> yellow
+ if (reviews_data.length > 0) {
+ var t = reviews_data[reviews_data.length - 1].results;
+ for (var j = 0; j < t.length; j++) {
+ var s = t[j][1];
+ if (s == 1) continue;
+ var n = t[j][0];
+ var k = item_idx[n];
+ items[k].marker = items[k].marker + '<span style="color: ' + (s == 0 ? '#FFAA00' : '#FF0000') + '">*</span>';
+ }
+ }
+
+
+ // Get max score
for (var i = 0; i < items.length; i++) {
if (items[i].score > max_score) max_score = items[i].score;
- med_score += items[i].score;
+ avg_score += items[i].score;
}
- med_score = Math.ceil(med_score * 10 / items.length) / 10;
+ avg_score = Math.ceil(avg_score * 20 / items.length) / 20;
+ med_score = max_score / 2;
}
function show_contents_table() {
- var html = '<table><tr>';
+ var html = '<table><tr><th style="border: none; background: transparent"></th>';
for (var i = 0; i < batch_data.columns.length; i++) {
var c = batch_data.columns[i];
html += '<th>' + c + ' - <a class="tool_link" href="#" onclick="ch(' + i + ')" id="chsl' + i + '">hide</a></th>';
@@ -54,6 +74,7 @@ function show_contents_table() {
html += '<th>win</th><th>fail</th><th>score</th></tr>';
for (var i = 0; i < items.length; i++) {
html += '<tr>';
+ html += '<td style="border: none; background: transparent; padding: 0px; padding-top: 8px; font-weight: bold;">' + items[i].marker + '</td>';
for (var j = 0; j < items[i].info.length; j++) {
html += '<td><span class="cd' + j + '">' + items[i].info[j] + '</span></td>';
}
@@ -61,11 +82,11 @@ function show_contents_table() {
html += '<td' + (items[i].fail > 0 ? (items[i].fail > items[i].win ? ' style="background-color: #ff7777"' : ' style="background-color: #FFFF00"') : '') + '>' + items[i].fail + '</td>';
html += '<td style="background-color: ' +
(items[i].score == max_score ? '#00aa00' :
- (items[i].score > med_score ? '#55FF55' :
+ (items[i].score >= med_score ? '#55FF55' :
(items[i].score < 0 ? '#FF7777' : '#FFFF00'))) + '">' + items[i].score + '</td></tr>';
}
html += '</table>';
- html += '<p>Medium score : ' + med_score + '</p>';
+ html += '<p>Average score : ' + avg_score + '</p>';
$("items").innerHTML = html;
}
diff --git a/js/reviewdesu.js b/js/reviewdesu.js
index 79bae82..829f07a 100644
--- a/js/reviewdesu.js
+++ b/js/reviewdesu.js
@@ -101,7 +101,7 @@ function show_answer() {
html += '<button taborder="3" id="winbtn" onclick="answer_question(1);">win</button></p>';
html += '</div>';
$("core").innerHTML = html;
- $("dunnobtn").focus();
+ $("winbtn").focus();
}
function answer_question(a) {
diff --git a/lib/list/list_models.php b/lib/list/list_models.php
index 0d34856..8db28a0 100644
--- a/lib/list/list_models.php
+++ b/lib/list/list_models.php
@@ -14,4 +14,17 @@ $list_models = array(
),
),
),
+ "JA-Vocab" => array(
+ "columns" => array("N#", "Kanji", "Kana", "English"),
+ "questions" => array(
+ array(
+ 'q' => '<p class="rtk_kr_q_2">%3</p>',
+ 'a' => '<p class="rtk_kr_a_2">%2<br /><span>%1</span><br />%3</p>',
+ ),
+ array(
+ 'q' => '<p class="rtk_kr_q_1">%1</p>',
+ 'a' => '<p class="rtk_kr_a_1">%1 【%2】<br /><span>%3</span></p>',
+ ),
+ ),
+ ),
);