” + (xid1+1) + “. ” + this.question + “
” }); var BPAnswers = $ (“”, { class: “BPAnswers” }); $ .each(this.alternatives, function(xid2){ if(xid2 == 0 && this.alternative.length == 0){ useText = false; } if(this.correct){ if(useText){ if(this.picture == null && this.alternative.length > 0){ BPAnswers.append(“
Riktig svar: ” + this.alternative + “
“); if(parseInt(answers[xid1]) == xid2){ BPAnswers.append(“
Du svarte riktig!
“); html.find(“.BPQuestion”).addClass(“correct”); correct = true; } } else if(this.picture != null && this.alternative.length > 0){ BPAnswers.append(“”); if(parseInt(answers[xid1]) == xid2){ BPAnswers.append(“
Du svarte riktig!
“); html.find(“.BPQuestion”).addClass(“correct”); correct = true; } useQuestionPicture = false; } } else if(this.picture != null){ BPAnswers.append(“”); if(parseInt(answers[xid1]) == xid2){ BPAnswers.append(“
Du svarte riktig!
“); html.find(“.BPQuestion”).addClass(“correct”); correct = true; } useQuestionPicture = false; } } }); if(!correct){ if(useText){ if(this.alternatives[answers[xid1]].picture == null && this.alternatives[answers[xid1]].alternative.length > 0) BPAnswers.append(“
Du svarte: ” + this.alternatives[answers[xid1]].alternative + “
“); else if(this.alternatives[answers[xid1]].picture != null && this.alternatives[answers[xid1]].alternative.length > 0) BPAnswers.append(“
Du svarte:
” + this.alternatives[answers[xid1]].alternative + “
“); } else if(this.alternatives[answers[xid1]].picture != null) BPAnswers.append(“”); } if(useQuestionPicture && this.picture != null){ BPAnswers.prepend(“”); } BPAnswers.append(“”); html.append(BPAnswers); $ (“.bluePrint”).append(html); }); $ (“.showBluePrint”).click(function(){ $ (“.bluePrint”).slideToggle(function(){ if($ (“.bluePrint”).is(“:visible”)){ $ (“.showBluePrint .btnSign”).html(“-”); $ (“.showBluePrint .text”).html(“Skjul fasit”); } else { $ (“.showBluePrint .btnSign”).html(“+”); $ (“.showBluePrint .text”).html(“Vis fasit”); } }); }); } } // Show question else{ if($ (“[name='quizObj']“).val() != “”){ var jsonQuiz = jQuery.parseJSON($ (“[name='quizObj']“).html()); var question = jsonQuiz["questions"][-1]; $ (“.quiz .header”).html(“”); $ (“.question”).html(“0/0 ” + question.question + “
No comments:
Post a Comment