Widget:SandboxNew2: Difference between revisions
Jump to navigation
Jump to search
Matt Pijoan (talk | contribs) Created page with "<includeonly> <style type="text/css"> .boxed{ border:5px solid black; } .unboxed{ border:0px; } #go{ width:150px; height:50px; background-color:#0f0; } .imageDiv{ margin:5px..." |
Matt Pijoan (talk | contribs) No edit summary |
||
Line 415: | Line 415: | ||
//Exam finishing/analyzing | //Exam finishing/analyzing | ||
//Add Question Button | |||
$('#changeslist').ready(function () { | |||
$.getScript("http://wikidoc.org/resources/mediawiki.api/mediawiki.api.js", function () { | |||
var api = new mw.Api(); | |||
var pageString = "WBRCurrentQuestion"; | |||
api.get({ | |||
action : 'query', | |||
format : 'json', | |||
titles : pageString, | |||
export : 'export', | |||
}, { | |||
ok : function (data) { | |||
var xml = data.query.export["*"]; | |||
xmlDoc = $.parseXML(xml), | |||
$xml = $(xmlDoc), | |||
$title = $xml.find("text"); | |||
var curr = parseInt($title.text()); | |||
document.getElementById('queslink').innerHTML = "<a id='add' href='http://wikidoc.org/index.php/Special:FormEdit/WBRQuestion/WBR" + curr + "'><img src='http://static.wikidoc.org/5/54/Click_here_to_add_a_question.png' /></a>"; | |||
$('#add').click(function () { | |||
addNewSection("WBRCurrentQuestion", parseInt(curr + 1).toString(), mw.user.tokens.get('editToken')); | |||
}); | |||
} | |||
}); | |||
}); | |||
}); |