Widget:Sandbox: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
(15 intermediate revisions by the same user not shown) | |||
Line 528: | Line 528: | ||
}); | }); | ||
$(".navPaneButton").click(questionNavigation); | $(".navPaneButton").click(questionNavigation); | ||
$(".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 674: | Line 672: | ||
} | } | ||
data.firstResponseSum = parseInt(data.firstResponseQuery.A) + parseInt(data.firstResponseQuery.B) + parseInt(data.firstResponseQuery.C) + parseInt(data.firstResponseQuery.D) + parseInt(data.firstResponseQuery.E); | data.firstResponseSum = parseInt(data.firstResponseQuery.A) + parseInt(data.firstResponseQuery.B) + parseInt(data.firstResponseQuery.C) + parseInt(data.firstResponseQuery.D) + parseInt(data.firstResponseQuery.E); | ||
$("#Ae").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.A/data.firstResponseSum)*100).toString() + "%"); | $("#Ae").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.A / data.firstResponseSum) * 100).toString() + "%"); | ||
$("#Be").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.B/data.firstResponseSum)*100).toString() + "%"); | $("#Be").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.B / data.firstResponseSum) * 100).toString() + "%"); | ||
$("#Ce").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.C/data.firstResponseSum)*100).toString() + "%"); | $("#Ce").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.C / data.firstResponseSum) * 100).toString() + "%"); | ||
$("#De").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.D/data.firstResponseSum)*100).toString() + "%"); | $("#De").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.D / data.firstResponseSum) * 100).toString() + "%"); | ||
$("#Ee").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.E/data.firstResponseSum)*100).toString() + "%"); | $("#Ee").append("<br />Selected as first response:" + parseInt((data.firstResponseQuery.E / data.firstResponseSum) * 100).toString() + "%"); | ||
}); | }); | ||
} | } | ||
function answerClicked(event) { | function answerClicked(event) { | ||
$(".answer").removeClass("boxed"); | $(".answer").removeClass("boxed"); | ||
$( | |||
$(event.currentTarget).addClass("boxed"); | |||
$(event.currentTarget.firstChild).prop("checked", true); | |||
$( | window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer = $("div .boxed").attr("id"); | ||
$( | |||
if ($("#exam").find('#submit').length == 0) { | if ($("#exam").find('#submit').length == 0) { | ||
$("#examSpace").append("<div class='noSelect WBRButton' id='submit'><br />Submit</div>"); | $("#examSpace").append("<div class='noSelect WBRButton' id='submit'><br />Submit</div>"); | ||
Line 733: | Line 730: | ||
function answerSubmitted(event) { | function answerSubmitted(event) { | ||
$("#submit").remove(); | $("#submit").remove(); | ||
if (!window.exam.examQuestions[window.exam.currentQuestion].creditRecieved && window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer === window.exam.examQuestions[window.exam.currentQuestion].RightAnswer) { | if (!window.exam.examQuestions[window.exam.currentQuestion].creditRecieved && window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer === window.exam.examQuestions[window.exam.currentQuestion].RightAnswer) { | ||
window.exam.answeredRight += 1; | window.exam.answeredRight += 1; | ||
Line 775: | Line 771: | ||
} | } | ||
function questionNavigation(event) { | function questionNavigation(event) { | ||
if ($(this).attr("id") === "back") { | if ($(this).attr("id") === "back") { | ||
window.exam.currentQuestion--; | window.exam.currentQuestion--; | ||
Line 783: | Line 778: | ||
window.exam.currentQuestion = $(this).attr("id"); | window.exam.currentQuestion = $(this).attr("id"); | ||
} | } | ||
questionDisplay(window.exam); | questionDisplay(window.exam); | ||
} | } | ||
function questionReviewNavigation(event) { | function questionReviewNavigation(event) { | ||
if ($(this).attr("id") === "back") { | if ($(this).attr("id") === "back") { | ||
window.exam.currentQuestion--; | window.exam.currentQuestion--; | ||
Line 795: | Line 788: | ||
window.exam.currentQuestion = $(this).attr("id"); | window.exam.currentQuestion = $(this).attr("id"); | ||
} | } | ||
questionReview(window.exam); | questionReview(window.exam); | ||
} | } | ||
Line 1,016: | Line 1,008: | ||
} | } | ||
$(document).ready(ensureLoggedIn); | $(document).ready(ensureLoggedIn); | ||
</script> | </script> | ||
<div id="exam">pewp</div> | <div id="exam">pewp</div> | ||
</includeonly> | </includeonly> |