upgraded Choisir app

preferencesAboutTextFull
unknown 13 years ago
parent d041bdd7aa
commit a83a8cde15
  1. 8
      resources/library/interactive/Choisir.wgt/css/basic.css
  2. 2
      resources/library/interactive/Choisir.wgt/index.html
  3. 24
      resources/library/interactive/Choisir.wgt/scripts/selQuestionApp.js

@ -217,7 +217,7 @@ body{
margin-left: 5px; margin-left: 5px;
font-family: Verdana,Arial,Helvetica,sans-serif; font-family: Verdana,Arial,Helvetica,sans-serif;
font-size: small; font-size: small;
width: 90%; width: 80%;
float: left; float: left;
-webkit-border-radius: 5px; -webkit-border-radius: 5px;
border-radius: 5px; border-radius: 5px;
@ -362,4 +362,10 @@ body{
-webkit-box-shadow: #dadada -1px 0 4px; -webkit-box-shadow: #dadada -1px 0 4px;
box-shadow: #dadada -1px 0 4px; box-shadow: #dadada -1px 0 4px;
z-index: 100; z-index: 100;
}
#answerText{
padding: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
} }

@ -19,6 +19,6 @@ and open the template in the editor.
</script> </script>
</head> </head>
<body> <body>
</body> </body>
</html> </html>

@ -51,10 +51,7 @@ function init(){
addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'"); addQstBlock(questionArray[i].id, questionArray[i].text, questionArray[i].type,"style='display: none;'");
for(var j in questionArray[i].answers) 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); 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 { } else {
if(event.target.type == "radio"){ if(event.target.type == "radio"){
if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns) 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 else
$(event.target).next().next().css("background-color","#f66"); $(event.target).next().next().find("span").css("background-color","red");
} else { } 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) 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 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){ $("select").live('change', function(evt){
if(mode){ if(mode){
//alert(currentQstId + " | " + event.target.value + " | " + getNeededElement(questionArray, currentQstId).rightAns)
if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns) if(event.target.value == getNeededElement(questionArray, currentQstId).rightAns)
$(event.target).parent().css("background-color","#6c0"); $(event.target).parent().css("background-color","#6c0");
else else
$(event.target).parent().css("background-color","#f66"); $(event.target).parent().css("background-color","red");
flagForSelect = false; flagForSelect = false;
} }
}); });
@ -386,7 +381,8 @@ function init(){
if(type == 3){ if(type == 3){
var newAnswer = $("<div class='newAnswer'>"); var newAnswer = $("<div class='newAnswer'>");
newAnswer.appendTo(ansDiv); newAnswer.appendTo(ansDiv);
selInput.appendTo(newAnswer); var selectSpan = $("<span id='answerText'>").appendTo(newAnswer);
selInput.appendTo(selectSpan);
$("<option value='0'>Choise the right answer</option>").appendTo(selInput); $("<option value='0'>Choise the right answer</option>").appendTo(selInput);
} }
for(var j in array[i].answers){ for(var j in array[i].answers){
@ -395,14 +391,14 @@ function init(){
newAnswer = $("<div class='newAnswer'>"); newAnswer = $("<div class='newAnswer'>");
var ansInput = $("<input type='radio' name='" + counter + "' value='" + array[i].answers[j].value + "' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer); var ansInput = $("<input type='radio' name='" + counter + "' value='" + array[i].answers[j].value + "' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
var ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer); var ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
var ansContent = $("<div class='ansContentDisplay'>" + array[i].answers[j].text + "</div>").appendTo(newAnswer); var ansContent = $("<div class='ansContentDisplay'><span id='answerText'>" + array[i].answers[j].text + "</span></div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv); newAnswer.appendTo(ansDiv);
break; break;
case "2": case "2":
newAnswer = $("<div class='newAnswer'>"); newAnswer = $("<div class='newAnswer'>");
ansInput = $("<input type='checkbox' value='" + array[i].answers[j].value + "' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer); ansInput = $("<input type='checkbox' value='" + array[i].answers[j].value + "' style='float: left; margin-right: 10px;'/>").appendTo(newAnswer);
ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer); ansSpan = $("<span class='ansSpanDisplay'>" + ansCount + ".</span>").appendTo(newAnswer);
ansContent = $("<div class='ansContentDisplay'>" + array[i].answers[j].text + "</div>").appendTo(newAnswer); ansContent = $("<div class='ansContentDisplay'><span id='answerText'>" + array[i].answers[j].text + "</span></div>").appendTo(newAnswer);
newAnswer.appendTo(ansDiv); newAnswer.appendTo(ansDiv);
break; break;
case "3": case "3":

Loading…
Cancel
Save