Widget:WikidocBoardReview: Difference between revisions

Jump to navigation Jump to search
No edit summary
Undo revision 1008080 by William J Gibson (talk)
 
Line 1: Line 1:
<includeonly>
<includeonly>
<base target="_blank">
<script src="http://www.wikidoc.org/includes/raty/jquery.timer.js"></script>
<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 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:0px solid black !important;
border:0px solid black !important;
Line 203: Line 9:
border:0px solid #F00 !important;
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 270: Line 60:
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:5%;
width:5%;
height:100%;
overflow-y:scroll;
}
}
#examSpace{
#examSpace{
Line 292: Line 69:
float:right;
float:right;
width:94%;
width:94%;
height:90%;
overflow-y:scroll;
}
}
#navBar{
#navBar{
Line 300: Line 75:
width:95%;
width:95%;
background-color:#3366CC;
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{
Line 323: Line 80:
background-color:#D0D0D0;
background-color:#D0D0D0;
padding-top:5px;
padding-top:5px;
color:#000000 ;
font-weight:bold;
font-weight:bold;
text-align: center;
text-align: center;
Line 339: Line 97:
height:auto;
height:auto;
visibility:visible;
visibility:visible;
}
#tutorOrExamContainer{
background-color:#E3E5E5;
}
}
</style>
</style>
<script type="text/javascript">function ensureLoggedIn() {
<script type="text/javascript">
mw.loader.load('mediaWiki.user');
function ensureLoggedIn() {
if ($.isEmptyObject(wgUserName)) {
mw.loader.load('mediaWiki.user');
alert("Please Log In To Continue.");
if ($.isEmptyObject(wgUserName)) {
window.location.replace("http://wikidoc.org/index.php?title=Special:UserLogin&returnto=User%3AMatt+Pijoan");
alert("Please Log In To Continue.");
} else {
window.location.replace("http://www.wikidoc.org/index.php?title=Special:UserLogin&returnto=Board_Review");
curriculumType();
} else {
}
curriculumType();
}
}
}
function curriculumType() {
function curriculumType() {
Line 388: Line 144:
}
}
}
}
 
var stuffs = "<a href='#' class='Curric' id='USMLE Step 1'><img src='http://static.wikidoc.org/8/87/Step1.png' /></a>";
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 += "<a href='#' class='Curric' id='USMLE Step 2 CK'><img src='http://static.wikidoc.org/0/07/Step2CK.png' /></a>";
$("#chooseQBank").html(background_html);
stuffs += "<a href='#' class='Curric' id='USMLE Step 3'><img src='http://static.wikidoc.org/0/08/Step3.png' /></a>";
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 += "<a href='#' class='Curric' id='Board Review'><img src='http://static.wikidoc.org/7/75/Boardcertification.png' /></a>";
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 += "<a href='#' class='Curric' id='MCAT'><img src='http://static.wikidoc.org/4/4b/MCAT.png' /></a><br />";
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>";
$("#exam").html(stuffs);
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").html(background_html+"<div class='examButtons'>" + stuffs + "</div>");
$('.Curric').click(options, chooseQBank);
$('.Curric').click(options, chooseQBank);


}
}
function chooseQBank(event) {
function chooseQBank(event) {
$("#chooseQBank").remove();//Once the QBank is picked, we'll remove the div that held it.
event.data.examtype = $(this).attr('id');
$("#exam").show();
window.exam.examtype = $(this).attr('id');
var divs = null;
var divs = null;
divs = "<center><h1>Build your own exam!</h1></center><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 />";
divs = "<center><h1>Build your own exam!</h1></center><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);
$('.stepTwo').click(window.exam, tutorOrExam);
$('.stepTwo').click(event.data, tutorOrExam);
}
}
function tutorOrExam(event) {
function tutorOrExam(event) {


window.exam.qbank = $(this).attr('id');
event.data.qbank = $(this).attr('id');
var buttons = '';
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 />";
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(window.exam, categoryOrKeyword);
$('.ToE').click(event.data, categoryOrKeyword);
}
}
function categoryOrKeyword(event) {
function categoryOrKeyword(event) {
window.exam.examType = $(this).attr('id');
event.data.examType = $(this).attr('id');
var buttons = '';
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 />";
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(window.exam, timerToggle);
$('.CoK').click(event.data, timerToggle);
}
}
function timerToggle(event) {
function timerToggle(event) {
window.exam.searchMethod = $(this).attr('id');
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 433: Line 182:
$("#exam").append(form);
$("#exam").append(form);
}
}
$('#yes').click(window.exam, timerDuration);
$('#yes').click(event.data, timerDuration);


if (window.exam.searchMethod === "Category") {
if (event.data.searchMethod === "Category") {
$('#nop').click(window.exam, countCats);
$('#nop').click(event.data, countCats);
} else {
} else {
$('#nop').click(window.exam, Keywords);
$('#nop').click(event.data, Keywords);
}
}
}
}
function timerDuration(event) {
function timerDuration(event) {
window.exam.timer = true;
event.data.timer = true;
var form = null;
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 />"
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 />"
Line 448: Line 197:
$("#exam").append(form);
$("#exam").append(form);
}
}
if (window.exam.searchMethod === "Category") {
if (event.data.searchMethod === "Category") {
$('.stepFour').click(window.exam, countCats);
$('.stepFour').click(event.data, countCats);
} else {
} else {
$('.stepFour').click(window.exam, Keywords);
$('.stepFour').click(event.data, Keywords);
}
}
}
}
Line 497: Line 246:
});
});


$("#showQueries").click(window.exam, showQueries);
$("#showQueries").click(event.data, showQueries);
function showQueries(event) {
function showQueries(event) {
$("#removeNum").remove();
$("#removeNum").remove();
window.exam.queries = [];
event.data.queries = [];
window.exam.questionListAll = [];
event.data.questionListAll = [];
window.exam.keyword = {};
event.data.keyword = {};
window.exam.keyword.iterator = 0;
event.data.keyword.iterator = 0;
$.each($(".query"), function (index, value) {
$.each($(".query"), function (index, value) {
window.exam.queries[index] = "[[ExamType::" + window.exam.examtype + "]]";
event.data.queries[index] = "[[ExamType::" + event.data.examtype + "]]";
$.each($(this).children(), function (ind, val) {
$.each($(this).children(), function (ind, val) {
window.exam.queries[index] += "[[WBRKeyword::" + $(this).val() + "]]";
event.data.queries[index] += "[[WBRKeyword::" + $(this).val() + "]]";
});
});
});
});
runQueries(window.exam);
runQueries(event.data);
}
}
function runQueries(obj) {
function runQueries(obj) {
Line 532: Line 281:
}
}
function removeDuplicates(obj) {
function removeDuplicates(obj) {
if (res.Count > 45) {
                if(res.Count > 45){
obj.maxQ = 45;
                        obj.maxQ = 45;
} else {
                } else {
obj.maxQ = res.Count;
                        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'>" + 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>";
if ($("#exam").find('#numQues').length == 0) {
if ($("#exam").find('#numQues').length == 0) {
Line 549: Line 298:
}
}
function TNG(event) {
function TNG(event) {
window.exam.numQuestion = $("#numQues").val();
event.data.numQuestion = $("#numQues").val();
if (window.exam.numQuestion > 0 && window.exam.numQuestion <= 45) {
        if(event.data.numQuestion > 0 && event.data.numQuestion <= 45){
loadNextQuestion(window.exam);
loadNextQuestion(event.data);
} else {
        } else {
alert('Invalid number of questions entered.');
        alert('Invalid number of questions entered.');
}
        }
}
}
function selectCats() {
function selectCats(exam) {
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 (window.exam.examtype === "MCAT") {
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 570: Line 319:
} else {
} else {


if (window.exam.examtype === "USMLE Step 1") {
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 (window.exam.examtype === "USMLE Step 2 CK") {
} 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 (window.exam.examtype === "USMLE Step 3") {
} 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 (window.exam.examtype === "Board Review") {
} 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 638: Line 387:
});
});


$("#CountQ").click(window.exam, selectExamLength);
$("#CountQ").click(exam, selectExamLength);
}
}
function selectExamLength(event) {
function selectExamLength(event) {
Line 652: Line 401:
Sub.push($(this).val());
Sub.push($(this).val());
});
});
window.exam.mainCat = Main;
event.data.mainCat = Main;
window.exam.subCat = Sub;
event.data.subCat = Sub;
var api = new mw.Api(event, Main, Sub);
var api = new mw.Api(event, Main, Sub);
api.get({
api.get({
Line 659: Line 408:
main : JSON.stringify(Main),
main : JSON.stringify(Main),
sub : JSON.stringify(Sub),
sub : JSON.stringify(Sub),
exam : window.exam.examtype,
exam : event.data.examtype,
format : 'json'
format : 'json'
}, {
}, {
ok : function (res) {
ok : function (res) {
if (res.Count > 45) {
                if( res.Count > 45){
window.exam.maxQ = 45;
                        event.data.maxQ = 45;
} else {
                } else {
window.exam.maxQ = res.Count;
                        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'>" + window.exam.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>";
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) {
if ($("#exam").find('#numQues').length == 0) {
$("#exam").append(output);
$("#exam").append(output);


}
}
$("#Go").click(window.exam, inputValidation);
$("#Go").click(event.data, inputValidation);
}
}
});
});
Line 682: Line 431:
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) {
window.exam.numQuestion = $("#numQues").val();
event.data.numQuestion = $("#numQues").val();
var api = new mw.Api();
api.get({
action : 'newExam',
username : mw.user.getName(),
type : window.exam.examtype,
format : 'json'
})
.done(function (data) {
window.exam.examid = data.newExam.exam_id;
});
$("#exam").html("<img src='http://static.wikidoc.org/5/51/Index.gif' />");
$("#exam").html("<img src='http://static.wikidoc.org/5/51/Index.gif' />");
if (window.exam.timer) {
if (event.data.timer) {
window.exam.examTimer = $.timer(function () {
event.data.examTimer = $.timer(function () {
var rem = parseInt($("#timeRem").html());
var rem = parseInt($("#timeRem").html());
$('#timerBox').css("visibility", "visible");
$('#timerBox').css("visibility", "visible");
$('#timerBox').html(formatTime(rem));
$('#timerBox').html(formatTime(rem));
if (rem == 0) {
if (rem == 0) {
window.exam.examTimer.stop();
event.data.examTimer.stop();
$("#content").click(window.exam, endExam);
$("#content").click(event.data, endExam);
} else {
} else {
var temp = rem - 7;
var temp = rem - 7;
Line 711: Line 450:
}, 70, false);
}, 70, false);


window.exam.examTimer.toggle();
event.data.examTimer.toggle();
}
}
loadNextQuestion();
loadNextQuestion(event.data);
} else {
} else {
alert('Invalid entry in number of questions input');
alert('Invalid entry in number of questions input');
}
}
}
}
function loadNextQuestion() {
// Common functions
window.exam.examQuestions = [];
function pad(number, length) {
if (window.exam.searchMethod === "Category") {
var str = '' + number;
var api = new mw.Api(window.exam);
while (str.length < length) {
api.get({
str = '0' + str;
action : 'load',
}
main : JSON.stringify(window.exam.mainCat),
return str;
sub : JSON.stringify(window.exam.subCat),
}
exam : window.exam.examtype,
function formatTime(time) {
num : window.exam.numQuestion,
var min = parseInt(time / 6000),
format : 'json'
sec = parseInt(time / 100) - (min * 60),
}, {
hundredths = pad(time - (sec * 100) - (min * 6000), 2);
ok : function (res) {
return (min > 0 ? pad(min, 2) : "00") + ":" + pad(sec, 2);
var i = 0;
}
window.exam.currentQuestion = 0;
function loadNextQuestion(event) {
$.each(res.questions.list, function (key, element) {
if(event.searchMethod === "Category"){
element.PageName = key;
var api = new mw.Api(event);
window.exam.examQuestions[i] = element;
api.get({
i++;
action : 'load',
});
main : JSON.stringify(event.mainCat),
addToNavBar(window.exam);
sub : JSON.stringify(event.subCat),
}
exam : event.examtype,
});
num : event.numQuestion,
} else if (window.exam.searchMethod === "Keyword") {
format : 'json'
var api = new mw.Api(window.exam);
}, {
api.get({
ok : function (res) {
action : 'load',
var i = 0;
keywords : JSON.stringify(window.exam.questionListAll),
event.currentQuestion = 0;
num : window.exam.numQuestion,
$.each(res.questions.list, function (key, element) {
format : 'json'
element.PageName = key;
}, {
event.examQuestions[i] = element;
ok : function (res) {
i++;
var i = 0;
});
window.exam.currentQuestion = 0;
addToNavBar(event);
$.each(res.questions.list, function (key, element) {
}
element.PageName = key;
});
window.exam.examQuestions[i] = element;
} else if(event.searchMethod === "Keyword"){
i++;
var api = new mw.Api(event);
});
api.get({
addToNavBar();
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() {
function addToNavBar(exam) {
$("#exam").html("<div id='navBar'><div id='flag' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/8/89/Flag_3_16_14.png' /></div><div id='back' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/c/c1/WBRLeftArrowlightblue.png' /></div><div id='next' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/e/eb/WBRRightArrowlightblue.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>");
$("#exam").html("<div id='navBar'><div id='flag' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/8/89/Flag_3_16_14.png' /></div><div id='back' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/c/c1/WBRLeftArrowlightblue.png' /></div><div id='next' class='noSelect WBRImgButton'><img src='http://static.wikidoc.org/e/eb/WBRRightArrowlightblue.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 () {
$("#flag").click(function(){alert("Coming Soon!")});
alert("Coming Soon!")
        $("#back").click(exam, questionNavigation);
});
$("#next").click(exam, questionNavigation);
$("#back").click(questionNavigation);
$("#finish").click(exam, endExam);
$("#next").click(questionNavigation);
if (exam.timer) {
$("#finish").click(endExam);
if (window.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>");
$("#timerBox").click(function () {
$("#timerBox").click(function () {
window.exam.examTimer.toggle();
exam.examTimer.toggle();
});
});
}
}
$.each(window.exam.examQuestions, function (index, value) {
$.each(exam.examQuestions, function (index, value) {
$("#navPane").append("<div id='" + index + "' class='navPaneButton'> " + (index - -1) + "</div>");
$("#navPane").append("<div id='" + index + "' class='navPaneButton'> " + (index - -1) + "</div>");
});
});
$(".navPaneButton").click(questionNavigation);
        $(".navPaneButton").click(exam, questionNavigation);
$("#" + 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");
questionDisplay();
questionDisplay(exam);
}
}
function questionDisplay() {
function questionDisplay(exam) {
var obj = new Object();
var obj = new Object();
obj = window.exam.examQuestions[window.exam.currentQuestion];
obj = exam.examQuestions[exam.currentQuestion];
if (obj.isParsed === 0) {
if (obj.isParsed === 0) {
$("#examSpace").html("<img src='http://static.wikidoc.org/5/51/Index.gif' />");
$("#examSpace").html("<img src='http://static.wikidoc.org/5/51/Index.gif' />");
parseQuestions();
parseQuestions(exam);
} else {
} else {
var htmlStuff = "<b>Question " + (window.exam.currentQuestion - -1) + " / " + (window.exam.examQuestions.length) + "</b><br /><br />" + "<div id='highlightable'>" + obj.Prompt + "</div>" + "<br />";
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' name = 'question" +(window.exam.currentQuestion - -1)+ "form' >" + trimP(obj.AnswerA) + "</div>";
htmlStuff += "<div class='answer answerNoBorder' id='A'><input type='radio' value='A' id='Ar'>" + trimP(obj.AnswerA) + "</div>";
}
}
if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Ae'>" + trimP(obj.AnswerAExp) + "</div>";
htmlStuff += "<div class='answerExp explanationHide' id='Ae'>" + trimP(obj.AnswerAExp) + "</div>";
}
}
Line 801: Line 553:
htmlStuff += "<div class='answer answerNoBorder' id='B'><input type='radio' value='B' id='Ar' />" + trimP(obj.AnswerB) + "</div>";
htmlStuff += "<div class='answer answerNoBorder' id='B'><input type='radio' value='B' id='Ar' />" + trimP(obj.AnswerB) + "</div>";
}
}
if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Be'>" + trimP(obj.AnswerBExp) + "</div>";
htmlStuff += "<div class='answerExp explanationHide' id='Be'>" + trimP(obj.AnswerBExp) + "</div>";
}
}
Line 807: Line 559:
htmlStuff += "<div class='answer answerNoBorder' id='C'><input type='radio' value='C' id='Ar' />" + trimP(obj.AnswerC) + "</div>";
htmlStuff += "<div class='answer answerNoBorder' id='C'><input type='radio' value='C' id='Ar' />" + trimP(obj.AnswerC) + "</div>";
}
}
if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Ce'>" + trimP(obj.AnswerCExp) + "</div>";
htmlStuff += "<div class='answerExp explanationHide' id='Ce'>" + trimP(obj.AnswerCExp) + "</div>";
}
}
Line 813: Line 565:
htmlStuff += "<div class='answer answerNoBorder' id='D'><input type='radio' value='D' id='Ar'>" + trimP(obj.AnswerD) + "</div>";
htmlStuff += "<div class='answer answerNoBorder' id='D'><input type='radio' value='D' id='Ar'>" + trimP(obj.AnswerD) + "</div>";
}
}
if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='De'>" + trimP(obj.AnswerDExp) + "</div>";
htmlStuff += "<div class='answerExp explanationHide' id='De'>" + trimP(obj.AnswerDExp) + "</div>";
}
}
Line 819: Line 571:
htmlStuff += "<div class='answer answerNoBorder' id='E'><input type='radio' value='E' id='Ar'>" + trimP(obj.AnswerE) + "</div>";
htmlStuff += "<div class='answer answerNoBorder' id='E'><input type='radio' value='E' id='Ar'>" + trimP(obj.AnswerE) + "</div>";
}
}
if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Ee'>" + trimP(obj.AnswerEExp) + "</div>";
htmlStuff += "<div class='answerExp explanationHide' id='Ee'>" + trimP(obj.AnswerEExp) + "</div>";
}
}
$("#examSpace").html(htmlStuff);
$("#examSpace").html(htmlStuff);
if (window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer !== 'F') {
if (exam.examQuestions[exam.currentQuestion].selectedAnswer !== 'F') {
$("#" + window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer).addClass("boxed");
$("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).addClass("boxed");
}
}
$("div.answer").mouseover(function () {
$("div.answer").mouseover(function () {
Line 835: Line 587:
})
})
});
});
$("div.answer").click(answerClicked);
$("div.answer").click(exam, answerClicked);
$('p.ans_text').click(function(){
}
}


$(this).toggleClass('choice_elim')
function trimP(data) {
});
return data.substring(3, data.length - 4).trim(); ;
 
$('#highlightable').textHighlighter({
              color: '#FFFF00'
          });
}
}
}
function questionReview() {
function questionReview(exam) {
var obj = new Object();
var obj = new Object();
obj = window.exam.examQuestions[window.exam.currentQuestion];
obj = exam.examQuestions[exam.currentQuestion];
if (obj.isParsed === 0) {
if (obj.isParsed === 0) {
$("#examSpace").html("<img src='http://static.wikidoc.org/5/51/Index.gif' />");
$("#examSpace").html("<img src='http://static.wikidoc.org/5/51/Index.gif' />");
parseQuestions();
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 />");
$("#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 " + (window.exam.currentQuestion - -1) + " / " + (window.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'><input type='radio' id='Ar'>  " + obj.AnswerA + "</div></input>";
htmlStuff += "<div class='answer answerNoBorder' id='A'><input type='radio' id='Ar'>  " + obj.AnswerA + "</div></input>";
}
}
if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerAExp && obj.AnswerAExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Ae'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerAExp + "</i></div>";
htmlStuff += "<div class='answerExp explanationHide' id='Ae'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerAExp + "</i></div>";
}
}
Line 865: Line 613:
htmlStuff += "<div class='answer answerNoBorder' id='B'><input type='radio' id='Br'> " + obj.AnswerB + "</input></div>";
htmlStuff += "<div class='answer answerNoBorder' id='B'><input type='radio' id='Br'> " + obj.AnswerB + "</input></div>";
}
}
if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerBExp && obj.AnswerBExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Be'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerBExp + "</div></i>";
htmlStuff += "<div class='answerExp explanationHide' id='Be'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerBExp + "</div></i>";
}
}
Line 871: Line 619:
htmlStuff += "<div class='answer answerNoBorder' id='C'><input type='radio' id='Cr'> " + obj.AnswerC + "</input></div>";
htmlStuff += "<div class='answer answerNoBorder' id='C'><input type='radio' id='Cr'> " + obj.AnswerC + "</input></div>";
}
}
if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerCExp && obj.AnswerCExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Ce'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerCExp + "</i></div>";
htmlStuff += "<div class='answerExp explanationHide' id='Ce'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerCExp + "</i></div>";
}
}
Line 877: Line 625:
htmlStuff += "<div class='answer answerNoBorder' id='D'><input type='radio' id='Dr'> " + obj.AnswerD + "</input></div>";
htmlStuff += "<div class='answer answerNoBorder' id='D'><input type='radio' id='Dr'> " + obj.AnswerD + "</input></div>";
}
}
if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerDExp && obj.AnswerDExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='De'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerDExp + "</i></div>";
htmlStuff += "<div class='answerExp explanationHide' id='De'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerDExp + "</i></div>";
}
}
Line 883: Line 631:
htmlStuff += "<div class='answer answerNoBorder' id='E'><input type='radio' id='Er'> " + obj.AnswerE + "</input></div>";
htmlStuff += "<div class='answer answerNoBorder' id='E'><input type='radio' id='Er'> " + obj.AnswerE + "</input></div>";
}
}
if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && window.exam.examType === "Tutor") {
if (obj.AnswerEExp && obj.AnswerEExp.length > 0 && exam.examType === "Tutor") {
htmlStuff += "<div class='answerExp explanationHide' id='Ee'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerEExp + "</i></div>";
htmlStuff += "<div class='answerExp explanationHide' id='Ee'><i>&nbsp;&nbsp;&nbsp;&nbsp;" + obj.AnswerEExp + "</i></div>";
}
}
$("#examSpace").html(htmlStuff);
$("#examSpace").html(htmlStuff);
addRatyRating(exam);
addRatyRating(exam);
if (window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer && window.exam.examQuestions[window.exam.currentQuestion].RightAnswer == window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer) {
if (exam.examQuestions[exam.currentQuestion].selectedAnswer && exam.examQuestions[exam.currentQuestion].RightAnswer == exam.examQuestions[exam.currentQuestion].selectedAnswer) {
$("#" + window.exam.examQuestions[window.exam.currentQuestion].RightAnswer).addClass("boxed");
$("#" + exam.examQuestions[exam.currentQuestion].RightAnswer).addClass("boxed");
} else {
} else {


$("#" + window.exam.examQuestions[window.exam.currentQuestion].RightAnswer).addClass("redBoxed");
$("#" + exam.examQuestions[exam.currentQuestion].RightAnswer).addClass("redBoxed");
$("#" + window.exam.examQuestions[window.exam.currentQuestion].RightAnswer).removeClass("answerNoBorder");
$("#" + exam.examQuestions[exam.currentQuestion].RightAnswer).removeClass("answerNoBorder");
$("#" + window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer).addClass("boxed");
$("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).addClass("boxed");
$("#" + window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer).removeClass("answerNoBorder");
$("#" + exam.examQuestions[exam.currentQuestion].selectedAnswer).removeClass("answerNoBorder");
}
}
$("#examSpace").append("<br /><br />The correct answer is: " + window.exam.examQuestions[window.exam.currentQuestion].RightAnswer + "<br /><br /><b>" + window.exam.examQuestions[window.exam.currentQuestion].Explanation + "</b><br /><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 />");
}
}
}
}
function addRatyRating() {
function addRatyRating(exam) {
addFirstResponses();
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 />"
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);
$("#examSpace").prepend(ratyLayers);


getRating(window.exam.examQuestions[exam.currentQuestion].PageName, window.exam);
getRating(exam.examQuestions[exam.currentQuestion].PageName, exam);
 


}
}
function addFirstResponses() {
function answerClicked(event){
var api = new mw.Api();
$(".answer").removeClass("boxed");
api.get({
$('input[type=radio]').prop('checked', function () {
action : 'firstResponseQuery',
    return this.getAttribute('checked') == 'checked';
question : window.exam.examQuestions[exam.currentQuestion].PageName,
});
format : 'json'
$(this).addClass("boxed");
})
$(this).find("#Ar").prop("checked",true);
.done(function (data) {
if($("#exam").find('#submit').length == 0){
if (data.firstResponseQuery.A === null) {
$("#examSpace").append("<div class='noSelect WBRButton' id='submit'><br />Submit</div>");
data.firstResponseQuery.A = 0;
                $("#submit").click(event.data, answerSubmitted);
}
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;
}
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() + "%");
$("#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() + "%");
$("#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() + "%");
});
}
}
function answerClicked(event) {
$(".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) {
$("#examSpace").append("<div class='noSelect WBRButton' id='submit'><br />Submit</div>");
$("#submit").click(window.exam, answerSubmitted);
}
}
}
function getRating(page, exam) {
function getRating(page, exam) {
Line 958: Line 676:
}, {
}, {
ok : function (res) {
ok : function (res) {
$("#star1").raty({
$("#star1").raty({
path : 'http://www.wikidoc.org/includes/raty/img/',
path : 'http://www.wikidoc.org/includes/raty/img/',
click : function (score, event) {
click : function (score, event) {
submitRating("difficulty", score, exam.examQuestions[exam.currentQuestion].PageName)
submitRating("difficulty", score, exam.examQuestions[exam.currentQuestion].PageName)
},
},
score : res.wbrgetrating.difficulty,
                score: res.wbrgetrating.difficulty,
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good']
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good']
});
});
$("#star1").append("(Avg: " + res.wbrgetrating.difficulty + ", n=" + res.wbrgetrating.diffCount + ")");
        $("#star1").append("(Avg: " + res.wbrgetrating.difficulty + ", n=" + res.wbrgetrating.diffCount + ")" );
$("#star2").raty({
$("#star2").raty({
path : 'http://www.wikidoc.org/includes/raty/img/',
path : 'http://www.wikidoc.org/includes/raty/img/',
click : function (score, event) {
click : function (score, event) {
submitRating("yield", score, exam.examQuestions[exam.currentQuestion].PageName)
submitRating("yield", score, exam.examQuestions[exam.currentQuestion].PageName)
},
},
score : res.wbrgetrating.yield,
score: res.wbrgetrating.yield,
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good']
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good']
});
});
$("#star2").append("(Avg: " + res.wbrgetrating.yield + ", n=" + res.wbrgetrating.qualCount + ")");
        $("#star2").append("(Avg: " + res.wbrgetrating.yield + ", n=" + res.wbrgetrating.qualCount + ")" );
$("#star3").raty({
$("#star3").raty({
path : 'http://www.wikidoc.org/includes/raty/img/',
path : 'http://www.wikidoc.org/includes/raty/img/',
click : function (score, event) {
click : function (score, event) {
submitRating("quality", score, exam.examQuestions[exam.currentQuestion].PageName)
submitRating("quality", score, exam.examQuestions[exam.currentQuestion].PageName)
},
},
score : res.wbrgetrating.quality,
score: res.wbrgetrating.quality,
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good']
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good']
});
$("#star3").append("(Avg: " + res.wbrgetrating.quality + ", n=" + res.wbrgetrating.yieldSum + ")");
}
});
});
}
        $("#star3").append("(Avg: " + res.wbrgetrating.quality + ", n=" + res.wbrgetrating.yieldSum + ")" );
}
});}
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) {
event.data.examQuestions[event.data.currentQuestion].selectedAnswer = $("div .boxed").attr("id");
window.exam.answeredRight += 1;
if (!event.data.examQuestions[event.data.currentQuestion].creditReceived && event.data.examQuestions[event.data.currentQuestion].selectedAnswer === event.data.examQuestions[event.data.currentQuestion].RightAnswer) {
window.exam.examQuestions[window.exam.currentQuestion].creditRecieved = true;
event.data.answeredRight += 1;
event.data.examQuestions[event.data.currentQuestion].creditReceived = true;
}
}
if (window.exam.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 () {
                $(".answerExp").each(function(){
if ($(this).attr('id') === window.exam.examQuestions[window.exam.currentQuestion].RightAnswer + "e") {
                              if($(this).attr('id') === event.data.examQuestions[event.data.currentQuestion].RightAnswer+"e"){
$(this).prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Correct:</b> ");
                                      $(this).prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Correct:</b> ");
} else {
                              } else {
$(this).prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Incorrect:</b> ");
                                      $(this).prepend("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Incorrect:</b> ");
}
                              }
});
                });


}
}
Line 1,009: Line 727:
var api = new mw.Api();
var api = new mw.Api();
api.get({
api.get({
action : 'answerQuestion',
action : 'wbrinsertmetric',
username : mw.user.getName(),
username : mw.user.getName(),
question : window.exam.examQuestions[window.exam.currentQuestion].PageName,
question : event.data.examQuestions[event.data.currentQuestion].PageName,
selected : window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer,
selectedAnswer : event.data.examQuestions[event.data.currentQuestion].selectedAnswer,
examid : window.exam.examid,
format : 'json'
format : 'json'
})
})
Line 1,019: Line 736:
console.log('API result:', data);
console.log('API result:', data);
});
});
if (window.exam.examType === "Exam") {
if (event.data.examType === "Exam") {
$("#" + window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer).addClass("boxed");
$("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed");
} else if (window.exam.examType === "Tutor") {
} else if (event.data.examType === "Tutor") {
$("#examSpace").append("<br /><br />The correct answer is: " + window.exam.examQuestions[window.exam.currentQuestion].RightAnswer + "<br /><br />" + window.exam.examQuestions[window.exam.currentQuestion].Explanation + "<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 />");
$("#examSpace").append("<b>Author:</b> " + window.exam.examQuestions[window.exam.currentQuestion].PageAuthor + "<br /><br /><b>Wiki Page:</b>" + window.exam.examQuestions[window.exam.currentQuestion].PageName + "<br /><br />Discuss this question <a href='http://www.wikidoc.org/index.php/Talk:" + window.exam.examQuestions[window.exam.currentQuestion].PageName + "'>Here</a>");
                $("#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>");
$("#" + window.exam.examQuestions[window.exam.currentQuestion].selectedAnswer).addClass("boxed");
$("#" + event.data.examQuestions[event.data.currentQuestion].selectedAnswer).addClass("boxed");
$("#" + window.exam.examQuestions[window.exam.currentQuestion].RightAnswer).addClass("redBoxed");
$("#" + event.data.examQuestions[event.data.currentQuestion].RightAnswer).addClass("redBoxed");
addRatyRating(window.exam);
addRatyRating(event.data);
}
}
 
       
}
}
function questionNavigation(event) {
function questionNavigation(event) {
$("#" + event.data.currentQuestion).removeClass("boxed");
if ($(this).attr("id") === "back") {
if ($(this).attr("id") === "back") {
window.exam.currentQuestion--;
event.data.currentQuestion--;
} else if ($(this).attr("id") === "next") {
} else if ($(this).attr("id") === "next") {
window.exam.currentQuestion++;
event.data.currentQuestion++;
} else if ($(this).attr("class") === "navPaneButton") {
} else if ($(this).attr("class") === "navPaneButton") {
window.exam.currentQuestion = $(this).attr("id");
event.data.currentQuestion = $(this).attr("id");
}
}
questionDisplay(window.exam);
$("#" + event.data.currentQuestion).addClass("boxed");
questionDisplay(event.data);
}
}
function questionReviewNavigation(event) {
function questionReviewNavigation(event) {
$("#" + event.data.currentQuestion).removeClass("boxed");
if ($(this).attr("id") === "back") {
if ($(this).attr("id") === "back") {
window.exam.currentQuestion--;
event.data.currentQuestion--;
} else if ($(this).attr("id") === "next") {
} else if ($(this).attr("id") === "next") {
window.exam.currentQuestion++;
event.data.currentQuestion++;
} else if ($(this).attr("class") === "navPaneButton") {
} else if ($(this).attr("class") === "navPaneButton") {
window.exam.currentQuestion = $(this).attr("id");
event.data.currentQuestion = $(this).attr("id");
}
}
questionReview(window.exam);
$("#" + event.data.currentQuestion).addClass("boxed");
questionReview(event.data);
}
}
function endExam(event) {
function endExam(event) {
if (window.exam.timer) {
if (event.data.timer) {
$('#timerBox').html("");
$('#timerBox').html("");
$('#timerBox').css("visibility", "hidden");
$('#timerBox').css("visibility", "hidden");
window.exam.examTimer.stop();
event.data.examTimer.stop();
}
}
$("#examSpace").html("");
$("#examSpace").html("");
var datas;
var datas;
datas = "";
datas = "";
datas += "<br />You answered " + window.exam.answeredRight + " out of " + window.exam.examQuestions.length + " correctly.<br /> Your percentage score is: ";
datas += "<br />You answered " + event.data.answeredRight + " out of " + event.data.examQuestions.length + " correctly.<br /> Your percentage score is: ";
var percent = (window.exam.answeredRight / window.exam.examQuestions.length) * 100;
var percent = (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.";
datas += percent + "%<br /><br />Click the Navigation Buttons on the left to review the questions you answered.";
var api = new mw.Api();
var api = new mw.Api();


api.get({
api.get({
action : 'endExam',
action : 'wbrinsertexam',
id : window.exam.examid,
username : mw.user.getName(),
size : event.data.examQuestions.length,
score : percent,
score : percent,
format : 'json'
format : 'json'
Line 1,076: Line 798:
$("#examSpace").append(datas);
$("#examSpace").append(datas);
$(".navPaneButton").unbind('click');
$(".navPaneButton").unbind('click');
$(".navPaneButton").click(window.exam, questionReviewNavigation);
$(".navPaneButton").click(event.data, questionReviewNavigation);
}
}
function submitRating(ratingType, score, page) {
function submitRating(ratingType, score, page) {
if (ratingType === "difficulty") {
      if(ratingType === "difficulty"){
var api = new mw.Api();
var api = new mw.Api();
api.get({
api.get({
action : 'wbrinsertrating',
action : 'wbrinsertrating',
username : mw.user.getName(),
username : mw.user.getName(),
question : page,
question : page,
difficulty : score,
difficulty : score,
format : 'json'
format : 'json'
}, {
}, {
ok : function (res) {}
ok : function (res) {}
});
});
} else if (ratingType === "yield") {
} else if (ratingType === "yield"){
var api = new mw.Api();
var api = new mw.Api();
api.get({
api.get({
action : 'wbrinsertrating',
action : 'wbrinsertrating',
username : mw.user.getName(),
username : mw.user.getName(),
question : page,
question : page,
yield : score,
yield : score,
format : 'json'
format : 'json'
}, {
}, {
ok : function (res) {}
ok : function (res) {}
});
});
} else if (ratingType === "quality") {
}
var api = new mw.Api();
else if (ratingType === "quality"){
api.get({
var api = new mw.Api();
action : 'wbrinsertrating',
api.get({
username : mw.user.getName(),
action : 'wbrinsertrating',
question : page,
username : mw.user.getName(),
quality : score,
question : page,
format : 'json'
quality : score,
}, {
format : 'json'
ok : function (res) {}
}, {
});
ok : function (res) {}
}
});
}
}
}


Line 1,232: Line 955:
}
}
function countCats(event) {
function countCats(event) {
window.exam.timeAmt = parseInt($(this).attr("id"), 10) * 6000;
event.data.timeAmt = parseInt($(this).attr("id"), 10) * 6000;
var temp = window.exam.examtype.replace(/ /g, "_");
var temp = event.data.examtype.replace(/ /g, "_");
var api = new mw.Api();
var api = new mw.Api();
api.get({
api.get({
Line 1,242: Line 965:
}, {
}, {
ok : function (data) {
ok : function (data) {
window.exam.arrCounts = data;
event.data.arrCounts = data;
selectCats(window.exam);
selectCats(event.data);
}
}
});
});
}
}
// Common functions
 
function pad(number, length) {
var str = '' + number;
while (str.length < length) {
str = '0' + str;
}
return str;
}
function formatTime(time) {
var min = parseInt(time / 6000),
sec = parseInt(time / 100) - (min * 60),
hundredths = pad(time - (sec * 100) - (min * 6000), 2);
return (min > 0 ? pad(min, 2) : "00") + ":" + pad(sec, 2);
}
function urlSwapSpace(swap) {
function urlSwapSpace(swap) {
return swap.split(' ').join('+');
return swap.split(' ').join('+');
}
function trimP(data) {
return data.substring(3, data.length - 4).trim(); ;
}
}
$(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="chooseQBank" style='height:100%;'></div>
<div id="exam"></div>
<div id="testOptions" style='height:100%;'></div>
<div id="exam" style='height:100%;'></div>
</includeonly>
</includeonly>

Latest revision as of 14:57, 10 August 2014