Widget:Sandbox: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) No edit summary |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 599: | Line 599: | ||
submitRating("difficulty", score, exam.examQuestions[exam.currentQuestion].PageName) | submitRating("difficulty", score, exam.examQuestions[exam.currentQuestion].PageName) | ||
}, | }, | ||
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | ||
}); | }); | ||
Line 619: | Line 606: | ||
submitRating("yield", score, exam.examQuestions[exam.currentQuestion].PageName) | submitRating("yield", score, exam.examQuestions[exam.currentQuestion].PageName) | ||
}, | }, | ||
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | ||
}); | }); | ||
Line 637: | Line 612: | ||
click : function (score, event) { | click : function (score, event) { | ||
submitRating("quality", score, exam.examQuestions[exam.currentQuestion].PageName) | submitRating("quality", score, exam.examQuestions[exam.currentQuestion].PageName) | ||
}, | }, | ||
hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | hints : ['Very Poor', 'Poor', 'Average', 'Good', 'Very Good'] | ||
}); | }); | ||
getRating(exam.examQuestions[exam.currentQuestion].PageName); | |||
} | } | ||
function answerClicked(event){ | function answerClicked(event){ | ||
Line 666: | Line 630: | ||
} | } | ||
} | } | ||
function getRating( | function getRating(page) { | ||
var api = new mw.Api(); | var api = new mw.Api(); | ||
api.get({ | api.get({ | ||
Line 674: | Line 638: | ||
}, { | }, { | ||
ok : function (res) { | ok : function (res) { | ||
$("#star1 input[name=score]").val(res.wbrgetrating.difficulty); | |||
$("#star2 input[name=score]").val(res.wbrgetrating.yield); | |||
$("#star3 input[name=score]").val(res.wbrgetrating.quality); | |||
} | } | ||
}); | }); |