From a83a8cde156e37b775710fa1b2c300c7fec44587 Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 5 Oct 2011 18:22:25 +0300 Subject: [PATCH] upgraded Choisir app --- .../interactive/Choisir.wgt/css/basic.css | 8 ++++++- .../interactive/Choisir.wgt/index.html | 2 +- .../Choisir.wgt/scripts/selQuestionApp.js | 24 ++++++++----------- 3 files changed, 18 insertions(+), 16 deletions(-) diff --git a/resources/library/interactive/Choisir.wgt/css/basic.css b/resources/library/interactive/Choisir.wgt/css/basic.css index 50165e3e..8d0f8e36 100644 --- a/resources/library/interactive/Choisir.wgt/css/basic.css +++ b/resources/library/interactive/Choisir.wgt/css/basic.css @@ -217,7 +217,7 @@ body{ margin-left: 5px; font-family: Verdana,Arial,Helvetica,sans-serif; font-size: small; - width: 90%; + width: 80%; float: left; -webkit-border-radius: 5px; border-radius: 5px; @@ -362,4 +362,10 @@ body{ -webkit-box-shadow: #dadada -1px 0 4px; box-shadow: #dadada -1px 0 4px; z-index: 100; +} + +#answerText{ + padding: 3px; + -webkit-border-radius: 3px; + border-radius: 3px; } \ No newline at end of file diff --git a/resources/library/interactive/Choisir.wgt/index.html b/resources/library/interactive/Choisir.wgt/index.html index 0d8223c1..1247e38a 100644 --- a/resources/library/interactive/Choisir.wgt/index.html +++ b/resources/library/interactive/Choisir.wgt/index.html @@ -19,6 +19,6 @@ and open the template in the editor. - + diff --git a/resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js b/resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js index 09dfaa44..ab60ae26 100644 --- a/resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js +++ b/resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js @@ -51,10 +51,7 @@ function init(){ addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'"); for(var j in questionArray[i].answers) addAnsBlock(questionArray[i].answers[j].id, questionArray[i].id, questionArray[i].answers[j].text, true, questionArray[i].rightAns, questionArray[i].type); - } - /*for(var i in questionArray) - setInputSelected(questionArray[i].id, questionArray[i].type, questionArray[i].rightAns); - alert(2); */ + } } } @@ -260,15 +257,14 @@ function init(){ } else { if(event.target.type == "radio"){ if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns) - $(event.target).next().next().css("background-color","#6c0"); + $(event.target).next().next().find("span").css("background-color","#6c0"); else - $(event.target).next().next().css("background-color","#f66"); + $(event.target).next().next().find("span").css("background-color","red"); } else { - //alert(event.target.value + " | " + getNeededElement(questionArray, currentQstId).rightAns + " | " + getNeededElement(questionArray, currentQstId).rightAns.replace(/,/g,"") + " | " + getNeededElement(questionArray, currentQstId).rightAns.replace(",","").indexOf(event.target.value + " ", 0) ) if(getNeededElement(questionArray, currentQstId).rightAns.replace(/,/g,"").indexOf(event.target.value + " ", 0) != -1) - $(event.target).next().next().css("background-color","#6c0"); + $(event.target).next().next().find("span").css("background-color","#6c0"); else - $(event.target).next().next().css("background-color","#f66"); + $(event.target).next().next().find("span").css("background-color","red"); } } }); @@ -336,11 +332,10 @@ function init(){ $("select").live('change', function(evt){ if(mode){ - //alert(currentQstId + " | " + event.target.value + " | " + getNeededElement(questionArray, currentQstId).rightAns) if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns) $(event.target).parent().css("background-color","#6c0"); else - $(event.target).parent().css("background-color","#f66"); + $(event.target).parent().css("background-color","red"); flagForSelect = false; } }); @@ -386,7 +381,8 @@ function init(){ if(type == 3){ var newAnswer = $("
"); newAnswer.appendTo(ansDiv); - selInput.appendTo(newAnswer); + var selectSpan = $("").appendTo(newAnswer); + selInput.appendTo(selectSpan); $("").appendTo(selInput); } for(var j in array[i].answers){ @@ -395,14 +391,14 @@ function init(){ newAnswer = $("
"); var ansInput = $("").appendTo(newAnswer); var ansSpan = $("" + ansCount + ".").appendTo(newAnswer); - var ansContent = $("
" + array[i].answers[j].text + "
").appendTo(newAnswer); + var ansContent = $("
" + array[i].answers[j].text + "
").appendTo(newAnswer); newAnswer.appendTo(ansDiv); break; case "2": newAnswer = $("
"); ansInput = $("").appendTo(newAnswer); ansSpan = $("" + ansCount + ".").appendTo(newAnswer); - ansContent = $("
" + array[i].answers[j].text + "
").appendTo(newAnswer); + ansContent = $("
" + array[i].answers[j].text + "
").appendTo(newAnswer); newAnswer.appendTo(ansDiv); break; case "3":