From 5d416c64fbf7ec7890f85b4e52d98dddb9746acb Mon Sep 17 00:00:00 2001 From: Nicolas BERNSTEIN Date: Sun, 20 Nov 2011 14:08:33 +0100 Subject: Minor changes --- js/liststudy.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'js') diff --git a/js/liststudy.js b/js/liststudy.js index a0be379..b33ed6c 100644 --- a/js/liststudy.js +++ b/js/liststudy.js @@ -5,6 +5,9 @@ var items = []; +var max_score = 0; +var med_score = 0; + function show_batch_table() { process_items(); show_contents_table(); @@ -35,6 +38,11 @@ function process_items() { } } } + for (var i = 0; i < items.length; i++) { + if (items[i].score > max_score) max_score = items[i].score; + med_score += items[i].score; + } + med_score = Math.ceil(med_score * 10 / items.length) / 10; } function show_contents_table() { @@ -49,9 +57,12 @@ function show_contents_table() { for (var j = 0; j < items[i].info.length; j++) { html += '' + items[i].info[j] + ''; } - html += '' + items[i].win + '' + items[i].fail + '' + items[i].score + ''; + html += '' + items[i].win + ''; + html += ' 0 ? (items[i].fail > items[i].win ? ' style="background-color: #ff7777"' : ' style="background-color: #FFFF00"') : '') + '>' + items[i].fail + ''; + html += '' + items[i].score + ''; } html += ''; + html += '

Medium score : ' + med_score + '

'; $("items").innerHTML = html; } @@ -76,7 +87,7 @@ function show_reviews_table() { for (var i = 0; i < reviews_data.length; i++) { var color = ''; if (reviews_data[i].score == 100) - color = '#00CC00'; + color = '#00aa00'; else if (reviews_data[i].score >= 90) color = '#55FF55'; else if (reviews_data[i].score >= 50) -- cgit v1.2.3