Widget:WJG Sandbox: Difference between revisions
Jump to navigation
Jump to search
Created page with "<includeonly> <script src="http://wikidoc.org/includes/jquery.timer.js"></script> <script type="text/javascript" src="http://wikidoc.org/includes/raty/lib/jquery.raty.js"></sc..." |
Undo revision 1008029 by William J Gibson (talk) |
||
(326 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<includeonly> | <includeonly> | ||
<script src="http://wikidoc.org/includes/jquery.timer.js"></script> | <base target="_blank"> | ||
<script type="text/javascript" src="http://wikidoc.org/includes/raty/ | <script src="http://www.wikidoc.org/includes/raty/jquery.timer.js"></script> | ||
<script type="text/javascript" src="http://www.wikidoc.org/includes/raty/jquery.raty.js"></script> | |||
<script src='http://dl.dropboxusercontent.com/u/1874620/ChartNew.js'></script> | |||
<script type="text/javascript" src="http://wikidoc.org/extensions/WGTextHighlight/jquery.textHighlighter.js"></script> | |||
<head> | |||
<link rel="stylesheet" href="http://dl.dropboxusercontent.com/u/1874620/animate.css"> | |||
</head> | |||
<style type="text/css"> | <style type="text/css"> | ||
input[type=radio].css-checkbox { | |||
display:none; | |||
} | |||
input[type=radio].css-checkbox + label.css-label { | |||
display: inline-block; | |||
*display: inline; | |||
vertical-align: middle; | |||
margin: 0; | |||
width: 20px; | |||
height: 20px; | |||
background-repeat: no-repeat; | |||
background: url(http://dl.dropboxusercontent.com/u/1874620/iCheck/flat/blue.png) no-repeat; | |||
border: none; | |||
cursor: pointer; | |||
background-position: -88px 0; | |||
} | |||
input[type=radio].css-checkbox:checked + label.css-label { | |||
background-position: -110px 0; | |||
} | |||
label.css-label { | |||
background-image:url(http://dl.dropboxusercontent.com/u/1874620/iCheck/flat/blue.png); | |||
-webkit-touch-callout: none; | |||
-webkit-user-select: none; | |||
-khtml-user-select: none; | |||
-moz-user-select: none; | |||
-ms-user-select: none; | |||
user-select: none; | |||
} | |||
.examOptionButton { | |||
font:14px/20px'MontserratRegular', Helvetica, Arial, sans-serif; | |||
color: #444; | |||
} | |||
.examOptionTitle { | |||
font:24px'MontserratRegular', Helvetica, Arial, sans-serif; | |||
color:#222 | |||
} | |||
@media (-o-min-device-pixel-ratio: 5/4), (-webkit-min-device-pixel-ratio: 1.25), (min-resolution: 120dpi) { | |||
input[type=radio].css-checkbox + label.css-label { | |||
background-image: url(http://dl.dropboxusercontent.com/u/1874620/iCheck/flat/blue@2x.png); | |||
-webkit-background-size: 176px 22px; | |||
background-size: 176px 22px; | |||
} | |||
} | |||
a{ | |||
target-name:new; | |||
target-new:tab; | |||
} | |||
body{ | |||
width:100%; | |||
margin:0; | |||
background-color:#FFFFFF; | |||
} | |||
#details{ | |||
position:absolute; background:white; border: 1px solid #D1C9C2; border-top: 0; width: 400px; margin: 0 auto; padding: 7px 15px; text-align: left; -webkit-border-bottom-right-radius: 6px; -webkit-border-bottom-left-radius: 6px; -moz-border-radius-bottomright: 6px; -moz-border-radius-bottomleft: 6px; border-bottom-right-radius: 6px; border-bottom-left-radius: 6px; | |||
} | |||
#content.mw-body{ | |||
width:100%; | |||
padding:0; | |||
margin-left:0; | |||
margin:0; | |||
border:none; | |||
} | |||
#bodyContent{ | |||
width:100%; | |||
height:90%; | |||
margin:0; | |||
} | |||
#chooseQBank{ | |||
background-color:#0e83cd; | |||
} | |||
body{ | |||
width:100%; | |||
margin:0; | |||
} | |||
/*Here's some css for the buttons used to select an exam. (.Curric buttons). | |||
lines comment*/ | |||
.round-button { | |||
width:100px; | |||
display:inline-block; | |||
cursor:pointer; | |||
} | |||
.round-button-circle { | |||
width: 100%; | |||
height:0; | |||
padding-bottom: 100%; | |||
border-radius: 50%; | |||
border:0px solid #cfdcec; | |||
overflow:hidden; | |||
opacity:50%; | |||
background: #3C9AD6; | |||
} | |||
.round-button p { | |||
font-family: 'Lato', Calibri, Arial, sans-serif; | |||
display:block; | |||
float:left; | |||
width:100%; | |||
padding-top:50%; | |||
padding-bottom:50%; | |||
line-height:1em; | |||
margin-top:-0.5em; | |||
text-align:center; | |||
color:white; | |||
font-size:3.2em; | |||
text-decoration:none; | |||
} | |||
.round-button p:hover { | |||
color:#0e83cd; | |||
transition: background 0.2s, color 0.2s; | |||
} | |||
.round-button-circle:hover { | |||
width: 100%; | |||
height:0; | |||
padding-bottom: 100%; | |||
border-radius: 50%; | |||
border-spacing:5px; | |||
border:3px solid #0e83cd; | |||
overflow:hidden; | |||
box-shadow: 0 0 0 4px #fff; | |||
transition: background 0.2s, color 0.2s; | |||
background: white; | |||
} | |||
#spacer{ | |||
margin:10px | |||
} | |||
.container > header { | |||
font-family: 'Lato', Calibri, Arial, sans-serif; | |||
margin: 0 auto; | |||
padding: 2em 1em 2em; | |||
width: 100%; | |||
text-align: center; | |||
background: #fff; | |||
z-index: 999999; | |||
-webkit-backface-visibility: hidden; | |||
border-bottom:none; | |||
margin-bottom:20px; | |||
} | |||
.container > header h1 { | |||
font-size: 3.625em; | |||
line-height: 1.3; | |||
margin: 0; | |||
font-weight: 300; | |||
color: #aaa; | |||
background: #fff; | |||
border-bottom:none; | |||
} | |||
.container > header span { | |||
display: block; | |||
font-size: 60%; | |||
opacity: 0.6; | |||
padding: 0 0 0.6em 0.1em; | |||
border-bottom:none; | |||
} | |||
.examButtons { | |||
text-align: center; | |||
margin: 0 auto; | |||
padding: 2em 0 3em; } | |||
.boxed{ | .boxed{ | ||
border: | border:0px solid black !important; | ||
} | } | ||
.redBoxed{ | .redBoxed{ | ||
border: | border:0px solid #F00 !important; | ||
} | |||
.answer{display: inline} | |||
.ans_text{ | |||
display: inline; | |||
cursor: pointer; | |||
} | |||
.choice_elim{ | |||
opacity:0.9; | |||
text-decoration:line-through; | |||
} | |||
.flagged{ | |||
color:#FF0000; | |||
} | |||
.labvalson{ | |||
display:visible; | |||
} | } | ||
.unboxed{ | .unboxed{ | ||
Line 37: | Line 247: | ||
margin-right:10px; | margin-right:10px; | ||
} | } | ||
.WBRImgButton{ | |||
font-family:Arial; | |||
float:left; | |||
height:40px; | |||
font-weight:bold; | |||
width:100px; | |||
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; | ||
} | } | ||
#content{ | |||
height:100%;} | |||
#exam{ | |||
height:90%; | |||
border:none; | |||
padding:0; | |||
} | |||
#mw-content-text{ | |||
height:100%;} | |||
#navPane{ | #navPane{ | ||
position:relative; | position:relative; | ||
float:left; | float:left; | ||
width: | width:5%; | ||
height:100%; | |||
overflow-y:scroll; | |||
} | } | ||
#examSpace{ | #examSpace{ | ||
position:relative; | position:relative; | ||
float:right; | float:right; | ||
width: | width:94%; | ||
height:90%; | |||
overflow-y:scroll; | |||
} | |||
#navBar{ | |||
position:relative; | |||
float:right; | |||
width:95%; | |||
background-color:#3366CC; | |||
} | |||
#bottomBar{ | |||
height:40px; | |||
position:relative; | |||
float:right; | |||
width:100%; | |||
background-color:#3366CC; | |||
} | |||
#pauseButton{ | |||
float:right; | |||
margin-bottom:0px; | |||
height:95%; | |||
} | |||
#stopButton{ | |||
float:right; | |||
margin-right: 5%; | |||
height=95%; | |||
margin-bottom:0px; | |||
} | } | ||
.navPaneButton{ | .navPaneButton{ | ||
height: | height:20px; | ||
background-color:# | background-color:#D0D0D0; | ||
padding-top:5px; | padding-top:5px; | ||
font-weight:bold; | font-weight:bold; | ||
text-align: center; | text-align: center; | ||
} | } | ||
div.answerNoBorder{ | div.answerNoBorder{ | ||
border: | border:0px solid #FFF; | ||
} | } | ||
div.answerBorder{ | div.answerBorder{ | ||
border: | border:0px solid #000; | ||
} | } | ||
div.explanationHide{ | div.explanationHide{ | ||
Line 73: | Line 340: | ||
visibility:visible; | visibility:visible; | ||
} | } | ||
#tutorOrExamContainer{ | |||
background-color:#E3E5E5; | |||
} | |||
</style> | </style> | ||
<script type="text/javascript"> | <script type="text/javascript"> | ||
function ensureLoggedIn(){ | function ensureLoggedIn() { | ||
mw.loader.load('mediaWiki.user'); | mw.loader.load('mediaWiki.user'); | ||
if ($.isEmptyObject(wgUserName)) { | if ($.isEmptyObject(wgUserName)) { | ||
alert("Please Log In To Continue."); | |||
window.location.replace("http://www.wikidoc.org/index.php?title=Special:UserLogin&returnto=User%3AMatt+Pijoan"); | |||
} else { | |||
curriculumType(); | curriculumType(); | ||
} | } | ||
} | } | ||
function curriculumType() { | function curriculumType() { | ||
Line 89: | Line 360: | ||
timer : null, | timer : null, | ||
qbank : null, | qbank : null, | ||
searchMethod : null, | |||
timer : null, | timer : null, | ||
examType : '', | |||
timeAmt : 0, | timeAmt : 0, | ||
questionListAll : new Array(), | questionListAll : new Array(), | ||
Line 116: | Line 387: | ||
selectedAnswer : 'F', | selectedAnswer : 'F', | ||
lastParsed : 0, | lastParsed : 0, | ||
creditReceived : false | |||
} | } | ||
} | } | ||
var | var background_html="<div class='container'><header><h1 class='animated bounceInDown'>Wikidoc Board Review </br> <span>Please select an exam below</span></h1></header></div>"; | ||
stuffs += "< | $("#chooseQBank").html(background_html); | ||
stuffs += "< | var bottom_html="<div id='bottomwelcome'></div>"; | ||
stuffs += "< | |||
var stuffs = "<div class='round-button Curric' id='MCAT'><div class='round-button-circle'><p class='round-button' style='font-size:2.5em;'>MCAT</p></div></div><div id='spacer' style='display: inline'></div>"; | |||
$("# | stuffs += "<div class='round-button Curric' id='USMLE Step 1'><div class='round-button-circle'><p class='round-button'>1</p></div></div><div id='spacer' style='display: inline'></div>"; | ||
stuffs += "<div class='round-button Curric' id='USMLE Step 2 CK'><div class='round-button-circle'><p class='round-button'>2</p></div></div><div id='spacer' style='display: inline'></div>"; | |||
stuffs += "<div class='round-button Curric' id='USMLE Step 3'><div class='round-button-circle'><p class='round-button'>3</p></div></div><div id='spacer' style='display: inline'></div>"; | |||
stuffs += "<div class='round-button Curric' id='Board Review'><div class='round-button-circle'><p class='round-button' style='font-size:2.5em;'>ABIM</p></div></div><div id='spacer' style='display: inline'></div><br /><br />"; | |||
stuffs+="<div class='stepBar'><img src='http://static.wikidoc.org/f/f3/Step_bar_5_22_14.png' /></div>"; | |||
// $("#chooseQBank").hide(); | |||
$("#chooseQBank").html(background_html+"<div class='examButtons'>" + stuffs + "</div>"); | |||
// $("#chooseQBank").slideDown('slow'); | |||
$('.Curric').click(options, chooseQBank); | $('.Curric').click(options, chooseQBank); | ||
} | } | ||
function chooseQBank(event) { | function chooseQBank(event) { | ||
event.data.examtype = $(this).attr('id'); | event.data.examtype = $(this).attr('id'); | ||
$("#chooseQBank").remove();//Once the QBank is picked, we'll remove the div that held it. | |||
$("#exam").show(); | |||
var divs = null; | var divs = null; | ||
divs = "< | divs = "<div class= 'container' id='optionScreenHeader' style='height:200px' ><header><h1>" +event.data.examtype+ " </br> <span> Select your options below</span></h1></header></div><div id='Pat' class='noSelect WBRButton stepTwo'><br />USMLE Format</div><div id='Flash' class='noSelect WBRButton stepTwo'><br />Flash Cards</div><br /><br /><br />"; | ||
$("#exam").html(divs); | $("#exam").html(divs); | ||
var temp_str="<div id= 'examOptions'></div>"; | |||
//$("#exam").append(temp_str); | |||
var tutorOrExam="<div class='container' id='tutorOrExamContainer' style='height:110px'>"+ | |||
"<div class='round-button Curric' id='tutorModeBigButton' style='margin-left:calc(50% - 100px); margin-top:5px'><div class='round-button-circle'><p class='round-button' style='font-size:1.5em;'>Tutor \n Mode</p></div></div><div id='spacer' style='display: inline'></div>"+ | |||
"<div class='round-button Curric' id='examModeBigButton'><div class='round-button-circle'><p class='round-button' style='font-size:1.5em;'>Exam \n Mode</p></div></div><div id='spacer' style='display: inline'></div>"+ | |||
"</div>" | |||
$("#optionScreenHeader").after(tutorOrExam); | |||
var examOptionButtons = "<div style='background:#fafafa; color:#222; padding:10px;'>"+ | |||
" <h3 class='examOptionTitle'>Exam Mode</h3>"+ | |||
" <form id='examModeForm'>"+ | |||
" <input type='radio' name='examMode' value='exam' id='examModeButton' class='css-checkbox' />"+ | |||
" <label for='examModeButton' class='css-label cb0 radGroup2'></label>"+ | |||
" <p class='examOptionButton' style='display:inline'>  Exam</p>"+ | |||
" <br />"+ | |||
" <input type='radio' name='examMode' value='tutor' id='tutor' class='css-checkbox' />"+ | |||
" <label for='tutor' class='css-label cb0 radGroup2'></label>"+ | |||
" <p class='examOptionButton' style='display:inline'>  Tutor</p>"+ | |||
" <br />"+ | |||
" </form>" + | |||
"</div>"+ | |||
"<div style='background:#fafafa; color:#222; padding:10px;'>"+ | |||
" <h3 class='examOptionTitle'>Question Selection</h3>"+ | |||
" <form id='CatKeyForm'>"+ | |||
" <input type='radio' name='CatKey' value='category' id='category' class='css-checkbox' />"+ | |||
" <label for='category' class='css-label cb0 radGroup2'></label>"+ | |||
" <p class='examOptionButton' style='display:inline'>  Category</p>"+ | |||
" <br />"+ | |||
" <input type='radio' name='CatKey' value='keyword' id='keyword' class='css-checkbox' />"+ | |||
" <label for='keyword' class='css-label cb0 radGroup2'></label>"+ | |||
" <p class='examOptionButton' style='display:inline'>  Keyword</p>"+ | |||
" </form>"+ | |||
"</div>"; | |||
$("#tutorOrExamContainer").after(examOptionButtons); | |||
recordResponses() | |||
$('.stepTwo').click(event.data, tutorOrExam); | $('.stepTwo').click(event.data, tutorOrExam); | ||
} | |||
function recordResponses(){ | |||
$("input:radio[name=examMode]").click(function() { | |||
var value = $(this).val(); | |||
console.log(value) | |||
}); | |||
$("input:radio[name=CatKey]").click(function() { | |||
var value = $(this).val(); | |||
console.log(value) | |||
}); | |||
} | |||
function chooseExamOptions(event) { | |||
$("#chooseQBank").remove();//Once the QBank is picked, we'll remove the div that held it. | |||
$("#exam").show(); | |||
$("#examOptions").append(""+ | |||
"<select id ='ToE' name='Exam Type'>" + | |||
"<option value='Tutor'>Tutor Mode</option>" + | |||
"<option value='Exam'>Exam Mode</option>" + | |||
"</select>" + | |||
"<select id ='catOrKey' name='Question Selection'>" + | |||
"<option value='Category'>Category</option>" + | |||
"<option value='Keyword'>Keyword</option>" + | |||
"</select>" + | |||
"<select id ='Timed' name='Timer'>" + | |||
"<option value='Untimed'>Untimed</option>" + | |||
"<option value='Timed'>Timed</option>" + | |||
"</select>"); | |||
//$("#exam").append("<div id='displayVals'></div>"); | |||
} | } | ||
function displayVals() { | |||
var tutor_or_exam_val = $( "#ToE" ).val(); | |||
var cat_or_key_val= $( "#catOrKey" ).val(); | |||
var timerSetting=$("#Timed").val(); | |||
$( "#displayVals" ).html( "<b>Tutor or Exam:</b> " + tutor_or_exam_val + "<br>" + | |||
" <b>Category or Keyword:</b> " + cat_or_key_val + "<br>" + | |||
"<b> Timed or Untimed: </b>" + timerSetting); | |||
} | |||
function tutorOrExam(event) { | function tutorOrExam(event) { | ||
event.data.qbank = $(this).attr('id'); | event.data.qbank = $(this).attr('id'); | ||
var buttons = ''; | |||
buttons = "<div id='Tutor' class='noSelect WBRButton ToE'><br />Tutor Mode</div><div id='Exam' class='noSelect WBRButton ToE'><br />Exam Mode</div><br /><br /><br />"; | |||
$("#exam").append(buttons); | $("#exam").append(buttons); | ||
$('.ToE').click(event.data, categoryOrKeyword); | |||
} | } | ||
function categoryOrKeyword(event) { | function categoryOrKeyword(event) { | ||
event.data.examType = $(this).attr('id'); | event.data.examType = $(this).attr('id'); | ||
var buttons = ''; | |||
buttons = "<div id='Category' class='noSelect WBRButton CoK'><br />Category</div><div id='Keyword' class='noSelect WBRButton CoK'><br />Keyword</div><br /><br /><br />"; | |||
$("#exam").append(buttons); | $("#exam").append(buttons); | ||
$('.CoK').click(event.data, timerToggle); | |||
} | } | ||
function timerToggle(event) { | function timerToggle(event) { | ||
event.data.searchMethod = $(this).attr('id'); | |||
var form = null; | var form = null; | ||
form = "<div id='yes' class='noSelect WBRButton stepThree'><br />Enable Timer</div><div id='nop' class='noSelect WBRButton stepThree'><br />Disable Timer</div><br /><br /><br />"; | form = "<div id='yes' class='noSelect WBRButton stepThree'><br />Enable Timer</div><div id='nop' class='noSelect WBRButton stepThree'><br />Disable Timer</div><br /><br /><br />"; | ||
Line 157: | Line 524: | ||
} | } | ||
$('#yes').click(event.data, timerDuration); | $('#yes').click(event.data, timerDuration); | ||
if (event.data.searchMethod === "Category") { | |||
$('#nop').click(event.data, countCats); | |||
} else { | |||
$('#nop').click(event.data, Keywords); | |||
} | |||
} | } | ||
function timerDuration(event) { | function timerDuration(event) { | ||
event.data.timer = true; | |||
var form = null; | |||
form = "<div id='1' class='noSelect WBRButton stepFour'><br />1 Minute</div><div id='10' class='noSelect WBRButton stepFour'><br />10 Minute</div><div id='20' class='noSelect WBRButton stepFour'><br />20 Minutes</div><div id='40' class='noSelect WBRButton stepFour'><br />40 Minutes</div><br /><br /><br />" | |||
if ($("#exam").find('#1').length == 0) { | |||
$("#exam").append(form); | |||
} | |||
if (event.data.searchMethod === "Category") { | |||
$('.stepFour').click(event.data, | $('.stepFour').click(event.data, countCats); | ||
} else { | |||
$('.stepFour').click(event.data, Keywords); | |||
} | |||
} | } | ||
function Keywords(event) { | function Keywords(event) { | ||
var stuffs = "<div id='formSpace'></div><div class='WBRButton' id='orOp'><br />OR</div><div class='WBRButton' id='andOp'><br />AND</div><div class='WBRButton' id='showQueries'><br />SHOW</div><br /><br /><br />"; | |||
$("#exam").append(stuffs); | |||
var orBox = "<div class='query'> <input type='text' class='queryString' /> </div><br />"; | var orBox = "<div class='query'> <input type='text' class='queryString' /> </div><br />"; | ||
var andBox = " <input type='text' class='queryString' /> "; | var andBox = " <input type='text' class='queryString' /> "; | ||
Line 223: | Line 589: | ||
$("#showQueries").click(event.data, showQueries); | $("#showQueries").click(event.data, showQueries); | ||
function showQueries(event) { | function showQueries(event) { | ||
$("#removeNum").remove(); | |||
event.data.queries = []; | |||
event.data.questionListAll = []; | |||
event.data.keyword = {}; | |||
event.data.keyword.iterator = 0; | |||
$.each($(".query"),function (index, value) { | $.each($(".query"), function (index, value) { | ||
event.data.queries[index] = "[[ExamType::" + event.data.examtype + "]]"; | |||
$.each($(this).children(), function (ind, val) { | |||
event.data.queries[index] += "[[WBRKeyword::" + $(this).val() + "]]"; | |||
}); | }); | ||
}); | |||
runQueries(event.data); | |||
} | } | ||
function runQueries(obj) { | function runQueries(obj) { | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get({ | api.get({ | ||
Line 244: | Line 610: | ||
}) | }) | ||
.always(function (data) { | .always(function (data) { | ||
$.each(data.query.results, function (index, value) { | |||
obj.questionListAll.push(value.fulltext); | |||
}); | |||
if ((obj.keyword.iterator + 1) < obj.queries.length) { | |||
obj.keyword.iterator++; | |||
runQueries(obj); | |||
} else { | |||
removeDuplicates(obj); | |||
} | |||
}); | }); | ||
} | } | ||
function removeDuplicates(obj){ | function removeDuplicates(obj) { | ||
if(res.Count > 45){ | |||
obj.maxQ = 45; | |||
} else { | |||
obj.maxQ = res.Count; | |||
} | |||
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.maxQ + "</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>"; | |||
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'>" + maxQ + "</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); | ||
} else { | |||
alert('Please ensure you have valid keywords entered'); | |||
} | |||
$("#Go").click(obj, TNG); | |||
} | } | ||
} | } | ||
function TNG(event) { | |||
event.data.numQuestion = $("#numQues").val(); | |||
if(event.data.numQuestion > 0 && event.data.numQuestion <= 45){ | |||
loadNextQuestion(event.data); | |||
} else { | |||
alert('Invalid number of questions entered.'); | |||
} | |||
} | } | ||
function selectCats(exam) { | |||
function selectCats( | |||
var categories = []; | var categories = []; | ||
var table = null; | var table = null; | ||
table = "<br /><b>Select All That Apply:</b><br /><br /><br />"; ; | table = "<br /><b>Select All That Apply:</b><br /><br /><br />"; ; | ||
if ( | if (exam.examtype === "MCAT") { | ||
categories['main'] = new Array("Biology", "Cell", "Enzymes", "Microbiology", "Cellular Metabolism", "Reproduction", "Embryology", "Musculoskeletal System", "Digestive System ", "Excretory System", "Respiratory System", "Skin", "Circulatory System", "Immune System", "Homeostasis", "Endocrine System", "Nervous System ", "Genetics", "Evolution", "Organic Chemistry", "Nomenclature", "Bonding/Structure", "Isomers", "Alkanes", "AlkenesAlkynes", "Haloalkanes", "Aromatic Compounds", "Alcohols", "Ethers", "Aldehydes ", "Ketones", "Carboxylic Acid", "Carboxylic Acid Derivatives", "Amines", "Nitrogen Containing Compounds", "Purification", "Spectroscopy", "Separations", "Carbohydrates", "Amino Acids", "Peptides", "Proteins", "Nucleic", "Acids", "Chemistry", "Atomic Structure", "Periodic Table", "Phases", "Gases", "Bonding", "Stoichiometry", "Kinetics", "Thermochemistry", "Phases", "Solutions", "Acids and Bases", "Redox Reactions", "Electrochemistry", "Physics", "Kinematics", "Fluids", "Solids", "Newtonian Mechanics", "Momentum", "Energy", "Thermodynamics", "Electrostatics", "Magnetism", "DC Circuits", "AC Circuits", "Periodic Motion", "Waves", "Sound", "Optics", "Light", "Atomic Phenomena", "Nuclear Phenomena"); | categories['main'] = new Array("Biology", "Cell", "Enzymes", "Microbiology", "Cellular Metabolism", "Reproduction", "Embryology", "Musculoskeletal System", "Digestive System ", "Excretory System", "Respiratory System", "Skin", "Circulatory System", "Immune System", "Homeostasis", "Endocrine System", "Nervous System ", "Genetics", "Evolution", "Organic Chemistry", "Nomenclature", "Bonding/Structure", "Isomers", "Alkanes", "AlkenesAlkynes", "Haloalkanes", "Aromatic Compounds", "Alcohols", "Ethers", "Aldehydes ", "Ketones", "Carboxylic Acid", "Carboxylic Acid Derivatives", "Amines", "Nitrogen Containing Compounds", "Purification", "Spectroscopy", "Separations", "Carbohydrates", "Amino Acids", "Peptides", "Proteins", "Nucleic", "Acids", "Chemistry", "Atomic Structure", "Periodic Table", "Phases", "Gases", "Bonding", "Stoichiometry", "Kinetics", "Thermochemistry", "Phases", "Solutions", "Acids and Bases", "Redox Reactions", "Electrochemistry", "Physics", "Kinematics", "Fluids", "Solids", "Newtonian Mechanics", "Momentum", "Energy", "Thermodynamics", "Electrostatics", "Magnetism", "DC Circuits", "AC Circuits", "Periodic Motion", "Waves", "Sound", "Optics", "Light", "Atomic Phenomena", "Nuclear Phenomena"); | ||
for (var i = 0; i < categories['main'].length; i++) { | for (var i = 0; i < categories['main'].length; i++) { | ||
Line 300: | Line 660: | ||
} else { | } else { | ||
if ( | if (exam.examtype === "USMLE Step 1") { | ||
categories['main'] = new Array("Anatomy", "Behavioral Science/Psychiatry", "Biochemistry", "Biostatistics/Epidemiology", "Embryology", "Ethics", "Genetics", "Histology", "Immunology", "Microbiology", "Pathology", "Pathophysiology", "Pharmacology", "Physiology"); | categories['main'] = new Array("Anatomy", "Behavioral Science/Psychiatry", "Biochemistry", "Biostatistics/Epidemiology", "Embryology", "Ethics", "Genetics", "Histology", "Immunology", "Microbiology", "Pathology", "Pathophysiology", "Pharmacology", "Physiology"); | ||
categories['sub'] = new Array("Cardiology", "Dermatology", "Endocrine", "Gastrointestinal", "Genitourinary", "Head and Neck", "Hematology", "Musculoskeletal/Rheumatology", "Neurology", "Oncology", "Pulmonology", "Reproductive", "Renal", "Vascular", "General Principles", "Infectious Disease"); | categories['sub'] = new Array("Cardiology", "Dermatology", "Endocrine", "Gastrointestinal", "Genitourinary", "Head and Neck", "Hematology", "Musculoskeletal/Rheumatology", "Neurology", "Oncology", "Pulmonology", "Reproductive", "Renal", "Vascular", "General Principles", "Infectious Disease"); | ||
} else if ( | } else if (exam.examtype === "USMLE Step 2 CK") { | ||
categories['main'] = new Array("Internal medicine", "Surgery", "OB/GYN", "Pediatrics", "Psychiatry"); | categories['main'] = new Array("Internal medicine", "Surgery", "OB/GYN", "Pediatrics", "Psychiatry"); | ||
categories['sub'] = new Array("Allergy/Immunology", "Cardiovascular", "Dermatology", "Endocrine", "Gastrointestinal", "Hepatology", "Genitourinary", "Head and Neck", "Hematology", "Infectious Disease", "Musculoskeletal/Rheumatology", "Neurology", "Obstetrics and Gynecology", "Oncology", "Ophthalmology", "Pediatrics", "Poisoning", "Preventive Medicine", "Psychiatry", "Respiratory", "Surgery", "Biostatistics/ Epidemiology", "Ethics", "Electrolytes", "Genetics", "Miscellaneous"); | categories['sub'] = new Array("Allergy/Immunology", "Cardiovascular", "Dermatology", "Endocrine", "Gastrointestinal", "Hepatology", "Genitourinary", "Head and Neck", "Hematology", "Infectious Disease", "Musculoskeletal/Rheumatology", "Neurology", "Obstetrics and Gynecology", "Oncology", "Ophthalmology", "Pediatrics", "Poisoning", "Preventive Medicine", "Psychiatry", "Respiratory", "Surgery", "Biostatistics/ Epidemiology", "Ethics", "Electrolytes", "Genetics", "Miscellaneous"); | ||
} else if ( | } else if (exam.examtype === "USMLE Step 3") { | ||
categories['main'] = new Array("Community Medical Health Center", "Primary Care Office", "Inpatient Facilities", "Emergency Room"); | categories['main'] = new Array("Community Medical Health Center", "Primary Care Office", "Inpatient Facilities", "Emergency Room"); | ||
categories['sub'] = new Array("Allergy/Immunology", "Cardiovascular", "Dermatology", "Endocrine", "Gastrointestinal", "Hepatology", "Genitourinary", "Head and Neck", "Hematology", "Infectious Disease", "Musculoskeletal/Rheumatology", "Neurology", "Obstetrics and Gynecology", "Oncology", "Ophthalmology", "Pediatrics", "Poisoning", "Preventive Medicine", "Psychiatry", "Respiratory", "Surgery", "Biostatistics/Epidemiology", "Ethics", "Electrolytes", "Genetics", "Miscellaneous"); | categories['sub'] = new Array("Allergy/Immunology", "Cardiovascular", "Dermatology", "Endocrine", "Gastrointestinal", "Hepatology", "Genitourinary", "Head and Neck", "Hematology", "Infectious Disease", "Musculoskeletal/Rheumatology", "Neurology", "Obstetrics and Gynecology", "Oncology", "Ophthalmology", "Pediatrics", "Poisoning", "Preventive Medicine", "Psychiatry", "Respiratory", "Surgery", "Biostatistics/Epidemiology", "Ethics", "Electrolytes", "Genetics", "Miscellaneous"); | ||
} else if ( | } else if (exam.examtype === "Board Review") { | ||
categories['main'] = new Array("Adolescent Medicine", "Advanced Heart Failure and Transplant Cardiology", "Allergy & Immunology", "Cardiovascular Disease", "Clinical Cardiac Electrophysiology", "Critical Care Medicine", "Endocrinology", "Diabetes and Metabolism", "Gastroenterology", "Geriatric Medicine", "Hematology", "Hospice & Palliative Medicine", "Hospital Medicine", "Focused Practice", "Infectious Disease", "Internal Medicine", "Interventional Cardiology", "Medical Oncology", "Nephrology", "Pulmonary Disease", "Rheumatology", "Sleep Medicine", "Sports Medicine", "Transplant Hepatology"); | categories['main'] = new Array("Adolescent Medicine", "Advanced Heart Failure and Transplant Cardiology", "Allergy & Immunology", "Cardiovascular Disease", "Clinical Cardiac Electrophysiology", "Critical Care Medicine", "Endocrinology", "Diabetes and Metabolism", "Gastroenterology", "Geriatric Medicine", "Hematology", "Hospice & Palliative Medicine", "Hospital Medicine", "Focused Practice", "Infectious Disease", "Internal Medicine", "Interventional Cardiology", "Medical Oncology", "Nephrology", "Pulmonary Disease", "Rheumatology", "Sleep Medicine", "Sports Medicine", "Transplant Hepatology"); | ||
categories['sub'] = new Array("Anesthesiology", "Dermatology", "Emergency Medicine", "Emergency Medicine/Critical Care Medicine", "Family Medicine", "Medical Genetics", "Neurology", "Nuclear Medicine", "Pediatrics", "Physical Medicine & Rehab", "Preventative Medicine", "Psychiatry"); | categories['sub'] = new Array("Anesthesiology", "Dermatology", "Emergency Medicine", "Emergency Medicine/Critical Care Medicine", "Family Medicine", "Medical Genetics", "Neurology", "Nuclear Medicine", "Pediatrics", "Physical Medicine & Rehab", "Preventative Medicine", "Psychiatry"); | ||
Line 318: | Line 678: | ||
table += "<table style='width:100%;'><tr><td style='width:49%;'><b>Main Category</b></td><td style='width:49%;'><b>Sub Category</b></td></tr>"; | table += "<table style='width:100%;'><tr><td style='width:49%;'><b>Main Category</b></td><td style='width:49%;'><b>Sub Category</b></td></tr>"; | ||
if (categories['sub'].length >= categories['main'].length) { | if (categories['sub'].length >= categories['main'].length) { | ||
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] + " ( | |||
} else { | } else { | ||
table += "<tr><td></td><td><input type='checkbox' name='SubCat' value='" + categories['sub'][i] + "' />" + categories['sub'][i] + " ( | 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 369: | Line 728: | ||
}); | }); | ||
$("#CountQ").click( | $("#CountQ").click(exam, selectExamLength); | ||
} | } | ||
function selectExamLength(event) { | function selectExamLength(event) { | ||
var Main = new Array(); | var Main = new Array(); | ||
Line 384: | Line 742: | ||
Sub.push($(this).val()); | Sub.push($(this).val()); | ||
}); | }); | ||
event.data.mainCat = Main; | |||
event.data.subCat = Sub; | |||
var api = new mw.Api(event, Main, Sub); | |||
api.get({ | |||
action : 'catcount', | |||
main : JSON.stringify(Main), | |||
sub : JSON.stringify(Sub), | |||
exam : event.data.examtype, | |||
format : 'json' | |||
}, { | |||
ok : function (res) { | |||
if( res.Count > 45){ | |||
event.data.maxQ = 45; | |||
} else { | |||
event.data.maxQ = res.Count; | |||
} | |||
var output = "<b>Choose the number of questions you would like to answer. The maximum number of questions you can select is <span id='countShow'>" + event.data.maxQ + "</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>"; | |||
if ($("#exam").find('#numQues').length == 0) { | |||
$("#exam").append(output); | |||
} | |||
$("#Go").click(event.data, inputValidation); | |||
} | |||
}); | }); | ||
} else { | } else { | ||
alert('Please ensure you have both a main and a sub category selected'); | alert('Please ensure you have both a main and a sub category selected'); | ||
}} | } | ||
} | |||
function inputValidation(event) { | function inputValidation(event) { | ||
if ($("#numQues").val().length > 0 && parseInt($("#numQues").val(), 10) <= parseInt($("#countShow").html(), 10) && parseInt($("#numQues").val(), 10) > 0) { | if ($("#numQues").val().length > 0 && parseInt($("#numQues").val(), 10) <= parseInt($("#countShow").html(), 10) && parseInt($("#numQues").val(), 10) > 0) { | ||
Line 446: | Line 812: | ||
return (min > 0 ? pad(min, 2) : "00") + ":" + pad(sec, 2); | return (min > 0 ? pad(min, 2) : "00") + ":" + pad(sec, 2); | ||
} | } | ||
function loadNextQuestion(event) { | function loadNextQuestion(event) { | ||
if(event.searchMethod === "Category"){ | |||
var api = new mw.Api(event); | var api = new mw.Api(event); | ||
api.get({ | api.get({ | ||
action : ' | action : 'load', | ||
main : JSON.stringify(event.mainCat), | |||
sub : JSON.stringify(event.subCat), | |||
exam : event.examtype, | |||
num : event.numQuestion, | |||
format : 'json' | format : 'json' | ||
}, { | }, { | ||
ok : function (res) { | ok : function (res) { | ||
$.each(res. | var i = 0; | ||
event.currentQuestion = 0; | |||
$.each(res.questions.list, function (key, element) { | |||
element.PageName = key; | |||
event.examQuestions[i] = element; | |||
i++; | |||
event.examQuestions[ | |||
}); | }); | ||
addToNavBar(event); | |||
} | } | ||
}); | }); | ||
} else if(event.searchMethod === "Keyword"){ | |||
var api = new mw.Api(event); | |||
api.get({ | |||
action : 'load', | |||
keywords : JSON.stringify(event.questionListAll), | |||
num : event.numQuestion, | |||
format : 'json' | |||
}, { | |||
ok : function (res) { | |||
var i = 0; | |||
event.currentQuestion = 0; | |||
$.each(res.questions.list, function (key, element) { | |||
element.PageName = key; | |||
event.examQuestions[i] = element; | |||
i++; | |||
}); | |||
addToNavBar(event); | |||
} | |||
}); | |||
} | |||
} | } | ||
function addToNavBar(exam) { | function addToNavBar(exam) { | ||
$("#exam").html("<div id='navPane'></div><div id='examSpace'></div><span id='timeRem' style='height: 0px; visibility: hidden'>" + exam.timeAmt.toString() + "</span>"); | $("#exam").html("<div id='navBar'><div id='flag' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/3/34/Flag_5_19_14.png' /></div><div id='back' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/f/f9/Leftarrow_3_29_b.png' /></div><div id='next' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/a/ae/Rightarrow_3_29_14_b.png' /></div><div id='lab_vals' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/8/8b/Lab_values_3_29_14.png' /></div><div id='notes' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/e/eb/Pencil_3_29_14_trimwspace.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>"); | ||
//$("#flag").click(function(){alert("Coming Soon!")}); | |||
$("<div id='bottomBar'><div id='stopButton' class= 'noSelect WBRImgButton'><img src='http://static.wikidoc.org/0/09/Stopbutton2.svg' ></div><div id='pauseButton' class= 'noSelect WBRImgButton'><img src='http://static.wikidoc.org/e/e3/Pausebutton6.svg' ></div></div>").insertAfter("#exam"); | |||
$("#back").click(exam, questionNavigation); | |||
$("#next").click(exam, questionNavigation); | |||
$("#finish").click(exam, endExam); | |||
$("#flag").click(exam, flagQ); | |||
$("#lab_vals").click(exam, showLabs); | |||
if (exam.timer) { | if (exam.timer) { | ||
$("#bodyContent").append("<div style='position:absolute; z-index:1000; width:300px; height:50px; top:0px; right:0px; border: 1px solid #000; background-color:#EEE; float:right; visibility:hidden;' id='timerBox'>Testing.</div>"); | $("#bodyContent").append("<div style='position:absolute; z-index:1000; width:300px; height:50px; top:0px; right:0px; border: 1px solid #000; background-color:#EEE; float:right; visibility:hidden;' id='timerBox'>Testing.</div>"); | ||
Line 504: | Line 872: | ||
} | } | ||
$.each(exam.examQuestions, function (index, value) { | $.each(exam.examQuestions, function (index, value) { | ||
$("#navPane").append("<div id='" + index + "' class='navPaneButton'> | $("#navPane").append("<div id='" + index + "' class='navPaneButton'> " + (index - -1) + "</div>"); | ||
}); | }); | ||
// I think there might be a bug with this line. | |||
$(".navPaneButton").click(exam, questionNavigation); | |||
$("#" + exam.currentQuestion).addClass("boxed"); | $("#" + exam.currentQuestion).addClass("boxed"); | ||
$(".navPaneButton"). | |||
$(".navPaneButton:odd").css("background-color", "#3338CC"); | |||
$(".navPaneButton:odd").css("background-color", "#B0B0B0"); | |||
questionDisplay(exam); | questionDisplay(exam); | ||
} | } | ||
function questionDisplay(exam) { | function questionDisplay(exam) { | ||
var obj = new Object(); | var obj = new Object(); | ||
Line 518: | Line 889: | ||
parseQuestions(exam); | parseQuestions(exam); | ||
} else { | } else { | ||
var htmlStuff = " | var htmlStuff = "<b>Question " + (exam.currentQuestion - -1) + " / " + (exam.examQuestions.length) + "</b><br /><br />" + "<div id='highlightable'>" + obj.Prompt +"</div>"+"<br />"; | ||
if (obj.AnswerA && obj.AnswerA.length > 0) { | if (obj.AnswerA && obj.AnswerA.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='A'> | htmlStuff += "<div class='answer answerNoBorder' id='A'><input type='radio' value='A' id='Ar'>" +"</div>" + "<p class='ans_text'>" + trimP(obj.AnswerA)+ "</p>" ; | ||
} | } | ||
if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && exam.examType === "Tutor") { | ||
htmlStuff += "<div class='answerExp explanationHide' id='Ae'> | htmlStuff += "<div class='answerExp explanationHide' id='Ae'>" + trimP(obj.AnswerAExp) + "</div>"; | ||
} | } | ||
if (obj.AnswerB && obj.AnswerB.length > 0) { | if (obj.AnswerB && obj.AnswerB.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='B'> " + obj.AnswerB + "</ | htmlStuff += "<div class='answer answerNoBorder' id='B'><input type='radio' value='B' id='Ar' />" +"</div>" + "<p class='ans_text'>" + trimP(obj.AnswerB)+ "</p>"; | ||
} | } | ||
if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && exam.examType === "Tutor") { | ||
htmlStuff += "<div class='answerExp explanationHide' id='Be'> | htmlStuff += "<div class='answerExp explanationHide' id='Be'>" + trimP(obj.AnswerBExp) + "</div>"; | ||
} | } | ||
if (obj.AnswerC && obj.AnswerC.length > 0) { | if (obj.AnswerC && obj.AnswerC.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='C'> " + obj.AnswerC + "</ | htmlStuff += "<div class='answer answerNoBorder' id='C'><input type='radio' value='C' id='Ar' />" +"</div>" + "<p class='ans_text'>" + trimP(obj.AnswerC)+ "</p>"; | ||
} | } | ||
if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && exam.examType === "Tutor") { | ||
htmlStuff += "<div class='answerExp explanationHide' id='Ce'> | htmlStuff += "<div class='answerExp explanationHide' id='Ce'>" + trimP(obj.AnswerCExp) + "</div>"; | ||
} | } | ||
if (obj.AnswerD && obj.AnswerD.length > 0) { | if (obj.AnswerD && obj.AnswerD.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='D'> " + obj.AnswerD + "</ | htmlStuff += "<div class='answer answerNoBorder' id='D'><input type='radio' value='D' id='Ar'>" +"</div>" + "<p class='ans_text'>" + trimP(obj.AnswerD)+ "</p>"; | ||
} | } | ||
if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && exam.examType === "Tutor") { | ||
htmlStuff += "<div class='answerExp explanationHide' id='De'> | htmlStuff += "<div class='answerExp explanationHide' id='De'>" + trimP(obj.AnswerDExp) + "</div>"; | ||
} | } | ||
if (obj.AnswerEExp && obj.AnswerE.length > 0) { | if (obj.AnswerEExp && obj.AnswerE.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='E'> " + obj.AnswerE + "</ | htmlStuff += "<div class='answer answerNoBorder' id='E'><input type='radio' value='E' id='Ar'>" +"</div>" + "<p class='ans_text'>" + trimP(obj.AnswerE)+ "</p>"; | ||
} | } | ||
if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && exam.examType === "Tutor") { | ||
htmlStuff += "<div class='answerExp explanationHide' id='Ee'> | htmlStuff += "<div class='answerExp explanationHide' id='Ee'>" + trimP(obj.AnswerEExp) + "</div>"; | ||
} | } | ||
$("#examSpace").html(htmlStuff); | $("#examSpace").html(htmlStuff); | ||
$("#examSpace").prepend("<div id='details' style='display:none'> <table class='tg'> <tr> <th class='tg-031e'>Analyte</th> <th class='tg-031e'>Reference Range</th> </tr> <tr> <td class='tg-031e'>Sodium (Na+)</td> <td class='tg-031e'>136-145 mEq/L</td> </tr> <tr> <td class='tg-031e'>Potassium (K+)</td> <td class='tg-031e'>3.5-5.0 mEq/L</td> </tr> <tr> <td class='tg-031e'>Chloride (Cl-)</td> <td class='tg-031e'>95-105 mEq/L</td> </tr> <tr> <td class='tg-031e'>Bicarbonate (HCO3-)</td> <td class='tg-031e'>22-28 mEq/L</td> </tr> <tr> <td class='tg-031e'>Magnesium (Mg2+)</td> <td class='tg-031e'>1.5-2.0mEq/L</td> </tr> <tr> <td class='tg-031e'>Calcium (Ca2+)</td> <td class='tg-031e'></td> </tr></table></div>"); | |||
if (exam.examQuestions[exam.currentQuestion].selectedAnswer !== 'F') { | |||
$("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).addClass("boxed"); | |||
} | |||
$("div.answer").mouseover(function () { | |||
$(this).css({ | $(this).css({ | ||
'border' : ' | 'border' : '0px solid #000' | ||
}) | }) | ||
}).mouseout(function () { | }).mouseout(function () { | ||
$(this).css({ | $(this).css({ | ||
'border' : ' | 'border' : '0px solid #FFF' | ||
}) | }) | ||
}); | }); | ||
$("div.answer").click(exam, answerClicked); | $("div.answer").click(exam, answerClicked); | ||
$('p.ans_text').click(function(){ | |||
$(this).toggleClass('choice_elim') | |||
}); | |||
$('#highlightable').textHighlighter({ | |||
color: '#FFFF00' | |||
}); | |||
} | } | ||
} | } | ||
function trimP(data) { | |||
return data.substring(3, data.length - 4).trim(); ; | |||
} | |||
function questionReview(exam) { | function questionReview(exam) { | ||
var obj = new Object(); | var obj = new Object(); | ||
Line 573: | Line 958: | ||
parseQuestions(exam); | parseQuestions(exam); | ||
} else { | } else { | ||
$("#examSpace").append("<br /><a href='http://www.wikidoc.org/index.php/Talk:" + obj.PageName + "' target='_blank'>Click here to discuss this question!</a><br />"); | |||
var htmlStuff = "<b>Author:</b> " + obj.PageAuthor + "<br /><br /><b>Question " + (exam.currentQuestion - -1) + " / " + (exam.examQuestions.length) + "</b><br /><br />" + obj.Prompt + "<br />"; | var htmlStuff = "<b>Author:</b> " + obj.PageAuthor + "<br /><br /><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'> " + obj.AnswerA + "</div>"; | htmlStuff += "<div class='answer answerNoBorder' id='A'><input type='radio' id='Ar'> " + obj.AnswerA + "</div></input>"; | ||
} | } | ||
if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && exam.examType === "Tutor") { | ||
Line 583: | Line 968: | ||
} | } | ||
if (obj.AnswerB && obj.AnswerB.length > 0) { | if (obj.AnswerB && obj.AnswerB.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='B'> " + obj.AnswerB + "</div>"; | htmlStuff += "<div class='answer answerNoBorder' id='B'><input type='radio' id='Br'> " + obj.AnswerB + "</input></div>"; | ||
} | } | ||
if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && exam.examType === "Tutor") { | ||
htmlStuff += "<div class='answerExp explanationHide' id='Be'><i> " + obj.AnswerBExp + "</ | htmlStuff += "<div class='answerExp explanationHide' id='Be'><i> " + obj.AnswerBExp + "</div></i>"; | ||
} | } | ||
if (obj.AnswerC && obj.AnswerC.length > 0) { | if (obj.AnswerC && obj.AnswerC.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='C'> " + obj.AnswerC + "</div>"; | htmlStuff += "<div class='answer answerNoBorder' id='C'><input type='radio' id='Cr'> " + obj.AnswerC + "</input></div>"; | ||
} | } | ||
if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && exam.examType === "Tutor") { | ||
Line 595: | Line 980: | ||
} | } | ||
if (obj.AnswerD && obj.AnswerD.length > 0) { | if (obj.AnswerD && obj.AnswerD.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='D'> " + obj.AnswerD + "</div>"; | htmlStuff += "<div class='answer answerNoBorder' id='D'><input type='radio' id='Dr'> " + obj.AnswerD + "</input></div>"; | ||
} | } | ||
if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && exam.examType === "Tutor") { | ||
Line 601: | Line 986: | ||
} | } | ||
if (obj.AnswerEExp && obj.AnswerE.length > 0) { | if (obj.AnswerEExp && obj.AnswerE.length > 0) { | ||
htmlStuff += "<div class='answer answerNoBorder' id='E'> " + obj.AnswerE + "</div>"; | htmlStuff += "<div class='answer answerNoBorder' id='E'><input type='radio' id='Er'> " + obj.AnswerE + "</input></div>"; | ||
} | } | ||
if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && exam.examType === "Tutor") { | if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && exam.examType === "Tutor") { | ||
Line 607: | Line 992: | ||
} | } | ||
$("#examSpace").html(htmlStuff); | $("#examSpace").html(htmlStuff); | ||
addRatyRating(exam); | |||
if (exam.examQuestions[exam.currentQuestion].selectedAnswer && exam.examQuestions[exam.currentQuestion].RightAnswer == exam.examQuestions[exam.currentQuestion].selectedAnswer) { | |||
$("#" + exam.examQuestions[exam.currentQuestion].RightAnswer).addClass("boxed"); | |||
} else { | |||
$("#" + exam.examQuestions[exam.currentQuestion].RightAnswer).addClass("redBoxed"); | |||
$("#" + exam.examQuestions[exam.currentQuestion].RightAnswer).removeClass("answerNoBorder"); | |||
$("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).addClass("boxed"); | |||
$("#" + 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 /><br />"); | |||
} | } | ||
} | } | ||
function addRatyRating(exam) { | |||
var ratyLayers = "<center>Rate this question!</center><br /><span style='position:relative; float:left;'>Difficulty: <div id='star1'></div></span><span style='position:relative; float:left;left:33%;'>High Yield: <div id='star2'></div></span><span style='position:relative; float:left;left:66%'>Quality: <div id='star3'></div></span><br /><br /><br />" | |||
$("#examSpace").prepend(ratyLayers); | |||
getRating(exam.examQuestions[exam.currentQuestion].PageName, exam); | |||
addFirstResponses(); | |||
} | |||
} | |||
function addFirstResponses(){ | |||
var api = new mw.Api(); | |||
api.get({ | |||
action : 'firstResponseQuery', | |||
question : window.exam.examQuestions[exam.currentQuestion].PageName, | |||
format : 'json' | |||
}) | |||
.done(function (data) { | |||
if(data.firstResponseQuery.A===null){ | |||
data.firstResponseQuery.A = 0; | |||
} | |||
if(data.firstResponseQuery.B===null){ | |||
data.firstResponseQuery.B = 0; | |||
} | |||
if(data.firstResponseQuery.C===null){ | |||
data.firstResponseQuery.C = 0; | |||
} | |||
if(data.firstResponseQuery.D===null){ | |||
data.firstResponseQuery.D = 0; | |||
} | |||
if(data.firstResponseQuery.E===null){ | |||
data.firstResponseQuery.E = 0; | |||
} | |||
var sumFS=data.firstResponseQuery.A+data.firstResponseQuery.B+data.firstResponseQuery.C+data.firstResponseQuery.D+data.firstResponseQuery.E; | |||
var firstResponses = "<table><th colspan='5'>First Responses</th><tr><td>A</td><td>B</td><td>C</td><td>D</td><td>E</td></tr><tr><td>" + data.firstResponseQuery.A + "</td><td>"+ data.firstResponseQuery.B + "</td><td>"+ data.firstResponseQuery.C + "</td><td>"+ data.firstResponseQuery.D + "</td><td>"+ data.firstResponseQuery.E + "</td><td></tr></table>"; | |||
$("#examSpace").prepend(firstResponses); | |||
}); | |||
} | } | ||
function answerClicked(event) { | function answerClicked(event){ | ||
$(".answer").removeClass("boxed"); | |||
event.data.examQuestions[event.data.currentQuestion].selectedAnswer = $( | $('input[type=radio]').prop('checked', function () { | ||
return this.getAttribute('checked') == 'checked'; | |||
}); | |||
$(this).addClass("boxed"); | |||
$(this).find("#Ar").prop("checked",true); | |||
if($("#exam").find('#submit').length == 0){ | |||
$("#examSpace").append("<div class='noSelect WBRButton' id='submit'><br />Submit</div>"); | |||
$("#submit").click(event.data, answerSubmitted); | |||
} | |||
} | |||
function getRating(page, exam) { | |||
var api = new mw.Api(); | |||
api.get({ | |||
action : 'wbrgetrating', | |||
question : page, | |||
format : 'json' | |||
}, { | |||
ok : function (res) { | |||
$("#star1").raty({ | |||
path : 'http://www.wikidoc.org/includes/raty/img/', | |||
click : function (score, event) { | |||
submitRating("difficulty", score, exam.examQuestions[exam.currentQuestion].PageName) | |||
}, | |||
score: res.wbrgetrating.difficulty, | |||
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | |||
}); | |||
$("#star1").append("(Avg: " + res.wbrgetrating.difficulty + ", n=" + res.wbrgetrating.diffCount + ")" ); | |||
$("#star2").raty({ | |||
path : 'http://www.wikidoc.org/includes/raty/img/', | |||
click : function (score, event) { | |||
submitRating("yield", score, exam.examQuestions[exam.currentQuestion].PageName) | |||
}, | |||
score: res.wbrgetrating.yield, | |||
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | |||
}); | |||
$("#star2").append("(Avg: " + res.wbrgetrating.yield + ", n=" + res.wbrgetrating.qualCount + ")" ); | |||
$("#star3").raty({ | |||
path : 'http://www.wikidoc.org/includes/raty/img/', | |||
click : function (score, event) { | |||
submitRating("quality", score, exam.examQuestions[exam.currentQuestion].PageName) | |||
}, | |||
score: res.wbrgetrating.quality, | |||
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | |||
}); | |||
$("#star3").append("(Avg: " + res.wbrgetrating.quality + ", n=" + res.wbrgetrating.yieldSum + ")" ); | |||
} | |||
});} | |||
function answerSubmitted(event) { | |||
$("#submit").remove(); | |||
event.data.examQuestions[event.data.currentQuestion].selectedAnswer = $(".answer.boxed").attr("id"); | |||
if (!event.data.examQuestions[event.data.currentQuestion].creditRecieved && event.data.examQuestions[event.data.currentQuestion].selectedAnswer === event.data.examQuestions[event.data.currentQuestion].RightAnswer) { | if (!event.data.examQuestions[event.data.currentQuestion].creditRecieved && event.data.examQuestions[event.data.currentQuestion].selectedAnswer === event.data.examQuestions[event.data.currentQuestion].RightAnswer) { | ||
event.data.answeredRight += 1; | event.data.answeredRight += 1; | ||
event.data.examQuestions[event.data.currentQuestion].creditRecieved = true; | |||
} | } | ||
if (event.data.examType === "Tutor") { | if (event.data.examType === "Tutor") { | ||
$(".answerExp").css("height", "auto"); | $(".answerExp").css("height", "auto"); | ||
$(".answerExp").css("visibility", "visible"); | $(".answerExp").css("visibility", "visible"); | ||
$(".answerExp").each(function(){ | |||
if($(this).attr('id') === event.data.examQuestions[event.data.currentQuestion].RightAnswer+"e"){ | |||
$(this).prepend(" <b>Correct:</b> "); | |||
} else { | |||
$(this).prepend(" <b>Incorrect:</b> "); | |||
} | |||
}); | |||
} | } | ||
$("div.answer").unbind('click'); | $("div.answer").unbind('click'); | ||
var api = new mw.Api(); | |||
api.get({ | api.get({ | ||
action : 'wbrinsertmetric', | action : 'wbrinsertmetric', | ||
Line 695: | Line 1,126: | ||
if (event.data.examType === "Exam") { | if (event.data.examType === "Exam") { | ||
$("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed"); | $("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed"); | ||
} else if (event.data.examType === "Tutor") { | |||
$("#examSpace").append("<br /><br />The correct answer is: " + event.data.examQuestions[event.data.currentQuestion].RightAnswer + "<br /><br / | $("#examSpace").append("<br /><br />The correct answer is: " + event.data.examQuestions[event.data.currentQuestion].RightAnswer + "<br /><br />" + event.data.examQuestions[event.data.currentQuestion].Explanation + "<br />"); | ||
$("#" + event.data.examQuestions[event.data.currentQuestion]. | $("#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 />Discuss this question <a href='http://www.wikidoc.org/index.php/Talk:" + event.data.examQuestions[event.data.currentQuestion].PageName + "'>Here</a>"); | ||
$("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed"); | |||
$("#" + event.data.examQuestions[event.data.currentQuestion].RightAnswer).addClass("redBoxed"); | |||
addRatyRating(event.data); | |||
$("# | |||
$("# | |||
} | } | ||
} | } | ||
function questionNavigation(event) { | function questionNavigation(event) { | ||
$("#" + event.data.currentQuestion).removeClass("boxed"); | $("#" + event.data.currentQuestion).removeClass("boxed"); | ||
Line 742: | Line 1,159: | ||
questionReview(event.data); | questionReview(event.data); | ||
} | } | ||
// $('#flag').click(function(){ | |||
//var cur_q=exam.currentQuestion; | |||
// var temp_flag_div_id='.navPaneButton#'+cur_q; | |||
// $("#" + event.data.currentQuestion).toggleClass('flagged'); | |||
//alert("You clicked the flag!"+temp_flag_div_id); | |||
// }) | |||
function flagQ(event) { | |||
$("#" + event.data.currentQuestion).toggleClass("flagged"); | |||
} | |||
function showLabs(event) { | |||
$("#details").stop(); | |||
$("#details").slideToggle("slow");} | |||
function convolve_bernouli(qprobs){ | |||
//takes in an array of probabilities of guessing questions correct | |||
for (var counter = 0; counter < qprobs.length; counter++) { | |||
//if the loop is in the first iteration, then initialize the array | |||
if (counter==0){ | |||
var pdfArray=[1-qprobs[0],qprobs[0]]; | |||
}else{ | |||
//initialize new Array for pdfs | |||
var newpdfArray= []; | |||
for (var i = 0; i < pdfArray.length+1; i+=1) { | |||
newpdfArray[i]=0; | |||
} | |||
//multiply by ones first | |||
for (var i = 0; i < pdfArray.length; i+=1) { | |||
newpdfArray[i+1]+=pdfArray[i]*qprobs[counter]; //probability of adding a success | |||
newpdfArray[i]+=pdfArray[i]*(1-qprobs[counter]); | |||
} | |||
pdfArray=newpdfArray; | |||
} | |||
} | |||
console.log(pdfArray); | |||
return(pdfArray); | |||
}//ends convolve_bernouli | |||
function endExam(event) { | function endExam(event) { | ||
if (event.data.timer) { | |||
$('#timerBox').html(""); | |||
$('#timerBox').css("visibility", "hidden"); | |||
event.data.examTimer.stop(); | |||
} | |||
$("#examSpace").html(""); | $("#examSpace").html(""); | ||
var datas; | var datas; | ||
datas = ""; | datas = ""; | ||
datas += "<br />You answered " + event.data.answeredRight + " out of " + event.data.examQuestions.length + " correctly.<br /> Your percentage score is: "; | |||
var percent = (event.data.answeredRight / event.data. | var percent = Math.round((event.data.answeredRight / event.data.examQuestions.length) * 100); | ||
datas += percent + "%<br /><br />Click the Navigation Buttons on the left to review the questions you answered."; | testlength=event.data.examQuestions.length; | ||
var question_probs=[]; | |||
for (var j = 0; j < testlength; j+=1){ | |||
question_probs[j]=Math.random(); | |||
} | |||
qdist=convolve_bernouli(question_probs); | |||
var myTotal = 0; //Variable to hold your total | |||
for(var i=0, len=event.data.answeredRight+1; i<len; i++){ | |||
myTotal += qdist[i]; //Iterate over your first array and then grab the second element add the values up | |||
} | |||
datas += percent + "%<br /><br />Click the Navigation Buttons on the left to review the questions you answered.<br />"; | |||
datas += "<br />You scored in the " + Math.round(myTotal*100) + " percentile. <br /><br />"; | |||
datas += "<canvas id='simExams' width='600' height='400'></canvas>"; | |||
$("#examSpace").append(datas); | |||
var api = new mw.Api(); | |||
api.get({ | api.get({ | ||
Line 766: | Line 1,243: | ||
console.log('API result:', data); | console.log('API result:', data); | ||
}); | }); | ||
// Here's some code to create the labels for the graph (recall that qdist is the distribution of points). | |||
point_labels=[]; | |||
for (var j = 0; j < qdist.length; j+=1){ | |||
point_labels[j]=j.toString(); | |||
} | |||
var simExamData = { | |||
labels : point_labels, | |||
datasets : [ | |||
{ | |||
fillColor : "rgba(220,220,220,0.5)", | |||
strokeColor : "rgba(220,220,220,1)", | |||
pointColor : "rgba(220,220,220,1)", | |||
pointStrokeColor : "#fff", | |||
data : qdist, | |||
title: "Percent of test takers" | |||
} | |||
] | |||
} | |||
var newopts = { | |||
yAxisLabel : "Percent of test takers", | |||
yAxisFontFamily : "'Arial'", | |||
yAxisFontSize : 16, | |||
yAxisFontStyle : "normal", | |||
yAxisFontColor : "#666", | |||
xAxisLabel : "Number of correct answers", | |||
legend : false, | |||
legendFontFamily : "'Arial'", | |||
legendFontSize : 12, | |||
legendFontStyle : "normal", | |||
legendFontColor : "#666", | |||
legendBlockSize : 15, | |||
legendBorders : false, | |||
legendBordersColor : "#666", | |||
graphTitle : "Peer Performance", | |||
graphTitleFontFamily : "'Arial'", | |||
graphTitleFontSize : 24, | |||
graphTitleFontStyle : "bold", | |||
graphTitleFontColor : "#666", | |||
} | } | ||
function submitRating( | // get line chart canvas | ||
var simExams = document.getElementById('simExams').getContext('2d'); | |||
// draw line chart | |||
new Chart(simExams).Line(simExamData,newopts); | |||
$(".navPaneButton").unbind('click'); | |||
$(".navPaneButton").click(event.data, questionReviewNavigation); | |||
} | |||
function submitRating(ratingType, score, page) { | |||
if(ratingType === "difficulty"){ | |||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get({ | api.get({ | ||
Line 780: | Line 1,311: | ||
username : mw.user.getName(), | username : mw.user.getName(), | ||
question : page, | question : page, | ||
difficulty : score, | |||
format : 'json' | format : 'json' | ||
}, { | }, { | ||
ok : function (res) { | ok : function (res) {} | ||
}); | |||
} else if (ratingType === "yield"){ | |||
var api = new mw.Api(); | |||
api.get({ | |||
action : 'wbrinsertrating', | |||
username : mw.user.getName(), | |||
question : page, | |||
yield : score, | |||
format : 'json' | |||
}, { | |||
ok : function (res) {} | |||
}); | |||
} | |||
else if (ratingType === "quality"){ | |||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get({ | api.get({ | ||
action : ' | action : 'wbrinsertrating', | ||
username : mw.user.getName(), | |||
question : page, | question : page, | ||
quality : score, | |||
format : 'json' | format : 'json' | ||
}, { | }, { | ||
ok : function (res) { | ok : function (res) {} | ||
}); | |||
} | |||
} | |||
function parseQuestions(examObj) { | function parseQuestions(examObj) { | ||
Line 849: | Line 1,383: | ||
tobeParsed = examObj.examQuestions[q].AnswerEExp; | tobeParsed = examObj.examQuestions[q].AnswerEExp; | ||
break; | break; | ||
case 12: | |||
tobeParsed = examObj.examQuestions[q].Author | |||
} | } | ||
if (tobeParsed && tobeParsed.length > 0) { | if (tobeParsed && tobeParsed.length > 0) { | ||
Line 901: | Line 1,435: | ||
examObj.examQuestions[q].AnswerEExp = parsed; | examObj.examQuestions[q].AnswerEExp = parsed; | ||
break; | break; | ||
case 12: | |||
examObj.examQuestions[q].Author = parsed; | |||
break | |||
} | } | ||
if (examObj.examQuestions[q].lastParsed < 13) { | if (examObj.examQuestions[q].lastParsed < 13) { | ||
Line 924: | Line 1,458: | ||
} | } | ||
} | } | ||
function countCats(event) { | |||
function | event.data.timeAmt = parseInt($(this).attr("id"), 10) * 6000; | ||
var temp = event.data.examtype.replace(/ /g, "_"); | |||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get({ | api.get({ | ||
action : ' | action : 'singlecat', | ||
exam : temp, | |||
format : 'json' | format : 'json', | ||
async : false | |||
}, { | }, { | ||
ok : function (data) { | ok : function (data) { | ||
event.data.arrCounts = data; | |||
selectCats(event.data); | |||
} | } | ||
}); | }); | ||
} | } | ||
function urlSwapSpace(swap) { | function urlSwapSpace(swap) { | ||
return swap.split(' ').join('+'); | return swap.split(' ').join('+'); | ||
} | } | ||
$(document).ready(ensureLoggedIn); | $(document).ready(ensureLoggedIn); | ||
$(document).ready(function(){ | |||
$("#testOptions").hide(); | |||
$("#exam").hide(); | |||
$("#footer").hide(); | |||
$("#mw-head").hide(); | |||
$("#mw-head-base").hide(); | |||
$("#mw-page-base").hide(); | |||
$("#searchbox").hide(); | |||
$("#firstHeading").after("<div class='show_wiki_button' style='font-family: Lato, Calibri, Arial, sans-serif; color:#aaa;font-size:0.5em;'>Wikiview</div>"); | |||
$("#firstHeading").hide(); | |||
$("#wikidocNav").hide(); | |||
$("#contentSub").hide(); | |||
$(".show_wiki_button").click(function(){ | |||
$("#footer").show(); | |||
$("#mw-head").show(); | |||
$("#mw-head-base").show(); | |||
$("#mw-page-base").show(); | |||
$("#searchbox").show(); | |||
$("#firstHeading").show(); | |||
$("#wikidocNav").show(); | |||
$("#contentSub").hide() | |||
}) | |||
}) | |||
</script> | </script> | ||
<div id="exam"> | <div id="chooseQBank" style='height:100%;'></div> | ||
<div id="testOptions" style='height:100%;'></div> | |||
<div id="exam" style='height:100%;'></div> | |||
</includeonly> | </includeonly> |