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 459: | Line 459: | ||
} | } | ||
function loadNextQuestion(event) { | function loadNextQuestion(event) { | ||
if(event.data.searchMethod === "Category"){ | |||
var api = new mw.Api(event); | var api = new mw.Api(event); | ||
api.get({ | api.get({ | ||
Line 479: | Line 480: | ||
} | } | ||
}); | }); | ||
} else if(event.data.searchMethod === "Keyword"){ | |||
var api = new mw.Api(event); | |||
api.get({ | |||
action : 'load', | |||
main : 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) { |