aboutsummaryrefslogtreecommitdiffstats
path: root/toj/pmod/pmod_test/pmod_test.js
diff options
context:
space:
mode:
authorpzread <netfirewall@gmail.com>2013-03-01 22:30:00 +0800
committerpzread <netfirewall@gmail.com>2013-03-01 22:30:00 +0800
commit56688ed6d0b18f68ac8ddd82c4944c5d2777d20a (patch)
treebb943e164f82b4a826f1d9ce253bfabf912c0004 /toj/pmod/pmod_test/pmod_test.js
parent69d7b55a1c9d3100d42b9c91ab995de44b13d73b (diff)
downloadtaiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.gz
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.bz2
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.lz
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.xz
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.tar.zst
taiwan-online-judge-56688ed6d0b18f68ac8ddd82c4944c5d2777d20a.zip
Taiwan Online Judge Alpha 1
Diffstat (limited to 'toj/pmod/pmod_test/pmod_test.js')
-rwxr-xr-xtoj/pmod/pmod_test/pmod_test.js74
1 files changed, 74 insertions, 0 deletions
diff --git a/toj/pmod/pmod_test/pmod_test.js b/toj/pmod/pmod_test/pmod_test.js
new file mode 100755
index 0000000..c691c8a
--- /dev/null
+++ b/toj/pmod/pmod_test/pmod_test.js
@@ -0,0 +1,74 @@
+var pmod_test = {
+ init:function(that,j_page){
+ that.export_urlchange = function(direct){
+ if(direct == 'in'){
+ that.fadein(j_page);
+ j_page.find('div.info > h2.proid').text('ProID:' + that.proid);
+ $.post('/toj/pmod/pmod_test/pmod_test.php',{'proid':JSON.stringify(that.proid)},function(res){
+ var i;
+ var reto;
+ var seto;
+ var j_table;
+ var j_item;
+
+ if(res[0] != 'E'){
+ reto = JSON.parse(res);
+ seto = reto.set;
+ index.setcontent($('<span>' + that.proname + '</span>'));
+ j_page.find('div.content').html(reto.content);
+
+ $.post('/toj/php/problem.php',{'action':'get_pro_stat','data':JSON.stringify({'proid':that.proid})},function(res){
+ var reto
+
+ if(res[0] != 'E'){
+ reto = JSON.parse(res);
+ j_page.find('div.info > table.statlist td.bscore').text(reto.score);
+ if(reto.tried == false){
+ j_page.find('div.info > table.statlist td.bscore').css('color','#1C1C1C');
+ j_page.find('div.info > table.statlist td.stat').text('未嘗試');
+ }else{
+ if(reto.score < 60){
+ j_page.find('div.info > table.statlist td.bscore').css('color','#FF0000');
+ }else if(reto.score < 80){
+ j_page.find('div.info > table.statlist td.bscore').css('color','#00FF00');
+ }else if(reto.score < 100){
+ j_page.find('div.info > table.statlist td.bscore').css('color','#FFFF00');
+ }else{
+
+ j_page.find('div.info > table.statlist td.bscore').css('color','#FFFFFF');
+ }
+
+ if(reto.is_ac == true){
+ j_page.find('div.info > table.statlist td.stat').text('已通過');
+ }else{
+ j_page.find('div.info > table.statlist td.stat').text('已嘗試');
+ }
+ }
+ }
+ });
+
+ j_page.find('div.info > table.limitlist td.timelimit').text(seto.timelimit + ' ms');
+ j_page.find('div.info > table.limitlist td.memlimit').text(seto.memlimit + ' KB');
+
+ j_table = j_page.find('table.scorelist');
+ j_table.find('tr.item').remove();
+ for(i = 0;i < seto.count;i++){
+ j_item = $('<tr class="item"><td class="no"></td><td class="score"></td></tr>');
+ j_item.find('td.no').text(i + 1);
+ j_item.find('td.score').text(seto.score[i]);
+ j_table.append(j_item);
+ }
+ }
+ });
+ }else if(direct == 'out'){
+ that.fadeout(j_page);
+ }else if(direct == 'same'){
+
+ }
+ };
+
+ j_page.find('div.info > button.submit').on('click',function(e){
+ that.submit();
+ });
+ }
+};