Widget:WJG Sandbox: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 37: | Line 37: | ||
margin-right:10px; | margin-right:10px; | ||
} | } | ||
.WBRImgButton{ | |||
font-family:Arial; | |||
float:left; | |||
height:40px; | |||
font-weight:bold; | |||
width:150px; | |||
display: table-cell; | |||
cursor: pointer; | |||
color:#FFFFFF; | |||
text-align: center; | |||
vertical-align: middle; | |||
margin-right:10px; | |||
} | |||
.WBRImgButton img{ | |||
width:auto; | |||
height:35px; | |||
} | |||
#globalWrapper{ | #globalWrapper{ | ||
z-index:-1; | z-index:-1; | ||
Line 260: | Line 280: | ||
} | } | ||
function removeDuplicates(obj) { | function removeDuplicates(obj) { | ||
var output = "<div id='removeNum'><b>Choose the number of questions you would like to answer. The maximum number of questions you can select is <span id='countShow'>" + | var output = "<div id='removeNum'><b>Choose the number of questions you would like to answer. The maximum number of questions you can select is <span id='countShow'>" + obj.questionListAll.length + "</span>.</b><br /><br /><br />Number of questions:<input type='text' id='numQues' /><br /><br /><div id='Go' class='noSelect WBRButton'>Click here to begin the exam</div></div>"; | ||
if ($("#exam").find('#numQues').length == 0) { | if ($("#exam").find('#numQues').length == 0) { | ||
$("#exam").append(output); | $("#exam").append(output); | ||
Line 310: | Line 330: | ||
for (var i = 0; i < categories['sub'].length; i++) { | for (var i = 0; i < categories['sub'].length; i++) { | ||
if (categories['main'][i]) { | if (categories['main'][i]) { | ||
table += "<tr><td><input type='checkbox' name='MainCat' value='" + categories['main'][i] + "' />" + categories['main'][i] + " ( " + exam.arrCounts['category']['main'][categories['main'][i]] + " ) </td><td><input type='checkbox' name='SubCat' value='" + categories['sub'][i] + "' />" + categories['sub'][i] + " ( " + exam.arrCounts['category']['sub'][categories['sub'][i]]+ " )</td></tr>"; | table += "<tr><td><input type='checkbox' name='MainCat' value='" + categories['main'][i] + "' />" + categories['main'][i] + " ( " + exam.arrCounts['category']['main'][categories['main'][i]] + " ) </td><td><input type='checkbox' name='SubCat' value='" + categories['sub'][i] + "' />" + categories['sub'][i] + " ( " + exam.arrCounts['category']['sub'][categories['sub'][i]] + " )</td></tr>"; | ||
} else { | } else { | ||
table += "<tr><td></td><td><input type='checkbox' name='SubCat' value='" + categories['sub'][i] + "' />" + categories['sub'][i] + " ( " + exam.arrCounts['category']['sub'][categories['sub'][i]] + " ) </td></tr>"; | table += "<tr><td></td><td><input type='checkbox' name='SubCat' value='" + categories['sub'][i] + "' />" + categories['sub'][i] + " ( " + exam.arrCounts['category']['sub'][categories['sub'][i]] + " ) </td></tr>"; | ||
Line 460: | Line 480: | ||
} | } | ||
function addToNavBar(exam) { | function addToNavBar(exam) { | ||
$("#exam").html("<div id='navBar'><div id='back' class='noSelect | $("#exam").html("<div id='navBar'><div id='back' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/b/bd/WBRLeftArrow.png' /></div><div id='next' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/5/54/WBRRightArrow.png' /></div><div id='finish' class='noSelect WBRButton'><br />Finish</div></div><div id='navPane'></div><div id='examSpace'></div><span id='timeRem' style='height: 0px; visibility: hidden'>" + exam.timeAmt.toString() + "</span>"); | ||
$("#back").click(exam, questionNavigation); | $("#back").click(exam, questionNavigation); | ||
$("#next").click(exam, questionNavigation); | $("#next").click(exam, questionNavigation); | ||
Line 473: | Line 493: | ||
$("#navPane").append("<div id='" + index + "' class='navPaneButton'> " + (index - -1) + "</div>"); | $("#navPane").append("<div id='" + index + "' class='navPaneButton'> " + (index - -1) + "</div>"); | ||
}); | }); | ||
$(".navPaneButton").click(exam, questionNavigation); | |||
$("#" + exam.currentQuestion).addClass("boxed"); | $("#" + exam.currentQuestion).addClass("boxed"); | ||
$(".navPaneButton:odd").css("background-color", "#3338CC"); | $(".navPaneButton:odd").css("background-color", "#3338CC"); | ||
$(".navPaneButton:odd").css("background-color", "#B0B0B0"); | $(".navPaneButton:odd").css("background-color", "#B0B0B0"); | ||
Line 485: | Line 507: | ||
parseQuestions(exam); | parseQuestions(exam); | ||
} else { | } else { | ||
var htmlStuff = " | var htmlStuff = "<b>Question " + (exam.currentQuestion - -1) + " / " + (exam.examQuestions.length) + "</b><br /><br />" + obj.Prompt + "<br />"; | ||
if (obj.AnswerA && obj.AnswerA.length > 0) { | if (obj.AnswerA && obj.AnswerA.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='A'><input type='radio' value='A' id='Ar'>" + trimP(obj.AnswerA) + "</div>"; | htmlStuff += "<div class='answer answerNoBorder' id='A'><input type='radio' value='A' id='Ar'>" + trimP(obj.AnswerA) + "</div>"; | ||
Line 587: | Line 609: | ||
$("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).removeClass("answerNoBorder"); | $("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).removeClass("answerNoBorder"); | ||
} | } | ||
$("#examSpace").append("<br /><br />The correct answer is: " + exam.examQuestions[exam.currentQuestion].RightAnswer + "<br /><br /><b>" + exam.examQuestions[exam.currentQuestion].Explanation + "</b><br />"); | $("#examSpace").append("<br /><br />The correct answer is: " + exam.examQuestions[exam.currentQuestion].RightAnswer + "<br /><br /><b>" + exam.examQuestions[exam.currentQuestion].Explanation + "</b><br /><br />"); | ||
} | } | ||
} | } | ||
Line 660: | Line 682: | ||
} | } | ||
}); | }); | ||
} | } | ||
$("div.answer").unbind('click'); | $("div.answer").unbind('click'); | ||
Line 677: | Line 700: | ||
} else if (event.data.examType === "Tutor") { | } else if (event.data.examType === "Tutor") { | ||
$("#examSpace").append("<br /><br />The correct answer is: " + event.data.examQuestions[event.data.currentQuestion].RightAnswer + "<br /><br /><i>" + event.data.examQuestions[event.data.currentQuestion].Explanation + "</i><br />"); | $("#examSpace").append("<br /><br />The correct answer is: " + event.data.examQuestions[event.data.currentQuestion].RightAnswer + "<br /><br /><i>" + event.data.examQuestions[event.data.currentQuestion].Explanation + "</i><br />"); | ||
$("#examSpace").append("<b>Author:</b> " + event.data.examQuestions[event.data.currentQuestion].PageAuthor + "<br /><br /><b>Wiki Page:</b>" + event.data.examQuestions[event.data.currentQuestion].PageName + "<br /><br />"); | |||
$("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed"); | $("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed"); | ||
$("#" + event.data.examQuestions[event.data.currentQuestion].RightAnswer).addClass("redBoxed"); | $("#" + event.data.examQuestions[event.data.currentQuestion].RightAnswer).addClass("redBoxed"); | ||
addRatyRating(event.data); | addRatyRating(event.data); | ||
} | } | ||
} | } | ||
function questionNavigation(event) { | function questionNavigation(event) { |