Widget:ExamObjDefinition: Difference between revisions

Jump to navigation Jump to search
Matt Pijoan (talk | contribs)
No edit summary
Matt Pijoan (talk | contribs)
No edit summary
Line 2: Line 2:
<script type="text/javascript">
<script type="text/javascript">
var exam = {
var exam = {
init : function (id, timestamp, username, questions, isTimed) {
        this.countdownTimer = null;
this.id = id;
this.countdownCurrent = null;
this.timestamp = timestamp;
this.id = id;
this.username = username;
this.timestamp = null;
this.questions = null;
this.username = mw.user.name();
this.questions = null;
        this.isPatientHistory = null;
        this.examType = null;
 
        setCountdown : function(time){
        this.countdownCurrent = parseInt(time) * 6000
        }
 
        isPatientHistory : function(isPatientHistory){
        this.isPatientHistory = isPatientHistory;
        }
 
        setExamType : function(examType){
        this.examType = examType;
        }
 
        questionAdd : function(question) {
        this.questions[] = question;
        }
questionCache : function (questions) {
$.each(questions, function (index, value) {
$.each(questions, function (index, value) {
this.questions[value.pagename] = getQuestionMembers(value.pagename);
this.questions[value.pagename] = getQuestionMembers(value.pagename);
//can define other question array member properties as null here as needed.
//can define other question array member properties as null here as needed.
});
});
if (isTimed) {
}
this.countdownTimer = null;
}
this.countdownCurrent = null;
        timerOn : function(duration) {
 
$.getScript("http://wikidoc.org/includes/jquery.timer.js", function () {
$.getScript("http://wikidoc.org/includes/jquery.timer.js", function () {
countdownTimer = $.timer(function () {
this.countdownTimer = $.timer(function () {
var min = parseInt(countdownCurrent / 6000);
var min = parseInt(this.countdownCurrent / 6000);
var sec = parseInt(countdownCurrent / 100) - (min * 60);
var sec = parseInt(this.countdownCurrent / 100) - (min * 60);
var micro = pad(countdownCurrent - (sec * 100) - (min * 6000), 2);
var micro = pad(this.countdownCurrent - (sec * 100) - (min * 6000), 2);
var output = "00";
var output = "00";
if (min > 0) {
if (min > 0) {
output = pad(min, 2);
output = pad(min, 2);
}
}
$('.countdowntime').html(output + ":" + pad(sec, 2));
$interface.updateClock(output + ":" + pad(sec, 2));
if (countdownCurrent == 0) {
if (this.countdownCurrent == 0) {
countdownTimer.stop();
this.countdownTimer.stop();
endExam();
endExam();
} else {
} else {
countdownCurrent -= 7;
this.countdownCurrent -= 7;
if (countdownCurrent < 0) {
if (this.countdownCurrent < 0) {
countdownCurrent = 0;
this.countdownCurrent = 0;
}
}
}
}
}, 70, false);
}, 70, false);
 
        }
});
}
}//End Init
}
}


Line 49: Line 67:
     stepTwo : function (){
     stepTwo : function (){
             $.("#wbrcontent").html(" ");
             $.("#wbrcontent").html(" ");
var examPicker = "<b>Click here to start the exam:</b><br />";
var examPicker = "
examPicker += "<a href='#' onclick="loginCheck(\'Random\',\'USMLE Step 1\')'><img src='http://static.wikidoc.org/8/87/Step1.png' /></a>";
examPicker += "<a href='#' onclick='loginCheck('Random','USMLE Step 2 CK')'><img src='http://static.wikidoc.org/0/07/Step2CK.png' /></a>
examPicker += "<a href="#" onclick="loginCheck('Random','USMLE Step 3')"><img src='http://static.wikidoc.org/0/08/Step3.png' /></a>
examPicker += "<a href="#" onclick="loginCheck('Random','Board Review')"><img src='http://static.wikidoc.org/7/75/Boardcertification.png' /></a>
examPicker += "<a href="#" onclick="loginCheck('Random','MCAT')"><img src='http://static.wikidoc.org/4/4b/MCAT.png' /></a><br />
<!-- bold + larger font size-->
<b>Click here to repeat questions you've gotten wrong previously</b>
<input type="button" onclick="loginCheck('Queue','Nuffin')" value="Review Exam" /><br />
             }
             }
}
}

Revision as of 21:03, 27 June 2013